Partially undo 5bbdf55 (1994/schnitzi)

The problem with changing it to use fgets() is feeding the program
itself generates compiler errors and the generated file does not use
fgets() either. This will have to be done another time, maybe. The
buffer size was increased to 10000 and even this required some slight
changes in formatting in order for the generated output to compile okay.
The buffer size generated is still the same as the original but now
larger files can be parsed by the original code and everything compiles
okay again.
This commit is contained in:
Cody Boone Ferguson committed 2023-04-01 10:42:14 -07:00
1 parent 3a1fb9ff7d
commit f3d6dc7202
2 files changed
+13 -9

No files matched your search

+9 -5
View File
@@ -14,11 +14,15 @@
./schnitzi < textfile
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed the entry to not
overflow the buffer (and segfault) by changing the call of `gets()` to
`fgets()`. He also increased the buffer size. Prior to this fix one could not
redirect the Makefile into this program, as an example problem. Thank you Cody
for your assistance!
[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 this Makefile. Thank
you Cody!
## Try:
+4 -4
View File
@@ -20,12 +20,12 @@ h mh111 de{l) +di (+'( d+% c n+
*/ n = 0 ;
main ( ) {
char v [
1000 ] , s;
int t[100 ] ,
u[100 ] ; u
10000 ] , s;
int t[100 ] ,
u[100 ] ; u
[ 0
]=ftell(stdin ) ;
while(fgets(v,100,stdin )&&((v[strlen(v)-1]='\0',1)) )
while(gets (v ) )
{t [ r ]=
strlen (
v);y=