Add 2011/zucker/try.sh
This commit is contained in:
1 parent
3b0a3b12a0
commit
48e7331f57
3 files changed
+45
-6
No files matched your search
@@ -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:
|
||||
|
||||
Executable
+35
@@ -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
|
||||
|
||||
|
||||
+5
-3
@@ -3676,13 +3676,15 @@ header files). To build try the alt rule of the Makefile.
|
||||
|
||||
## <a name="2011_zucker"></a>[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.
|
||||
|
||||
|
||||
# <a name="2012"></a>2012
|
||||
|
||||
Reference in new issue
Block a user