diff --git a/1992/westley/whereami.alt.sh b/1992/westley/whereami.alt.sh index 4356e6790..04195524b 100755 --- a/1992/westley/whereami.alt.sh +++ b/1992/westley/whereami.alt.sh @@ -23,16 +23,12 @@ fi # 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" # try getting the columns the simple way first: tput cols -COLUMNS="$(tput cols)" - -if [[ "$?" -ne 0 ]]; then - # if tput failed for any reason try stty(1) with awk(1): - COLUMNS="$(stty size|awkf '{print $NF}')" +if ! COLUMNS="$(tput cols)"; then + # if tput failed for any reason try stty(1) with cut(1). + COLUMNS="$(stty size|cut -f2 -d' ')" fi if [[ "$COLUMNS" -lt 80 ]]; then diff --git a/1992/westley/whereami.sh b/1992/westley/whereami.sh index 811ca6474..f15af4952 100755 --- a/1992/westley/whereami.sh +++ b/1992/westley/whereami.sh @@ -23,15 +23,12 @@ fi # 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" # try getting the columns the simple way first: tput cols -COLUMNS="$(tput cols)" -if [[ "$?" -ne 0 ]]; then - # if tput failed for any reason try stty(1) with awk(1): - COLUMNS="$(stty size|awkf '{print $NF}')" +if ! COLUMNS="$(tput cols)"; then + # if tput failed for any reason try stty(1) with cut(1). + COLUMNS="$(stty size|cut -f2 -d' ')" fi if [[ "$COLUMNS" -lt 80 ]]; then diff --git a/2000/bmeyer/try.sh b/2000/bmeyer/try.sh index ee56ad4fe..ea560b89f 100755 --- a/2000/bmeyer/try.sh +++ b/2000/bmeyer/try.sh @@ -19,17 +19,12 @@ clear # be determined: we just use a default value. # # try getting the columns the simple way first: tput cols -if ! COLUMNS="$(tput cols)"; then - # if tput failed for any reason try stty(1) with awk(1). - # - # Disable this warning of shellcheck as it's wrong: awk needs single quotes. - # - # SC2016 (info): Expressions don't expand in single quotes, use double quotes for that. - # https://www.shellcheck.net/wiki/SC2016 - # shellcheck disable=SC2016 - COLUMNS="$(stty size|awk '{print $NF}')" - - if [[ "$?" -ne 0 ]]; then +if COLUMNS="$(tput cols)"; then + # if tput failed for any reason try stty(1) with cut(1). + COLUMNS="$(stty size|cut -f2 -d' ')" + + # if however either stty size or cut fails, set to 150. + if [[ "${PIPESTATUS[0]}" -ne 0 || "${PIPESTATUS[1]}" -ne 0 ]]; then COLUMNS=150 fi fi diff --git a/2001/coupard/README.md b/2001/coupard/README.md index 9b189172a..2de6e454b 100644 --- a/2001/coupard/README.md +++ b/2001/coupard/README.md @@ -14,19 +14,8 @@ make ## Try: -If you have access to `/dev/audio` or `/dev/sound/dsp`: - ```sh -./coupard > /dev/audio -./coupard > /dev/sound/dsp -``` - -If you do not, first install [sox](https://en.wikipedia.org/wiki/SoX). If you -use macOS you might install it from [MacPorts](https://www.macports.org) or -[Homebrew](https://brew.sh). Then you can try: - -```sh -./coupard | sox -q -traw -r8000 -b8 -e unsigned-integer - -tcoreaudio +./try.sh ``` diff --git a/2001/coupard/try.sh b/2001/coupard/try.sh new file mode 100755 index 000000000..315af9412 --- /dev/null +++ b/2001/coupard/try.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2001/coupard +# + +# 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. +[[ -z "$CC" ]] && CC="cc" + +# in this case we won't fail if we can't compile the code because we can still +# run the supplementary program. +make CC="$CC" everything >/dev/null + +# clear screen after compilation so that only the entry is shown +clear + +# hopefully sox(1) is installed but we check for it just in case that it's not +SOX="$(type -P sox)" +AUDIO="/dev/audio" +DSP="/dev/sound/dsp" + +if [[ -n "$SOX" ]]; then + echo "$ ./coupard | $SOX -q -traw -r8000 -b8 -e unsigned-integer - -tcoreaudio" 1>&2 + read -r -n 1 -p "Press any key to continue: " + echo 1>&2 + ./coupard | "$SOX" -q -traw -r8000 -b8 -e unsigned-integer - -tcoreaudio + echo 1>&2 +elif [[ -S "$AUDIO" ]]; then + ./coupard > "$AUDIO" +elif [[ -S "$DSP" ]]; then + ./coupard > "$DSP" +else + echo "SoX not installed. Please install it and try again." 1>&2 + echo "Tip: see https://github.com/ioccc-src/temp-test-ioccc/blob/master/faq.md#sox." 1>&2 +fi diff --git a/2001/ctk/.gitignore b/2001/ctk/.gitignore index ca41c8f61..c050af53d 100644 --- a/2001/ctk/.gitignore +++ b/2001/ctk/.gitignore @@ -2,6 +2,7 @@ # sort with: ../../bin/sgi *.dSYM ctk +ctk.alt ctk.orig indent indent.c diff --git a/2001/dgbeards/README.md b/2001/dgbeards/README.md index 759f75bca..986d101ea 100644 --- a/2001/dgbeards/README.md +++ b/2001/dgbeards/README.md @@ -55,13 +55,6 @@ It's a very simple thing to do. Read the author's remarks for clues. This game crashes if it loses. -This is supposed to happen. As is written in the -[The Jargon File](http://catb.org/jargon/html/F/feature.html): - -``` -That's not a bug, that's a feature. -``` - ## Judges' remarks: diff --git a/2001/ollinger/try.sh b/2001/ollinger/try.sh index 80998d955..711a7c6c3 100755 --- a/2001/ollinger/try.sh +++ b/2001/ollinger/try.sh @@ -19,25 +19,25 @@ clear read -r -n 1 -p "Press any key to run: ./ollinger 1000 | cut -c -200 (space = next page, q = quit): " echo 1>&2 -./ollinger 1000 | cut -c -200 | less -rEXF +./ollinger 1000 | cut -c -200 | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: ./ollinger 1000 | cut -c -100 (space = next page, q = quit): " echo 1>&2 -./ollinger 1000 | cut -c -100 | less -rEXF +./ollinger 1000 | cut -c -100 | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: ./ollinger 42 (space = next page, q = quit): " echo 1>&2 -./ollinger 42 | less -rEXF +./ollinger 42 | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: ./ollinger 42 | cut -c -100 (space = next page, q = quit): " echo 1>&2 -./ollinger 42 | cut -c -100 | less -rEXF +./ollinger 42 | cut -c -100 | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: ./ollinger 42 | cut -c -200 (space = next page, q = quit): " echo 1>&2 -./ollinger 42 | cut -c -200 | less -rEXF +./ollinger 42 | cut -c -200 | less -rEXFK echo 1>&2 diff --git a/2004/hoyle/try.sh b/2004/hoyle/try.sh index a2b138cd7..ed453a82c 100755 --- a/2004/hoyle/try.sh +++ b/2004/hoyle/try.sh @@ -18,43 +18,43 @@ clear read -r -n 1 -p "Press any key to run: ./hoyle 10 0.5 (space = next page, q = quit): " echo 1>&2 -./hoyle 10 0.5 +./hoyle 10 0.5 | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: ./hoyle 1 1 1 1 (space = next page, q = quit): " echo 1>&2 -./hoyle 1 1 1 1 +./hoyle 1 1 1 1 | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: ./hoyle 2 0 1 0 -0.001 (space = next page, q = quit): " echo 1>&2 -./hoyle 2 0 1 0 -0.001 +./hoyle 2 0 1 0 -0.001 | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: ./hoyle 1 2 3 42 -0.42 (space = next page, q = quit): " echo 1>&2 -./hoyle 1 2 3 42 -0.42 +./hoyle 1 2 3 42 -0.42 | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: ./hoyle 42 42 42 42 42 42 (space = next page, q = quit): " echo 1>&2 -./hoyle 42 42 42 42 42 42 +./hoyle 42 42 42 42 42 42 | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: ./hoyle 42 42 42 42 42 (space = next page, q = quit): " echo 1>&2 -./hoyle 42 42 42 42 42 +./hoyle 42 42 42 42 42 | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: ./hoyle 0 0 1 | tee hoyle1.txt (space = next page, q = quit): " echo 1>&2 -./hoyle 0 0 1 | tee hoyle1.txt | less -rEXF +./hoyle 0 0 1 | tee hoyle1.txt | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: ./hoyle 0 0 2 | tee hoyle2.txt (space = next page, q = quit): " echo 1>&2 -./hoyle 0 0 2 | tee hoyle2.txt | less -rEXF +./hoyle 0 0 2 | tee hoyle2.txt | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: diff -s hoyle1.txt hoyle2.txt: " diff --git a/2004/newbern/try.sh b/2004/newbern/try.sh index fa2265691..7e18aa363 100755 --- a/2004/newbern/try.sh +++ b/2004/newbern/try.sh @@ -17,7 +17,7 @@ clear read -r -n 1 -p "Press any key to run: ./newbern newbern.dat \"IOCCC 2004\" (space = next page, q = quit): " echo 1>&2 -./newbern newbern.dat "IOCCC 2004" | less -rEXF +./newbern newbern.dat "IOCCC 2004" | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: echo SOS | ./newbern: " @@ -27,5 +27,5 @@ echo 1>&2 read -r -n 1 -p "Press any key to run: ./newbern newbern.dat IOCCC x (space = next page, q = quit): " echo 1>&2 -./newbern newbern.dat IOCCC x | less -rEXF +./newbern newbern.dat IOCCC x | less -rEXFK echo 1>&2 diff --git a/2004/omoikane/try.sh b/2004/omoikane/try.sh index 791cbebae..a026aff27 100755 --- a/2004/omoikane/try.sh +++ b/2004/omoikane/try.sh @@ -1,5 +1,19 @@ #!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2004/omoikane +# +# 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 read -r -n 1 -p "Press any key to run: ./omoikane omoikane.info omoikane.info omoikane.output: " echo 1>&2 diff --git a/2004/sds/try.sh b/2004/sds/try.sh index 80fde7233..30cdb4c86 100755 --- a/2004/sds/try.sh +++ b/2004/sds/try.sh @@ -17,12 +17,12 @@ clear read -r -n 1 -p "Press any key to show sds.c (space = next page, q = quit): " echo 1>&2 -less -rEXF sds.c +less -rEXFK sds.c echo 1>&2 read -r -n 1 -p "Press any key to run: ./sds < sds.c | tee encoder.c (space = next page, q = quit): " echo 1>&2 -./sds < sds.c | tee encoder.c | less -rEXF +./sds < sds.c | tee encoder.c | less -rEXFK echo 1>&2 read -r -n 1 -p "Press any key to run: make encoder 2>/dev/null: " @@ -33,7 +33,7 @@ echo 1>&2 echo "$ ./encoder README.md &2 read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " echo 1>&2 -./encoder README.md /dev/null: " echo 1>&2 @@ -43,7 +43,7 @@ echo 1>&2 echo "$ ./sds_msg < sds.c | tee sds2_msg.c | less -rEXF" 1>&2 read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " echo 1>&2 -./sds_msg < sds.c | tee sds2_msg.c | less -rEXF +./sds_msg < sds.c | tee sds2_msg.c | less -rEXFK read -r -n 1 -p "Press any key to run: diff -s sds2_msg.c encoder.c: " echo 1>&2 @@ -58,12 +58,12 @@ echo 1>&2 echo "$ ./encoder message < README.md | tee remarks.md" 1>&2 read -r -n 1 -p "Press any key to continue (space = next page, q = quit): " echo 1>&2 -./encoder message < README.md | tee remarks.md | less -rEXF +./encoder message < README.md | tee remarks.md | less -rEXFK echo 1>&2 -read -r -n 1 -p "Press any key to run: diff remarks.md README.md: " +read -r -n 1 -p "Press any key to run: diff remarks.md README.md (space = next page, q = quit): " echo 1>&2 -diff remarks.md README.md # notice how similar they are +diff remarks.md README.md | less -rEXFK echo "Did you notice how similar they are?" 1>&2 echo 1>&2 diff --git a/2005/aidan/Makefile b/2005/aidan/Makefile index a8316a53c..17a9bf762 100644 --- a/2005/aidan/Makefile +++ b/2005/aidan/Makefile @@ -132,11 +132,11 @@ all: data ${TARGET} ${PROG}: ${PROG}.c ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} -test: test-su.perl - ${PERL} $< +test: ${PROG} test-su.perl + ${PERL} test-su.perl -test-n0: test-su.perl - ${PERL} $< -n 0 +test-n0: ${PROG} test-su.perl + ${PERL} test-su.perl -n 0 # alternative executable # diff --git a/2005/boutines/README.md b/2005/boutines/README.md index d013543a6..81a1746cc 100644 --- a/2005/boutines/README.md +++ b/2005/boutines/README.md @@ -9,6 +9,8 @@ make You will need an [SVG](https://www.w3.org/TR/SVG11/expanded-toc.html) viewer or a converter like [ImageMagick](https://imagemagick.org/index.php)'s `convert`. +See [FAQ 3.17 - How do I compile and install ImageMagick for entries that +require it?](/faq.md#imagemagick). Look here to find some [SVG Viewer Implementations](https://www.w3.org/Graphics/SVG/WG/wiki/Implementations). diff --git a/2005/boutines/try.sh b/2005/boutines/try.sh index aae39ffbf..d09f2a484 100755 --- a/2005/boutines/try.sh +++ b/2005/boutines/try.sh @@ -43,7 +43,6 @@ if [[ ! -f result.svg && ! -f test.svg ]]; then fi if [[ -n "$CONVERT" ]]; then - read -r -n 1 -p "Press any key to run: convert test.svg test.png: " echo 1>&2 if ! convert test.svg test.png; then @@ -66,4 +65,5 @@ else echo 1>&2 echo "convert not found (ImageMagick not installed?)" 1>&2 echo "Try viewing *.svg with a graphics viewer that can view SVG files." 1>&2 + echo "Tip: see https://github.com/ioccc-src/temp-test-ioccc/blob/master/faq.md#imagemagick." 1>&2 fi diff --git a/2013/endoh3/try.sh b/2013/endoh3/try.sh index 39586e6b2..7fe5cb64a 100755 --- a/2013/endoh3/try.sh +++ b/2013/endoh3/try.sh @@ -76,6 +76,7 @@ endoh3() echo 1>&2 else echo "Please install either SoX, ruby or padsp (from PulseAudio)." 1>&2 + echo "Tip: see https://github.com/ioccc-src/temp-test-ioccc/blob/master/faq.md#sox." 1>&2 exit 1 fi fi diff --git a/thanks-for-help.md b/thanks-for-help.md index f4f8ef7f9..8e34cc346 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2808,14 +2808,19 @@ void e(n,h){ ``` -This was not really worth a thanks per se but it was originally done by adding -`int`. The better solution is to disable the warning which is what was done -later on to make it more like the original. +and for some reason it was being reported as an error. This was not really worth +a thanks per se but it was originally done by adding `int`. The better solution +is to disable the warning which is what was done later on to make it more like +the original. -Yusuke provided a proper command line for macOS (to do with sound; see his +[Yusuke](#yusuke) provided a proper command line for those without `/dev/audio` +or `/dev/sound/dsp` (which is most everyone nowadays, it seems, and especially +those with macOS) (to do with sound; see his [/2013/endoh3/README.md](/2013/endoh3/README.md) entry where he also refers to sound devices in macOS). +Cody added the [try.sh](/2001/coupard/try.sh). + ## [2001/ctk](/2001/ctk/ctk.c) ([README.md](/2001/ctk/README.md])) diff --git a/tmp/update-manifest.sh b/tmp/update-manifest.sh index face10c26..5110b2b46 100755 --- a/tmp/update-manifest.sh +++ b/tmp/update-manifest.sh @@ -81,7 +81,7 @@ fi # first determine if git is executable if [[ -z "$GIT" || ! -f "$GIT" || ! -x "$GIT" ]]; then - echo "$0: ERROR: git not an executable file: $GIT" 1>&2 + echo "$0: ERROR: git not a regular executable file: $GIT" 1>&2 exit 3 fi @@ -106,22 +106,33 @@ if ! cd "$TOPDIR"; then fi # I have found problems using git rev-parse to verify that we're in a git repo -# so use git status instead. Plus we need the user to see git status anyway. -"$GIT" status 1>&2 -status="$?" -if [[ "$status" -ne 0 ]]; then +# plus we need the user to see git status anyway so use git status instead. +if ! "$GIT" status 1>&2; then echo "$USAGE" 1>&2 echo 1>&2 echo "$(basename "$0"): ERROR: ${PWD} is not a git repository" 1>&2 exit 3 fi +echo 1>&2 +echo "NOTE: manifest.numbers and manifest.csv may be modified here but nothing else" 1>&2 +echo "may be and no new files may be staged for commit either:" 1>&2 read -r -p "Do you have a clean state from git status (Y/N)? " if [[ "$REPLY" != "Y" && "$REPLY" != "y" ]]; then echo "$0: exiting 4 due to user telling us there's a problem." 1>&2 exit 4 fi +# ask user if they're on the correct branch +# +echo "Showing branches: " 1>&2 +"$GIT" branch 1>&2 +read -r -p "Are you on the right branch (Y/N)? " +if [[ "$REPLY" != "Y" && "$REPLY" != "y" ]]; then + echo "$0: exiting 4 due to user telling us there's a problem." 1>&2 + exit 4 +fi + # now cd to the tmp directory # if ! cd tmp; then