diff --git a/1994/schnitzi/Makefile b/1994/schnitzi/Makefile index cf2666d21..0dcaaad8a 100644 --- a/1994/schnitzi/Makefile +++ b/1994/schnitzi/Makefile @@ -128,6 +128,7 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c + @echo "NOTE: the buffer size of this entry is very small at 100." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/1994/schnitzi/README.md b/1994/schnitzi/README.md index a528218cb..c75f5b73c 100644 --- a/1994/schnitzi/README.md +++ b/1994/schnitzi/README.md @@ -18,20 +18,6 @@ make all ./schnitzi < textfile ``` -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) increased the buffer -size from 100 to 10000. Changing it to use `fgets()` instead of `gets()` is more -problematic because when feeding the source code to the program the output -results in compiler errors and not only that but the gets() is still there in -the generated output. Even changing the buffer size can result in compilation -errors if not done correctly. The generated output also does not have a changed -buffer size. Changing it to use fgets() can happen later, maybe, but bigger -files can now be parsed by the original code. An example is the Makefile. Cody -gave some tips on how this entry works, in order to make the entry use fgets() -and compile successfully too, in the [bugs.md](/bugs.md) file. Thank you Cody! - -For the original source file [schnitzi.alt.c](schnitzi.alt.c) see below. - - ## Try: ```sh @@ -39,10 +25,19 @@ For the original source file [schnitzi.alt.c](schnitzi.alt.c) see below. ./schnitzi < /etc/passwd ``` +NOTE: the buffer size is very small at 100. It's easy to fix the buffer size but +it is not as easy to change it to `fgets()`. [Cody Boone +Ferguson](/winners.html#Cody_Boone_Ferguson) gives some hints in the +[bugs.md](/bugs.md) file on how this entry works which might be useful in order +to get this to use `fgets()` which would prevent a warning at linking or +runtime. The file [schnitzi.alt.c](schnitzi.alt.c) has this to get anyone +started, should they wish to tackle it (Cody will in time). The problem with +changing the buffer size is that even when it works the generated output (see +judges' comments below) will not be 100% correct duplication of the program. ### Alternate code: -For the original version with a smaller buffer try: +To build the alternative code try: ```sh make alt @@ -50,6 +45,7 @@ make alt Use `schnitzi.alt` as you would `schnitzi`. + ## Judges' comments: diff --git a/1994/schnitzi/schnitzi.alt.c b/1994/schnitzi/schnitzi.alt.c index 45a5365e4..a28d79ee9 100644 --- a/1994/schnitzi/schnitzi.alt.c +++ b/1994/schnitzi/schnitzi.alt.c @@ -20,7 +20,7 @@ h mh111 de{l) +di (+'( d+% c n+ */ n = 0 ; main ( ) { char v [ - 100 ] , s; + 10000 ] , s; int t[100 ] , u[100 ] ; u [ 0 diff --git a/1994/schnitzi/schnitzi.c b/1994/schnitzi/schnitzi.c index a28d79ee9..45a5365e4 100644 --- a/1994/schnitzi/schnitzi.c +++ b/1994/schnitzi/schnitzi.c @@ -20,7 +20,7 @@ h mh111 de{l) +di (+'( d+% c n+ */ n = 0 ; main ( ) { char v [ - 10000 ] , s; + 100 ] , s; int t[100 ] , u[100 ] ; u [ 0