From 4bab6df670be3ba1e88f7725edb60d94a8d74ae5 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 20 Jan 2024 10:23:30 -0800 Subject: [PATCH] Add 2004/newbern/try.sh One of the features the author noted is also in the script. It was documented by Yusuke but I chose to use the letters IOCCC instead (it seemed more fitting). This is noted in the thanks file. --- 2004/newbern/README.md | 3 +-- 2004/newbern/try.sh | 31 +++++++++++++++++++++++++++++++ thanks-for-help.md | 4 ++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100755 2004/newbern/try.sh diff --git a/2004/newbern/README.md b/2004/newbern/README.md index 29ef3ce86..db55cc571 100644 --- a/2004/newbern/README.md +++ b/2004/newbern/README.md @@ -15,8 +15,7 @@ make ## Try: ```sh -./newbern newbern.dat "IOCCC 2004" -echo SOS | ./newbern +./try.sh ``` diff --git a/2004/newbern/try.sh b/2004/newbern/try.sh new file mode 100755 index 000000000..fa2265691 --- /dev/null +++ b/2004/newbern/try.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2004/newbern +# + +# 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: ./newbern newbern.dat \"IOCCC 2004\" (space = next page, q = quit): " +echo 1>&2 +./newbern newbern.dat "IOCCC 2004" | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: echo SOS | ./newbern: " +echo 1>&2 +echo SOS | ./newbern +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./newbern newbern.dat IOCCC x (space = next page, q = quit): " +echo 1>&2 +./newbern newbern.dat IOCCC x | less -rEXF +echo 1>&2 diff --git a/thanks-for-help.md b/thanks-for-help.md index 072dc5554..ce0dd2b57 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3063,6 +3063,10 @@ get it to work, that being `kopczynski-10-rev`. [Cody](#cody) and Landon individually fixed this to work with clang. +Cody also added the [try.sh](/2004/newbern/try.sh) script (with a hidden feature +that the author referred to and was documented by [Yusuke](#yusuke) though Cody +chose the word `IOCCC` instead of `AAA`). + ## [2004/schnitzi](/2004/schnitzi/schnitzi.c) ([README.md](/2004/schnitzi/README.md]))