From 67343f2bd84d0ed137e6ec783b3fd9e6ca768640 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 04:44:41 -0700
Subject: [PATCH 01/31] Format/typo check 1987/hines/README.md
---
1987/hines/README.md | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/1987/hines/README.md b/1987/hines/README.md
index f4d8126fa..fc3d3bf84 100644
--- a/1987/hines/README.md
+++ b/1987/hines/README.md
@@ -1,10 +1,6 @@
# Worst Style
-Spencer Hines
-OnLine Computer Systems
-4200 Farragut Street
-Hyattsville, MD
-20781
+Spencer Hines
US
## To build:
@@ -27,8 +23,8 @@ make all
### Alternate code:
-An alternate version of this entry is in [hines.alt.c](hines.alt.c). With older compilers you
-can try the alt version:
+An alternate version of this entry is in [hines.alt.c](hines.alt.c). With older
+compilers you can try the alt version:
```sh
make alt
@@ -39,11 +35,12 @@ Use `hines.alt` as you would `hines` above.
## Judges' remarks:
This program was designed to maximize the bother function for
-structured programmers. This program takes goto statements to their
+structured programmers. This program takes `goto` statements to their
logical conclusion. The layout and choice of names are classic.
We consider this to be a beautiful counter-example for Frank Rubin's
-letter to ACM form titled: _"'GOTO Considered Harmful' Considered Harmful"_.
+letter to ACM form titled: _["'GOTO Considered Harmful' Considered
+Harmful"](https://web.archive.org/web/20090320002214/http://www.ecn.purdue.edu/ParaMount/papers/rubin87goto.pdf)_.
See the Communications of the ACM, March 1987, Page 195-196.
From d88c00f3394d60544b5f291c238f389b475136b3 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 04:54:53 -0700
Subject: [PATCH 02/31] Format/typo check 1987/korn/README.md
This includes some links added that seemed useful.
---
1987/korn/README.md | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/1987/korn/README.md b/1987/korn/README.md
index a5f3bced8..260c39d92 100644
--- a/1987/korn/README.md
+++ b/1987/korn/README.md
@@ -1,10 +1,6 @@
# Best One Liner
David Korn
-AT&T Bell Labs
-MH 3C-526B, AT&T Bell Labs
-Murray Hill, NJ
-07974
US
## To build:
@@ -13,15 +9,21 @@ US
make all
```
+## To use:
+
+```sh
+./korn
+```
+
## Judges' remarks:
The Judges believe that this is the best one line entry ever received.
-Compile on a `UNIX` system, or at least using a C implementation that
+Compile on a UNIX system, or at least one using a C implementation that
fakes it. Very few people are able to determine what this program
does by visual inspection. I suggest that you stop reading this
section right now and see if you are one of the few people who can.
-Several points are important to understand in this program:
+Several points are important to understand this program:
1. What is the symbol `unix` and what is its value in the program? Clearly
`unix` is not a function, and since `unix` is not declared to be a data type
@@ -34,10 +36,9 @@ characters, or `'h'`, or a string) Consider the fact that:
char *x;
- defines a pointer to a character (i.e. an address), and that the `=` assigns
+ defines a pointer to a `char` (i.e. an address), and that the `=` assigns
things of compatible types. Since:
-
x = "have";
is legal C, what type of value is `"have"`?
@@ -53,8 +54,12 @@ characters, or `'h'`, or a string) Consider the fact that:
?
-David Korn's `/bin/ksh` provides us with a greatly improved version of
-the /bin/sh. The source for v7's /bin/sh greatly inspired this contest.
+[David
+Korn](https://news.slashdot.org/story/01/02/06/2030205/david-korn-tells-all)'s
+[/bin/ksh](https://en.wikipedia.org/wiki/KornShell) provides us with a greatly
+improved version of the [/bin/sh](https://en.wikipedia.org/wiki/Bourne_shell).
+The source for [v7](https://en.wikipedia.org/wiki/Version_7_Unix)'s /bin/sh
+greatly inspired this contest.
## Author's remarks:
From 41c4dab26017041969e638982f7b0e4a08dd13dd Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 05:08:21 -0700
Subject: [PATCH 03/31] Format/typo check 1987/lievaart/README.md
---
1987/lievaart/README.md | 44 +++++++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 17 deletions(-)
diff --git a/1987/lievaart/README.md b/1987/lievaart/README.md
index 919ac5b5a..10822ef6b 100644
--- a/1987/lievaart/README.md
+++ b/1987/lievaart/README.md
@@ -9,8 +9,8 @@ Netherlands
make all
```
-NOTE: The original entry may be built with "make alt" if you have an old enough
-compiler.
+There is [Alternate code](#alternate-code) available for if you have an old
+enough compiler.
## To run:
@@ -19,12 +19,6 @@ compiler.
# enter a level and start playing as described below
```
-### INABIAF - it's not a bug it's a feature! :-)
-
-If you enter invalid input the program will enter an infinite loop displaying a
-string like `"You:"` repeatedly (for instance if you input `.`). If you enter an
-incorrect value it will prompt you again until you input a proper value.
-
## Try:
To see what it would have looked like without the size restrictions:
@@ -34,30 +28,46 @@ To see what it would have looked like without the size restrictions:
# enter a level and start playing as described below
```
+## Alternate code:
+
+If you have an old enough compiler you might wish to try using it. To use:
+
+```sh
+make alt
+```
+
+Use `./lievaart.alt` as you would `./lievaart` above.
+
+### INABIAF - it's not a bug it's a feature! :-)
+
+If you enter invalid input the program will enter an infinite loop displaying a
+string like `"You:"` repeatedly (for instance if you input `.`). If you enter an
+incorrect value it will prompt you again until you input a proper value.
## Judges' remarks:
We believe that you too will be amazed at just how much power Mr. Lievaart
packed into 1024 bytes!
-This Plays the game of Reversi (Othello)! Compile and run. It then
+This Plays the game of [Reversi
+(Othello)](https://en.wikipedia.org/wiki/Reversi)! Compile and run. It then
asks for a playing level. Enter 0-10 (easy-hard). It then asks for
-your move. A move is a number within 11-88, or a 99 to pass. Illegal
+your move. A move is a number within 11-88, or 99 to pass. Illegal
moves (except for an illegal pass) are rejected. Then the computer
does its move (or a 0 to pass), until the board is full.
-It plays rather well, for such a small program! Lievaart had to leave out the
+It plays rather well, for such a small program! Lievaart had to leave out the
board printing routine, so you'll have to take a real game board to play it (or
see below). ... Also due to space-limitations (the rules for 1987 had a limit
of 1024 byes), Lievaart took out the passing-handler, which makes its
-ending-game rather poor. But further it knows all the rules, uses alpha-beta
-pruning, and it plays f.i. on mobility(!). Most important: it can play a pretty
-good game of Reversi!
+ending-game rather poor. But further it knows all the rules, uses [alpha-beta
+pruning](https://en.wikipedia.org/wiki/Alpha-beta_pruning), and it plays for
+instance on mobility(!). Most important: it can play a pretty good game of Reversi!
The Author was kind enough to supply the fully functional version of the
-program. The file lievaart2.c contains what the program would have
-been without the size restriction. This version has the full end game
-logic and displays the board after each move!
+program. The file [lievaart2.c](lievaart2.c) contains what the program would
+have been without the size restriction. This version has the full end game
+logic and displays the board after each move! See above for how to use this.
## Author's remarks:
From b2cd7434bf6225f13b6dcb4257e34a794c22d764 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 05:09:43 -0700
Subject: [PATCH 04/31] Format/typo check 1987/wall/README.md
---
1987/wall/README.md | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/1987/wall/README.md b/1987/wall/README.md
index 152f28736..4a19a9aa3 100644
--- a/1987/wall/README.md
+++ b/1987/wall/README.md
@@ -1,6 +1,6 @@
# Most Useful Obfuscation
-Larry Wall
+Larry Wall
US
## To build:
@@ -59,12 +59,12 @@ quit # for the cat version
## Judges' remarks:
-What we found amazing was how the flow of control was transferred
-between subroutines. Careful inspection will show that the array of
-pointers to functions named `vi` refers to functions which seem to not
-be directly called. Even so, these pointers to functions are being
-used as an argument to `signal()` (used both with and without an arg - but
-how?). Can you determine why this is being done and how it is being exploited?
+What we found amazing was how the flow of control was transferred between
+subroutines. Careful inspection will show that the array of pointers to
+functions named `vi` refers to functions which seem to not be directly called.
+Even so, these pointers to functions are being used as an argument to
+`signal(3)` (used both with and without an arg - but how?). Can you determine
+why this is being done and how it is being exploited?
Some compilers complained about this file, so we changed: `=++I` to `= ++I`.
From e6c07ea4d661ff8b8fcb1ff45815bf6f12a50718 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 05:11:28 -0700
Subject: [PATCH 05/31] Format/typo check 1987/westley/README.md
---
1987/westley/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/1987/westley/README.md b/1987/westley/README.md
index b4048c4fa..d638e4534 100644
--- a/1987/westley/README.md
+++ b/1987/westley/README.md
@@ -30,7 +30,7 @@ Use `westley.alt` as you would `westley` above.
## Judges' remarks:
-Putchar must exist in the C library and not just as a macro.
+`putchar()` must exist in the C library and not just as a macro.
If it fails to compile, add the line: `#include ` at the
top of the program.
From c13a4ffc925cd1e9662415a3d16496ac74d7ba82 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 05:12:54 -0700
Subject: [PATCH 06/31] Make 1987/lievaart slightly more like original
Restored the #define D define even though it can't be used with modern
compilers, just so it looks as close to the original as possible. This
goes for both versions, the one with the board and the entry (limited by
the contest restrictions).
---
1987/lievaart/lievaart.c | 1 +
1987/lievaart/lievaart2.c | 1 +
thanks-for-fixes.md | 6 ++++++
3 files changed, 8 insertions(+)
diff --git a/1987/lievaart/lievaart.c b/1987/lievaart/lievaart.c
index 90df1a3fa..eb18d37b5 100644
--- a/1987/lievaart/lievaart.c
+++ b/1987/lievaart/lievaart.c
@@ -1,3 +1,4 @@
+#define D define
#define Y return
#define R for
#define e while
diff --git a/1987/lievaart/lievaart2.c b/1987/lievaart/lievaart2.c
index cb05bfc59..27c34bcc8 100644
--- a/1987/lievaart/lievaart2.c
+++ b/1987/lievaart/lievaart2.c
@@ -1,3 +1,4 @@
+#define D define
#define Y return
#define R for
#define e while
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 2b90d3c5a..5b4997448 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -283,6 +283,12 @@ of `strings.h` and because it's identical in use to `strchr(3)` (and we noted
that for System V we had to do this) Cody added to the Makefile
`-Dindex=strchr`.
+## [1987/lievaart](1987/lievaart/lievaart.c) ([README.md](1987/lievaart/README.md))
+
+Cody made this ever so slightly like the original code by adding back the
+`#define D define` even though it's unused. This was done for both versions as
+well (the one with the board and the one without, the entry itself with the
+limitations of the contest).
## [1987/wall](1987/wall/wall.c) ([README.md](1987/wall/README.md]))
From 0d4b60eeee486676a12f25d2adcb891b29dc69a1 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 05:17:14 -0700
Subject: [PATCH 07/31] Add -include stdio.h to 1987/westley/Makefile
Although this is very unlikely(?) nowadays the judges noted that
putchar() has to exist and if compilation fails one should include
stdio.h. This cannot be done in the file, however, as it would ruin the
symmetry (already some of this was messed up due to C standard changes).
---
1987/westley/Makefile | 4 ++--
1987/westley/README.md | 4 +---
thanks-for-fixes.md | 2 ++
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/1987/westley/Makefile b/1987/westley/Makefile
index f69ac9fb3..c2c2d8377 100644
--- a/1987/westley/Makefile
+++ b/1987/westley/Makefile
@@ -39,7 +39,7 @@ include ../../var.mk
# Common C compiler warnings to silence
#
CSILENCE= -Wno-for-loop-analysis -Wno-unused-value \
- -Wno-deprecated-non-prototype -Wno-strict-prototypes
+ -Wno-deprecated-non-prototype -Wno-strict-prototypes -Wno-implicit-int
# Common C compiler warning flags
#
@@ -62,7 +62,7 @@ CDEFINE=
# Include files that are needed to compile
#
-CINCLUDE=
+CINCLUDE= -include stdio.h
# Optimization
#
diff --git a/1987/westley/README.md b/1987/westley/README.md
index d638e4534..f13e98662 100644
--- a/1987/westley/README.md
+++ b/1987/westley/README.md
@@ -31,13 +31,11 @@ Use `westley.alt` as you would `westley` above.
## Judges' remarks:
`putchar()` must exist in the C library and not just as a macro.
-If it fails to compile, add the line: `#include ` at the
-top of the program.
+If it fails to compile, bug your OS/compiler vendor.
Line by line symmetry performed better than any C beautifier. Think
of if it as a C ink blot. :-)
-
## Author's remarks:
No remarks were provided by the author.
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 5b4997448..d15e040b9 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -309,6 +309,8 @@ Cody fixed this for modern systems. The problem was `'assignment to cast is
illegal, lvalue casts are not supported'`. For the original file see the
README.md file.
+Cody also added to the Makefile `-include stdio.h` in the nowadays very
+unlikely(?) but nevertheless suggested case that `putchar()` is not available.
## [1988/dale](1988/dale/dale.c) ([README.md](1988/dale/README.md]))
From 7be723e0ad443ca79570e2b0da5b51f061e9c996 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 05:24:45 -0700
Subject: [PATCH 08/31] Make 1987/westley more symmetrical after fix
With the compilation fix of the code some symmetry was unfortunately
destroyed. To try and keep it as close as possible to the original I had
just commented out the code. But looking at it again today it occurred
to me that I can make it look more symmetrical by removing the commented
out code and then formatting the code a bit differently (another cast
was removed to do this). It is not any less authentic but it now has
more symmetry which was an important part of the entry's layout.
---
1987/westley/westley.c | 4 ++--
thanks-for-fixes.md | 7 ++++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/1987/westley/westley.c b/1987/westley/westley.c
index 6db527893..f58cb3251 100644
--- a/1987/westley/westley.c
+++ b/1987/westley/westley.c
@@ -26,11 +26,11 @@
,LACEDx0 = 0xDECAL,
rof ; for
(;(int) (tni);)
- /* (int)*/(tni)
+ (tni)
= reviled ; deliver =
redivider
;
-for ((int)(tni)++,++reviled;reviled* *deliver;deliver++,++/*(int)*/(tni)) rof
+ for ((tni)++,++reviled;reviled**deliver;deliver++,++(tni)) rof
=
(int) -1- (tni)
;reviled--;--deliver;
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index d15e040b9..b585db4a7 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -307,7 +307,12 @@ the code can refer to `gets()` instead.
Cody fixed this for modern systems. The problem was `'assignment to cast is
illegal, lvalue casts are not supported'`. For the original file see the
-README.md file.
+README.md file. Unfortunately this ruins some symmetry. To try and resolve this
+as much as possible at first code was commented out but later on the commented
+out code was removed and another part changed so that, although it has some code
+no longer there, it has a closer match in symmetry and since the code was
+commented out it's probably not a big deal to have it removed instead as it does
+look more symmetrical now.
Cody also added to the Makefile `-include stdio.h` in the nowadays very
unlikely(?) but nevertheless suggested case that `putchar()` is not available.
From 3a034eed140a269b9ca18ae1f876fd3c1eb2a8b5 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 05:41:01 -0700
Subject: [PATCH 09/31] Reword top of thanks file
This should shorten it a bit and yet still provide the same information
(or actually more :-) ) as before.
There was slight formatting changes in the file as well, both at the top
and lower down.
---
thanks-for-fixes.md | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index b585db4a7..e0103f4de 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -12,19 +12,19 @@ contributed thousands, that we wish to thank.
We call out the extensive contributions of [Cody Boone
Ferguson](https://www.ioccc.org/winners.html#Cody_Boone_Ferguson) who is
responsible for many of the improvements including many, many **very complicated
-bug fixes** such as [2001/anonymous](2001/anonymous/README.md) and
-[2004/burley](2004/burley/README.md), making entries not require
-`-traditional-cpp` (which are **very complicated fixes**), fixing entries to
-compile with clang, fixing entries to work with macOS (some of which are **very
-complicated** such as [1998/schweikh1](1998/schweikh1/README.md)), fixing code
-to work with both 32-bit and 64-bit (such as
-[2001/herrmann2](2001/herrmann2/README.md)) which *can be* **quite complicated
-too** (though not always even if it seems it), providing alternate code where
-useful or necessary, fixing where possible dead links and otherwise removing
-them, typo and consistency fixes, improving **ALL _Makefiles_** and writing the
-[sgit tool](https://github.com/xexyl/sgit) that we installed locally and have
-used to easily run `sed` on files in the repository to help build the website.
-Thank you **very much** for your extensive efforts in helping improve the IOCCC
+bug fixes** ([1988/phillipps](1988/phillipps/README.md),
+[2001/anonymous](2001/anonymous/README.md), [2004/burley](2004/burley/README.md)
+and others) making entries not require `-traditional-cpp` (which are **very
+complicated fixes**), fixing entries to compile with clang, fixing entries to
+work with macOS (some of which are **very complicated** like
+[1998/schweikh1](1998/schweikh1/README.md)), fixing code to work with both
+32-bit and 64-bit (e.g. [2001/herrmann2](2001/herrmann2/README.md)) which *can
+be* **quite complicated**, providing alternate code where useful/necessary,
+fixing where possible dead links or removing them, typo/consistency fixes,
+improving **ALL _Makefiles_** and writing the [sgit
+tool](https://github.com/xexyl/sgit) that we installed locally and have used to
+easily run `sed` on files in the repository to help build the website. **Thank
+you very much** for your extensive efforts in helping improve the IOCCC
presentation of past IOCCC winners and making many many past entries work with
modern systems!
@@ -32,7 +32,7 @@ modern systems!
number of important bug fixes to a number of past IOCCC winners. Some of those
fixes were **very technically challenging** such as
[1989/robison](1989/robison/README.md), [1990/cmills](1990/cmills/README.md),
-[1992/lush](1992/lush/README.md) and [2001/ctk](2001/ctk/README.md). Thank you **very
+[1992/lush](1992/lush/README.md) and [2001/ctk](2001/ctk/README.md). **Thank you very
much** for your help!
A good number of the [past winners of the
@@ -405,10 +405,11 @@ README.md file for more details.
Cody fixed this for modern systems. It did not compile with clang because it
requires the second and third args of `main()` to be `char **` but even before
-that with gcc it printed random characters. After fixing it for clang by
-changing `main()` to call the new function `pain()` (chosen because it's a pain
-that clang requires these args to be `char **` :-) ) with the correct args it
-now works.
+that with gcc it printed random characters.
+
+After fixing it for clang by changing `main()` to call the new function `pain()`
+(chosen because it's a pain that clang requires these args to be `char **` :-) )
+with the correct args it now works.
## [1988/reddy](1988/reddy/reddy.c) ([README.md](1988/reddy/README.md))
From 24490a361cbf4ad29cf6dffad9dcce7ccf22da08 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 05:47:17 -0700
Subject: [PATCH 10/31] Further shorten top of thanks-for-fixes.md
---
thanks-for-fixes.md | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index e0103f4de..63e1bdda3 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -16,17 +16,16 @@ bug fixes** ([1988/phillipps](1988/phillipps/README.md),
[2001/anonymous](2001/anonymous/README.md), [2004/burley](2004/burley/README.md)
and others) making entries not require `-traditional-cpp` (which are **very
complicated fixes**), fixing entries to compile with clang, fixing entries to
-work with macOS (some of which are **very complicated** like
+work with macOS (some being **very complicated** like
[1998/schweikh1](1998/schweikh1/README.md)), fixing code to work with both
-32-bit and 64-bit (e.g. [2001/herrmann2](2001/herrmann2/README.md)) which *can
-be* **quite complicated**, providing alternate code where useful/necessary,
-fixing where possible dead links or removing them, typo/consistency fixes,
-improving **ALL _Makefiles_** and writing the [sgit
-tool](https://github.com/xexyl/sgit) that we installed locally and have used to
-easily run `sed` on files in the repository to help build the website. **Thank
-you very much** for your extensive efforts in helping improve the IOCCC
-presentation of past IOCCC winners and making many many past entries work with
-modern systems!
+32-bit/64-bit (e.g. [2001/herrmann2](2001/herrmann2/README.md)) which *can be*
+**quite complicated**, providing alternate code where useful/necessary, fixing
+where possible dead links or removing them, typo/consistency fixes, improving
+**ALL _Makefiles_** and writing [sgit](https://github.com/xexyl/sgit) that we
+installed locally and used to easily run `sed` on files in the repository to
+help build the website. **Thank you very much** for your extensive efforts in
+helping improve the IOCCC presentation of past IOCCC winners and making many
+many past entries work with modern systems!
[Yusuke Endoh](https://www.ioccc.org/winners.html#Yusuke_Endoh) supplied a
number of important bug fixes to a number of past IOCCC winners. Some of those
From 4413500809ba6b75b8268da2055f500af07668b2 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 05:49:48 -0700
Subject: [PATCH 11/31] More shortening of thanks file
---
thanks-for-fixes.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 63e1bdda3..d7ed89b75 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -23,9 +23,9 @@ work with macOS (some being **very complicated** like
where possible dead links or removing them, typo/consistency fixes, improving
**ALL _Makefiles_** and writing [sgit](https://github.com/xexyl/sgit) that we
installed locally and used to easily run `sed` on files in the repository to
-help build the website. **Thank you very much** for your extensive efforts in
-helping improve the IOCCC presentation of past IOCCC winners and making many
-many past entries work with modern systems!
+help build the website. **Thank you very much** for your extensive efforts in
+helping improve the IOCCC presentation of past IOCCC winners and fixing many
+many past entries for modern systems!
[Yusuke Endoh](https://www.ioccc.org/winners.html#Yusuke_Endoh) supplied a
number of important bug fixes to a number of past IOCCC winners. Some of those
From 203697e8000886d10f7ba0f60d2b127321aa5f75 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 05:54:19 -0700
Subject: [PATCH 12/31] Even more :-) shortening of top of thanks file
I'm sure it's quite surprising but I expect to be done soon. It's hard
to tell exactly how much it helps without seeing it on GitHub but it's
looking better.
---
thanks-for-fixes.md | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index d7ed89b75..40c8d9d9c 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -18,14 +18,14 @@ and others) making entries not require `-traditional-cpp` (which are **very
complicated fixes**), fixing entries to compile with clang, fixing entries to
work with macOS (some being **very complicated** like
[1998/schweikh1](1998/schweikh1/README.md)), fixing code to work with both
-32-bit/64-bit (e.g. [2001/herrmann2](2001/herrmann2/README.md)) which *can be*
-**quite complicated**, providing alternate code where useful/necessary, fixing
-where possible dead links or removing them, typo/consistency fixes, improving
-**ALL _Makefiles_** and writing [sgit](https://github.com/xexyl/sgit) that we
-installed locally and used to easily run `sed` on files in the repository to
-help build the website. **Thank you very much** for your extensive efforts in
-helping improve the IOCCC presentation of past IOCCC winners and fixing many
-many past entries for modern systems!
+32-bit/64-bit which *can be* **very complicated** like
+[2001/herrmann2](2001/herrmann2/README.md) , providing alternate code where
+useful/necessary, fixing where possible dead links or removing them,
+typo/consistency fixes, improving **ALL _Makefiles_** and writing
+[sgit](https://github.com/xexyl/sgit) that we installed locally and used to
+easily run `sed` on files in the repo to help build the website. **Thank you
+very much** for your extensive efforts in helping improve the IOCCC presentation
+of past IOCCC winners and fixing so many past entries for modern systems!
[Yusuke Endoh](https://www.ioccc.org/winners.html#Yusuke_Endoh) supplied a
number of important bug fixes to a number of past IOCCC winners. Some of those
From 8efcabeed461e56c382d489f65187cdc7a9752e4 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 06:02:07 -0700
Subject: [PATCH 13/31] Typo fix in thanks file
This should be the last update on this pull request but I noticed a ')
,' (a ')' followed by a space followed by a ',') and I decided to
slightly reword that part as well.
---
thanks-for-fixes.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 40c8d9d9c..10863ddf6 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -18,8 +18,8 @@ and others) making entries not require `-traditional-cpp` (which are **very
complicated fixes**), fixing entries to compile with clang, fixing entries to
work with macOS (some being **very complicated** like
[1998/schweikh1](1998/schweikh1/README.md)), fixing code to work with both
-32-bit/64-bit which *can be* **very complicated** like
-[2001/herrmann2](2001/herrmann2/README.md) , providing alternate code where
+32-bit/64-bit which *can be* **very complicated** (like
+[2001/herrmann2](2001/herrmann2/README.md)), providing alternate code where
useful/necessary, fixing where possible dead links or removing them,
typo/consistency fixes, improving **ALL _Makefiles_** and writing
[sgit](https://github.com/xexyl/sgit) that we installed locally and used to
From 8f20693d5616e2fd4b8e00747c6f2e6d75cbaa86 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 06:08:59 -0700
Subject: [PATCH 14/31] Remove slight redundancy in thanks file
---
thanks-for-fixes.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 10863ddf6..86c5eab1c 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -25,7 +25,7 @@ typo/consistency fixes, improving **ALL _Makefiles_** and writing
[sgit](https://github.com/xexyl/sgit) that we installed locally and used to
easily run `sed` on files in the repo to help build the website. **Thank you
very much** for your extensive efforts in helping improve the IOCCC presentation
-of past IOCCC winners and fixing so many past entries for modern systems!
+of past IOCCC winners and fixing so many for modern systems!
[Yusuke Endoh](https://www.ioccc.org/winners.html#Yusuke_Endoh) supplied a
number of important bug fixes to a number of past IOCCC winners. Some of those
From b26aaccd08c12593455e92066edbbf7e9adabc09 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 07:49:07 -0700
Subject: [PATCH 15/31] Improve how 1986/wall alt code is built
Add explicit rule to compile alt code and update CFLAGS to include (if
CC is gcc) -traditional-cpp. Clang does not support it. If CC is cc it
might support it depending on the system (macOS gcc is actually clang so
it won't but linux it will). This allows just running instead of:
make CFLAGS+="-traditional-cpp" alt
to do:
make CC=gcc alt
but still allowing for the former which might be necessary if CC is not
defined to be gcc.
The README.md points out that in macOS gcc is clang.
Improve the command (in the thanks file) of how to see the difference
between the -traditional-cpp version and the fixed version so that it
doesn't need git but rather just diff (as git diff is unnecessary here).
Note that there is discussion about new make rules that will make this
type of thing not needed so the thanks file would be updated at this
point for that to just refer to the FAQ (or not say anything about it at
all).
---
1986/wall/Makefile | 6 +++++-
1986/wall/README.md | 7 ++++++-
thanks-for-fixes.md | 38 ++++++++++++++++++++------------------
3 files changed, 31 insertions(+), 20 deletions(-)
diff --git a/1986/wall/Makefile b/1986/wall/Makefile
index 4ce40ac19..22cb187b8 100644
--- a/1986/wall/Makefile
+++ b/1986/wall/Makefile
@@ -103,6 +103,7 @@ ifeq ($(CC),gcc)
#
#CWARN+=
#
+CFLAGS+= -traditional-cpp
endif
@@ -136,9 +137,12 @@ ${PROG}: ${PROG}.c
# alternative executable
#
-alt: data ${ALT_TARGET}
+alt: ${ALT_TARGET}
@${TRUE}
+${PROG}.alt: ${PROG}.alt.c
+ ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
+
# data files
#
data: ${DATA}
diff --git a/1986/wall/README.md b/1986/wall/README.md
index d6b18ed0e..8ea1ca22d 100644
--- a/1986/wall/README.md
+++ b/1986/wall/README.md
@@ -26,10 +26,15 @@ might enjoy looking at the original source in [wall.alt.c](wall.alt.c).
# if you have an old enough compiler:
make alt
-# or with gcc:
+# or if you have gcc:
+make CC=gcc alt
+
+# or if you have a compiler that supports -traditional-cpp that's not gcc:
make CFLAGS+="-traditional-cpp" alt
```
+NOTE: gcc in macOS is actually clang even the binary `/usr/bin/gcc`.
+
Use `./wall.alt` as you would `./wall`.
## Judges' remarks:
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 86c5eab1c..482bc9d02 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -11,21 +11,22 @@ contributed thousands, that we wish to thank.
We call out the extensive contributions of [Cody Boone
Ferguson](https://www.ioccc.org/winners.html#Cody_Boone_Ferguson) who is
-responsible for many of the improvements including many, many **very complicated
-bug fixes** ([1988/phillipps](1988/phillipps/README.md),
-[2001/anonymous](2001/anonymous/README.md), [2004/burley](2004/burley/README.md)
-and others) making entries not require `-traditional-cpp` (which are **very
-complicated fixes**), fixing entries to compile with clang, fixing entries to
-work with macOS (some being **very complicated** like
-[1998/schweikh1](1998/schweikh1/README.md)), fixing code to work with both
-32-bit/64-bit which *can be* **very complicated** (like
-[2001/herrmann2](2001/herrmann2/README.md)), providing alternate code where
-useful/necessary, fixing where possible dead links or removing them,
-typo/consistency fixes, improving **ALL _Makefiles_** and writing
-[sgit](https://github.com/xexyl/sgit) that we installed locally and used to
-easily run `sed` on files in the repo to help build the website. **Thank you
-very much** for your extensive efforts in helping improve the IOCCC presentation
-of past IOCCC winners and fixing so many for modern systems!
+responsible for many of the improvements including many **very complicated bug
+fixes** like [1988/phillipps](1988/phillipps/README.md),
+[2001/anonymous](2001/anonymous/README.md) and
+[2004/burley](2004/burley/README.md), making entries like
+[1986/wall](1986/wall/README.md) not require `-traditional-cpp` (all **very
+complicated fixes**), fixing entries to compile with clang, porting entries to
+macOS, some being **very complicated** like
+[1998/schweikh1](1998/schweikh1/README.md), fixing code like
+[2001/herrmann2](2001/herrmann2/README.md) to work in both 32-bit/64-bit which
+*can be* **very complicated**, providing alternate code where useful/necessary,
+fixing where possible dead links or removing them, typo/consistency fixes,
+improving **ALL _Makefiles_** and writing [sgit](https://github.com/xexyl/sgit)
+that we installed locally to easily run `sed` on files in the repo to help build
+the website. **Thank you very much** for your extensive efforts in helping
+improve the IOCCC presentation of past IOCCC winners and fixing almost all for
+modern systems!
[Yusuke Endoh](https://www.ioccc.org/winners.html#Yusuke_Endoh) supplied a
number of important bug fixes to a number of past IOCCC winners. Some of those
@@ -261,15 +262,16 @@ noted earlier, very complicated, but we encourage you to look at [original
code](1986/wall/wall.orig.c) to see how different C was in 1986.
Yusuke originally patched this to use `strdup()` on two strings and this let it
-work with gcc but it still requires `-traditional-cpp`. The [alternate
+work with gcc but it still required `-traditional-cpp`. The [alternate
code](1986/wall/wall.alt.c) is the version patched by Yusuke should you wish to
-try it with a compiler that has the `-traditional-cpp`.
+try it with a compiler that has the `-traditional-cpp`. See the README.md file
+for details.
If you'd like to see the difference between the version that requires
`-traditional-cpp` and the fixed version, try:
```sh
-git diff 82cbf069a781d64802fc59b36778c0b02be4043e..a74abb69b7e9b87e305b529941bf46f97ffff341 1986/wall/wall.c
+diff 1986/wall/wall.alt.c 1986/wall/wall.c
```
## [1987/heckbert](1987/heckbert/heckbert.c) ([README.md](1987/heckbert/README.md))
From 87fc9722a20b247e1971789a92a8db025aa709ac Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 08:10:12 -0700
Subject: [PATCH 16/31] Further improve my fixes to 1984/decot
When I restored the macros it allowed for reinstating the 'union'
instead of 'static struct' and it also allowed for reintroducing the 'x'
(which is '=') in that line so that it looks just like the original:
union tag u x{4};
For documentation purposes this was added in the thanks file (in the
same part of that entry, the making it look more like the original which
is a worthy goal) as well.
---
1984/decot/decot.c | 2 +-
thanks-for-fixes.md | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/1984/decot/decot.c b/1984/decot/decot.c
index 1069eb7d9..7aa30e532 100644
--- a/1984/decot/decot.c
+++ b/1984/decot/decot.c
@@ -21,7 +21,7 @@ int dup, signal;
goto _0;
_O: while (!(k['a'] <<= - dup)) { /*/*\*/
- static struct tag u = {4};
+ union tag u x{4};
}
}
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 482bc9d02..3b3d3110f 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -127,6 +127,10 @@ char x {sizeof(
and changing the type of `k` to be an `int`.
+Additionally, because of the `#define union static struct` there is no need to
+have in the code `static struct` as we can have it like the original code which
+has it as `union`.
+
Originally Yusuke supplied a patch so that this entry would compile with gcc -
but not clang - or at least some versions.
From 1248d962f4919c939b1f141bb904e9a514cb80d8 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 08:23:52 -0700
Subject: [PATCH 17/31] Format/typo check 1988/dale
This includes the thanks-for-fixes.md file where C code was actually in
the form of a diff (which happened when I was looking for the
differences to put in the file in the first place, forgetting to remove
the [-+] at the time).
---
1988/dale/README.md | 5 +++--
thanks-for-fixes.md | 13 ++++++++-----
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/1988/dale/README.md b/1988/dale/README.md
index 5ba311efe..35e49fa2b 100644
--- a/1988/dale/README.md
+++ b/1988/dale/README.md
@@ -1,6 +1,6 @@
# Best abuse of system calls
-Paul Dale
+Paul Dale
Australia
## To build:
@@ -40,7 +40,8 @@ If you have an old enough compiler you can try the original version in
make clobber alt
```
-Use `dale.alt` as you would `dale` above.
+Use `dale.alt` as you would `dale` above. To understand the differences in more
+detail, see [thanks-for-fixes.md](/thanks-for-fixes.md).
## Judges' remarks
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 3b3d3110f..8a8004d01 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -379,16 +379,19 @@ modern compilers do not allow directives like:
```c
#define _ define
-+#_ P char
-+#_ p int
-+#_ O close(
-...
+#_ P char
+#_ p int
+#_ O close(
+/* ... */
```
so Cody changed the lines to be in the form of:
```c
-#define foo bar
+#define P char
+#define p int
+#define O close(
+/* ... */
```
However, to keep the entry as close to as possible in look, Cody kept the `_`
From 5832e2b656defed99298ff72f4581ab2a7a5670c Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 08:32:17 -0700
Subject: [PATCH 18/31] Format/typo check 1988/isaak/README.md
Added a section with historical notes about the entry (that is I added
the section heading and put the respective text, some of which I
previously added, under it).
This file should be in good order except perhaps a pending issue of
formatting the alternate code/to build/try sections.
---
1988/isaak/README.md | 47 ++++++++++++++++++++++++++++----------------
1 file changed, 30 insertions(+), 17 deletions(-)
diff --git a/1988/isaak/README.md b/1988/isaak/README.md
index f5b343693..a93747e76 100644
--- a/1988/isaak/README.md
+++ b/1988/isaak/README.md
@@ -1,11 +1,7 @@
# Best visuals
-Mark Isaak
-Imagen Corporation
-2650 San Tomas Expy.
-Santa Clara, CA
-95052-8101
-US
+Mark Isaak
+US
## To build:
@@ -13,6 +9,10 @@ US
make all
```
+There is an alternate version, the original, that can't be compiled in modern
+systems but can be if you have an old enough compiler. See [Alternate
+code](#alternate-code) below.
+
## To run:
```sh
@@ -29,28 +29,41 @@ The original entry starts with the line:
```
This works on some systems. Why? Note that `#include ` is given on
-the last line. Why is this needed? Note the unusual calls to sprintf.
+the last line. Why is this needed? Note the unusual calls to `sprintf(3)`.
This version also relied on being able to define `#define` to something else and
-using that macro for `#define`. This version will not likely work on modern
-systems if you can even get it to compile.
+using that macro for `#define`.
+This version will not likely work on modern systems if you can even get it to
+compile.
+
+#### To build:
+
+```sh
+make alt
+```
+
+Use `isaak.alt` as you would `isaak` above.
## Judges' remarks:
-NOTE: The program relies heavily on ASCII. Don't even think of running it on
-an EBCDIC machine. If you named the file anything other than [isaak.c](isaak.c),
-you had to change the `#include` on line 6. This limitation has been fixed by
-using the `__FILE__` macro.
+The program relies heavily on ASCII. Don't even think of running it on
+an EBCDIC machine.
+
+### Historical notes about the original entry:
+
+NOTE: If you named the file anything other than [isaak.c](isaak.c), you had to
+change the `#include` on line 6. This limitation has been fixed by using the
+`__FILE__` macro.
NOTE: The use of null comments to separate macros to construct different tokens
from a single macro (e.g., `"O/**/O"` creates either `++` or `--` by defining
`O` to be `+` or `-`) may cause some strict ANSI C preprocessors to object.
NOTE: Most System V machines were not be able to execute this program correctly
-due to the fact that BSD style systems have an sprintf() that returns a `char *`.
-Due to the above problems, we placed the output of this program in the file:
-isaak.encode. To read this file do:
+due to the fact that BSD style systems have an `sprintf(3)` that returns a `char
+*`. Due to the above problems, we placed the output of this program in the
+file: isaak.encode. To read this file do.
```sh
uudecode < isaak.encode
@@ -58,7 +71,7 @@ cat isaak.output
```
Since this was fixed, this file is not strictly necessary. See the
-[isaak.orig.c](isaak.orig.c) for the original source.
+[isaak.alt.c](isaak.alt.c) for the original source.
FYI: We are likely to be more strict about portability in the future.
From 5b4847ce70c29c9c8e067d02e5a0987e588c9f63 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 08:42:36 -0700
Subject: [PATCH 19/31] Update 1988/litmaath
Format and typo check the README.md file.
Improved the order of the alt code (displayed by the judges) and what
followed it (that might seem like it's related to the alt code when
although maybe true it still is about the entry itself).
Updated thanks file to refer to the alt code and removed myself from the
README.md (this before the far superior idea of a single file outside of
the entries existed and because some entries were missed, this one
included).
---
1988/litmaath/README.md | 29 +++++++++++++++++++----------
thanks-for-fixes.md | 4 ++++
2 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/1988/litmaath/README.md b/1988/litmaath/README.md
index 0e801e4ca..9e57ad8cd 100644
--- a/1988/litmaath/README.md
+++ b/1988/litmaath/README.md
@@ -1,6 +1,6 @@
# Best small program
-Maarten Litmaath
+Maarten Litmaath
The Netherlands
## To build:
@@ -15,7 +15,8 @@ make
./litmaath some text
```
-There is an alternate version provided. See the Alternate code section below.
+There is an alternate version provided. See the [Alternate
+code](#alternate-code) section below.
## Try:
@@ -25,9 +26,13 @@ There is an alternate version provided. See the Alternate code section below.
### Alternate code:
-[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) added the
-[litmaath.alt.c](litmaath.alt.c) which we described in our remarks below. To
-use:
+
+This alternate code, added to help understand the entry and for fun, is code
+that we suggested at the time of the entry publication but which we never put in
+a file.
+
+#### To build:
+
```sh
make alt
@@ -35,7 +40,11 @@ make alt
Use `litmaath.alt` as you would `litmaath` above.
-Thank you Cody!
+#### Try:
+
+```sh
+./litmaath.alt six was afraid of seven because seven eight nine
+```
## Judges' remarks:
@@ -50,10 +59,12 @@ while ()
Did you notice that the body is empty?
+Furthermore, it's interesting to note that only two variables are
+used to achieve everything.
The best one can do to understand how the program works is to give it
two small strings as arguments, and follow the program closely. One
-could make the body of the 'while' loop an 'fprintf' with interesting
+could make the body of the `while` loop an `fprintf` with interesting
variables like:
@@ -64,15 +75,13 @@ fprintf(stderr,
(long) argv[1], argv[1] && *argv[1] ? *argv[1] : '@', argc);
```
+... which is what the [alternate code](#alternate-code) is.
-Furthermore, it's interesting to note that only two variables are
-used to achieve everything.
## Author's remarks:
No remarks were provided by the author.
-
## Copyright and CC BY-SA 4.0 License:
This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 8a8004d01..f8e6b45d4 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -408,6 +408,10 @@ function, a redefinition of `exit()`, was not being called in main(). The
original version is in [1988/isaak/isaak.alt.c](1988/isaak/isaak.alt.c). See the
README.md file for more details.
+## [1988/litmaath](1988/litmaath/litmaath.c) ([README.md](1988/litmaath/README.md))
+
+Cody added the alt code which is code that we suggested at the time of
+publication, in the remarks, to help understand the entry, and for fun.
## [1988/phillipps](1988/phillipps/phillipps.c) ([README.md](1988/phillipps/README.md]))
From f5d658b9b6b47487a11964138e7a1e0fc0e8e79d Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 08:49:22 -0700
Subject: [PATCH 20/31] Format/typo check 1988/applin
The README.md and the Makefile were both updated. The Makefile because
of typos/unclear things. The README.md had formatting fixes and also
added the historical note about 1988 from the Makefile as it's far less
likely people will see that note versus that which is in the README.md.
---
1988/applin/Makefile | 4 ++--
1988/applin/README.md | 37 ++++++++++++++++++++++++++-----------
2 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/1988/applin/Makefile b/1988/applin/Makefile
index 173ce47cc..1673422cd 100644
--- a/1988/applin/Makefile
+++ b/1988/applin/Makefile
@@ -131,9 +131,9 @@ all: data ${TARGET}
#
# This entry took 75 minutes to compile on a Amdahl 5980-300E
# (a 55658 Dhyrstone/sec/cpu machine) using the System V cpp.
-# (The GNU cpp when defined as BIG_CPP took only 45 seconds)
+# (The GNU cpp when defined as BIG_CPP took only 45 seconds.)
# Your cpp may not be able to compile it due to a common bug
-# that results in ${CPP} running out of space. The routine
+# that results in cpp running out of space. The routine
# 'zsmall' is a smaller version of the applin.c entry.
#
${PROG}: ${PROG}.c
diff --git a/1988/applin/README.md b/1988/applin/README.md
index 187729cdf..baee1b29a 100644
--- a/1988/applin/README.md
+++ b/1988/applin/README.md
@@ -1,7 +1,7 @@
# Best of show
-Jack Applin
-US
+Jack Applin
+US
## To build:
@@ -10,9 +10,10 @@ US
make all
```
-A smaller version, originally called `zsmall.c`, of [applin.c](applin.c) can be
-found in [applin.alt.c](applin.alt.c). Your machine may have an easier time
-with this program. See the Alternate code section below for details.
+A smaller version, originally called `zsmall.c` (and still exists as such, as
+the source of the alt code), of [applin.c](applin.c), can be found in
+[applin.alt.c](applin.alt.c). Your machine may have an easier time with this
+program. See the [Alternate code](#alternate-code) section below for details.
## Try:
@@ -22,8 +23,10 @@ with this program. See the Alternate code section below for details.
### Alternate code:
-As noted above a smaller version can be used in case your cpp has a hard time
-with this entry. To use:
+As noted above a smaller version can be used in case your `cpp` has a hard time
+with this entry.
+
+#### To build:
```sh
make alt
@@ -31,22 +34,34 @@ make alt
Use `applin.alt` as you would `applin` above.
+#### History about the smaller version:
+
+Way back in 1988 ..
+
+This entry took 75 minutes to compile on a Amdahl 5980-300E (a 55658
+Dhyrstone/sec/cpu machine) using the System V `cpp`. (The GNU `cpp` when defined as
+`BIG_CPP` took only 45 seconds.)
+
+Your `cpp` may not be able to compile it due to a common bug that results in
+`cpp` running out of space. The routine [zsmall](zsmall.c) is a smaller version
+of the [applin.c](applin.c) entry.
+
## Judges' remarks:
This entry is by far the most unusual abuse of the C preprocessor that
we have received thus far. Nearly all of the real work is done in the
-preprocessor!
+C preprocessor!
When we compiled [applin.c](applin.c) on an
[Amdahl](https://en.wikipedia.org/wiki/Amdahl_Corporation) 5890-300E, we found that it
spent over 75 minutes in the System V C preprocessor! Besides showing that the
-standard System V cpp is slow, it showed that it contained a memory usage
+standard System V `cpp` is slow, it showed that it contained a memory usage
problem. The [applin.c](applin.c) only uses 29 different preprocessor symbols
(besides `stdio.h`) and yet the preprocessor ran out of space!
-The GNU C preprocessor took less than 45 seconds to perform the 2nd pass
-on the Amdahl 5890-300E. But due to the ANSI-likeness of GNU cpp (v. 1-21),
+The GNU C preprocessor took under 45 seconds to perform the 2nd pass
+on the Amdahl 5890-300E. But due to the ANSI-likeness of GNU `cpp` (v. 1-21),
it was not able to cleanly substitute a symbol that began with a '#'.
Clearly the GNU C preprocessor is faster.
From b400fc22fb7c3bd6e42b586b0d6ec37cadd34080 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 09:03:04 -0700
Subject: [PATCH 21/31] Improve slightly my fix to 1988/phillipps
As main() used K&R style I changed main() to use K&R. The function that
it became (to fix it), pain(), already has the same exact format of what
main() once was only named painfully. Since main() also had the function
on many lines, even just the return statement in the beginning, I did
this in main() but given that main() only calls pain() obviously this is
not perfect. This has been documented in the thanks file like for all
the other improvements, to keep track of it.
Format/typo check README.md.
---
1988/phillipps/README.md | 9 ++-------
1988/phillipps/phillipps.c | 11 ++++++++++-
thanks-for-fixes.md | 8 +++++++-
3 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/1988/phillipps/README.md b/1988/phillipps/README.md
index 5340c1e6f..8f410d3ce 100644
--- a/1988/phillipps/README.md
+++ b/1988/phillipps/README.md
@@ -1,12 +1,7 @@
# Least likely to compile successfully
-Ian Phillipps
-Cambridge Consultants Ltd
-Science Park
-Milton Road
-Cambridge CB4 4DW
-England
-
+Ian Phillipps
+UK
## To build:
diff --git a/1988/phillipps/phillipps.c b/1988/phillipps/phillipps.c
index 9b6832545..6d4baf8be 100644
--- a/1988/phillipps/phillipps.c
+++ b/1988/phillipps/phillipps.c
@@ -51,4 +51,13 @@ pain(0,
pain(-61,*a, "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry")
,a+1);}
-main(int t,char **_,char **a){return pain(t,(int)_,(char *)a);}
+main(t,_,a )
+char
+**
+_,
+**
+a;
+{
+ return
+pain(t,(int)_,
+(char *)a);}
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index f8e6b45d4..e93b34a01 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -421,7 +421,13 @@ that with gcc it printed random characters.
After fixing it for clang by changing `main()` to call the new function `pain()`
(chosen because it's a pain that clang requires these args to be `char **` :-) )
-with the correct args it now works.
+with the correct args it now works with gcc and clang.
+
+Later Cody improved the fix to make it look a bit more like the original, using
+K&R style functions, and trying to match the format as best as possible of what
+`main()` used to look like but without the full body that cannot exist as it
+once did. The format of `pain()` is exactly like how `main()` was as it's the
+same code.
## [1988/reddy](1988/reddy/reddy.c) ([README.md](1988/reddy/README.md))
From 044738aa3c68e150ba8ae6c788caa1835c34fe69 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 09:12:56 -0700
Subject: [PATCH 22/31] Format/typo fix 1988/reddy + restore winner name
By some crazy chance the winner's name was not in the README.md file:
just a corporation (which has been removed along with the address). I
was able to locate it in the author/ subdirectory in the JSON file.
Format and typo checked the README.md and also added some things to try
to explore the entry more.
---
1988/reddy/README.md | 15 ++++++++++-----
thanks-for-fixes.md | 2 ++
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/1988/reddy/README.md b/1988/reddy/README.md
index 2d4347270..a141639b6 100644
--- a/1988/reddy/README.md
+++ b/1988/reddy/README.md
@@ -1,10 +1,7 @@
# Most useful Obfuscated C program
-Amperif Corporation
-9232 Eton Avenue
-Chatsworth, CA
-91311
-U.S.A.
+Gopi Reddy
+US
## To build:
@@ -19,8 +16,16 @@ make all
```sh
./reddy
char *(*(fun[16])();
+char *(*(*(*(*(*fun[32])))))();
```
+What happens if you input:
+
+```
+char *(*(*(*(*(*fun[32])))))());
+```
+
+? What can you do about it?
## Judges' remarks:
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index e93b34a01..6ac324591 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -434,6 +434,8 @@ same code.
Cody made this use `fgets()` to prevent annoying warnings during compiling,
linking and runtime, the latter of which being the most annoying.
+Cody also restored the name of the winner in the README.md file that was missing
+by some crazy chance.
## [1988/spinellis](1988/spinellis/spinellis.c) ([README.md](1988/spinellis/README.md]))
From d3ef471ca0c887eda89cc11e73ce4590655ea8ac Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 09:15:21 -0700
Subject: [PATCH 23/31] Add missing
to 1988/reddy/README.md
---
1988/reddy/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/1988/reddy/README.md b/1988/reddy/README.md
index a141639b6..bcdc3baf6 100644
--- a/1988/reddy/README.md
+++ b/1988/reddy/README.md
@@ -1,6 +1,6 @@
# Most useful Obfuscated C program
-Gopi Reddy
+Gopi Reddy
US
From fd18362f6368c0f6f2e84f5c756e38fc0357de75 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 09:17:55 -0700
Subject: [PATCH 24/31] Format/typo check 1988/robison
---
1988/robison/README.md | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/1988/robison/README.md b/1988/robison/README.md
index 8e59ddfea..5af451ca9 100644
--- a/1988/robison/README.md
+++ b/1988/robison/README.md
@@ -1,10 +1,6 @@
# Best abuse of C constructs
-Arch D. Robison
-University of Illinois at Urbana-Champaign
-1304 W. Springfield Ave.
-Urbana IL
-61801
+Arch D. Robison
US
## To build:
@@ -46,9 +42,9 @@ not take a while to execute?
## Author's remarks:
This program shows that C has many unnecessary constructs, in fact
-only "while","--", and ">=" are required. (The two assignments at
-the beginning could be avoided if "atoi" was rewritten with this
-new paradigm.) Note that the lack of both the controversial "goto"
+only `while`,`--`, and `>=` are required. (The two assignments at
+the beginning could be avoided if `atoi(3)` was rewritten with this
+new paradigm.) Note that the lack of both the controversial `goto`
and assignment statements makes the meaning crystal clear. The current
ANSI committee should look into this practical simplification of C.
From 41427c64c32569f5af7498d93edbca1b629ce21b Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 09:27:50 -0700
Subject: [PATCH 25/31] Format/typo check 1988/spinellis
---
1988/spinellis/README.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/1988/spinellis/README.md b/1988/spinellis/README.md
index d92fefa1f..2aa122781 100644
--- a/1988/spinellis/README.md
+++ b/1988/spinellis/README.md
@@ -1,8 +1,8 @@
# Best abuse of the rules
-Diomidis Spinellis
-Greece
-
+Diomidis Spinellis
+GR
+
Mastodon:
## To build:
@@ -46,7 +46,7 @@ be compiled from within a Makefile without the need of human intervention.
## Author's remarks:
This program can be configured to do almost everything. The configuration is
-done during compile time by typing in, C code, that one would like the program
+done during compile time by typing in C code that one would like the program
to perform. A trivial example is given in the `how to compile' section but the
possibilities are clearly limited only by your imagination and programming
skills.
From 5acb285dda9c30d9db110b05aaddc74064b99f62 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 09:29:09 -0700
Subject: [PATCH 26/31] Commit thanks file for previous commit
I reworded why the alt code is necessary.
---
thanks-for-fixes.md | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 6ac324591..73e267248 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -441,11 +441,12 @@ by some crazy chance.
Cody provided an [alternate version](1988/spinellis/spinellis.alt.c) so that
this will work with compilers like clang. An alternate version had to be
-provided because not doing so would be tampering with the file too much. It
-would work but it would not show the same creativity. The original file exploits
-a fun mis-feature that works with gcc but not clang. This resulted in a change
-of rules which is another reason to not modify the original. See the README.md
-file for details on the alternate code.
+provided because not doing so would be tampering with the entry too much. It
+would work but it would not show the same creativity and cleverness.
+
+The original entry exploits a fun mis-feature that works with gcc but not clang.
+This resulted in a change of rules which is another reason to not modify the
+original. See the README.md file for details on the alternate code.
Meanwhile Cody was twisted enough to point out (though to be fair he felt sick
doing this) that with a slight modification this entry can be C++ instead. We don't
From 70fa8f5ee9d3314577482f547fcc1e0b9fdb751a Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 09:33:40 -0700
Subject: [PATCH 27/31] Add 1988/westley/demo.sh + format/typo check
The reason for the demo is because when one looks at the code and then
sees the output at the same time it's far more beautiful and magical.
The README.md has been typo and format checked.
With this commit, the README.md files for the 1988 entries have been
checked and besides some things brought up on GitHub they should be in
good order (for now?).
---
1988/westley/README.md | 12 ++++++++++--
1988/westley/demo.sh | 15 +++++++++++++++
thanks-for-fixes.md | 3 +++
3 files changed, 28 insertions(+), 2 deletions(-)
create mode 100755 1988/westley/demo.sh
diff --git a/1988/westley/README.md b/1988/westley/README.md
index cea7c3418..9aa04f881 100644
--- a/1988/westley/README.md
+++ b/1988/westley/README.md
@@ -10,8 +10,8 @@ US
make all
```
-NOTE: this version is a fixed version for modern C compilers. See the Alternate
-code section below for how to use the original.
+NOTE: this version is a fixed version for modern C compilers. See the [Alternate
+code](#alternate-code) section below for how to use the original.
## Try:
@@ -20,6 +20,14 @@ code section below for how to use the original.
./westley
```
+Also try:
+
+```sh
+./demo.sh
+```
+
+to show the code with followed by the result so you can truly see the magic.
+
## Judges' remarks:
Your compiler must parse
diff --git a/1988/westley/demo.sh b/1988/westley/demo.sh
new file mode 100755
index 000000000..050823120
--- /dev/null
+++ b/1988/westley/demo.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+clear
+echo "$ cat westley.c"
+cat westley.c
+
+sleep 1
+
+echo "$ cc westley.c -o westley"
+cc -std=gnu89 -Wall -Wextra -pedantic -Wno-error -Wno-implicit-function-declaration -Wno-return-type -O3 westley.c -o westley 2>/dev/null
+
+echo "$ ./westley"
+./westley
+
+echo
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 73e267248..4cae316c7 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -460,6 +460,9 @@ was fixed by Misha Dynin, based on the judges' remarks, so that this would work
with modern C compilers. We encourage you to try the alternate version to see
what happens with current compilers! See the README.md files for details.
+Cody added the [demo.sh](1988/westley/demo.sh) script to show the magic of the
+entry as seeing the code with the result at once is far more beautiful.
+
## [1989/fubar](1989/fubar/fubar.c) ([README.md](1989/fubar/README.md]))
From 5a68f769ddbc7847fb19cd4333fb09ed4aa5a003 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 09:38:34 -0700
Subject: [PATCH 28/31] Improve 1988/westley/demo.sh
In addition to exiting (1) on compilation error (rather than trying to
run the program) don't use -Wall -Wextra and don't redirect stderr to
/dev/null. This way if there ever is a problem compiling it can be seen.
Another option might be to first check if the program is already
compiled but this might not be that important. This can be determined
later.
---
1988/westley/demo.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/1988/westley/demo.sh b/1988/westley/demo.sh
index 050823120..b14f9975e 100755
--- a/1988/westley/demo.sh
+++ b/1988/westley/demo.sh
@@ -7,7 +7,7 @@ cat westley.c
sleep 1
echo "$ cc westley.c -o westley"
-cc -std=gnu89 -Wall -Wextra -pedantic -Wno-error -Wno-implicit-function-declaration -Wno-return-type -O3 westley.c -o westley 2>/dev/null
+cc -std=gnu89 -Wno-error -Wno-implicit-function-declaration -Wno-return-type -O3 westley.c -o westley || exit 1
echo "$ ./westley"
./westley
From 594e3898a2ddca520ae03f4a3f4111fc72ca1984 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 10:05:52 -0700
Subject: [PATCH 29/31] Clarify fix for 1989/paul
I have clarified that the reason I fixed the segfault in macOS is
because without it the entry did not work.
---
thanks-for-fixes.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 4cae316c7..b8b9e4470 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -496,9 +496,9 @@ author's remarks. See the README.md for details.
## [1989/paul](1989/paul/paul.c) ([README.md](1989/paul/README.md]))
-Cody fixed a segfault under macOS. The problem was that the int (from `#define
-f`) should be a long. This became apparent when he was using lldb and saw that
-the type of a pointer was too `long` :-)
+Cody fixed a segfault under macOS that prevented it from working. The problem
+was that the int (from `#define f`) should be a long. This became apparent when
+he was using lldb and saw that the type of a pointer was too `long` :-)
## [1989/robison](1989/robison/robison.c) ([README.md](1989/robison/README.md]))
From 16bcb2aaa781ae79751c8388161202908aa582fe Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 12:17:38 -0700
Subject: [PATCH 30/31] Improve my fix to 1988/phillipps
The return in main() to pain() can be negated just like main() did to
itself (and now pain() does). Now the program exits with 0.
---
1988/phillipps/phillipps.c | 2 +-
thanks-for-fixes.md | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/1988/phillipps/phillipps.c b/1988/phillipps/phillipps.c
index 6d4baf8be..bb0d506f0 100644
--- a/1988/phillipps/phillipps.c
+++ b/1988/phillipps/phillipps.c
@@ -58,6 +58,6 @@ _,
**
a;
{
- return
+ return!
pain(t,(int)_,
(char *)a);}
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index b8b9e4470..149cbc285 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -25,8 +25,8 @@ fixing where possible dead links or removing them, typo/consistency fixes,
improving **ALL _Makefiles_** and writing [sgit](https://github.com/xexyl/sgit)
that we installed locally to easily run `sed` on files in the repo to help build
the website. **Thank you very much** for your extensive efforts in helping
-improve the IOCCC presentation of past IOCCC winners and fixing almost all for
-modern systems!
+improve the IOCCC presentation of past IOCCC winners and fixing almost all past
+entries for modern systems!
[Yusuke Endoh](https://www.ioccc.org/winners.html#Yusuke_Endoh) supplied a
number of important bug fixes to a number of past IOCCC winners. Some of those
@@ -369,7 +369,7 @@ for/*/(;;);/*/k()){O/*/*/c);
```
cannot form `fork())` in modern C compilers. Since it was not done through a
-macro it was simply changed to be 'fork()', rather than adding a new macro.
+macro it was simply changed to be `fork()`, rather than adding a new macro.
(What is quite fun is that at least some C pre-processors can form these
constructs! Can you figure out why this is?)
From 98f1598032e61b3689e25813387238a1ee84ec4e Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 18 Oct 2023 12:19:41 -0700
Subject: [PATCH 31/31] Update thanks file for improved fix to 1988/phillipps
---
thanks-for-fixes.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 149cbc285..2f5a6d2ca 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -427,7 +427,8 @@ Later Cody improved the fix to make it look a bit more like the original, using
K&R style functions, and trying to match the format as best as possible of what
`main()` used to look like but without the full body that cannot exist as it
once did. The format of `pain()` is exactly like how `main()` was as it's the
-same code.
+same code. Additionally, `main()` returns `!pain(...)` like `main()` used to do
+to itself and `pain()` does now.
## [1988/reddy](1988/reddy/reddy.c) ([README.md](1988/reddy/README.md))