diff --git a/2011/zucker/README.md b/2011/zucker/README.md index 7c160afb9..2a1e1ed11 100644 --- a/2011/zucker/README.md +++ b/2011/zucker/README.md @@ -14,15 +14,17 @@ binary mode from text mode. See [alternate code](#alternate-code) below. ./zucker > image.ppm ``` +Now open `image.ppm` with your image viewer of choice. + ## Try: ```sh -./zucker "Hello\!\!\!" > hello.ppm -./zucker faster\! -preview > image2.ppm +./try.sh ``` -Display the PPM image with your favorite image viewer. +After running `try.sh`, open the PPM images `ioccc.ppm`, `hello.ppm` and +`image2.ppm` with your image viewer of choice. ## Alternate code: diff --git a/2011/zucker/try.sh b/2011/zucker/try.sh new file mode 100755 index 000000000..df0444eb2 --- /dev/null +++ b/2011/zucker/try.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2011/zucker +# + +# 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 + +# 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" all >/dev/null + +# clear screen after compilation so that only the entry is shown +clear + + +read -r -n 1 -p "Press any key to run: ./zucker > ioccc.ppm: " +echo 1>&2 +./zucker > ioccc.ppm +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./zucker \"Hello!!!\" > hello.ppm: " +echo 1>&2 +./zucker "Hello\!\!\!" > hello.ppm + +read -r -n 1 -p "Press any key to run: ./zucker faster\! -preview > image2.ppm: " +echo 1>&2 +./zucker faster\! -preview > image2.ppm +echo 1>&2 + + diff --git a/thanks-for-help.md b/thanks-for-help.md index e8ad23df5..c7f603d72 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3676,13 +3676,15 @@ header files). To build try the alt rule of the Makefile. ## [2011/zucker](/2011/zucker/zucker.c) ([README.md](/2011/zucker/README.md])) -[Cody](#cody) added [alt code](/2011/zucker/README.md#alternate-code) that should work on +[Cody](#cody) added the [try.sh](/2011/zucker/try.sh) script. + +Cody also added [alt code](/2011/zucker/README.md#alternate-code) that should work on Windows, based on the author's remarks that if the system distinguishes binary and text then `stdout` needs to be set to binary mode. Cody also added the PDF file -[sphere-tracing.pdf](/2011/zucker/sphere-tracing.pdf) in case the link eventually -dies. +[sphere-tracing.pdf](/2011/zucker/sphere-tracing.pdf) in case the link +eventually dies. # 2012