From e600715fe78f0e488398d6c48a04daf92e921374 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 16 Nov 2023 05:35:31 -0800 Subject: [PATCH] Rename 2001/westley/westley.sh to try.sh The rest of the entry has not been reviewed except that the 'to use' section has been corrected (and the try section obviously has been updated too). I have some improvements to try.sh in mind but that'll have to happen another time. --- 2001/westley/README.md | 9 +++++++-- 2001/westley/{westley.sh => try.sh} | 24 ++++++++++++++++++++---- thanks-for-fixes.md | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) rename 2001/westley/{westley.sh => try.sh} (66%) diff --git a/2001/westley/README.md b/2001/westley/README.md index 8ce7fe0d1..36eeed214 100644 --- a/2001/westley/README.md +++ b/2001/westley/README.md @@ -9,13 +9,18 @@ make ```sh ./westley +# enter some input, terminate with EOF + +echo foo | ./westley + +./westley < westley.c ``` ### Try: ```sh -./westley.sh +./try.sh ``` @@ -43,7 +48,7 @@ Use `westley.sort` as you would `westley` above. The author also stated that if you just sort the code you'll get the with `sort`) version that just prints out the punch card. The -[westley.punch.c](westley.punch.c) code specifically so that Westley can punch +[westley.punch.c](westley.punch.c) code is specifically so that Westley can punch everyone in the face! :-) This is also compiled by default. To use, try: diff --git a/2001/westley/westley.sh b/2001/westley/try.sh similarity index 66% rename from 2001/westley/westley.sh rename to 2001/westley/try.sh index 82963668a..a27501d5f 100755 --- a/2001/westley/westley.sh +++ b/2001/westley/try.sh @@ -1,14 +1,30 @@ #!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2001/westley +# -echo "./westley < westley.c 2>/dev/null > westley2.c" +# 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 + +echo "./westley < westley.c 2>/dev/null > westley2.c" 1>&2 ./westley < westley.c 2>/dev/null > westley2.c -make westley2 2>/dev/null 1>&2 +echo "Compiling westley2.c..." 1>&2 +make CC="$CC" westley2 2>/dev/null 1>&2 echo -echo "echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null" +echo "$ echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null" echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null echo -make westley.sort 2>/dev/null 1>&2 +make CC="$CC" westley.sort 2>/dev/null 1>&2 echo echo "./westley.sort < westley.c 2>/dev/null | diff - westley.c" # SC2094 (info): Make sure not to read and write the same file in the same pipeline. diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index bd8016e13..ad0086553 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -2638,7 +2638,7 @@ README.md for details. ## [2001/westley](2001/westley/westley.c) ([README.md](2001/westley/README.md])) -Cody added the script [westley.sh](westley.sh) to automate a heap of commands +Cody added the script [try.sh](try.sh) to automate a heap of commands that we, the IOCCC judges, suggested, as well as some additional ones that he thought would be fun. He also provided the sort and punch card versions, described in the README.md, based on the author's remarks.