From df22315198bcb52b64ae2e64443170961596be6c Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 5 Jan 2024 06:32:37 -0800 Subject: [PATCH] Add 1987/biggar/try.sh --- 1987/biggar/README.md | 4 +++- 1987/biggar/try.sh | 34 ++++++++++++++++++++++++++++++++++ thanks-for-help.md | 5 +++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100755 1987/biggar/try.sh diff --git a/1987/biggar/README.md b/1987/biggar/README.md index 323759f28..94d3dface 100644 --- a/1987/biggar/README.md +++ b/1987/biggar/README.md @@ -9,13 +9,15 @@ make all ```sh some_command | ./biggar | od -c + +./biggar < file | od -c ``` ### Try: ```sh -./biggar < biggar.c | od -c +./try.sh ``` diff --git a/1987/biggar/try.sh b/1987/biggar/try.sh new file mode 100755 index 000000000..7cb66a993 --- /dev/null +++ b/1987/biggar/try.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 1987/biggar +# + +# 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: ./biggar < biggar.c: " +echo 1>&2 +./biggar < biggar.c +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./biggar < biggar.c | od -c: " +echo 1>&2 +./biggar < biggar.c | od -c +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./biggar < Makefile (space = next page, q = quit): " +./biggar < Makefile | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./biggar < Makefile | od -c (space = next page, q = quit): " +echo 1>&2 +./biggar < Makefile | od -c | less -rEXF diff --git a/thanks-for-help.md b/thanks-for-help.md index 682355cf9..a4f547dcf 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -500,6 +500,11 @@ There might have been other changes as well. # 1987 +## [1987/biggar](/1987/biggar/biggar.c) ([README.md](/1987/biggar/README.md)) + +[Cody](#cody) added the [try.sh](1987/biggar/try.sh) script. + + ## [1987/heckbert](/1987/heckbert/heckbert.c) ([README.md](/1987/heckbert/README.md)) [Cody](#cody) made this look more like the original entry by restoring the `#define` of