Add save state option in 2018/mills, update bugs

The save state option is based on the author's remarks that one can
change the W macro to MAP_SHARED. This is defined in the Makefile so a
variable called 'SAVE' was added which if not 1 will result in
MAP_PRIVATE. This way one can run

    make clobber SAVE=1 all

and it'll save state, assuming that (if you add a file) you run 'sync'
before exiting. If you don't run sync(1) it's likely the file won't
exist or it'll be corrupt (like a.out from mullender.c). README.md file
updated for this update. Note that the setting the W macro to ${MAP} is
only done for the make targets that had it set to MAP_PRIVATE. This is
because I guess that if it's already set to MAP_SHARED in the Makefile
there is a good reason for this. This is noted in the Makefile.

The bug I discovered happens whether or not state is saved (this had to
be verified before I did the above change that I added when I was
working on this entry some days back but never committed it for this
reason). If you run ./prog and then exit (ctrl-e) if you then run ./prog
again it'll show a strange message as if the image was corrupt. You have
to hit enter at this point (that's important) and then hit ctrl-e again.
When you run it a third time it'll be okay. I did not look at this in
detail but it probably should be fixed.

The Makefile also tries to make the note about preserving images to be
the state of the file (downloaded) at the time the entry won and how any
updates are unofficial stand out more.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-17 08:37:58 -08:00
1 parent 3a470289db
commit a76d3fde42
4 files changed
+84 -11

No files matched your search

+12
View File
@@ -4066,6 +4066,18 @@ that's probably true: let's just say that for the IOCCC I'm (Cody) a weasel! :-)
Cody also added the [try.sh](/2018/hou/try.sh) script.
## <a name="2018_mills"></a>[2018/mills](/2018/mills/prog.c) ([README.md](/2018/mills/README.md))
[Cody](#cody), based on the author's remarks, made it possible to save state
between runs of the program so that one can resume where they left off. It
should be noted that there is a bug in the entry (irrespective of save state
option) where running `./prog` twice in a row involves having to hit (the second
run) enter and then exit and then start the program again. Also if you do add a
file you should run `sync` prior to exiting or else the file might not exist or
it might be corrupt. See [2018/mills in bugs.md](/bugs.md#2018-mills) for more
details on the bug.
## <a name="2018_poikola"></a>[2018/poikola](/2018/poikola/prog.c) ([README.md[(/2018/poikola/README.md))
[Cody](#cody) added the missing `docs` rule to the Makefile that forms a PDF