From c7620f2b96780c37b4327917dbcf47fbc4a09974 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sun, 21 Jan 2024 11:24:51 -0800 Subject: [PATCH] Add 2005/persano/try.sh --- 2005/persano/.gitignore | 1 + 2005/persano/README.md | 4 ++-- 2005/persano/try.sh | 45 +++++++++++++++++++++++++++++++++++++++++ thanks-for-help.md | 2 ++ 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100755 2005/persano/try.sh diff --git a/2005/persano/.gitignore b/2005/persano/.gitignore index b47eaf316..679625f01 100644 --- a/2005/persano/.gitignore +++ b/2005/persano/.gitignore @@ -8,3 +8,4 @@ indent.o persano persano.orig prog.orig +seal.gif diff --git a/2005/persano/README.md b/2005/persano/README.md index 5f7a3390f..44e755e5a 100644 --- a/2005/persano/README.md +++ b/2005/persano/README.md @@ -18,10 +18,10 @@ setting binary mode on `stdout`. See [alternate code](#alternate-code) below. ## Try: ```sh -./persano 3 16 > knot3-16.gif +./try.sh ``` -Open the [GIF](https://en.wikipedia.org/wiki/GIF) file with a viewer capable of +Open the [GIF](https://en.wikipedia.org/wiki/GIF) files with a viewer capable of displaying animated GIFs and watch closely at the bottom of the picture (you may need to use [gifsicle](https://www.lcdf.org/gifsicle/) - a great tool to manipulate animated GIFs - to slow down the animation and to compress the GIFs diff --git a/2005/persano/try.sh b/2005/persano/try.sh new file mode 100755 index 000000000..f9a45f5ec --- /dev/null +++ b/2005/persano/try.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2005/persano +# + +# 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: ./persano 3 16 > knot3-16.gif: " +echo 1>&2 +./persano 3 16 > knot3-16.gif +echo 1>&2 +if [[ -f knot3-16.gif ]]; then + echo "Now open the file knot3-16.gif in a GIF viewer capable of viewing animated" 1>&2 + echo "GIFs. See the README.md for details on a tool to manipulate it, if you wish." 1>&2 +fi + +read -r -n 1 -p "Press any key to run: ./persano 3 2 1 > foo.gif: " +echo 1>&2 +./persano 3 2 1 > foo.gif +echo 1>&2 +if [[ -f foo.gif ]]; then + echo "Now open the file foo.gif in a GIF viewer capable of viewing animated" 1>&2 + echo "GIFs. See the README.md for details on a tool to manipulate it, if you wish." 1>&2 +fi + +read -r -n 1 -p "Press any key to run: ./persano 5 2 > seal.gif: " +echo 1>&2 +./persano 5 2 > seal.gif +echo 1>&2 + +if [[ -f seal.gif ]]; then + echo "Now open seal.gif (Solomon's Seal knot) in a GIF viewer capable of viewing" 1>&2 + echo "animated GIFs. See the README.md for details on a tool to manipulate it, if you wish." 1>&2 +fi diff --git a/thanks-for-help.md b/thanks-for-help.md index d3d5580a6..ce80553d1 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3330,6 +3330,8 @@ code](/2005/persano/README.md#alternate-code) which should work for Windows as i sets binary mode on `stdout`. It is untested as Cody has no Windows system to test it on. +Cody also added the [try.sh](/2005/persano/try.sh) script. + ## [2005/sykes](/2005/sykes/sykes.c) ([README.md](/2005/sykes/README.md]))