Add helper scripts to 2018/endoh2 + formatting

The run.sh script was fixed to work. It did not work because it had a
command that does not even exist ('tempfile') and even after that was
resolved there was another problem to be resolved.

The Makefile rule make python runs the python.sh script but it sets a
trap so one can exit that script but not exit everything (see below).
The python3.sh script is what python.sh is but for the make rule python3
and it works in the same way. The try.sh script runs all of these
scripts as well as the commands suggested by the judges.

The README.md file has been format/typo checked. For the link (twice
referenced) that has flashing lights (and quite a few at that) I put a
warning in parentheses for those who are (like me) sensitive to it (more
important for some people with epilepsy, depending on how sensitive they
are, maybe, but I hate flashing text and lights and so do many other
people).
This commit is contained in:
Cody Boone Ferguson committed 2023-12-13 06:41:52 -08:00
1 parent 52ee9b9697
commit 30847d6aad
7 files changed
+146 -50

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2018/endoh2
#
# 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 continue (ctrl-c/intr = skip to next early, runs 20 seconds): "
echo 1>&2
./run.sh
echo 1>&2
read -r -n 1 -p "Press any key to run a few times (ctrl-c/intr exits script): "
echo 1>&2
./prog | tee prog_next.c
make prog_next
./prog_next | tee prog_next.c
make prog_next
./prog_next | tee prog_next.c
read -r -n 1 -p "Press any key to sleep 1 sec between runs (intr/ctrl-c to exit): "
echo 1>&2
./python.sh
echo 1>&2
read -r -n 1 -p "Press any key run without sleeping (intr/ctrl-c to exit): "
echo 1>&2
./python3.sh
exit 0