From e7092d77f01944f559a4bab8baad1b2063ef694b Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Fri, 26 Jan 2024 09:09:36 -0800
Subject: [PATCH 01/12] Improve 2012/hamano/try.sh + add helper make rules
The Makefile rules added:
hint.pdf
hint
hello.pdf
hello
The hint rules generate the hint.pdf (which is the README.md file
obfuscated in a pdf) by feeding the program README.md and then it
compiles hint.pdf as C code. Running it will print the README.md file!
The hello rules generate hello.pdf which is (inside the pdf) an
obfuscated 'Hello World!' program. This is done by a simple echo piped o
the program which redirects it to hello.pdf. Then hello.pdf will be
compiled as C code which when run (as ./hello2) will print 'Hello
World!'.
The script now uses these rules to do what was once done manually. These
rules are .PHONY rules as otherwise they might not always run.
The clobber rule now removes these files.
---
2012/hamano/Makefile | 43 ++++++++++++++++++++++++++++++---
2012/hamano/README.md | 23 ++++++++++++++----
2012/hamano/try.sh | 56 +++++++++++++++++++++++++------------------
thanks-for-help.md | 4 +++-
4 files changed, 94 insertions(+), 32 deletions(-)
diff --git a/2012/hamano/Makefile b/2012/hamano/Makefile
index 56919d9d1..bcfb44f53 100644
--- a/2012/hamano/Makefile
+++ b/2012/hamano/Makefile
@@ -40,7 +40,7 @@ include ../../var.mk
#
CSILENCE= -Wno-bitwise-op-parentheses -Wno-empty-body -Wno-format \
-Wno-format-security -Wno-gnu-zero-variadic-macro-arguments -Wno-main \
- -Wno-parentheses
+ -Wno-parentheses -Wno-implicit-function-declaration -Wno-strict-prototypes
# Common C compiler warning flags
#
@@ -129,11 +129,48 @@ all: data ${TARGET}
.PHONY: all alt data everything diff_orig_prog diff_prog_orig \
diff_alt_prog diff_prog_alt diff_orig_alt diff_alt_orig \
clean clobber install love haste waste maker easter_egg \
- sandwich supernova deep_magic magic charon pluto
+ sandwich supernova deep_magic magic charon pluto hint hint.pdf \
+ hello hello.pdf
+
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
+# hint.pdf rules to simplify use of 2012/hamano
+#
+
+# This rule generates the hint.pdf file which is the README.md obfuscated as a
+# PDF that is NOT part of the repo:
+hint.pdf: ${PROG} README.md
+ ./${PROG} < README.md > hint.pdf
+ @echo
+
+# This rule, hint, depends on the hint.pdf rule. That rule generates the
+# hint.pdf file (NOT part of the repo) which is an obfuscated (as a PDF) version
+# of the README.md. This rule, in turn, COMPILES THAT PDF FILE AS C CODE!
+hint: hint.pdf
+ ${CC} ${CFLAGS} -xc $< -o $@
+
+
+# hello.pdf rules to simplify use of 2012/hamano
+#
+
+# This rule generates the hello.pdf file which is a simple 'Hello World!'
+# program obfuscated as a PDF:
+hello.pdf:
+ echo 'int main(){puts("Hello World!");}' | ./${PROG} > hello.pdf
+
+# This rule, hello, depends on the hello.pdf rule. That rule generates the
+# hello.pdf file (NOT part of the repo) which is an obfuscated (as a PDF) version
+# of a simple 'Hello World!' program. This rule, in turn, COMPILES THAT PDF FILE
+# AS C CODE to hello and then pipes it to cc to compile it to hello2 which when
+# run will print 'Hello World!'.
+hello: hello.pdf
+ @echo
+ ${CC} ${CFLAGS} -xc hello.pdf -o $@
+ @echo
+ ./hello | ${CC} ${CFLAGS} -xc - -o hello2
+
# alternative executable
#
alt: data ${ALT_TARGET}
@@ -204,7 +241,7 @@ clean:
fi
clobber: clean
- ${RM} -f ${TARGET} ${ALT_TARGET}
+ ${RM} -f ${TARGET} ${ALT_TARGET} hint.pdf hello.pdf hello hello2
${RM} -rf *.dSYM
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
diff --git a/2012/hamano/README.md b/2012/hamano/README.md
index 3d8c90728..17d0ebf6f 100644
--- a/2012/hamano/README.md
+++ b/2012/hamano/README.md
@@ -28,16 +28,29 @@ One of the PDF files generated is this README.md file as a PDF, obfuscated, and
the PDF file will then be compiled as C (itself!) and executed so that it shows
README.md!
-Another PDF file generated is obfuscated C code. Once this is done it will
-compile the PDF as if it was C and then run it like:
+That procedure looks like:
+
+```sh
+./hamano < README.md > hint.pdf
+cc -xc hint.pdf -o hint
+./hint
+```
+
+Another PDF generated is an obfuscated `Hello World!` program (obfuscated inside
+the PDF). Once this is done it will compile the PDF as if it was C (itself!). It
+will look like:
```sh
echo 'int main(){puts("Hello World!");}' | ./hamano > hello.pdf
-cc -Wno-implicit-function-declaration -xc hello.pdf -o hello2
-./hello2 | gcc -Wno-implicit-function-declaration -xc - -o ./hello3
-./hello3
+cc -xc hello.pdf -o hello
+./hello | cc -Wno-implicit-function-declaration -xc - -o ./hello2
+
+./hello2
```
+although the `CFLAGS` will be what is in the Makefile as it uses the helper
+rules `hint.pdf`, `hint`, `hello.pdf` and `hello` to do this.
+
## Judges' remarks:
diff --git a/2012/hamano/try.sh b/2012/hamano/try.sh
index 2f949d0e4..a7b00c88a 100755
--- a/2012/hamano/try.sh
+++ b/2012/hamano/try.sh
@@ -15,37 +15,47 @@ 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 obfuscate README.md, writing to hint.pdf: "
-echo 1>&2
-echo "$ ./hamano < README.md > hint.pdf" 1>&2
-./hamano < README.md > hint.pdf
-
-echo "Now try opening it in a pdf viewer before proceeding." 1>&2
-read -r -n 1 -p "Press any key to continue: "
+# delete hint.pdf
+rm -f hint.pdf
+echo "Will obfuscate README.md like:" 1>&2
echo 1>&2
-echo "$ ${CC} -xc hint.pdf -o hint" 1>&2
-${CC} -xc hint.pdf -o hint
+echo " ./hamano < README.md > hint.pdf" 1>&2
echo 1>&2
-read -r -n 1 -p "Press any key to run: ./hint | less (space = next page, q = quit): "
-./hint | less
-
+echo "and then compile it as C like:" 1>&2
+echo 1>&2
+echo " ${CC} -xc hint.pdf -o hint" 1>&2
+echo 1>&2
+read -r -n 1 -p "Press any key to run: make hint: "
+echo 1>&2
+make hint
+echo 1>&2
+echo "Now try opening hint.pdf in a pdf viewer before proceeding." 1>&2
+echo 1>&2
+read -r -n 1 -p "Press any key to run: ./hint (space = next page, q = quit): "
+echo 1>&2
+./hint | less -rEXFK
echo 1>&2
echo "Will obfuscate the following code: " 1>&2
echo 1>&2
-echo " int main(){puts("Hello World!");}"
+echo " int main(){puts("Hello World!");}"
echo 1>&2
-echo "writing to hello.pdf" 1>&2
-echo 'int main(){puts("Hello World!");}' | ./hamano > hello.pdf
+echo "writing it to hello.pdf via:" 1>&2
echo 1>&2
-echo "Now open hello.pdf in a pdf viewer before continuing." 1>&2
+echo " echo 'int main(){puts("Hello World!");}' | ./hamano > hello.pdf"
echo 1>&2
-read -r -n 1 -p "Press any key to continue to deobfuscate and compile hello.pdf: "
+echo "and then execute the following commands:" 1>&2
echo 1>&2
-echo "$ ${CC} -Wno-implicit-function-declaration -xc hello.pdf -o hello2" 1>&2
-${CC} -Wno-implicit-function-declaration -xc hello.pdf -o hello2
-echo "$ ./hello2 | ${CC} -Wno-implicit-function-declaration -xc - -o ./hello3" 1>&2
-./hello2 | ${CC} -Wno-implicit-function-declaration -xc - -o ./hello3
-echo "$ ./hello3" 1>&2
-./hello3
+echo " ${CC} -xc hello.pdf -o hello" 1>&2
+echo " ./hello | ${CC} -xc - -o hello2" 1>&2
+echo 1>&2
+read -r -n 1 -p "Press any key to run: make hello: "
+echo 1>&2
+make hello
+echo 1>&2
+echo "Now open hello.pdf in a pdf viewer to see the obfuscated source." 1>&2
+echo 1>&2
+read -r -n 1 -p "Press any key to run: ./hello2: "
+echo 1>&2
+./hello2
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 62e84285f..53e793a70 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -3769,7 +3769,9 @@ which the recipe file now links to.
## [2012/hamano](/2012/hamano/hamano.c) ([README.md](/2012/hamano/README.md]))
-[Cody](#cody) added the [try.sh](/2012/hamano/try.sh) script.
+[Cody](#cody) added the [try.sh](/2012/hamano/try.sh) script and the helper
+Makefile rules `hint.pdf`, `hint`, `hello.pdf` and `hello` to simplify the
+procedure for both `hint.pdf` and `hello.pdf` as well as compiling them as C.
## [2012/hou](/2012/hou/hou.c) ([README.md](/2012/hou/README.md]))
From 75634c62bb5c0a538ac3bc58b8cbfd2e9f0ea192 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Fri, 26 Jan 2024 09:24:33 -0800
Subject: [PATCH 02/12] Improve 2012/hou/try.sh
---
2012/hou/try.sh | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/2012/hou/try.sh b/2012/hou/try.sh
index f19b41c35..c62ad6643 100755
--- a/2012/hou/try.sh
+++ b/2012/hou/try.sh
@@ -15,14 +15,18 @@ 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: less hou.c (space = next page, q = quit): "
+read -r -n 1 -p "Press any key to run show hou.c (space = next page, q = quit): "
echo 1>&2
-less -X hou.c
+less -rEXFK hou.c
echo 1>&2
-read -r -n 1 -p "Press any key to run: ./hou ansi.txt hou.c | less -r (space = next page, q = quit): "
+read -r -n 1 -p "Press any key to run: ./hou ansi.txt hou.c (space = next page, q = quit): "
echo 1>&2
-echo "$ ./hou ansi.txt hou.c | less -r"
+# Note: unlike the other try.sh/try.alt.sh scripts we don't use options that
+# don't reset the terminal and that quit less(1) when it reaches EOF. This is
+# because if we do the effect will vanish the moment they reach the EOF. Also if
+# we don't have less(1) reset things the colour of the rest of the script will
+# be wrong. Thus in this script the user must hit 'q' to finish this command.
./hou ansi.txt hou.c | less -r
echo 1>&2
From 69ee0b8de6e0f4ecd18f1d896ef4512263ab3502 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Fri, 26 Jan 2024 09:47:01 -0800
Subject: [PATCH 03/12] Improve scripts (and add one) of 2012/kang
The try.alt.sh uses the alt code. This helps further show how a single
letter can change so much and thus one can really appreciate the
subtlety of the entry even more. The other scripts were improved.
---
2012/kang/README.md | 15 +++++++++----
2012/kang/de.alt.sh | 7 ++++---
2012/kang/de.sh | 7 ++++---
2012/kang/en.alt.sh | 5 +++--
2012/kang/en.sh | 5 +++--
2012/kang/try.alt.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++
2012/kang/try.sh | 32 ++++++++++++++++++++++------
thanks-for-help.md | 8 ++++---
8 files changed, 106 insertions(+), 23 deletions(-)
create mode 100755 2012/kang/try.alt.sh
diff --git a/2012/kang/README.md b/2012/kang/README.md
index a8871e42d..cf243d179 100644
--- a/2012/kang/README.md
+++ b/2012/kang/README.md
@@ -36,8 +36,9 @@ where the sound of 'V' is 'F' and so the program had the letter be 'F'. A
problem, however, with changing it is that it breaks other words including in
German. Thus there is the alternate version instead which fixes a problem for
Germans that causes problems for Germans so if you're German you'll just have to
-deal with it :-) It is, however, good as you might be able appreciate the entry
-even more.
+deal with it :-) It also breaks other words too and this happens only for one
+letter change. With this one should hopefully be able to really appreciate the
+subtlety of this entry even more.
### Alternate build:
@@ -50,7 +51,10 @@ make alt
### Alternate use:
```sh
+echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang.alt
+
echo vier | ./kang.alt
+
echo uno | ./kang.alt
```
@@ -58,14 +62,17 @@ echo uno | ./kang.alt
### Alternate try:
```sh
-./de.alt.sh # German 0 through 13 both with and without umlaut
+./try.alt.sh # try various languages
+
./en.alt.sh # English 0 through 13
+
+./de.alt.sh # German 0 through 13 with both umlauts and without (additional 'e')
```
What does it get right? What does it get wrong? How does it compare to the
original entry without the change of `f` to `v`?
-Finally why does it get what it gets wrong wrong?
+Finally why does it get wrong what it gets wrong?
## Judges' remarks:
diff --git a/2012/kang/de.alt.sh b/2012/kang/de.alt.sh
index c5449d4be..b6fa1ed95 100755
--- a/2012/kang/de.alt.sh
+++ b/2012/kang/de.alt.sh
@@ -37,7 +37,8 @@ done
j=0
for i in Null eins zwei drei vier fünf fuenf sechs sieben acht neun zehn elf zwoelf zwölf dreizehn ; \
do
- echo -n "$i (${NUMBERS[$j]}): "
- echo "$i"|"./$KANG"
- ((j++))
+ read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: "
+ echo 1>&2
+ echo "$i" | "./$KANG"
+ ((j++))
done
diff --git a/2012/kang/de.sh b/2012/kang/de.sh
index 75e59b99c..f31a3e9f8 100755
--- a/2012/kang/de.sh
+++ b/2012/kang/de.sh
@@ -37,7 +37,8 @@ done
j=0
for i in Null eins zwei drei vier fünf fuenf sechs sieben acht neun zehn elf zwoelf zwölf dreizehn ; \
do
- echo -n "$i (${NUMBERS[$j]}): "
- echo "$i"|"./$KANG"
- ((j++))
+ read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: "
+ echo 1>&2
+ echo "$i" | "./$KANG"
+ ((j++))
done
diff --git a/2012/kang/en.alt.sh b/2012/kang/en.alt.sh
index 098a0d5f3..64aee361c 100755
--- a/2012/kang/en.alt.sh
+++ b/2012/kang/en.alt.sh
@@ -32,7 +32,8 @@ done
j=0
for i in zero one two three four five six seven eight nine ten eleven twelve thirteen ; \
do
- echo -n "$i (${NUMBERS[$j]}): "
- echo "$i"|"./$KANG"
+ read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: "
+ echo 1>&2
+ echo "$i" | "./$KANG"
((j++))
done
diff --git a/2012/kang/en.sh b/2012/kang/en.sh
index 02aa3e808..dfa3c5dff 100755
--- a/2012/kang/en.sh
+++ b/2012/kang/en.sh
@@ -33,7 +33,8 @@ done
j=0
for i in zero one two three four five six seven eight nine ten eleven twelve thirteen ; \
do
- echo -n "$i (${NUMBERS[$j]}): "
- echo "$i"|"./$KANG"
+ read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: "
+ echo 1>&2
+ echo "$i" | "./$KANG"
((j++))
done
diff --git a/2012/kang/try.alt.sh b/2012/kang/try.alt.sh
new file mode 100755
index 000000000..d949038b7
--- /dev/null
+++ b/2012/kang/try.alt.sh
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+#
+# try.alt.sh - demonstrate IOCCC winner 2012/kang alt code
+
+# 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" everything >/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: echo Nineteen hundred and eighty-four | ./kang.alt # 1984: "
+echo 1>&2
+echo Nineteen hundred and eighty-four | ./kang.alt
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: echo uno | ./kang.alt # 1: "
+echo 1>&2
+echo uno | ./kang.alt
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: echo trois | ./kang.alt # 3: "
+echo 1>&2
+echo trois | ./kang.alt
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: echo fier | ./kang.alt # 4, should be vier: "
+echo 1>&2
+echo fier | ./kang.alt
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: echo vier | ./kang.alt # 4: "
+echo 1>&2
+echo vier | ./kang.alt
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: echo \"shest'\" | ./kang.alt # 6: "
+echo 1>&2
+echo "shest'" | ./kang.alt
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: echo dos | ./kang.alt # 2: "
+echo 1>&2
+echo dos | ./kang.alt
+echo 1>&2
diff --git a/2012/kang/try.sh b/2012/kang/try.sh
index ce013b131..1e613994e 100755
--- a/2012/kang/try.sh
+++ b/2012/kang/try.sh
@@ -14,20 +14,40 @@ make CC="$CC" everything >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
-echo "$ echo Nineteen hundred and eighty-four | ./kang" 1>&2
+read -r -n 1 -p "Press any key to run: echo Nineteen hundred and eighty-four | ./kang # 1984: "
+echo 1>&2
echo Nineteen hundred and eighty-four | ./kang
+echo 1>&2
-echo "$ echo uno | ./kang" 1>&2
+read -r -n 1 -p "Press any key to run: echo uno | ./kang # 1: "
+echo 1>&2
echo uno | ./kang
+echo 1>&2
-echo "$ echo trois | ./kang" 1>&2
+read -r -n 1 -p "Press any key to run: echo trois | ./kang # 3: "
+echo 1>&2
echo trois | ./kang
+echo 1>&2
-echo "$ echo fier | ./kang # notice the issue here, see alternate code instead" 1>&2
+read -r -n 1 -p "Press any key to run: echo fier | ./kang # 4, should be vier: "
+echo 1>&2
echo fier | ./kang # notice the issue here, see alternate code instead
+echo 1>&2
-echo "$ echo \"shest'\" | ./kang" 1>&2
+read -r -n 1 -p "Press any key to run: echo vier | ./kang # 4: "
+echo 1>&2
+echo vier | ./kang # notice the issue here, see alternate code instead
+echo 1>&2
+echo "Note: for a version that gets this one right (breaking others" 1>&2
+echo "including fier), see the alt code." 1>&2
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: echo \"shest'\" | ./kang # 6: "
+echo 1>&2
echo "shest'" | ./kang
+echo 1>&2
-echo "$ echo dos | ./kang" 1>&2
+read -r -n 1 -p "Press any key to run: echo dos | ./kang # 2: "
+echo 1>&2
echo dos | ./kang
+echo 1>&2
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 53e793a70..b423c0995 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -3797,7 +3797,7 @@ about it. Using both, however, allows one to experience different capabilities
and also enjoy or appreciate the entry even more, given how simple the
difference is.
-Cody also added five scripts: [en.sh](/2012/kang/en.sh),
+Cody also added six scripts: [en.sh](/2012/kang/en.sh),
[de.sh](/2012/kang/de.sh), [en.alt.sh](/2012/kang/en.alt.sh) and
[de.alt.sh](/2012/de.alt.sh) which count from 0 through 13 in English and German
using the original entry and the alt version respectively.
@@ -3807,8 +3807,10 @@ In the German scripts it uses the umlaut and also does it without the umlaut
either version but the `.alt.sh` versions default to the `alt` version whereas
the other defaults to the submitted entry. See the README.md for details.
-The fifth script, [try.sh](/2012/kang/try.sh), runs a sequence of commands to
-show different languages and numbers.
+The fifth and sixth scripts, [try.sh](/2012/kang/try.sh) and
+[try.alt.sh](/2012/kang/try.alt.sh), run a sequence of commands to
+show different languages and numbers with the submitted and alternate version
+respectively. Notice how a single letter changes so much!
## [2012/konno](/2012/konno/konno.c) ([README.md](/2012/konno/README.md]))
From bf98cc9052ef195e033d9f1072f1288733191157 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Fri, 26 Jan 2024 10:32:17 -0800
Subject: [PATCH 04/12] Improve 2012/konno/try.sh
Now randomly selects 10 numbers (in range $((RANDOM % 101))).
Also allows one to pass in numbers (or if they wish to they can pass in
non-numbers) to pass to the program.
The script has new fun numbers.
Removed that the valid range is from 0 - 255 as numbers bigger than 255
not only work but some show some fun output (a number of which are used
in the script now).
---
2012/konno/README.md | 8 +++++--
2012/konno/try.sh | 54 ++++++++++++++++++++++++++++++++------------
2 files changed, 45 insertions(+), 17 deletions(-)
diff --git a/2012/konno/README.md b/2012/konno/README.md
index c4e7916c3..8362bc69e 100644
--- a/2012/konno/README.md
+++ b/2012/konno/README.md
@@ -14,15 +14,19 @@ code](#alternate-code) below.
./konno N
```
-NOTE: N is an integer from 0 to 255.
-
## Try:
```sh
./try.sh
+
+# you can also specify numbers to try before the random and preselected ones:
+./try.sh 111 222 333 444 555 666 777 888 999
```
+Try running [try.sh](try.sh) a number of times as the first part randomly
+selects ten numbers to try.
+
## Alternate code:
diff --git a/2012/konno/try.sh b/2012/konno/try.sh
index 4ded663b1..c60835e21 100755
--- a/2012/konno/try.sh
+++ b/2012/konno/try.sh
@@ -15,47 +15,71 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
-echo "$ ./konno 30" 1>&2
+# let user specify args to run on program too
+while [[ "$#" -ge 1 ]]; do
+ read -r -n 1 -p "Press any key to run: ./konno $1: "
+ echo 1>&2
+ ./konno "$1"
+ echo 1>&2
+ shift 1
+done
+
+# use ten random values (in range $((RANDOM % 101)))
+i=0
+# we do it this way to prevent the annoying shellcheck warning that 'i' appears
+# to be unused (as it would be if 'for i in {0..9}; do .. done').
+while [[ "$i" -lt 10 ]]; do
+ NUM="$((RANDOM % 101))"
+ read -r -n 1 -p "Press any key to run: ./konno $NUM: "
+ echo 1>&2
+ ./konno "$NUM"
+ echo 1>&2
+ ((i++))
+done
+
+
+# finally use some preselected values
+read -r -n 1 -p "Press any key to run: ./konno 30: "
+echo 1>&2
./konno 30
echo 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: ./konno 90: "
echo 1>&2
-echo "$ ./konno 90" 1>&2
./konno 90
echo 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: ./konno 102: "
echo 1>&2
-echo "$ ./konno 102" 1>&2
./konno 102
echo 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: ./konno 109: "
echo 1>&2
-echo "$ ./konno 109" 1>&2
./konno 109
echo 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: ./konno 165: "
echo 1>&2
-echo "$ ./konno 165" 1>&2
./konno 165
echo 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: ./konno 42: "
echo 1>&2
-echo "$ ./konno 42" 1>&2
./konno 42
echo 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: ./konno 37: "
echo 1>&2
-echo "$ ./konno 37" 1>&2
./konno 37
echo 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: ./konno 255: "
echo 1>&2
-echo "$ ./konno 255" 1>&2
./konno 255
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./konno 10000: "
+echo 1>&2
+./konno 10000
+echo 1>&2
From 86ee07db3691f37f766c79d794c8b7d0f7faedee Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Fri, 26 Jan 2024 10:42:14 -0800
Subject: [PATCH 05/12] Improve 2012/omoikane/try scripts
---
2012/omoikane/try.alt.sh | 48 ++++++++++++++++++++++------------------
2012/omoikane/try.sh | 44 ++++++++++++++++++++----------------
thanks-for-help.md | 8 +++----
3 files changed, 55 insertions(+), 45 deletions(-)
diff --git a/2012/omoikane/try.alt.sh b/2012/omoikane/try.alt.sh
index 4aaf26b65..8111748a6 100755
--- a/2012/omoikane/try.alt.sh
+++ b/2012/omoikane/try.alt.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
-# try.sh - demonstrate IOCCC winner 2012/omoikane alternate code
+# try.alt.sh - demonstrate IOCCC winner 2012/omoikane alt code
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
@@ -10,7 +10,7 @@ if [[ -z "$CC" ]]; then
CC="cc"
fi
-make CC="$CC" everything >/dev/null || exit 1
+make CC="$CC" alt >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
@@ -23,27 +23,29 @@ PERL="$(type -P perl)"
echo "$ echo \"A quick brown fox jumps over the lazy dog\" | ./nyaruko.alt > output.c" 1>&2
echo "A quick brown fox jumps over the lazy dog" | ./nyaruko.alt > output.c
-read -r -n 1 -p "Press any key to run: less -EX output.c (space = next page, q = quit): "
+read -r -n 1 -p "Press any key to show output.c (space = next page, q = quit): "
echo 1>&2
-less -EX output.c
+less -rEXFK output.c
# perl specific stuff
-if [[ -n "$PERL" ]]; then
+if [[ -n "$PERL" && -f "$PERL" && -x "$PERL" ]]; then
read -r -n 1 -p "Press any key to run: ${PERL} output.c > data.c: " 1>&2
echo 1>&2
"${PERL}" output.c > data.c
- read -r -n 1 -p "Press any key to run: less -EX data.c (space = next page, q = quit): "
+ read -r -n 1 -p "Press any key to show data.c (space = next page, q = quit): "
+ echo 1>&2
+ less -rEXFK data.c
+ echo 1>&2
+ read -r -n 1 -p "Press any key to run: cc -o data data.c: "
echo 1>&2
- less -EX data.c
- echo "$ cc -o data data.c" 1>&2
cc -o data data.c
read -r -n 1 -p "Press any key to run: ./data: "
- echo "$ ./data" 1>&2
echo 1>&2
./data
fi
-echo "$ cc -o output output.c" 1>&2
+read -r -n 1 -p "Press any key to run: cc -o output output.c: "
+echo 1>&2
cc -o output output.c
read -r -n 1 -p "Press any key to run: ./output: "
echo 1>&2
@@ -53,37 +55,41 @@ echo "$ ./output" 1>&2
read -r -n 1 -p "Press any key to run: ./nyaruko.alt < output > output.c: "
echo 1>&2
./nyaruko.alt < output > output.c
-read -r -n 1 -p "Press any key to run: less -EX output.c (space = next page, q = quit): "
+read -r -n 1 -p "Press any key to show output.c (space = next page, q = quit): "
echo 1>&2
-less -EX output.c
+less -rEXFK output.c
read -r -n 1 -p "Press any key to run: bash output.c > key.c: "
+echo 1>&2
bash output.c > key.c
echo 1>&2
-read -r -n 1 -p "Press any key to run: less -EX key.c (space = next page, q = quit): "
-less -EX key.c
+read -r -n 1 -p "Press any key to run: show key.c (space = next page, q = quit): "
+less -rEXFK key.c
# more perl stuff
-if [[ -n "${PERL}" ]]; then
+if [[ -n "${PERL}" && -f "$PERL" && -x "$PERL" ]]; then
read -r -n 1 -p "Press any key to run: ${PERL} output.c > data.c: "
echo 1>&2
"${PERL}" output.c > data.c
- read -r -n 1 -p "Press any key to run: less -EX data.c (space = next page, q = quit): "
+ read -r -n 1 -p "Press any key to show data.c (space = next page, q = quit): "
echo 1>&2
- less -EX data.c
+ less -rEXFK data.c
read -r -n 1 -p "Press any key to run: cat key.c data.c > output.c: "
echo 1>&2
cat key.c data.c > output.c
- read -r -n 1 -p "Press any key to run: less -EX output.c (space = next page, q = quit): "
+ read -r -n 1 -p "Press any key to show output.c (space = next page, q = quit): "
+ echo 1>&2
+ less -rEXFK output.c
+ read -r -n 1 -p "Press any key to run: cc output.c -o output: "
echo 1>&2
- less -EX output.c
- echo "$ cc output.c -o output" 1>&2
cc output.c -o output
read -r -n 1 -p "Press any key to run: ./output > output.2: "
echo 1>&2
./output > output.2
- echo "$ chmod +x output.2" 1>&2
+ read -r -n 1 -p "Press any key to run: chmod +x output.2: "
+ echo 1>&2
chmod +x output.2
read -r -n 1 -p "Press any key to run: ./output.2: "
+ echo 1>&2
./output.2
fi
diff --git a/2012/omoikane/try.sh b/2012/omoikane/try.sh
index 6778a1faf..962e4b42b 100755
--- a/2012/omoikane/try.sh
+++ b/2012/omoikane/try.sh
@@ -23,27 +23,29 @@ PERL="$(type -P perl)"
echo "$ echo \"A quick brown fox jumps over the lazy dog\" | ./nyaruko > output.c" 1>&2
echo "A quick brown fox jumps over the lazy dog" | ./nyaruko > output.c
-read -r -n 1 -p "Press any key to run: less -EX output.c (space = next page, q = quit): "
+read -r -n 1 -p "Press any key to show output.c (space = next page, q = quit): "
echo 1>&2
-less -EX output.c
+less -rEXFK output.c
# perl specific stuff
-if [[ -n "$PERL" ]]; then
+if [[ -n "$PERL" && -f "$PERL" && -x "$PERL" ]]; then
read -r -n 1 -p "Press any key to run: ${PERL} output.c > data.c: " 1>&2
echo 1>&2
"${PERL}" output.c > data.c
- read -r -n 1 -p "Press any key to run: less -EX data.c (space = next page, q = quit): "
+ read -r -n 1 -p "Press any key to show data.c (space = next page, q = quit): "
+ echo 1>&2
+ less -rEXFK data.c
+ echo 1>&2
+ read -r -n 1 -p "Press any key to run: cc -o data data.c: "
echo 1>&2
- less -EX data.c
- echo "$ cc -o data data.c" 1>&2
cc -o data data.c
read -r -n 1 -p "Press any key to run: ./data: "
- echo "$ ./data" 1>&2
echo 1>&2
./data
fi
-echo "$ cc -o output output.c" 1>&2
+read -r -n 1 -p "Press any key to run: cc -o output output.c: "
+echo 1>&2
cc -o output output.c
read -r -n 1 -p "Press any key to run: ./output: "
echo 1>&2
@@ -53,37 +55,41 @@ echo "$ ./output" 1>&2
read -r -n 1 -p "Press any key to run: ./nyaruko < output > output.c: "
echo 1>&2
./nyaruko < output > output.c
-read -r -n 1 -p "Press any key to run: less -EX output.c (space = next page, q = quit): "
+read -r -n 1 -p "Press any key to show output.c (space = next page, q = quit): "
echo 1>&2
-less -EX output.c
+less -rEXFK output.c
read -r -n 1 -p "Press any key to run: bash output.c > key.c: "
+echo 1>&2
bash output.c > key.c
echo 1>&2
-read -r -n 1 -p "Press any key to run: less -EX key.c (space = next page, q = quit): "
-less -EX key.c
+read -r -n 1 -p "Press any key to run: show key.c (space = next page, q = quit): "
+less -rEXFK key.c
# more perl stuff
-if [[ -n "${PERL}" ]]; then
+if [[ -n "${PERL}" && -f "$PERL" && -x "$PERL" ]]; then
read -r -n 1 -p "Press any key to run: ${PERL} output.c > data.c: "
echo 1>&2
"${PERL}" output.c > data.c
- read -r -n 1 -p "Press any key to run: less -EX data.c (space = next page, q = quit): "
+ read -r -n 1 -p "Press any key to show data.c (space = next page, q = quit): "
echo 1>&2
- less -EX data.c
+ less -rEXFK data.c
read -r -n 1 -p "Press any key to run: cat key.c data.c > output.c: "
echo 1>&2
cat key.c data.c > output.c
- read -r -n 1 -p "Press any key to run: less -EX output.c (space = next page, q = quit): "
+ read -r -n 1 -p "Press any key to show output.c (space = next page, q = quit): "
+ echo 1>&2
+ less -rEXFK output.c
+ read -r -n 1 -p "Press any key to run: cc output.c -o output: "
echo 1>&2
- less -EX output.c
- echo "$ cc output.c -o output" 1>&2
cc output.c -o output
read -r -n 1 -p "Press any key to run: ./output > output.2: "
echo 1>&2
./output > output.2
- echo "$ chmod +x output.2" 1>&2
+ read -r -n 1 -p "Press any key to run: chmod +x output.2: "
+ echo 1>&2
chmod +x output.2
read -r -n 1 -p "Press any key to run: ./output.2: "
+ echo 1>&2
./output.2
fi
diff --git a/thanks-for-help.md b/thanks-for-help.md
index b423c0995..945e3ef32 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -3820,17 +3820,15 @@ respectively. Notice how a single letter changes so much!
## [2012/omoikane](/2012/omoikane/omoikane.c) ([README.md](/2012/omoikane/README.md]))
-[Cody](#cody) added the [try.sh](/2012/omoikane/try.sh) script.
-
-Cody also added the [alternate code](/2012/omoikane/README.md#alternate-code)
+[Cody](#cody) added the [alternate versions](/2012/omoikane/README.md#alternate-code)
which will, if no arg is specified, read in the program itself, rather than
`/dev/urandom`. This is mostly useful for those without a `/dev/urandom` device
file (the default for the entry). The second alternate version is like the first
except that it also sets binary mode on `stdin` and `stdout` which should
theoretically make it work in Windows.
-Cody also added the [try.alt.sh](/2012/omoikane/try.alt.sh) script that is like
-the `try.sh` script but which uses the (first version of the) alt code instead.
+Cody also added the [try.sh](/2012/omoikane/try.sh) and
+[try.alt.sh](/2012/omoikane/try.alt.sh) scripts.
## [2012/tromp](/2012/tromp/tromp.c) ([README.md](/2012/tromp/README.md))
From 6f4167373fbad296698cc493124ee13ef1037d9c Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Fri, 26 Jan 2024 10:53:05 -0800
Subject: [PATCH 06/12] Improve and shellcheck fix 2012/tromp/try.sh
As for the shellcheck warning could be fixed (missing '\' before a '"')
and the useless cat ones had the rationale updated (it's what the author
used so it's easier to verify it's okay though I still say - and so does
the script - that there's no such thing as a useless cat) and the format
of what warning is disabled (URL included).
---
2012/tromp/try.sh | 86 +++++++++++++++++++++--------------------------
1 file changed, 38 insertions(+), 48 deletions(-)
diff --git a/2012/tromp/try.sh b/2012/tromp/try.sh
index 1b404686b..48680afe4 100755
--- a/2012/tromp/try.sh
+++ b/2012/tromp/try.sh
@@ -15,106 +15,96 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
-# ^-- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
-# shellcheck disable=SC2140
-echo "$ (cat hilbert.Blc; echo -n "1") | ./tromp" 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: (cat hilbert.Blc; echo -n \"1\") | ./tromp: "
echo 1>&2
(cat hilbert.Blc; echo -n "1") | ./tromp
echo 1>&2
-# ^-- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
-# shellcheck disable=SC2140
-echo "$ (cat hilbert.Blc; echo -n "12") | ./tromp" 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: (cat hilbert.Blc; echo -n \"12\") | ./tromp: "
echo 1>&2
(cat hilbert.Blc; echo -n "12") | ./tromp
echo 1>&2
-# ^-- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
-# shellcheck disable=SC2140
-echo "$ (cat hilbert.Blc; echo -n "123") | ./tromp" 1>&2
-read -r -n 1 -p "Press any key to continue: "
-echo 1>&2
-
-# There's no such thing as a useless cat so we silence:
-#
-# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
+# There's no such thing as a useless cat so we silence. Well okay it's also
+# because it's easier to verify that it works as this form was given by the
+# author.
#
+# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
+# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
+read -r -n 1 -p "Press any key to run: (cat hilbert.Blc; echo -n \"123\") | ./tromp: "
+echo 1>&2
(cat hilbert.Blc; echo -n "123") | ./tromp
echo 1>&2
-echo "$ (cat hilbert.Blc; echo -n 1234) | ./tromp" 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: (cat hilbert.Blc; echo -n 1234) | ./tromp: "
echo 1>&2
-# There's no such thing as a useless cat so we silence:
-#
-# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
+# There's no such thing as a useless cat so we silence. Well okay it's also
+# because it's easier to verify that it works as this form was given by the
+# author.
#
+# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
+# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
-
(cat hilbert.Blc; echo -n 1234) | ./tromp
echo 1>&2
-echo "$ echo " Hello, world" | ./tromp"
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: echo \" Hello, world\" | ./tromp: "
echo 1>&2
echo " Hello, world" | ./tromp
echo 1>&2
-echo "$ echo "*Hello, world" | ./tromp" 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: echo \"*Hello, world\" | ./tromp: "
echo 1>&2
echo "*Hello, world" | ./tromp
echo 1>&2
-echo "$ (cat uni8.Blc; echo " Ni hao") | ./tromp" 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: (cat uni8.Blc; echo \" Ni hao\") | ./tromp: "
echo 1>&2
-# There's no such thing as a useless cat so we silence:
-#
-# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
-#
-# shellcheck disable=SC2002
(cat uni8.Blc; echo " Ni hao") | ./tromp
echo 1>&2
echo "$ cat primes.blc | ./tromp -b | head -c 70" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
-# There's no such thing as a useless cat so we silence:
-#
-# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
+# There's no such thing as a useless cat so we silence. Well okay it's also
+# because it's easier to verify that it works as this form was given by the
+# author.
#
+# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
+# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
cat primes.blc | ./tromp -b | head -c 70
echo 1>&2
echo "$ (cat oddindices.Blc; echo -n " "; cat primes.blc | ./tromp -b) | ./tromp | head -c 70" 1>&2
-echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
-# There's no such thing as a useless cat so we silence:
-#
-# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
+
+# There's no such thing as a useless cat so we silence. Well okay it's also
+# because it's easier to verify that it works as this form was given by the
+# author.
#
+# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
+# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
(cat oddindices.Blc; echo -n " "; cat primes.blc | ./tromp -b) | ./tromp | head -c 70
echo 1>&2
-echo "$ cat hw.bf" 1>&2
-read -r -n 1 -p "Press any key to continue: "
+read -r -n 1 -p "Press any key to run: cat hw.bf: "
echo 1>&2
cat hw.bf
echo 1>&2
-echo "$ cat bf.Blc hw.bf | ./tromp" 1>&2
-read -r -n 1 -p "Press any key to continue: "
+
+
+read -r -n 1 -p "Press any key to run: cat bf.Blc hw.bf | ./tromp: "
echo 1>&2
-# There's no such thing as a useless cat so we silence:
-#
-# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
+# There's no such thing as a useless cat so we silence. Well okay it's also
+# because it's easier to verify that it works as this form was given by the
+# author.
#
+# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
+# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
cat bf.Blc hw.bf | ./tromp
From 479601899bc6a1f8656427b183431ecf9ab331b6 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Fri, 26 Jan 2024 11:09:51 -0800
Subject: [PATCH 07/12] Bug fix 2012/vik/try.sh
The additional commands I added cannot come first because the program
(as the bugs.md states and now more clearly) will likely crash (and does
in all the systems I tested) if the file does not exist. This did not
show itself the first time because the files already existed but running
make clobber before the script would remove the image files and thus a
crash (or actually two) would occur the first time the script was run
(second time it would be fine as the files it uses then exist).
---
2012/vik/try.sh | 24 ++++++++++++------------
bugs.md | 6 +++---
thanks-for-help.md | 11 ++++-------
3 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/2012/vik/try.sh b/2012/vik/try.sh
index deb29e9fb..f46bc2e3f 100755
--- a/2012/vik/try.sh
+++ b/2012/vik/try.sh
@@ -15,18 +15,6 @@ 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 embed chocolate in chocolate-in-ioccc.png: "
-echo 1>&2
-echo "$ ./vik e chocolate-in-ioccc.png \"Mmm... chocolate.\" > mmm-chocolate.png" 1>&2
-./vik e chocolate-in-ioccc.png "Mmm... chocolate." > mmm-chocolate.png
-echo 1>&2
-
-read -r -n 1 -p "Press any key to extract chocolate from mmm-chocolate.png: "
-echo 1>&2
-echo "$ ./vik d mmm-chocolate.png" 1>&2
-./vik d mmm-chocolate.png
-echo 1>&2
-
read -r -n 1 -p "Press any key to embed chocolate.png in ioccc.png: "
echo 1>&2
echo "$ ./vik e ioccc.png chocolate.png > chocolate-in-ioccc.png" 1>&2
@@ -39,6 +27,18 @@ echo "$ ./vik e chocolate.png ioccc.png > ioccc-in-chocolate.png"
./vik e chocolate.png ioccc.png > ioccc-in-chocolate.png
echo 1>&2
+read -r -n 1 -p "Press any key to embed chocolate in chocolate-in-ioccc.png: "
+echo 1>&2
+echo "$ ./vik e chocolate-in-ioccc.png \"Mmm... chocolate.\" > mmm-chocolate.png" 1>&2
+./vik e chocolate-in-ioccc.png "Mmm... chocolate." > mmm-chocolate.png
+echo 1>&2
+
+read -r -n 1 -p "Press any key to extract chocolate from mmm-chocolate.png: "
+echo 1>&2
+echo "$ ./vik d mmm-chocolate.png" 1>&2
+./vik d mmm-chocolate.png
+echo 1>&2
+
read -r -n 1 -p "Press any key to embed a brainfuck program as a text file and decode it: "
echo 1>&2
echo "$ ./vik e ioccc.png .+[.+] > encodedimg.png" 1>&2
diff --git a/bugs.md b/bugs.md
index 907a7e70d..aa081950b 100644
--- a/bugs.md
+++ b/bugs.md
@@ -3019,12 +3019,12 @@ will likely dump core.
### Information: [2012/vik/README.md](2012/vik/README.md)
The author stated that the program will crash if no argument is passed to the
-program or if invalid arguments or images of mismatching sizes or unsupported
-pixel formats though we note that your computer might also [halt and catch
+program or if invalid arguments (e.g. file does not exist) or images of
+mismatching sizes or unsupported pixel formats though we note that your computer
+might also [halt and catch
fire](https://en.wikipedia.org/wiki/Halt_and_Catch_Fire_(computing)) :-)
-
# 2013
## 2013 cable2
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 945e3ef32..fe629acf5 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -3838,14 +3838,11 @@ Cody also added the [try.sh](/2012/omoikane/try.sh) and
## [2012/vik](/2012/vik/vik.c) ([README.md](/2012/vik/README.md]))
+[Cody](#cody) added the [try.sh](/2012/vik/try.sh) script.
+
Based on the author's description it should be able to get this entry to work
-for Windows. With his instructions Cody added the alternate version that does
-this for the few who might use Windows.
-
-We're not sure whether we want to thank Cody or not for this :-) and he's not
-sure if he wants to be thanked either :-) but we appreciate it nonetheless.
-
-Cody also added the [try.sh](/2012/vik/try.sh) script.
+for Windows. With his instructions Cody also added the alternate version that
+does this for the few who might use Windows.
## [2012/zeitak](/2012/zeitak/zeitak.c) ([README.md](/2012/zeitak/README.md]))
From 34c8958ac20ca51f143bb8e77463665df844d9e2 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Fri, 26 Jan 2024 11:15:14 -0800
Subject: [PATCH 08/12] Improve 2013/birken/try scripts
---
2013/birken/try.alt.sh | 4 +++-
2013/birken/try.sh | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/2013/birken/try.alt.sh b/2013/birken/try.alt.sh
index 32604bcb4..c0df5856c 100755
--- a/2013/birken/try.alt.sh
+++ b/2013/birken/try.alt.sh
@@ -21,6 +21,7 @@ PERL="$(type -P perl)"
if [[ -n "$PERL" ]]; then
read -r -n 1 -p "Press any key to try a random run: "
+ echo 1>&2
perl -e 'map{map{print int(rand()*8);}(0..16);print chr(10);}(0..30);' | tr '[0-4]' ' '| ./birken.alt
fi
@@ -30,7 +31,8 @@ for i in *.txt; do
-e 's/Cheepcheep/Cheep Cheep/g' -e 's/Happyface/Happy Face/g' -e 's/Paranaplant/Piranha Plant/g' \
-e 's/Koopaparatroopa/Koopa Paratroopa/g')"
read -r -n1 -p "Press any key to try $NAME: "
+ echo 1>&2
./birken.alt < "$i"
- echo
+ echo 1>&2
done
clear
diff --git a/2013/birken/try.sh b/2013/birken/try.sh
index f08c8e1e4..2f3982cac 100755
--- a/2013/birken/try.sh
+++ b/2013/birken/try.sh
@@ -20,6 +20,7 @@ PERL="$(type -P perl)"
if [[ -n "$PERL" ]]; then
read -r -n 1 -p "Press any key to try a random run: "
+ echo 1>&2
perl -e 'map{map{print int(rand()*8);}(0..16);print chr(10);}(0..30);' | tr '[0-4]' ' '| ./birken
fi
@@ -29,7 +30,8 @@ for i in *.txt; do
-e 's/Cheepcheep/Cheep Cheep/g' -e 's/Happyface/Happy Face/g' -e 's/Paranaplant/Piranha Plant/g' \
-e 's/Koopaparatroopa/Koopa Paratroopa/g')"
read -r -n1 -p "Press any key to try $NAME: "
+ echo 1>&2
./birken < "$i"
- echo
+ echo 1>&2
done
clear
From 3419e33e972e1dace1757e4f5b69a472dd8c4ad6 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Fri, 26 Jan 2024 11:18:30 -0800
Subject: [PATCH 09/12] Improve 2013/cable2/try.sh
---
2013/cable2/try.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/2013/cable2/try.sh b/2013/cable2/try.sh
index a03c6dbec..1ae4ed99a 100755
--- a/2013/cable2/try.sh
+++ b/2013/cable2/try.sh
@@ -37,7 +37,8 @@ read -r -n 1 -p "Press any key to extract and compile C code by OCR: "
echo 1>&2
echo "$ ./cable2 hello_world.bmp | gcc -xc -o hello -" 1>&2
./cable2 hello_world.bmp | gcc -xc -o hello -
-echo "$ ./hello" 1>&2
+read -r -n 1 -p "Press any key to run: ./hello: "
+echo 1>&2
./hello
echo 1>&2
@@ -45,7 +46,8 @@ echo "Sometimes typeset text will work if the typeset has characters that are" 1
echo "enough to support the handwritten shapes." 1>&2
read -r -n 1 -p "Press any key to try Menlo 160pt text: "
echo 1>&2
-echo "$ ./cable2 typeset.bmp" 1>&2
+read -r -n 1 -p "Press any key to run: ./cable2 typeset.bmp: "
+echo 1>&2
./cable2 typeset.bmp
echo 1>&2
From 331901386449f82c6c6b6c40f7baf376159fde03 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Fri, 26 Jan 2024 11:21:37 -0800
Subject: [PATCH 10/12] Rename 2013/runme to cable3.sh
This is to be consistent with other entries that have wrapper scripts
for the entry which are named winner.sh.
---
2013/cable3/Makefile | 2 +-
2013/cable3/README.md | 6 +++---
2013/cable3/{runme => cable3.sh} | 0
thanks-for-help.md | 8 +++++---
4 files changed, 9 insertions(+), 7 deletions(-)
rename 2013/cable3/{runme => cable3.sh} (100%)
diff --git a/2013/cable3/Makefile b/2013/cable3/Makefile
index 2961a0bd0..7195279c9 100644
--- a/2013/cable3/Makefile
+++ b/2013/cable3/Makefile
@@ -119,7 +119,7 @@ ENTRY= cable3
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
-DATA= bios fd.img runme sc-ioccc.terminal screenshot_autocad.png \
+DATA= bios fd.img cable3.sh sc-ioccc.terminal screenshot_autocad.png \
screenshot_flightsim4.png screenshot_lotus123.png screenshot_qbasic.png \
screenshot_simcity.png screenshot_win3_on_macosx.png
TARGET= ${PROG}
diff --git a/2013/cable3/README.md b/2013/cable3/README.md
index 302b1cf28..910fa82e8 100644
--- a/2013/cable3/README.md
+++ b/2013/cable3/README.md
@@ -18,7 +18,7 @@ available. See the [Alternate code](#alternate-code) section below.
## Try:
```sh
-./runme
+./cable3.sh
```
NOTE: to quit the program type `QUITEMU`. You might have to be at the top level
@@ -211,7 +211,7 @@ stty cbreak raw -echo min 0
stty cooked echo
```
-See the [runme](runme) script.
+See the [cable3.sh](cable3.sh) script.
## To use the emulator - floppy mode only
@@ -221,7 +221,7 @@ the `fd.img` provided, which is a FreeDOS boot disk.
Before running the emulator on a Unix-type system, `stty` needs to be used to
put the keyboard into raw mode (and afterwards it needs to be put back to
cooked). So, run the emulator using something like this script (provided as
-[runme](runme)):
+[cable3.sh](cable3.sh)):
```sh
stty cbreak raw -echo min 0
diff --git a/2013/cable3/runme b/2013/cable3/cable3.sh
similarity index 100%
rename from 2013/cable3/runme
rename to 2013/cable3/cable3.sh
diff --git a/thanks-for-help.md b/thanks-for-help.md
index fe629acf5..ba05f795d 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -3903,9 +3903,11 @@ Later on in an updated macOS (problem discovered in macOS Sonoma) the entry
failed to compile again also due to `localtime()` so he removed the prototype
entirely to solve the problem.
-Cody also slightly improved the `runme` script to not assume that the program has
-been compiled by running `make clobber all || exit 1` and he also made it pass
-`shellcheck` (using `[[ .. ]]` over `[ .. ]`).
+Cody also slightly improved the `runme` script (renamed to
+[cable3.sh](/2013/cable3/cable3.sh) for consistency with other entries that have
+wrapper scripts) to not assume that the program has been compiled by running
+`make clobber all || exit 1` and he also made it pass `shellcheck` (using `[[ ..
+]]` over `[ .. ]`).
As well, based on the author's remarks, Cody added the [alternate
code](/2013/cable3/cable3.alt.c) which should be compilable for Windows/MS Visual
From 1adcbf82eb2f9600a0b65433a91679a88d88aac5 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Fri, 26 Jan 2024 11:28:56 -0800
Subject: [PATCH 11/12] Improve scripts of 2013/dlowe
The try.sh script cannot be modified to prompt the user to run commands
as the other scripts (or at least one, diff.sh) make use of tail(1) on
the output. The script diff.sh however can have that and it has been
done.
Minor fixes in display in slflen.sh.
---
2013/dlowe/diff.sh | 22 +++++++++++++++-------
2013/dlowe/slflen.sh | 2 ++
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/2013/dlowe/diff.sh b/2013/dlowe/diff.sh
index bdeb9527a..6eb49cbcf 100755
--- a/2013/dlowe/diff.sh
+++ b/2013/dlowe/diff.sh
@@ -11,12 +11,20 @@ if [[ -z "$CC" ]]; then
fi
make CC="$CC" all >/dev/null || exit 1
-echo "$ ./try.sh | tail -n 3 > 1.txt" 1>&2
-./try.sh | tail -n 3 > 1.txt
+read -r -n 1 -p "Press any key to run: ./try.sh | tail -n 3 | tee 1.txt: "
+./try.sh | tail -n 3 | tee 1.txt
+
echo "$ echo 'IOCCC winning entry 2013/dlowe' > ioccc.txt" 1>&2
-echo 'IOCCC winning entry 2013/dlowe' > ioccc.txt
-echo "$ ./try.sh | tail -n 3 > 2.txt" 1>&2
-./try.sh | tail -n 3 > 2.txt
-echo "$ diff 1.txt 2.txt" 1>&2
-diff 1.txt 2.txt
+read -r -n 1 -p "Press any key to run: echo 'IOCCC winning entry 2013/dlowe' | tee ioccc.txt: "
+echo 1>&2
+echo 'IOCCC winning entry 2013/dlowe' | tee ioccc.txt
+
+read -r -n 1 -p "Press any key to run: ./try.sh | tail -n 3 | tee 2.txt: "
+echo 1>&2
+./try.sh | tail -n 3 | tee 2.txt
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: diff -s 1.txt 2.txt: "
+echo 1>&2
+diff -s 1.txt 2.txt
rm -f 1.txt 2.txt ioccc.txt
diff --git a/2013/dlowe/slflen.sh b/2013/dlowe/slflen.sh
index 399051543..7a492f246 100755
--- a/2013/dlowe/slflen.sh
+++ b/2013/dlowe/slflen.sh
@@ -15,5 +15,7 @@ make CC="$CC" all >/dev/null || exit 1
ln -sf dlowe sparkl
ls -1 *
+echo 1>&2
echo -n "sparkline length of above files: "
wc -c ./* | awk '{print $1}' | xargs ./sparkl
+echo 1>&2
From 7cd46f8e536e5c1d877de11e3ad2a9af0a60779e Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Fri, 26 Jan 2024 11:33:18 -0800
Subject: [PATCH 12/12] Improve 2013/endoh1/try.sh
---
2013/endoh1/try.sh | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/2013/endoh1/try.sh b/2013/endoh1/try.sh
index 2dbdbf189..d10254a00 100755
--- a/2013/endoh1/try.sh
+++ b/2013/endoh1/try.sh
@@ -17,12 +17,12 @@ clear
read -r -n 1 -p "Press any key to run: less endoh1.c (space = next page, q = quit): "
echo 1>&2
-less -EXF endoh1.c
+less -rEXFK endoh1.c
echo 1>&2
-read -r -n 1 -p "Press any key to run: ./endoh1 hello.lazy: "
+read -r -n 1 -p "Press any key to run: ./endoh1 hello.lazy (space = next page, q = quit): "
echo 1>&2
-./endoh1 hello.lazy
+./endoh1 hello.lazy | less -rEXFK
echo 1>&2
read -r -n 1 -p "Press any key to run: ./hello: "
@@ -35,12 +35,13 @@ echo 1>&2
# ShellCheck gets this wrong, thinking ./echo is the shell built-in or system
# command so we disable the warning.
#
-# ^----^ SC2216 (warning): Piping to 'echo', a command that doesn't read stdin. Did you want 'cat' instead?
+# SC2216 (warning): Piping to 'echo', a command that doesn't read stdin. Did you want 'cat' instead?
+# https://www.shellcheck.net/wiki/SC2216
# shellcheck disable=SC2216
echo Hello | ./echo
echo 1>&2
-read -r -n 1 -p "Press any key to run: ./tac < endoh1.c | less (space = next page, q = quit): "
+read -r -n 1 -p "Press any key to run: ./tac < endoh1.c (space = next page, q = quit): "
echo 1>&2
-./tac < endoh1.c | less -EXF
+./tac < endoh1.c | less -rEXFK
echo 1>&2