diff --git a/1989/ovdluhe/Makefile b/1989/ovdluhe/Makefile index eedacb161..fd8cfb68d 100644 --- a/1989/ovdluhe/Makefile +++ b/1989/ovdluhe/Makefile @@ -68,7 +68,7 @@ CINCLUDE= # Optimization # -OPT= +OPT= -O3 # Default flags for ANSI C compilation # diff --git a/1989/ovdluhe/README.md b/1989/ovdluhe/README.md index ff12f3525..6904d0179 100644 --- a/1989/ovdluhe/README.md +++ b/1989/ovdluhe/README.md @@ -22,11 +22,7 @@ by chance or is killed. ### Try: ```sh -./ovdluhe < ./ovdluhe.c -./ovdluhe < ./ovdluhe.c - -./ovdluhe < README.md -./ovdluhe < README.md +./try.sh ; sleep 2 ; ./try.sh ``` diff --git a/1989/ovdluhe/try.sh b/1989/ovdluhe/try.sh new file mode 100755 index 000000000..2b6362d9c --- /dev/null +++ b/1989/ovdluhe/try.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 1989/ovdluhe +# + +# 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 + +i=0 +for ((i=0; i<4; ++i)); do + read -r -n 1 -p "Press any key to run: ./ovdluhe < ovdluhe.c: " + echo 1>&2 + ./ovdluhe < ovdluhe.c + echo 1>&2 + + read -r -n 1 -p "Press any key to run: ./ovdluhe < README.md: " + echo 1>&2 + ./ovdluhe < README.md + echo 1>&2 + + read -r -n 1 -p "Press any key to run: ./ovdluhe < Makefile: " + echo 1>&2 + ./ovdluhe < Makefile + echo 1>&2 +done diff --git a/thanks-for-help.md b/thanks-for-help.md index a111c8f0b..5c9298d79 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -744,6 +744,12 @@ and over again, flooding the screen. The problem is that there was a `for` loop that by necessity had to not have an increment stage but only in the `if` path (in the loop itself) did the pointer get updated. +Cody also provided the [try.sh](/1989/ovdluhe/try.sh) script which runs the +program four times on three files to show the different output. It doesn't run +the program on each file four times in a row but rather does it on each file +and starts over, doing it four times, to help with hopefully allowing different +output. + Cody also provided an [alternate version](/1989/ovdluhe/ovdluhe.alt.c) based on the author's remarks. See the README.md for details. The fix described above was fixed in this version too, after it was discovered and fixed.