From 9a8c60cc0392f0785d387af3670344df08f2a37c Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Sun, 8 Feb 2015 18:33:11 +0100 Subject: [PATCH] update ass1-ex1 --- ass2/mart/sws1-s4109503-s4202015/Makefile | 4 +++- ass2/mart/sws1-s4109503-s4202015/exercise1b.c | 5 ++--- ass2/mart/sws1-s4109503-s4202015/exercise1d.c | 5 ++--- ass2/mart/sws1-s4109503-s4202015/exercise2.c | 4 ++++ 4 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 ass2/mart/sws1-s4109503-s4202015/exercise2.c diff --git a/ass2/mart/sws1-s4109503-s4202015/Makefile b/ass2/mart/sws1-s4109503-s4202015/Makefile index cacd2e7..1b465c7 100644 --- a/ass2/mart/sws1-s4109503-s4202015/Makefile +++ b/ass2/mart/sws1-s4109503-s4202015/Makefile @@ -1,7 +1,9 @@ CC=gcc CFLAGS=-std=c99 -Wall -Wextra -all: exercise1b.c exercise1d.c +all: exercise1 + +exercise1: exercise1b.c exercise1d.c $(CC) $(CFLAGS) exercise1b.c -o exercise1b $(CC) $(CFLAGS) exercise1d.c -o exercise1d diff --git a/ass2/mart/sws1-s4109503-s4202015/exercise1b.c b/ass2/mart/sws1-s4109503-s4202015/exercise1b.c index 9cbaa94..1f8a43e 100644 --- a/ass2/mart/sws1-s4109503-s4202015/exercise1b.c +++ b/ass2/mart/sws1-s4109503-s4202015/exercise1b.c @@ -1,7 +1,7 @@ #include #include -int main() +int main(void) { FILE *f = fopen("/dev/urandom", "r"); char c; @@ -9,7 +9,6 @@ int main() c = fgetc(f); printf("%i %u %x\n", c, c, c); } while(c != 42); - if(f != stdin) - fclose(f); + fclose(f); return 0; } diff --git a/ass2/mart/sws1-s4109503-s4202015/exercise1d.c b/ass2/mart/sws1-s4109503-s4202015/exercise1d.c index 4b6e9c7..07dfa41 100644 --- a/ass2/mart/sws1-s4109503-s4202015/exercise1d.c +++ b/ass2/mart/sws1-s4109503-s4202015/exercise1d.c @@ -2,7 +2,7 @@ #include #include -int main() +int main(void) { FILE *f = fopen("/dev/urandom", "r"); uint16_t c; @@ -10,7 +10,6 @@ int main() c = fgetc(f)+fgetc(f)*256; printf("%04x\n", c); } while(c != 42); - if(f != stdin) - fclose(f); + fclose(f); return 0; } diff --git a/ass2/mart/sws1-s4109503-s4202015/exercise2.c b/ass2/mart/sws1-s4109503-s4202015/exercise2.c new file mode 100644 index 0000000..6ea6252 --- /dev/null +++ b/ass2/mart/sws1-s4109503-s4202015/exercise2.c @@ -0,0 +1,4 @@ +int main(void) +{ + +} -- 2.20.1