From 13ddc4afbb9ec2e2efc82fb6bd833b25b9bac2a1 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 13 Feb 2024 03:02:19 -0800 Subject: [PATCH 1/5] Typo fixes and comments updated in top Makefile To do with the build of html files in particular. The comments for each now have the tool being used in the form of ${FOO} tool (bin/foo). The entry_index rule has been aliased to readme2index as that is what the rule uses (well bin/readme2index.sh). The quick_entry_index rule has been aliased to quick_readme2index as that is what the rule uses (well bin/quick-readme2index.sh). --- Makefile | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index abbb795c3..4b9abd205 100644 --- a/Makefile +++ b/Makefile @@ -239,8 +239,8 @@ indent.c: # Suggest rules in this section # # This may not be much help to people who are not already familiar with -# the tools needed to build the web site, but it is does print out a friendly -# reminder to hose who to understand. For all else, there is "RTFS". :-) +# the tools needed to build the web site, but it does print out a friendly +# reminder to those who understand it. For all else, there is "RTFS". :-) # help: @echo make genpath @@ -273,35 +273,40 @@ genpath: fi @echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-=' -# generate the top level authors.html page +# generate the top level authors.html page using the +# ${GEN_AUTHORS} tool (bin/gen-authors.sh). # gen_authors: ${GEN_AUTHORS} authors.html @echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-=' ${GEN_AUTHORS} -v 1 @echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-=' -# generate the top level location.html page +# generate the top level location.html page using the +# ${GEN_LOCATION} tool (bin/gen-location.sh). # gen_location: ${GEN_LOCATION} location.html @echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-=' ${GEN_LOCATION} -v 1 @echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-=' -# generate the top level years.html page +# generate the top level years.html page using the ${GEN_YEARS} +# tool (bin/gen-years.sh). # gen_years: ${GEN_YEARS} years.html @echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-=' ${GEN_YEARS} -v 1 @echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-=' -# force the build of all winner index.html files +# force the build of ALL winner index.html files using +# the ${README2INDEX} tool (bin/readme2index.sh) # -entry_index: ${ALL_RUN} ${README2INDEX} +entry_index readme2index: ${ALL_RUN} ${README2INDEX} @echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-=' ${ALL_RUN} -v 3 ${README2INDEX} -v 1 @echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-=' -# generate year level index.html files +# generate year level index.html files using the +# ${GEN_YEAR_INDEX} tool (bin/gen-year-index.sh). # gen_year_index: ${ALL_YEARS} ${GEN_YEAR_INDEX} @echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-=' @@ -310,11 +315,12 @@ gen_year_index: ${ALL_YEARS} ${GEN_YEAR_INDEX} # build winner index.html files that might be out of date # -# This rule uses the QUICK_README2INDEX tool, so -# some winner index.html files that seem to be up to date +# This rule uses the ${QUICK_README2INDEX} tool +# (bin/quick-readme2index.sh), so some winner +# index.html files that seem to be up to date # (but might not be up to date) won't be built. # -quick_entry_index: ${ALL_RUN} ${QUICK_README2INDEX} +quick_entry_index quick_readme2index: ${ALL_RUN} ${QUICK_README2INDEX} @echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-=' ${ALL_RUN} -v 3 ${QUICK_README2INDEX} -v 1 @echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-=' From d688a1b2c79dcd56ee2aedb6c0646a96343fbcfd Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 13 Feb 2024 03:12:38 -0800 Subject: [PATCH 2/5] Fix make clobber in 2006/stewart --- 2006/stewart/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2006/stewart/Makefile b/2006/stewart/Makefile index ee0d7ce0d..fa68d3811 100644 --- a/2006/stewart/Makefile +++ b/2006/stewart/Makefile @@ -206,7 +206,7 @@ clean: clobber: clean ${RM} -f ${TARGET} ${ALT_TARGET} - ${RM} -rf *.dSYM + ${RM} -rf *.dSYM *.png *.xbm @-if [ -e sandwich ]; then \ ${RM} -f sandwich; \ echo 'ate sandwich'; \ From ad12345e08480eac2f08cfe6f83df7be9c9fb205 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 13 Feb 2024 03:18:43 -0800 Subject: [PATCH 3/5] Modularise 2006/birken/try.sh --- 2006/birken/try.sh | 81 ++++++++++++---------------------------------- 1 file changed, 20 insertions(+), 61 deletions(-) diff --git a/2006/birken/try.sh b/2006/birken/try.sh index f891c8f0b..15cedb547 100755 --- a/2006/birken/try.sh +++ b/2006/birken/try.sh @@ -15,67 +15,26 @@ make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -read -r -n 1 -p "Press any key to run: ./birken < adder.tofu: " -echo 1>&2 -./birken < adder.tofu 2>/dev/null -echo 1>&2 +birken() +{ + if [[ "$#" -ne 1 ]]; then + echo "$0: birken() requires exactly 1 arg, got: $#" 1>&2 + return + fi -read -r -n 1 -p "Press any key to run: ./birken < buffer.tofu: " -echo 1>&2 -./birken < buffer.tofu 2>/dev/null -echo 1>&2 + if [[ ! -f "$1" || ! -r "$1" ]]; then + echo "$0: $1 not a regular readable file" 1>&2 + return + fi -read -r -n 1 -p "Press any key to run: ./birken < computer.tofu (space = next page, q = quit): " -echo 1>&2 -./birken < computer.tofu 2>/dev/null | less -rEXFK -echo 1>&2 + read -r -n 1 -p "Press any key to run: ./birken < $1 (space = next page, q = quit): " + echo 1>&2 + ./birken < "$1" 2>/dev/null | less -rEXFK +} -read -r -n 1 -p "Press any key to run: ./birken < counter.tofu: " -echo 1>&2 -./birken < counter.tofu 2>/dev/null -echo 1>&2 - -read -r -n 1 -p "Press any key to run: ./birken < divider.tofu: " -echo 1>&2 -./birken < divider.tofu 2>/dev/null -echo 1>&2 - -read -r -n 1 -p "Press any key to run: ./birken < lfsr.tofu: " -echo 1>&2 -./birken < lfsr.tofu 2>/dev/null -echo 1>&2 - -read -r -n 1 -p "Press any key to run: ./birken < memory.tofu: " -echo 1>&2 -./birken < memory.tofu 2>/dev/null -echo 1>&2 - -read -r -n 1 -p "Press any key to run: ./birken < multiplier.tofu: " -echo 1>&2 -./birken < multiplier.tofu 2>/dev/null -echo 1>&2 - -read -r -n 1 -p "Press any key to run: ./birken < multiplier2.tofu: " -echo 1>&2 -./birken < multiplier2.tofu 2>/dev/null -echo 1>&2 - -read -r -n 1 -p "Press any key to run: ./birken < oneline.tofu: " -echo 1>&2 -./birken < oneline.tofu 2>/dev/null -echo 1>&2 - -read -r -n 1 -p "Press any key to run: ./birken < shift.tofu: " -echo 1>&2 -./birken < shift.tofu 2>/dev/null -echo 1>&2 - -read -r -n 1 -p "Press any key to run: ./birken < zuse.tofu: " -echo 1>&2 -./birken < zuse.tofu 2>/dev/null -echo 1>&2 - -read -r -n 1 -p "Press any key to run: ./birken < zuse2.tofu: " -echo 1>&2 -./birken < zuse2.tofu 2>/dev/null -echo 1>&2 +for f in adder.tofu buffer.tofu computer.tofu counter.tofu divider.tofu lfsr.tofu \ + memory.tofu multiplier.tofu multiplier2.tofu oneline.tofu shift.tofu zuse.tofu \ + zuse2.tofu; do + + birken "$f" +done From c69f254b29ce90911261c2ec1758179917286254 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 13 Feb 2024 03:27:34 -0800 Subject: [PATCH 4/5] Fix 2000/natori/Makefile - wrong variable used The -Wno-foo options were in the CDEFINE variable which although works it is not congruent with the other Makefiles and it is slightly more confusing (even though not confusing). --- 2000/natori/Makefile | 6 +++--- thanks-for-help.md | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/2000/natori/Makefile b/2000/natori/Makefile index 3cc1c13af..7be84187b 100644 --- a/2000/natori/Makefile +++ b/2000/natori/Makefile @@ -38,7 +38,8 @@ include ../../var.mk # Common C compiler warnings to silence # -CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int \ + -Wno-int-conversion -Wno-pointer-to-int-cast -Wno-unused-parameter # Common C compiler warning flags # @@ -57,8 +58,7 @@ ARCH= # Defines that are needed to compile # -CDEFINE= -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int \ - -Wno-int-conversion -Wno-pointer-to-int-cast -Wno-unused-parameter +CDEFINE= # Include files that are needed to compile # diff --git a/thanks-for-help.md b/thanks-for-help.md index 8e34cc346..37f2d72f4 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2557,6 +2557,10 @@ one-liner but rather a small program. At the same point Cody made the code itself a one-line like the code is in the original entry. Now it looks much more like the original entry but with the two fixes. +Finally Cody fixed the Makefile that had the `-Wno-foo` options in the `CDEFINE` +variable which although works it is incongruent with the other Makefiles and is +more confusing (even if not confusing). + ## [2000/primenum](/2000/primenum/primenum.c) ([README.md](/2000/primenum/README.md])) From 0b53ebac9aa449c68282ed0805837090fbe4f78d Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 13 Feb 2024 03:34:01 -0800 Subject: [PATCH 5/5] Bug fix 2000/primenum/try.sh --- 2000/primenum/try.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/2000/primenum/try.sh b/2000/primenum/try.sh index 747dbb70e..1b6a12362 100755 --- a/2000/primenum/try.sh +++ b/2000/primenum/try.sh @@ -6,16 +6,13 @@ # 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 +[[ -z "$CC" ]] && CC="cc" make CC="$CC" all >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear - read -r -n 1 -p "Press any key to run: echo IOCCC 23209 | ./primenum 23209: " echo 1>&2 echo IOCCC 23209 | ./primenum 23209 @@ -27,9 +24,9 @@ echo THIS MESSAGE IS IN ALL CAPS | ./primenum 32 echo 1>&2 rm -f try.sh.txt -read -r -n 1 -p "Press any key to run: ./primenum 101 < try.sh | ./primenum n > try.sh.txt: " +read -r -n 1 -p "Press any key to run: ./primenum 101 < try.sh | ./primenum 101 > try.sh.txt: " echo 1>&2 -./primenum 101 < try.sh | ./primenum n > try.sh.txt +./primenum 101 < try.sh | ./primenum 101 > try.sh.txt echo 1>&2 read -r -n 1 -p "Press any key to show try.sh.txt (space = next page, q = quit): " @@ -37,8 +34,8 @@ echo 1>&2 less -rEXFK try.sh.txt echo 1>&2 -echo "$ diff try.sh try.sh.txt" -read -r -n 1 -p "Press any key to see diff (space = next page, q = quit): " 1>&2 -diff try.sh try.sh.txt | less -rEXFK +read -r -n 1 -p "Press any key to run: diff -s try.sh try.sh.txt: " 1>&2 +echo 1>&2 +diff -s try.sh try.sh.txt rm -f try.sh.txt