From 58195f6192db4cc8e1be1e8a2b2fb4cb38303f34 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sun, 14 Jan 2024 10:34:44 -0800 Subject: [PATCH] Add 1993/dgibson/try.sh --- 1993/dgibson/README.md | 5 +++-- 1993/dgibson/dgibson.sh | 12 ++++++++++-- 1993/dgibson/try.sh | 17 +++++++++++++++++ thanks-for-help.md | 6 +++++- 4 files changed, 35 insertions(+), 5 deletions(-) create mode 100755 1993/dgibson/try.sh diff --git a/1993/dgibson/README.md b/1993/dgibson/README.md index 9c265098d..046b90d25 100644 --- a/1993/dgibson/README.md +++ b/1993/dgibson/README.md @@ -19,7 +19,7 @@ where: ### Try: ```sh -./dgibson.sh dgibson.data3 +./try.sh ``` @@ -38,7 +38,8 @@ There are a number of data files available: - [dgibson.data5](dgibson.data5) For [dgibson.data5](dgibson.data5) you will need a large screen, lots of virtual -memory and lots of time! +memory and lots of time! The [try.sh](try.sh) script will run +[dgibson.sh](dgibson.sh) on all the data files. Good luck trying to use a debugger on this entry! Life is not always pretty. diff --git a/1993/dgibson/dgibson.sh b/1993/dgibson/dgibson.sh index 35bb9d8f0..c3482fce9 100755 --- a/1993/dgibson/dgibson.sh +++ b/1993/dgibson/dgibson.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# dgibson.sh - run the dgibson entry +# dgibson.sh - run the IOCCC winner 1993/dgibson # # usage: # dgibson.sh [data_file] @@ -45,7 +45,15 @@ fi # build a new copy of the program # rm -f dgibson -make dgibson +# 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 + # form the next generation # diff --git a/1993/dgibson/try.sh b/1993/dgibson/try.sh new file mode 100755 index 000000000..c5ffa0550 --- /dev/null +++ b/1993/dgibson/try.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 1993/dgibson +# + +# we make use of the script dgibson.sh so we don't need to compile it. In any +# event that script rebuilds the program. +if [[ -z "$CC" ]]; then + CC="cc" +fi + +for f in dgibson.data[1-5]; do + read -r -n 1 -p "Press any key to run: CC=$CC ./dgibson.sh $f: " + echo 1>&2 + CC="$CC" ./dgibson.sh "$f" + echo 1>&2 +done diff --git a/thanks-for-help.md b/thanks-for-help.md index a84ffa18a..2c710308f 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -1713,7 +1713,11 @@ first. ## [1993/dgibson](/1993/dgibson/dgibson.c) ([README.md](/1993/dgibson/README.md])) -[Cody](#cody) fixed the script to work which assumed that `.` is in the path. +[Cody](#cody) fixed the [dgibson.sh](/1993/dgibson/dgibson.sh) script to work +which assumed that `.` is in the path. + +Cody also added the [try.sh](/1993/dgibson/try.sh) script which runs the above +mentioned script on all the data files. ## [1993/ejb](/1993/ejb/ejb.c) ([README.md](/1993/ejb/README.md]))