From 2558cbb5a83ac5fbdefadbb7483e6e86d5d7a089 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Thu, 18 Jan 2024 11:01:41 -0800
Subject: [PATCH 1/7] Add 1995/schnitzi/try.sh
---
1995/schnitzi/README.md | 4 +---
1995/schnitzi/try.sh | 36 ++++++++++++++++++++++++++++++++++++
thanks-for-help.md | 5 +++++
3 files changed, 42 insertions(+), 3 deletions(-)
create mode 100755 1995/schnitzi/try.sh
diff --git a/1995/schnitzi/README.md b/1995/schnitzi/README.md
index b5a69c4b2..4d5d500eb 100644
--- a/1995/schnitzi/README.md
+++ b/1995/schnitzi/README.md
@@ -15,9 +15,7 @@ make all
## Try:
```sh
-./schnitzi 24
-./schnitzi 18
-./schnitzi 30
+./try.sh
```
WARNING: the author warns to not use too high a number! If you wish to ignore
diff --git a/1995/schnitzi/try.sh b/1995/schnitzi/try.sh
new file mode 100755
index 000000000..8013bcb64
--- /dev/null
+++ b/1995/schnitzi/try.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+#
+# try.sh - demonstrate IOCCC winner 1995/schnitzi
+#
+
+# 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: ./schnitzi 24 (space = next page, q = quit): "
+echo 1>&2
+./schnitzi 24 | less -rEXF
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./schnitzi 18 (space = next page, q = quit): "
+echo 1>&2
+./schnitzi 18 | less -rEXF
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./schnitzi 30 (space = next page, q = quit): "
+echo 1>&2
+./schnitzi 30 | less -rEXF
+echo 1>&2
+
+
+
+
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 4978c4e7a..6fd8e5654 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -2074,6 +2074,11 @@ calls which has the four args.
[Cody](#cody) added the [try.sh](/1995/savastio/try.sh) script.
+## [1995/schnitzi](/1995/schnitzi/schnitzi.c) ([README.md](/1995/schnitzi/README.md]))
+
+[Cody](#cody) added the [try.sh](/1995/schnitzi/try.sh) script.
+
+
## [1995/vanschnitz](/1995/vanschnitz/vanschnitz.c) ([README.md](/1995/vanschnitz/README.md))
[Cody](#cody) added the authors' [spoiler as a C
From 8cfd3f67e519f3e42f1de590ab89098c609f6b1e Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Thu, 18 Jan 2024 11:09:51 -0800
Subject: [PATCH 2/7] Add 1995/vanschnitz/try.sh
---
1995/vanschnitz/README.md | 3 +--
1995/vanschnitz/try.sh | 30 ++++++++++++++++++++++++++++++
thanks-for-help.md | 2 ++
3 files changed, 33 insertions(+), 2 deletions(-)
create mode 100755 1995/vanschnitz/try.sh
diff --git a/1995/vanschnitz/README.md b/1995/vanschnitz/README.md
index fbf4a7107..a2df9bd5a 100644
--- a/1995/vanschnitz/README.md
+++ b/1995/vanschnitz/README.md
@@ -29,8 +29,7 @@ For more detailed information see [1995 vanschnitz in bugs.md](/bugs.md#1995-van
## Try:
```sh
-make clobber all LEVEL=6
-./vanschnitz
+./try.sh
```
diff --git a/1995/vanschnitz/try.sh b/1995/vanschnitz/try.sh
new file mode 100755
index 000000000..e3939a461
--- /dev/null
+++ b/1995/vanschnitz/try.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+#
+# try.sh - demonstrate IOCCC winner 1995/vanschnitz
+#
+
+# 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: ./vanschnitz (space = next page, q = quit): "
+echo 1>&2
+./vanschnitz | less -rEXF
+echo 1>&2
+
+for i in $(seq 1 6); do
+ read -r -n 1 -p "Press any key to set level at $i (make clobber all LEVEL=$i): "
+ echo 1>&2
+ make clobber all LEVEL="$i"
+ read -r -n 1 -p "Press any key to run: ./vanschnitz (space = next page, q = quit): "
+ echo 1>&2
+ ./vanschnitz | less -rEXF
+done
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 6fd8e5654..6e00d929e 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -2087,6 +2087,8 @@ cases all the code should be available for the wider audience, without having to
extract it. The exception is when the files are created by the entry or the
entry decrypts the text or something like that.
+Cody also added the [try.sh](/1995/vanschnitz/try.sh) script.
+
# 1996
From 5402b8f1da472d1885bac6e218d8cc07fad14426 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Thu, 18 Jan 2024 11:22:22 -0800
Subject: [PATCH 3/7] Improve 1996/august/try.sh
---
1996/august/README.md | 2 +-
1996/august/try.sh | 53 +++++++++++++++++++++++++++++++++++++++----
thanks-for-help.md | 4 ++--
3 files changed, 52 insertions(+), 7 deletions(-)
diff --git a/1996/august/README.md b/1996/august/README.md
index 47f445022..a6e942036 100644
--- a/1996/august/README.md
+++ b/1996/august/README.md
@@ -41,7 +41,7 @@ The above should print a `!` followed by a newline.
## Judges' remarks:
This entry can feed on itself. If you C pre-process the source,
-you compile the interpreter:
+you can compile the interpreter:
```sh
make august.oc
diff --git a/1996/august/try.sh b/1996/august/try.sh
index ca8898933..88da98b73 100755
--- a/1996/august/try.sh
+++ b/1996/august/try.sh
@@ -15,26 +15,71 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
-set -x
+read -r -n 1 -p "Press any key to run: cat august.c test.oc | ./august > test.oo: "
+echo 1>&2
cat august.c test.oc | ./august > test.oo
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./august < test.oo: "
+echo 1>&2
./august < test.oo
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: cat august.c fac.oc | ./august > fac.oo: "
+echo 1>&2
cat august.c fac.oc | ./august > fac.oo
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./august < fac.oo: "
+echo 1>&2
./august < fac.oo
+echo 1>&2
+read -r -n 1 -p "Press any key to run: cat august.c fac.oc | ./august | ./august: "
+echo 1>&2
cat august.c fac.oc | ./august | ./august
+echo 1>&2
+read -r -n 1 -p "Press any key to run: cat august.c parse.oc | ./august > parse.oo: "
+echo 1>&2
cat august.c parse.oc | ./august > parse.oo
-cat parse.oo fac.oc | ./august | ./august
+echo 1>&2
-rm august.oc
-make august.oc
+read -r -n 1 -p "Press any key to run: cat parse.oo fac.oc | ./august | ./august: "
+echo 1>&2
+cat parse.oo fac.oc | ./august | ./august
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: rm august.oc; make august.oc: "
+echo 1>&2
+rm august.oc; make august.oc
+echo 1>&2
# this next step is vital for some compilers! Not having it will make the
# compiler create code that enters an infinite loop. This is known to happen in
# macOS as one example.
+read -r -n 1 -p "Press any key to run: sed -i'' '/^#/d' august.oc: "
+echo 1>&2
sed -i'' '/^#/d' august.oc
+echo 1>&2
+read -r -n 1 -p "Press any key to run: cat august.c august.oc | ./august > august.oo: "
+echo 1>&2
cat august.c august.oc | ./august > august.oo
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: cat august.oo test.oo | ./august: "
+echo 1>&2
cat august.oo test.oo | ./august
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: cat august.oo august.oo fac.oo | ./august: "
+echo 1>&2
cat august.oo august.oo fac.oo | ./august
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: cat august.oo august.oo august.oo fac.oo | ./august: "
+echo 1>&2
+echo "This step may take more time: " 1>&2
cat august.oo august.oo august.oo fac.oo | ./august
+echo 1>&2
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 6e00d929e..93295c5f4 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -2099,8 +2099,8 @@ Cody also added the [try.sh](/1995/vanschnitz/try.sh) script.
also fixed an infinite loop in the try commands. The problem with the infinite
loop is that the file `august.oc` had to have lines starting with `#` removed
and it was not being done. After this is done with say `sed(/1)` (like `sed -i''
-'/^#/d' august.oc` which has been added to both the remarks and the try.sh
-script as described below) the code can proceed. This problem existed in macOS.
+'/^#/d' august.oc` which has been added to both the remarks and the `try.sh`
+script noted below) the code can proceed. This problem existed in macOS.
Cody also added the [try.sh](/1996/august/try.sh) script that runs all the
commands given in the try section to simplify it as there are quite a lot of
From 01d50b7ff47959a1e3cda9053fc528068f1afd35 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Thu, 18 Jan 2024 11:28:07 -0800
Subject: [PATCH 4/7] Add 1996/dalbec/try.sh
---
1996/dalbec/README.md | 2 +-
1996/dalbec/try.sh | 26 ++++++++++++++++++++++++++
thanks-for-help.md | 2 ++
3 files changed, 29 insertions(+), 1 deletion(-)
create mode 100755 1996/dalbec/try.sh
diff --git a/1996/dalbec/README.md b/1996/dalbec/README.md
index d98715e93..189019e30 100644
--- a/1996/dalbec/README.md
+++ b/1996/dalbec/README.md
@@ -15,7 +15,7 @@ make all
## Try:
```sh
-./dalbec 3 | head -n 29
+./try.sh
```
Why does the output end with 121?
diff --git a/1996/dalbec/try.sh b/1996/dalbec/try.sh
new file mode 100755
index 000000000..9794cd337
--- /dev/null
+++ b/1996/dalbec/try.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+#
+# try.sh - show IOCCC winner 1996/dalbec
+#
+
+# 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: ./dalbec 5 | head -n 29 (space = next page, q = quit): "
+echo 1>&2
+./dalbec 5 | head -n 29 | less -rEXF
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./dalbec 3 | head -n 29 (space = next page, q = quit): "
+echo 1>&2
+./dalbec 3 | head -n 29 | less -rEXF
+echo 1>&2
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 93295c5f4..0e3c4dea3 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -2123,6 +2123,8 @@ number is printed on a line by itself rather than having a long string of
numbers on the same line. This was not put in an alternate version but perhaps
it should be.
+Cody also added the [try.sh](/1996/dalbec/try.sh) script.
+
## [1996/eldby](/1996/eldby/eldby.c) ([README.md](/1996/eldby/README.md]))
From b60486cb84717d9b8885ae2ad473c1a4c10d9fe0 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Thu, 18 Jan 2024 11:46:10 -0800
Subject: [PATCH 5/7] Improve 1996/gandalf/try.sh
---
1996/gandalf/try.sh | 65 +++++++++++++++++----------------------------
1 file changed, 25 insertions(+), 40 deletions(-)
diff --git a/1996/gandalf/try.sh b/1996/gandalf/try.sh
index b7dd5acbb..b205fca90 100755
--- a/1996/gandalf/try.sh
+++ b/1996/gandalf/try.sh
@@ -23,98 +23,83 @@ rm -f hatcat.txt cathat.txt hatcat2.txt cathat2.txt hatcat3.txt cathat3.txt
trap 'rm -f hatcat.txt cathat.txt hatcat2.txt cathat2.txt hatcat3.txt cathat3.txt; exit' 0 1 2 3 15
-delete_tmp_files()
-{
- rm -f hatcat.txt cathat.txt hatcat2.txt cathat2.txt hatcat3.txt cathat3.txt
- return 0
-}
-press_any_key()
-{
- echo 1>&2
- read -r -n 1 -p "Press any key to continue (q = quit): " 1>&2
- test "$REPLY" = "q" && delete_tmp_files && echo 1>&2 && exit
-}
-
show_diff()
{
if [[ "$#" -ne 2 ]]; then
echo "$0: show_diff expects two args, got: $#" 1>&2
exit 1
fi
- echo "$ diff $1 $2" 1>&2
+ read -r -n 1 -p "Press any key to run: diff $1 $2: "
+ echo 1>&2
diff "$1" "$2" && echo "$1 and $2 are identical"
+ echo 1>&2
}
-echo "Notice how the programs are the same:" 1>&2
+read -r -n 1 -p "Press any key to run: diff -s hatcat cathat: "
+echo 1>&2
diff -s hatcat cathat
-press_any_key
+echo 1>&2
-echo "Now notice how running both cathat and hatcat in different ways" 1>&2
+echo "Next notice how running both cathat and hatcat in different ways" 1>&2
echo "shows different output." 1>&2
-press_any_key
-echo "Running hatcat without a path:" 1>&2
-echo "$ PATH=.:\$PATH" 1>&2
+read -r -n 1 -p "Press any key to run: PATH=.:\$PATH: "
+echo 1>&2
PATH=.:$PATH
-echo "$ hatcat | tee hatcat.txt" 1>&2
+read -r -n 1 -p "Press any key to run: hatcat | tee hatcat.txt (no path): "
+echo 1>&2
hatcat | tee hatcat.txt
-press_any_key
+echo 1>&2
-echo "Running cathat without a path:" 1>&2
-echo "$ cathat | tee cathat.txt" 1>&2
+read -r -n 1 -p "Press any key to run: cathat | tee cathat.txt (no path): "
+echo 1>&2
cathat | tee cathat.txt
-press_any_key
+echo 1>&2
echo "Showing diff between the above two commands, 'hatcat' and './cathat':" 1>&2
show_diff hatcat.txt cathat.txt
-press_any_key
-echo "Now watch ./hatcat:" 1>&2
+read -r -n 1 -p "Press any key to run: ./hatcat | tee hatcat2.txt: "
+echo 1>&2
./hatcat | tee hatcat2.txt
-press_any_key
-echo "Now watch ./cathat:" 1>&2
+read -r -n 1 -p "Press any key to run: ./cathat | tee cathat2.txt: "
+echo 1>&2
./cathat | tee cathat2.txt
-press_any_key
echo "Showing diff between running 'hatcat' and './hatcat':" 1>&2
show_diff hatcat.txt hatcat2.txt
-press_any_key
-echo "Now watch \$(pwd)/cathat" 1>&2
+read -r -n 1 -p "Press any key to run: \$(pwd)/cathat | tee cathat3.txt: "
+echo 1>&2
"$(pwd)"/cathat | tee cathat3.txt
-press_any_key
-echo "Finally, watch \$(pwd)/hatcat" 1>&2
+read -r -n 1 -p "Press any key to run: \$(pwd)/hatcat | tee hatcat3.txt: "
+echo 1>&2
"$(pwd)"/hatcat | tee hatcat3.txt
-press_any_key
echo "Showing diff between running './hatcat' and './cathat':" 1>&2
show_diff hatcat2.txt cathat2.txt
-press_any_key
echo "Showing diff between running '\$(pwd)/hatcat' and '\$(pwd)/cathat':" 1>&2
show_diff hatcat3.txt cathat3.txt
-press_any_key
echo "Showing diff between running '\$(pwd)/hatcat' and 'hatcat':" 1>&2
show_diff hatcat3.txt hatcat.txt
-press_any_key
echo "Showing diff between running '\$(pwd)/hatcat' and './hatcat':" 1>&2
show_diff hatcat3.txt hatcat2.txt
-press_any_key
echo "Showing diff between running '\$(pwd)/cathat' and 'cathat':" 1>&2
show_diff cathat3.txt cathat.txt
-press_any_key
echo "Showing diff between running '\$(pwd)/cathat' and './cathat':" 1>&2
show_diff cathat3.txt cathat2.txt
-press_any_key
# remove temporary files
rm -f hatcat.txt cathat.txt hatcat2.txt cathat2.txt hatcat3.txt cathat3.txt
echo 1>&2
echo "Now answer: why did some of the same programs execute differently?" 1>&2
+
+rm -f hatcat.txt cathat.txt hatcat2.txt cathat2.txt hatcat3.txt cathat3.txt
From 4e16e80e4d1bd15c0d32dbf6afd7dafe6c683ab6 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Thu, 18 Jan 2024 11:52:06 -0800
Subject: [PATCH 6/7] Improve 1996/huffman/try.sh
---
1996/huffman/try.sh | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/1996/huffman/try.sh b/1996/huffman/try.sh
index 5afc3155a..d98a05f42 100755
--- a/1996/huffman/try.sh
+++ b/1996/huffman/try.sh
@@ -45,11 +45,16 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
-echo "$ echo 'seeing or feeling is believing' | ./huffman" 1>&2
+read -r -n 1 -p "Press any key to run: echo 'seeing or feeling is believing' | ./huffman: "
+echo 1>&2
echo 'seeing or feeling is believing' | ./huffman 2>/dev/null
+echo 1>&2
-echo "$ echo 'CC OR NOT CC' | ./huffman" 1>&2
+read -r -n 1 -p "Press any key to run: echo 'CC OR NOT CC' | ./huffman: "
+echo 1>&2
echo 'CC OR NOT CC' | ./huffman 2>/dev/null
+echo 1>&2
-echo "$ $ echo 'CC OR NOT CC' | ./huffman | ./huffman" 1>&2
+read -r -n 1 -p "Press any key to run: echo 'CC OR NOT CC' | ./huffman | ./huffman: "
+echo 1>&2
echo 'CC OR NOT CC' | ./huffman 2>/dev/null | ./huffman 2>/dev/null
From 62993c6303760abe8eceb245512e1c5f75ff8c44 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Thu, 18 Jan 2024 12:01:50 -0800
Subject: [PATCH 7/7] Update 1995/garry.gitignore - add garry.fmt
---
1995/garry/.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/1995/garry/.gitignore b/1995/garry/.gitignore
index d88fdba9e..8f76f29de 100644
--- a/1995/garry/.gitignore
+++ b/1995/garry/.gitignore
@@ -3,6 +3,7 @@
*.dSYM
garry
garry.alt
+garry.fmt
garry.orig
indent
indent.c