When I added the 'gets()' and 'exit()' macros to make the code look more
like the original I accidentally left out a space between 'gets(x)' and
'fgets(...' so that it looked like:
#define gets(x)fgets((x),512,stdin)
which I believe is incorrect. It now looks instead like:
#define gets(x) fgets((x),512,stdin)
The compact version that the authors provided was compile fixed quite
some time back but I never added the exit macro to match the original
more closely.
Also since the compact version was meant to be identical in function of
the entry and since that entry was changed to use fgets() (by the macro
gets()) I decided it would be better to make it use fgets() also, also
through redefining gets(). To make the line length closer in match to
the original compact version I changed the code to be two lines. This
wasn't necessary to do, as I recall, in the entry itself though it's
possible it was and I just managed to get the ASCII art the same or
almost the same.
The thanks-for-fixes.md file was updated for this change but
unfortunately I had made some changes yesterday that I forgot about
(just rewording) in another entry so that will also be in this commit.
In particular the fix to make it more like the original. There was no
need to have the function prototypes at the top of the file.
I also added a couple -Wno- options to the CSILENCE variable in the
Makefile.
I also added to the Makefile so that make alt will build the alt version
(only functional difference is that there is gets() instead of fgets()).
The code now looks much more like the original. This was done through
the use of macros to redefine exit() and gets() so that the exit() call
uses the comma operator (,0) (because it is used in a binary expression)
and gets() now uses fgets() (details below).
The usual problem with fgets() versus gets() (and it was changed
primarily because with macOS the warning about gets() also occurs at
runtime and it is interspersed with the interactive output of this
program and this caused confusing output though a nice side effect is
it's safer too) is that fgets() retains the newline whereas gets() does
not (supposedly for backwards compatibility).
In some cases one can get away with not removing it (at the expense of a
newline possibly being printed) but that was not possible here. This
normally means one has to check for fgets() returning NULL which
required another binary expression (... != NULL || exit(0),0 ...) which
made the line much longer and not snakey. It appears that in this case
(possibly because it's used in a for loop but I did not examine this in
more detail) one can get away with not checking for NULL first and just
remove the newline so that the line looks much more like the original.
The segfault has been fixed when EOF is sent to the program (causing
fgets() to return NULL).
Since fgets() is far safer than gets() and since the gets() version will
intersperse the warning and the first line of output I have changed the
alt version to be the original (fixed to compile with modern compilers)
and the tbr is the one with fgets().
My first 41st, 51st and 29th (all depending on the base) birthday
updates (possibly more will follow but this is not a certainty). All the
1990 entries now compile!
In one we used a patch from Yusuke Endoh (thank you Yusuke!) which we
credited him in the README and in another we used a tip from him (use
-ansi at the compiler line) to get the other to compile (again, thank
you Yusuke!). We fixed the others. In the case of 1990/tbr/tbr.c the
author had supplied a shorter version and we fixed that one too.
Added 1990/.gitignore which has the built files of 1990 so that after
doing `cd 1990 ; make all' running `git status .' will not show any
untracked files.
We we move 1988-2004 entries from all of a year's winning entries
in a single directory to each winner being in their own sub-directory
under the given year directory.