I've now looked at the entire README.md file and fixed formatting.
I also renamed the sheet1.info file to finance.sheet as it seems a more
appropriate name for usability.
This will be the 97th open pull request by me so I have to say the
following insightful (or it will be to Landon .. and me) number:
2305567963945518424753102147331756070 since it's so magical.
The URL for one of the authors was no longer valid so I had to use the
Internet Wayback Machine. The winners.html and winners.csv files have
been updated for this change.
Format the authors' information.
That's all there is this time as I have to think on how to do the
formatting in a way that matches their set up (sections and numbers).
This will have to come another time.
In a previous commit I had accidentally changed 'Author's remarks' to
'Alternate code' (I have no idea how this happened).
Another typo was fixed.
Added a note how this no longer (of course) prints the largest prime
known.
Fix URL.
Fix formatting.
I observed something strange though: the author noted the output of the
input 'Hello, world!' and it doesn't appear to match the program before
or after the fgets() change. I'm not sure if this is a bug or if it is
(as I guess) a formatting problem.
The entry does not do what one might expect so add a note about this.
Fixed commands to try.
Format fixes.
Make main() void again as part of redefinition of INABIAF.
As both Landon and I have been wondering if changing entries to use
fgets() is bordering on tampering with entries I decided to make the
original (sometimes bug fixed) versions (using gets()) alt code. I had
originally started to make the fgets() version of each entry the alt but
since the fgets() versions can handle input better and since some also
fixed bugs (see below) I decided to make the original version the alt
code (this also is how it is for other entries).
There were some exceptions here. If the change also fixed some crashes
or other bugs outside of the gets() to fgets() conversion I did not
bother to make an alt version. An example is 1992/dds. In some cases the
alt code does have bug fixes in which case they were added.
Updated the Makefiles and .gitignore files as well for the alt target
and the new files (compiled and in the case of 1992/adrian additional
source files in the Makefile alt rule).
This should solve the problem observed by Landon and me. It wouldn't be
a problem to change it so the alt version is the one that uses fgets()
but I think that might be the wrong choice.
In some entries I altogether avoided changing to fgets() say if the
author notes it uses gets() (in one case even providing a version that
uses fgets()). In some cases using fgets() introduces a bug so those are
also not changed.
As for 1990/tbr there's a strong reason for not having the fgets()
version being the alt. In macOS in particular (in linux - or maybe gcc,
not sure - it shows a warning at linker time) it will mess up the first
line of output in a potentially confusing way. For instance:
$ ./tbr.alt
$ warning: this program uses gets(), which is unsafe.
# nothing here, what to do?
And that touches on another issue of making the alt version the one that
uses gets(): the warnings that can be alarming during compilation,
linking and (in the case of macOS) runtime.
Not all entries should be or can be changed to fgets() but some can and
it's warranted for these reasons. More will possibly happen in the
future.
There were many many README.md files with the wrong heading level for
different sections. These have been changed.
To help go through the changes it should be noted I used sgit and also
here is what is changed:
The 'Try', 'To build' and 'To run' lines have two '#'s. Some had one and
others had three.
An exception is that in 1984/anonymous/README.md for the alternative
code that had three '#'s. This is not consistent yet and it might be
that only two are desired. But for now that one at least has three.
Simply the Makefile header.
Refer to the //www.ioccc.org/bugs.md URL (that will eventually exist).
Now using CC BY-SA 4.0 License to how you may share and adapt the
Makefile.
Formatting and other notes. Many more need to be checked for this but I
wanted these changes out of the way of git status to try and clean my
working changes.
The problem was that they renamed 'na' to 'PL_na' so the code did not
compile. I note that it segfaults in macOS but I've not had a chance to
look into that yet. It works fine in linux.
The includes for the X11 header files omitted the X11 and this means
running make will fail even if one has the files in a place that's in
the include path (default or via -I option).
Of course if one has X11 include files in a non-standard location (or
where the compiler doesn't look) they'll still have to use the -I
option.
I am aware of some entries that do not compile that I haven't even
thought about fixing yet.
I also need to use my linux box to test the X11 entries (this goes for
other years as well) but that'll come at another time as I rarely am at
sitting at that computer. But the README.md files should be in a better
state.
With clang it did not compile at all; with gcc it segfaulted. Now it
works properly. It's a crescent moon today and that's exactly what is
being shown. This required another function but since it wasn't a
one-liner this doesn't cause any problems with the award either.
In some files changed the formatting was fixed to be a proper markdown
file.
There were some typos including that some README.md files that linked to
/winners.html#Cody_Boone_Ferguson actually linked to the non-existent
file /years which obviously would not work.
I also added links to the rest of the places I have fixed entries (but
see below) and I did the same for Yusuke Endoh's fixes.
As well apparently one entry I thought he fixed to compile under modern
systems does not seem to so that entry will have to be revisited another
time. That entry was 1993/jonth.
Those are the main changes here if not all of them.
There was an attempt to get natori.c to compile.
We moved the 2 includes to the compile line
restoring the code as a 1-liner.
We forced the types of args iun main to conform to
bogons introduced by the ANSI-C committee.
Nevertheless, the code still fails to compile:
assignment to cast is illegal, lvalue casts are not supported
This will be a TODO fix for later.