From 2f76ad3c8ef2a5b1bbd34a22c30ab43aabea80df Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 13 Jan 2024 06:12:40 -0800
Subject: [PATCH 01/11] Add 1990/baruch to bugs.md, update try.sh
A feature is that as the number specified gets bigger so too does the
runtime, the amount of resources and the number of lines of output.
The script has another example command (that isn't too long but is a
number of pages of less(1) output).
---
1990/baruch/README.md | 12 ++++++++
1990/baruch/try.sh | 5 ++++
bugs.md | 69 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+)
diff --git a/1990/baruch/README.md b/1990/baruch/README.md
index 825dcb4d1..692092589 100644
--- a/1990/baruch/README.md
+++ b/1990/baruch/README.md
@@ -8,6 +8,18 @@ There is an alternate version for those using Turbo-C or MSC. See [alternate
code](#alternate-code) below for details.
+### Bugs and (Mis)features:
+
+The current status of this entry is:
+
+```
+STATUS: INABIAF - please **DO NOT** fix
+```
+
+For more detailed information see [1990 baruch in bugs.md](/bugs.md#1990-baruch).
+
+
+
## To use:
```sh
diff --git a/1990/baruch/try.sh b/1990/baruch/try.sh
index 28822ca1a..c3e98403e 100755
--- a/1990/baruch/try.sh
+++ b/1990/baruch/try.sh
@@ -20,6 +20,11 @@ echo 1>&2
echo 5 | ./baruch | less -rEXF
echo 1>&2
+read -r -n 1 -p "Press any key to run: echo 8 | ./baruch (space = next page, q = quit): "
+echo 1>&2
+echo 8 | ./baruch | less -rEXF
+echo 1>&2
+
read -r -n 1 -p "Press any key to run: echo 2 | ./baruch: "
echo 1>&2
echo 2 | ./baruch
diff --git a/bugs.md b/bugs.md
index 8e3788e78..4d6a35b5b 100644
--- a/bugs.md
+++ b/bugs.md
@@ -673,6 +673,75 @@ Enjoy! :-)
# 1990
+## 1990 baruch
+
+### STATUS: known bug - please help us fix
+### Source code: [1990/baruch/baruch.c](1990/baruch/baruch.c)
+### Information: [1990/baruch/README.md](1990/baruch/README.md)
+
+A point worth considering is that as the number passed into the program gets
+bigger the number of lines of output gets substantially larger and it takes much
+more time and resources to run as well. For instance:
+
+```sh
+$ for n in $(seq 1 18); do echo "$n"; echo "$n" | time "./baruch" | wc -l | sed -E -e 's/[[:space:]]//g'; done
+1
+3
+./baruch 0.00s user 0.00s system 5% cpu 0.115 total
+2
+1
+./baruch 0.00s user 0.00s system 64% cpu 0.004 total
+3
+1
+./baruch 0.00s user 0.00s system 60% cpu 0.003 total
+4
+11
+./baruch 0.00s user 0.00s system 64% cpu 0.003 total
+5
+61
+./baruch 0.00s user 0.00s system 66% cpu 0.003 total
+6
+29
+./baruch 0.00s user 0.00s system 61% cpu 0.003 total
+7
+321
+./baruch 0.00s user 0.00s system 69% cpu 0.002 total
+8
+829
+./baruch 0.00s user 0.00s system 76% cpu 0.003 total
+9
+3521
+./baruch 0.00s user 0.00s system 87% cpu 0.005 total
+10
+7965
+./baruch 0.01s user 0.00s system 95% cpu 0.014 total
+11
+32161
+./baruch 0.05s user 0.00s system 98% cpu 0.053 total
+12
+184601
+./baruch 0.29s user 0.00s system 99% cpu 0.294 total
+13
+1031969
+./baruch 1.78s user 0.00s system 99% cpu 1.794 total
+14
+5483941
+./baruch 11.26s user 0.02s system 99% cpu 11.311 total
+15
+36466945
+./baruch 79.20s user 0.15s system 99% cpu 1:19.72 total
+16
+251132705
+./baruch 592.89s user 0.77s system 99% cpu 9:55.34 total
+17
+1724671873
+./baruch 4535.71s user 5.25s system 99% cpu 1:15:49.76 total
+18
+12655721857
+./baruch 37496.97s user 58.50s system 99% cpu 10:27:48.29 total
+```
+
+
## 1990 jaw
### STATUS: known bug - please help us fix
From e0b6a7f3577fc64b147e8afa66c501b47732af8c Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 13 Jan 2024 07:27:37 -0800
Subject: [PATCH 02/11] Add 1991/brnstnd/try.sh and try.txt
The try.txt is a file for the rot13 SORTA file. All but one of the
sorta.* files is used. The only one that is not prints out a verr long
line of output and would flood the screen. The try section in the
README.md does suggest one try it just to be complete.
---
1991/brnstnd/README.md | 7 +++--
1991/brnstnd/try.sh | 59 ++++++++++++++++++++++++++++++++++++++++++
1991/brnstnd/try.txt | 1 +
thanks-for-help.md | 3 +++
4 files changed, 66 insertions(+), 4 deletions(-)
create mode 100755 1991/brnstnd/try.sh
create mode 100644 1991/brnstnd/try.txt
diff --git a/1991/brnstnd/README.md b/1991/brnstnd/README.md
index 0407f3c68..74305cf16 100644
--- a/1991/brnstnd/README.md
+++ b/1991/brnstnd/README.md
@@ -8,11 +8,10 @@ make all
### Try:
```sh
-./brnstnd < sorta.i2+2
-./brnstnd < sorta.iwhosort
-```
+./try.sh
-See also the other `sorta.*` files.
+./sorta < sorta.itailrec
+```
## Judges' remarks:
diff --git a/1991/brnstnd/try.sh b/1991/brnstnd/try.sh
new file mode 100755
index 000000000..b06e365e3
--- /dev/null
+++ b/1991/brnstnd/try.sh
@@ -0,0 +1,59 @@
+#!/usr/bin/env bash
+#
+# try.sh - demonstrate IOCCC winner 1991/brnstnd
+#
+
+# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
+# this way allows us to have the user specify a different compiler in an easy
+# way.
+if [[ -z "$CC" ]]; then
+ CC="cc"
+fi
+
+make CC="$CC" all >/dev/null || exit 1
+
+# clear screen after compilation so that only the entry is shown
+clear
+
+sorta_with_arg()
+{
+ if [[ "$#" != 2 ]]; then
+ echo "$0: sorta_with_arg() expects a file and arg, only got file name" 1>&2
+ return
+ fi
+
+ read -r -n 1 -p "Press any key to run: ./sorta < $1 $2: "
+ echo 1>&2
+ ./sorta < "$1" "$2"
+ echo 1>&2
+}
+
+sorta()
+{
+ if [[ "$#" != 1 ]]; then
+ echo "$0: sorta() expects 1 arg, got: $#" 1>&2
+ return
+ fi
+
+ read -r -n 1 -p "Press any key to run: ./sorta < $1: "
+ echo 1>&2
+ ./sorta < "$1"
+ echo 1>&2
+}
+
+sorta sorta.i2+2
+sorta sorta.icalc
+sorta_with_arg sorta.iecho "IOCCC 1991/brnstnd"
+sorta sorta.ifact2
+sorta sorta.iio
+sorta sorta.isleep
+sorta sorta.iwhosort
+sorta sorta.iarg0
+sorta sorta.idup
+sorta sorta.ifact1
+sorta sorta.ifact3
+read -r -n 1 -p "Press any key to show try.txt: "
+echo 1>&2
+cat try.txt
+echo 1>&2
+sorta_with_arg sorta.irot13 try.txt
diff --git a/1991/brnstnd/try.txt b/1991/brnstnd/try.txt
new file mode 100644
index 000000000..2fe6575e7
--- /dev/null
+++ b/1991/brnstnd/try.txt
@@ -0,0 +1 @@
+The quick brown fox jumps over the lazy dog.
diff --git a/thanks-for-help.md b/thanks-for-help.md
index ef469ed47..a17dcb6a3 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -1177,6 +1177,9 @@ invalid operands to binary expressions were resolved with the comma operator.
Later on, Cody added back the macro `#define D define` to make it look ever so
slightly more like the original, even though it's unused.
+Cody also added the [try.sh](/1991/brnstnd/try.sh) script and
+[try.txt](/1991/brnstnd/try.txt) which the script uses.
+
## [1991/buzzard](/1991/buzzard/buzzard.c) ([README.md](/1991/buzzard/README.md]))
From e2e00d66f587c5ab4c6a2098aa683b8bcec46742 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 13 Jan 2024 07:31:16 -0800
Subject: [PATCH 03/11] Minor update in thanks file for 1991/buzzard
---
thanks-for-help.md | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/thanks-for-help.md b/thanks-for-help.md
index a17dcb6a3..d7c522465 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -1185,7 +1185,7 @@ Cody also added the [try.sh](/1991/brnstnd/try.sh) script and
[Cody](#cody) fixed this so that the coordinates being specified would not crash the
program. This happened because the function that calls `atoi(3)` took an arg
-without any type specified and as an implicit int it was not a `char *` which
+without any type specified and as an implicit `int` it was not a `char *` which
crashed the program in modern systems.
Cody also made the file name in the code (which is the default maze file) not
@@ -1195,7 +1195,8 @@ Finally Cody added the [alternate
version](/1991/buzzard/README.md#alternate-code) which will possibly feel more at
home with those familiar with vi(m) (it certainly does feel more at home with
him): `k` for forward, `h` for left and `l` for right. This version also has a
-more useful way to exit, just entering `q` followed by enter.
+more useful way to exit, just entering `q` followed by enter, rather than
+completing or killing the program.
## [1991/davidguy](/1991/davidguy/davidguy.c) ([README.md](/1991/davidguy/README.md]))
From c3e6471e80c81543935bb341a0d1268950d67377 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 13 Jan 2024 07:39:57 -0800
Subject: [PATCH 04/11] Improve 1991/fine/try.sh
I'll now suggest that now it's 'quite fine' :-)
---
1991/fine/try.sh | 82 ++++++++++++++++++------------------------------
1 file changed, 30 insertions(+), 52 deletions(-)
diff --git a/1991/fine/try.sh b/1991/fine/try.sh
index 24edb2a8f..29e914597 100755
--- a/1991/fine/try.sh
+++ b/1991/fine/try.sh
@@ -14,57 +14,35 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen to remove any compiler message to make the entry stand out more
clear
-echo -n "Green terra <-> "
-echo "Green terra" | ./fine
+fine()
+{
+ if [[ "$#" != 1 ]]; then
+ echo "$0: expected 1 arg, got $#" 1>&2
+ return
+ fi
-echo -n "Vex <-> "
-echo "Vex" | ./fine
+ read -r -n 1 -p "Press any key to run: echo $1 | ./fine: "
+ echo 1>&2
+ echo -n "$1 <-> "
+ echo "$1" | ./fine
+ echo 1>&2
+}
-echo -n "Tang <-> "
-echo "Tang" | ./fine
-
-echo -n "Vend onyx <-> "
-echo "Vend onyx" | ./fine
-
-echo -n "Cheryl be flashy <-> "
-echo "Cheryl be flashy" | ./fine
-
-echo -n "Rail <-> "
-echo "Rail" | ./fine
-
-echo -n "Clerk <-> "
-echo "Clerk" | ./fine
-
-echo -n "Ones <-> "
-echo "Ones" | ./fine
-
-echo -n "Fur <-> "
-echo "Fur" | ./fine
-
-echo -n "Er <-> "
-echo "Er" | ./fine
-
-echo -n "IV <-> "
-echo "IV" | ./fine
-
-echo -n "NYC <-> "
-echo "NYC" | ./fine
-
-echo -n "Fubar <-> "
-echo "Fubar" | ./fine
-
-echo -n "DQ <-> "
-echo "DQ" | ./fine
-
-echo -n "Off <-> "
-echo "Off" | ./fine
-
-echo -n "Ire <-> "
-echo "Ire" | ./fine
-
-echo -n "PEP <-> "
-echo "PEP" | ./fine
-
-
-echo -n "The rug gary lenT <-> "
-echo "The rug gary lenT" | ./fine
+fine "Green terra"
+fine "Vex"
+fine "Tang"
+fine "Vend onyx"
+fine "Cheryl be flashy"
+fine "Rail"
+fine "Clerk"
+fine "Ones"
+fine "Fur"
+fine "Er"
+fine "IV"
+fine "NYC"
+fine "Fubar"
+fine "DQ"
+fine "Off"
+fine "Ire"
+fine "PEP"
+fine "The rug gary lenT"
From 9b1d4e7a8330f70392ffc0140455a7d9cfe72c5a Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 13 Jan 2024 09:58:19 -0800
Subject: [PATCH 05/11] Format fix thanks file - add missing `
---
thanks-for-help.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/thanks-for-help.md b/thanks-for-help.md
index d7c522465..5578eec99 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -1604,7 +1604,7 @@ loop, reading again if `scanf(3)` did not return 2 (that was not a problem in
that `scanf(/2)` will not return until the number of specifiers have been
processed or some error occurs) or a function it called returned non-zero.
-Instead the fix involves the `scanf(3)` specifiers being `"%4s %4s" on two
+Instead the fix involves the `scanf(3)` specifiers being `"%4s %4s"` on two
new char arrays (always cleared in the beginning of the loop) and then using
`strtol(3)` with a base of `8` (as it's octal), checking for `< 0 || > 077` on
both numbers (using `"%o %o"` does not solve the problem).
@@ -1650,7 +1650,7 @@ Cody also added an arg check because the program and the
[nuked](https://en.wikipedia.org/wiki/Nuclear_weapon) the [entire
world](https://en.wikipedia.org/wiki/Earth) or just the
[USA](https://en.wikipedia.org/wiki/United_States), respectively, without enough
-args (/2). And not that we need the help or anything for this :-) but we
+args (2). And not that we need the help or anything for this :-) but we
encourage you to try the original without two args :-)
From 27ba4879a10197ebf45e8d769e4fe3785891e475 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 13 Jan 2024 10:22:32 -0800
Subject: [PATCH 06/11] Improve 1992/nathan/try.sh
---
1992/nathan/try.sh | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/1992/nathan/try.sh b/1992/nathan/try.sh
index 44a7090ee..4e9860c6f 100755
--- a/1992/nathan/try.sh
+++ b/1992/nathan/try.sh
@@ -13,14 +13,31 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
-echo "$ ./nathan obfuscate < nathan.c > foobarf.c" 1>&2
+read -r -n 1 -p "Press any key to run: ./nathan obfuscate < nathan.c > foobarf.c: "
+echo 1>&2
./nathan obfuscate < nathan.c > foobarf.c
+echo 1>&2
-echo "$ ./nathan - obfuscate < foobarf.c > barfoof.c" 1>&2
+read -r -n 1 -p "Press any key to show foobarf.c (space = next page, q = quit): "
+echo 1>&2
+less -rEXF foobarf.c
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./nathan - obfuscate < foobarf.c > barfoof.c: "
+echo 1>&2
./nathan - obfuscate < foobarf.c > barfoof.c
+echo 1>&2
-echo "$ diff nathan.c barfoof.c" 1>&2
+read -r -n 1 -p "Press any key to show barfoof.c (space = next page, q = quit): "
+echo 1>&2
+less -rEXF barfoof.c
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: diff -s nathan.c barfoof.c: "
+echo 1>&2
diff -s nathan.c barfoof.c
+echo 1>&2
-echo "$ echo 'IOCCC 1992 winner nathan' | ./nathan" 1>&2
+read -r -n 1 -p "Press any key to run: echo 'IOCCC 1992 winner nathan' | ./nathan: "
+echo 1>&2
echo 'IOCCC 1992 winner nathan' | ./nathan
From 70311308435762b0cf1eea709b31fe8fab6b1018 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 13 Jan 2024 10:29:59 -0800
Subject: [PATCH 07/11] Rename 1992/runme.sh lush.sh and improve it
The script now lets one specify which compiler to use so that one can
(in the case that their cc is clang, for instance like it is with macOS)
specify a path to a real gcc compiler.
---
1992/lush/README.md | 2 +-
1992/lush/lush.sh | 14 ++++++++++++++
1992/lush/runme.sh | 4 ----
bugs.md | 4 +++-
thanks-for-help.md | 8 ++++----
5 files changed, 22 insertions(+), 10 deletions(-)
create mode 100755 1992/lush/lush.sh
delete mode 100755 1992/lush/runme.sh
diff --git a/1992/lush/README.md b/1992/lush/README.md
index ba0a40227..a531701a9 100644
--- a/1992/lush/README.md
+++ b/1992/lush/README.md
@@ -19,7 +19,7 @@ For more detailed information see [1992 lush in bugs.md](/bugs.md#1992-lush).
## To use:
```sh
-./runme.sh
+./lush.sh
```
diff --git a/1992/lush/lush.sh b/1992/lush/lush.sh
new file mode 100755
index 000000000..a92929370
--- /dev/null
+++ b/1992/lush/lush.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#
+# lush.sh - run IOCCC winner 1992/lush
+#
+
+# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
+# this way allows us to have the user specify a different compiler in an easy
+# way.
+if [[ -z "$CC" ]]; then
+ CC="cc"
+fi
+
+make clobber all
+"$CC" -include stdio.h -o lush lush.c|& ./lush
diff --git a/1992/lush/runme.sh b/1992/lush/runme.sh
deleted file mode 100755
index 800acc73e..000000000
--- a/1992/lush/runme.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-
-make clobber all
-cc -include stdio.h -o lush lush.c|& ./lush
diff --git a/bugs.md b/bugs.md
index 4d6a35b5b..9cbb31bb2 100644
--- a/bugs.md
+++ b/bugs.md
@@ -995,7 +995,8 @@ If you want to try and fix this (mis)feature, you are welcome to try.
### Information: [1992/lush/README.md](1992/lush/README.md)
We used a patch from [Yusuke Endoh](/winners.html#Yusuke_Endoh) to get this to
-work but it only works with gcc. Cody removed the warnings of `gets()`.
+work but it only works with gcc. Cody removed the warnings of `gets()` and
+provided a script to run the entry properly.
Unfortunately due to the way the entry works and the fact that other compilers
like clang have different warnings and errors this simply does not work with
@@ -1069,6 +1070,7 @@ Hello World.
Can you help us?
+
## 1992 vern
### STATUS: INABIAF - please **DO NOT** fix
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 5578eec99..ca28c30af 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -1568,13 +1568,13 @@ it moves towards the right but if you click the mouse it goes back.
[Yusuke](#yusuke) supplied a patch which makes this work with gcc. Due to how it works (see
Judges' remarks in the README.md file) this will not work with clang.
-[Cody](#cody) also provided the `runme.sh` script to demonstrate it as using make was
-problematic.
+[Cody](#cody) also provided the [lush.sh](/1992/lush/lush.sh) script to
+demonstrate it as using make was problematic.
Cody made it use `fgets()` instead of `gets()`.
-NOTE: this entry cannot work with clang due to different compiler messages. See
-[bugs.md](/bugs.md) for details.
+NOTE: this entry cannot work with clang due to different compiler messages (it
+will compile fine but it won't work). See [bugs.md](/bugs.md) for details.
## [1992/marangon](/1992/marangon/marangon.c) ([README.md](/1992/marangon/README.md))
From f9d5a7b9074a0006fe212836e42bdfc3af47a788 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 13 Jan 2024 10:35:43 -0800
Subject: [PATCH 08/11] Minor formatting fix in 1992/kivinen/README.md
---
1992/kivinen/README.md | 4 ++--
thanks-for-help.md | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/1992/kivinen/README.md b/1992/kivinen/README.md
index 12d614cb2..38d9c2a4d 100644
--- a/1992/kivinen/README.md
+++ b/1992/kivinen/README.md
@@ -78,8 +78,8 @@ NOTE: Some systems do not need (or have) `-lsocket -lresolv -lnsl`.
Such systems should compile using `-lX11`.
NOTE: The original winning source [kivinen.orig.c](kivinen.orig.c) assumed that
-exit returned a value which cause problems for some systems where exit returns
-void. The file [kivinen.c](kivinen.c) avoids this problem.
+`exit(3)` returned a value which cause problems for some systems where `exit(3)` returns
+`void`. The file [kivinen.c](kivinen.c) avoids this problem.
## Author's remarks:
diff --git a/thanks-for-help.md b/thanks-for-help.md
index ca28c30af..6894d0c46 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -1542,7 +1542,8 @@ operator so that it could be used in binary expressions.
It was observed that on modern systems this goes much too quick. [Yusuke](#yusuke) created
a patch that calls `usleep(3)` but [Cody](#cody) thought the value was too slow so he
-made it a macro in the Makefile `Z`, defaulting at 15000. This was made an [alt
+made it a macro in the Makefile `Z` (which can be redefined with `make
+SLEEP=...`), defaulting at 15000. This was made an [alt
version](/1992/kivinen/kivinen.alt.c) and it is recommended one use the alt
version first. See the README.md file to see how to reconfigure it.
From 3f4d556101ed397a38623ad8fdd99d1e0b0521ed Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 13 Jan 2024 10:36:46 -0800
Subject: [PATCH 09/11] Minor formatting update in 1992/marangon
---
1992/marangon/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/1992/marangon/README.md b/1992/marangon/README.md
index 81cf0db7e..347546321 100644
--- a/1992/marangon/README.md
+++ b/1992/marangon/README.md
@@ -24,7 +24,7 @@ NOTE: Some systems need to compile with `-ltermcap` as well as `-lcurses`.
NOTE: The original winning source [marangon.orig.c](marangon.orig.c), found in
the archive directory, assumed that `exit(3)` returns a value which cause
-problems for some systems where `exit(3)` returns a void. The file
+problems for some systems where `exit(3)` returns a `void`. The file
[marangon.c](marangon.c) avoids this problem.
From b639167e036150420e25ea805e5216fbcd9893cf Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 13 Jan 2024 10:48:32 -0800
Subject: [PATCH 10/11] Added 1992/imc/try.sh
---
1992/imc/README.md | 9 +++++++++
1992/imc/try.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
thanks-for-help.md | 4 +++-
3 files changed, 58 insertions(+), 1 deletion(-)
create mode 100755 1992/imc/try.sh
diff --git a/1992/imc/README.md b/1992/imc/README.md
index 03620bb4a..6360bbaaa 100644
--- a/1992/imc/README.md
+++ b/1992/imc/README.md
@@ -15,6 +15,15 @@ make all
```
+## Try:
+
+To see a number of options and configurations:
+
+```sh
+./try.sh
+```
+
+
## Judges' remarks:
The program is more interesting to run on workstations that can make use of a
diff --git a/1992/imc/try.sh b/1992/imc/try.sh
new file mode 100755
index 000000000..b661f0b23
--- /dev/null
+++ b/1992/imc/try.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+#
+# try.sh - demonstrate IOCCC winner 1992/imc
+#
+
+# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
+# this way allows us to have the user specify a different compiler in an easy
+# way.
+if [[ -z "$CC" ]]; then
+ CC="cc"
+fi
+
+make CC="$CC" all >/dev/null || exit 1
+
+# clear screen after compilation so that only the entry is shown
+clear
+
+read -r -n 1 -p "Press any key to run: ./imc -text: "
+echo 1>&2
+./imc -text
+echo 1>&2
+
+echo "$ ./imc -text -size 40 40 -limit 256 -julia 0.5 -0.5"
+read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
+echo 1>&2
+./imc -text -size 40 40 -limit 256 -julia 0.5 -0.5 | less -rEXF
+
+echo "$ ./imc -text -size 40 40 -limit 1024 -julia 2 -2.5"
+read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
+echo 1>&2
+./imc -text -size 40 40 -limit 1024 -julia 2 -2.5 | less -rEXF
+
+echo "$ ./imc -text -size 40 40 -limit 1024 -centre 1 2 -julia 2 -2.5"
+read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
+echo 1>&2
+./imc -text -size 40 40 -limit 1024 -centre 1 2 -julia 2 -2.5 | less -rEXF
+
+echo "$ ./imc -text -size 40 40 -limit 256"
+read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
+echo 1>&2
+./imc -text -size 40 40 -limit 256 | less -rEXF
+
+echo "$ ./imc -text -size 40 40 -limit 1024"
+read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
+echo 1>&2
+./imc -text -size 40 40 -limit 1024 | less -rEXF
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 6894d0c46..85a5f5f36 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -1531,9 +1531,11 @@ details if you're interested in trying to understand it (or fix?).
## [1992/imc](/1992/imc/imc.c) ([README.md](/1992/imc/README.md]))
+[Cody](#cody) provided the [try.sh](/1992/imc/try.sh) script.
+
The original code, [imc.orig.c](/1992/imc/imc.orig.c), assumed that `exit(3)`
returned a value but this will cause problems where `exit(3)` returns void. The
-source code was modified to avoid this problem but like [Cody](#cody) did with other fixes
+source code was modified to avoid this problem but like Cody did with other fixes
he made this more like the original by redefining `exit` to use the comma
operator so that it could be used in binary expressions.
From 543b25081527954d0c82cb2e8b58f075515d0ab8 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 13 Jan 2024 10:54:25 -0800
Subject: [PATCH 11/11] Slightly improve 1992/buzzard.1/try.sh
---
1992/buzzard.1/try.sh | 30 ++++++++++++++++++++++--------
thanks-for-help.md | 2 +-
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/1992/buzzard.1/try.sh b/1992/buzzard.1/try.sh
index 794c47fd5..67c7d8e14 100755
--- a/1992/buzzard.1/try.sh
+++ b/1992/buzzard.1/try.sh
@@ -14,16 +14,30 @@ make CC="$CC" all >/dev/null || exit 1
#
clear
-echo "$ ./buzzard.1 0 10" 1>&2
+read -r -n 1 -p "Press any key to run: ./buzzard.1 0 10: "
+echo 1>&2
./buzzard.1 0 10
-echo "$ ./buzzard.1 56 720" 1>&2
-./buzzard.1 56 720
-echo "$ ./buzzard.1 1 521" 1>&2
-./buzzard.1 1 521
+echo 1>&2
-echo "$ ./buzzard.1 '1+1' 111" 1>&2
+read -r -n 1 -p "Press any key to run: ./buzzard.1 56 720: "
+echo 1>&2
+./buzzard.1 56 720
+
+read -r -n 1 -p "Press any key to run: ./buzzard.1 1 521: "
+echo 1>&2
+./buzzard.1 1 521
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./buzzard.1 '1+1' 111: "
+echo 1>&2
./buzzard.1 '1+1' 111
-echo "$ ./buzzard.1 '1+1' 11" 1>&2
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./buzzard.1 '1+1' 11: "
+echo 1>&2
./buzzard.1 '1+1' 11
-echo "$ ./buzzard.1 '1+1' 1" 1>&2
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./buzzard.1 '1+1' 1: "
+echo 1>&2
./buzzard.1 '1+1' 1
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 85a5f5f36..3bb0db57f 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -1500,7 +1500,7 @@ necessary to include `time.h` so Cody did this as well.
## [1992/buzzard.1](/1992/buzzard.1/buzzard.1.c) ([README.md](/1992/buzzard.1/README.md))
-[Cody](#cody) added a check for the right number of args, exiting 1 if not enough (/2)
+[Cody](#cody) added a check for the right number of args, exiting 1 if not enough (2)
used. This was not originally done but at a time it was changed to be considered
a bug so it was fixed at that point as it only took a few seconds and had to be
verified that it was consistent with the [bugs.md](/bugs.md) file.