Improve fixes to 1998/schnitzi

The author stated that there was no 'if's and I have made it that way
now.

The author stated that the number should be > 0 && < 27 so I added the
range check (was previously != 0). Too high value could segfault and < 0
was problematic too. 27 itself was code that could not compile. Since
the program is so beautiful it had been decided to fix the problems
which is why these changes were added too.

The above was done like:

    ((V[1]&&((atoi(V[1])>0&&atoi(V[1])<27)||(exit(1),1))));

The try.sh script has been added to the entry to try out a lot of
commands instead of copy pasting it from the judges' remarks.

Removed duplicate INABIAF information from README.md (which is why the
other updates).

Updated bugs.md with more information to the features like how output
can end up being gigabytes in length depending on the number specified
to the program. Removed from the bugs.md details about warnings to
ignore as the compiler -Wno- options take care of that now. Extra
parentheses were added to the above to prevent another warning (I was
not sure if all compilers and versions had the -Wno- so I decided to fix
it in the code itself).

The try section has a question to ponder as well. The detail is also in
the bugs.md file.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-02 09:53:57 -07:00
1 parent 723df90fa3
commit 459fff8859
6 files changed
+120 -48

No files matched your search

+10 -26
View File
@@ -1138,38 +1138,22 @@ See above entry [1998/dlowe](1998/dlowe/dlowe.c).
### Source code: [1998/schnitzi/schnitzi.c](1998/schnitzi/schnitzi.c)
### Information: [1998/schnitzi/README.md](1998/schnitzi/README.md)
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to work for
modern systems but he notes a couple compile warnings to ignore.
First if you get the warning:
warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
11 | void g(){ O=j; printf(_); }
| ^~~~~~
please do NOT change it! Doing so will break the generated output.
Another warning that was introduced but should be ignored (it's required) is:
warning: assignment to 'char *' from incompatible pointer type 'char **' [-Wincompatible-pointer-types]
55 | main(int v,char **c){ O=r_; _d=c;
| ^
Please DO NOT change this either.
If there are any other warnings triggered by your compiler please DO NOT fix
those either!
Another important note is that as the number passed into the program gets bigger
the number of lines of output gets substantially larger. For instance:
A point worth considering is that as the number passed into the program gets
bigger the number of lines of output gets substantially larger. For instance:
```sh
$ ./schnitzi 9|wc -l
771999
```
The larger the number the bigger the file can become too, even becoming
gigabytes in size. The range is checked for `>0 && <27` as not having this can
be a problem including a segfault.
If you use the generated program and do not give enough numbers in input
something funny will happen, very possibly with different results per run. This
is in the README.md file as something to try and ponder.
# 1999