From b066c51da17e791e55718d265d0cf3d0defcfbd4 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 11 Jan 2024 10:11:03 -0800 Subject: [PATCH] Improve alt build of 1989/ovdluhe One can now do make clobber P=5 alt instead of the more awkward make clobber CDEFINE="-DP=5" alt The try.alt.sh script was added and allows one to do P=5 ./try.alt.sh If P is not specified it uses the default of the alt code (which checks if it's defined first via #ifdef..#endif). Otherwise it uses the new value. Of course if one specifies not an int or too high value (or maybe too low - didn't try that) the program will fail. That is the fault of the user. The author does note a reasonable range to try. --- 1989/ovdluhe/Makefile | 5 ++++- 1989/ovdluhe/README.md | 15 +++++++++++++-- 1989/ovdluhe/try.alt.sh | 38 ++++++++++++++++++++++++++++++++++++++ thanks-for-help.md | 8 +++++--- 4 files changed, 60 insertions(+), 6 deletions(-) create mode 100755 1989/ovdluhe/try.alt.sh diff --git a/1989/ovdluhe/Makefile b/1989/ovdluhe/Makefile index 73910cea0..c9b79ee6e 100644 --- a/1989/ovdluhe/Makefile +++ b/1989/ovdluhe/Makefile @@ -140,8 +140,11 @@ ${PROG}: ${PROG}.c alt: data ${ALT_TARGET} @${TRUE} +# Variable to simplify reconfiguring P +# +P= '(A</dev/null || exit 1 +else + make clobber CC="$CC" alt >/dev/null || exit 1 +fi + +# clear screen after compilation so that only the entry is shown + +i=0 +for ((i=0; i<4; ++i)); do + read -r -n 1 -p "Press any key to run: ./ovdluhe.alt < ovdluhe.alt.c: " + echo 1>&2 + ./ovdluhe.alt < ovdluhe.alt.c + echo 1>&2 + + read -r -n 1 -p "Press any key to run: ./ovdluhe.alt < README.md: " + echo 1>&2 + ./ovdluhe.alt < README.md + echo 1>&2 + + read -r -n 1 -p "Press any key to run: ./ovdluhe.alt < Makefile: " + echo 1>&2 + ./ovdluhe.alt < Makefile + echo 1>&2 +done diff --git a/thanks-for-help.md b/thanks-for-help.md index 76169a5bd..5ab7bd13e 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -819,9 +819,11 @@ 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. +Cody also provided an [alternate version](/1989/ovdluhe/ovdluhe.alt.c) based on +the author's remarks and the [try.alt.sh](/1989/ovdluhe/try.alt.sh) script that +uses the alt code, allowing one to configure the alt build. See the README.md +for details. The fix described above was fixed in this version too, after it was +discovered and fixed. ## [1989/paul](/1989/paul/paul.c) ([README.md](/1989/paul/README.md]))