diff --git a/bin/warning b/bin/warning new file mode 100755 index 0000000..f120f39 Binary files /dev/null and b/bin/warning differ diff --git a/compile-all.sh b/compile-all.sh index a87e883..7a61f4a 100755 --- a/compile-all.sh +++ b/compile-all.sh @@ -10,4 +10,12 @@ do returnCode=1; fi done +echo -ne "\nfinished compiling all source files. "; +if [ "$returnCode" -eq 0 ] +then + echo -ne "No errors occured."; +else + echo -ne "Some errors occured."; +fi +echo ""; exit $returnCode diff --git a/compile-and-run.sh b/compile-and-run.sh index ccd5cea..2b5dd18 100755 --- a/compile-and-run.sh +++ b/compile-and-run.sh @@ -1,4 +1,4 @@ #!/bin/bash noext=$(echo "$1" | cut -f 1 -d '.') -./compile $1 +./compile.sh $1 ./bin/$noext $2 $3 $4 $5 $6 $7 $8 $9 diff --git a/compile.sh b/compile.sh index cfad674..688a322 100755 --- a/compile.sh +++ b/compile.sh @@ -1,4 +1,8 @@ #!/bin/bash echo "compiling $1 ..." noext=$(echo "$1" | cut -f 1 -d '.') + +# to treat warnings as errors, use the following line +#gcc $1 -o bin/$noext -lm -Werror=format +# gcc $1 -o bin/$noext -lm diff --git a/huffman/README.md b/huffman/README.md index 3b5f5b2..0d0b8c5 100644 --- a/huffman/README.md +++ b/huffman/README.md @@ -1,11 +1,9 @@ # Huffman the testfiles folder is unpopulated and not staged through gitignore, as it might contain large files. -use the following command to populate it or create your own testfiles. +Use the following command to populate it or create your own testfiles. ``dd if=/dev/urandom of=10K-random.img count=1K`` - ``dd if=/dev/urandom of=10K-random.img count=1M`` - ... files with random bytes wont be able to be compressed byy much, that is normal. diff --git a/warning.c b/warning.c new file mode 100644 index 0000000..99d58c1 --- /dev/null +++ b/warning.c @@ -0,0 +1,9 @@ +#include + +int main(){ + char s[2]; + // produce warning, char* s is too small for the following fgets instruction + fgets(s, 10, stdin); + printf("%s\n",s); + return 0; +}