Add alt code to 1986/hague - fgets()

The reason it is in alt code is because one of the forms of input (see
below) will, although print out correct output, segfault after
outputting the text. That is when one does something like:

    echo foo | ./hague.alt

Whether it might be worth making it the entry itself with a note in the
Makefile and README.md and bugs.md (because it does print out correct
output) can be determined later - or not.

This change required several files to be updated besides the new file
hague.alt.c.
This commit is contained in:
Cody Boone Ferguson committed 2023-10-04 04:09:38 -07:00
1 parent 4836ed4622
commit c1c8197c34
8 files changed
+114 -10

No files matched your search

+27 -3
View File
@@ -9,9 +9,9 @@ UK
make all
```
NOTE: this entry uses `gets()` so you might get a warning about this when
compiling and running this program with some systems.
There is an alternate version which uses `fgets()`. See the Alternate code
section below as well as the [bugs.md](/bugs.md) file for more details as to why
it is worth having as an alternate version.
## To run:
@@ -29,6 +29,30 @@ International Obfuscated C Code Contest
Jim Hague
```
Also try:
```sh
echo IOCCC | ./hague
```
### Alternate code:
Whereas with some entries the change to `fgets()` (see the [FAQ](/faq.md) for
details on why this has been done) can be done in the original code this entry
is more complicated in that although both forms of input show the correct
output, one form segfaults after the output.
If you wish to use this alternate code, do:
```sh
make alt
```
Use `hague.alt` as you would `hague` above. As for which form will segfault
after outputting the text it is when text is piped into the program. Again see
the [bugs.md](/bugs.md) file for more details.
## Judges' remarks: