diff --git a/1995/garry/README.md b/1995/garry/README.md index bc142e2db..6631f39f7 100644 --- a/1995/garry/README.md +++ b/1995/garry/README.md @@ -15,9 +15,7 @@ make all ### Try: ```sh -./garry.test.sh - -./garry < README.md +./try.sh ``` @@ -46,9 +44,7 @@ make alt ### Alternate try: ```sh -GARRY=garry.alt ./garry.test.sh - -./garry.alt < README.md +./try.alt.sh ``` diff --git a/1995/garry/garry.alt.test.sh b/1995/garry/garry.alt.test.sh deleted file mode 100755 index c6f980c80..000000000 --- a/1995/garry/garry.alt.test.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env sh -# -# garry.alt.test.sh - example of how to use garry.alt - -EXAMPLEON="\33\133\61\73\67\155" -EXAMPLEOFF="\33\133\155" -DOLLAR="$" -export EXAMPLEON EXAMPLEOFF DOLLAR - -# make sure alt code is built, first -make alt || exit 1 - -./garry.alt /dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear + +echo "$ EXAMPLEON=\"\33\133\61\73\67\155\"; EXAMPLEOFF=\"\33\133\155\"; DOLLAR=\"$\"" 1>&2 +EXAMPLEON="\33\133\61\73\67\155" +EXAMPLEOFF="\33\133\155" +DOLLAR="$" +export EXAMPLEON EXAMPLEOFF DOLLAR + +read -r -n 1 -p "Press any key to run: ./garry.alt < garry.data | less (q = quit, space = next page): " + +./garry.alt &2 + +read -r -n 1 -p "Press any key to run: ./garry.alt < README.md | less (q = quit, space = next page): " +./garry.alt < README.md | less -X diff --git a/1995/garry/try.sh b/1995/garry/try.sh new file mode 100755 index 000000000..18f6d2476 --- /dev/null +++ b/1995/garry/try.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env sh +# +# try.sh - demonstrate IOCCC winner 1995/garry +# + +# 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 "$ EXAMPLEON=\"\33\133\61\73\67\155\"; EXAMPLEOFF=\"\33\133\155\"; DOLLAR=\"$\"" 1>&2 +EXAMPLEON="\33\133\61\73\67\155" +EXAMPLEOFF="\33\133\155" +DOLLAR="$" +export EXAMPLEON EXAMPLEOFF DOLLAR + +read -r -n 1 -p "Press any key to run: ./garry < garry.data | less (q = quit, space = next page): " + +./garry &2 + +read -r -n 1 -p "Press any key to run: ./garry < README.md | less (q = quit, space = next page): " +./garry < README.md | less -X diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 92f825eb7..9ede25260 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1834,15 +1834,15 @@ problem was a missing `int` for the `f` variable. He felt it was even more important that it works because the layout does indeed look to him like a rat is dropping core :-), something that the judges suggested. -Cody also improved the script [garry.test.sh](1995/garry/garry.test.sh) to make -sure the program is compiled before trying to use it and he also added the -[garry.alt.test.sh](1995/garry/garry.alt.test.sh) script to use the alt version, +Cody also renamed `garry.test.sh` to [try.sh](1995/garrytry.sh) and improved it +to to make sure the program is compiled before trying to use it and he also +added the [try.alt.sh](1995/garry/try.alt.sh) script to use the alt version, though the alt version is not as important as alt code in other entries. The reason the alt script was added rather than using an environmental variable to specify which one to use is to make it easier on the user as typing -`GARRY=garry.alt ./garry.test.sh` is not as simple (even though simple) as just -running `./garry.alt.test.sh`. +`GARRY=garry.alt ./try.sh` is not as simple (even though simple) as just +running `./try.alt.sh`. ## [1995/leo](1995/leo/leo.c) ([README.md](1995/leo/README.md]))