From c9f3d429371e8d40945b2f5f1637b76c23986f0c Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:37:35 -0800 Subject: [PATCH] Add 2018/ciura/try.alt.sh This also fixes the missing reference to try.sh in the README.md file. Using both scripts one can see the problem the alt code has that was fixed by the author. --- 2018/ciura/README.md | 13 +++++++++++-- 2018/ciura/try.alt.sh | 27 +++++++++++++++++++++++++++ thanks-for-help.md | 3 ++- 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100755 2018/ciura/try.alt.sh diff --git a/2018/ciura/README.md b/2018/ciura/README.md index 5cc430d9f..dfae12eaa 100644 --- a/2018/ciura/README.md +++ b/2018/ciura/README.md @@ -19,8 +19,7 @@ below for more details. ## Try: ```sh -./prog < Makefile -./prog < README.md +./try.sh ``` @@ -43,6 +42,16 @@ make alt Use `prog.alt` as you would `prog` above. +### Alternate try: + +```sh +./try.alt.sh +``` + +Do you spot the fix by running both [try.sh](try.sh) and +[try.alt.sh](try.alt.sh)? + + ## Judges' remarks: This text was processed by `prog`. You may get confused. We're not really sure: diff --git a/2018/ciura/try.alt.sh b/2018/ciura/try.alt.sh new file mode 100755 index 000000000..1b731011e --- /dev/null +++ b/2018/ciura/try.alt.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# +# try.alt.sh - demonstrate IOCCC winner 2018/ciura 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" alt >/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: ./prog.alt < Makefile: " +echo 1>&2 +./prog.alt < Makefile +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./prog.alt < README.md: " +echo 1>&2 +./prog.alt < README.md + +exit 0 diff --git a/thanks-for-help.md b/thanks-for-help.md index feb379284..2344f7401 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -4417,7 +4417,8 @@ Finally Cody added the [try.sh](/2018/burton2/try.sh) script. ## [2018/ciura](/2018/ciura/prog.c) ([README.md](/2018/ciura/README.md)) -[Cody](#cody) added the [try.sh](/2018/ciura/try.sh) script and the PDF file, +[Cody](#cody) added the [try.sh](/2018/ciura/try.sh) and +[try.alt.sh](/2018/ciura/try.alt.sh) scripts and the PDF file, [lexicon.pdf](/2018/ciura/lexicon.pdf), that was a dead link, restored from the Internet Wayback Machine.