diff --git a/1995/leo/.gitignore b/1995/leo/.gitignore index 092bef7c4..8714ca785 100644 --- a/1995/leo/.gitignore +++ b/1995/leo/.gitignore @@ -1,6 +1,7 @@ # # sort with: ../../bin/sgi *.dSYM +foo.ps indent indent.c indent.o diff --git a/1995/leo/Makefile b/1995/leo/Makefile index 716641ee8..a53424aca 100644 --- a/1995/leo/Makefile +++ b/1995/leo/Makefile @@ -203,7 +203,7 @@ clean: clobber: clean ${RM} -f ${TARGET} ${ALT_TARGET} - ${RM} -rf *.dSYM + ${RM} -rf *.dSYM foo.ps @-if [ -e sandwich ]; then \ ${RM} -f sandwich; \ echo 'ate sandwich'; \ diff --git a/1995/leo/README.md b/1995/leo/README.md index a4fe5ba43..fcf4f2ff8 100644 --- a/1995/leo/README.md +++ b/1995/leo/README.md @@ -5,6 +5,18 @@ make all ``` +### Bugs and (Mis)features: + +The current status of this entry is: + +``` +STATUS: known bug - please help us fix +``` + +For more detailed information see [1995 leo in bugs.md](/bugs.md#1995-leo). + + + ## To use: ```sh @@ -17,20 +29,9 @@ See the author's information below on these details. ## Try: ```sh -./leo 1 | cat - /dev/tty | gs - - -./leo 37 80 | cat - /dev/tty | gs - +./try.sh ``` -If you don't have gs or an equivalent postscript viewer, try: - -```sh -echo "" | ./leo 1 > foo.ps -``` - -and send foo.ps to your local postscript printer or open it in an appropriate -application (e.g. GIMP). - ## Judges' remarks: diff --git a/1995/leo/try.sh b/1995/leo/try.sh new file mode 100755 index 000000000..ea6cb8e70 --- /dev/null +++ b/1995/leo/try.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC entry 1995/leo +# + +# 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 + + +# try finding gs +GS="$(type -P gs)" + +rm -f foo.ps +read -r -n 1 -p "Press any key to run: ./leo 1 | cat - > foo.ps: " +echo "" | ./leo 1 | cat - > foo.ps +echo 1>&2 +# if they have gs open foo.ps with it +if [[ -n "$GS" ]]; then + read -r -n 1 -p "Press any key to run: $GS foo.ps: " + echo 1>&2 + "$GS" foo.ps +else + echo "Now send foo.ps to your local postscript printer or open it in an appropriate" 1>&2 + echo "application (e.g. GIMP)." 1>&2 +fi diff --git a/bugs.md b/bugs.md index 6751aae46..8fec0c272 100644 --- a/bugs.md +++ b/bugs.md @@ -1491,6 +1491,36 @@ supposed to be printed again and one is supposed to press a key as at that point it calls `getchar()` via the pointer `m`. So this is a feature not a bug. +## 1995 leo + +### STATUS: known bug - please help us fix +### Source code: [1995/leo/leo.c](1995/leo/leo.c) +### Information: [1995/leo/README.md](1995/leo/README.md) + +The judges suggested that the following commands should result in output: + + +```sh +./leo 1 | cat - /dev/tty | gs - + +./leo 37 80 | cat - /dev/tty | gs - +``` + +The first one can work if one does instead: + +```sh +echo "" | ./leo 1 > foo.ps +gs foo.ps +``` + +but it is supposed to work in the pipeline as is. The second one does not appear +to work at all even if one redirects to a file (like the workaround for the +first) as it appears to just block. + +It is not known if this is platform specific but this was observed in macOS and +it would be good if it was fixed. + + ## 1995 savastio ### STATUS: INABIAF - please **DO NOT** fix diff --git a/thanks-for-help.md b/thanks-for-help.md index 7ee2aaefa..226bf0403 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2061,7 +2061,9 @@ added. ## [1995/leo](/1995/leo/leo.c) ([README.md](/1995/leo/README.md])) -At our change in how to deal with spoilers, [Cody](#cody) uudecoded the spoiler provided +[Cody](#cody) added the [try.sh](/1995/leo/try.sh) script. + +At our change in how to deal with spoilers, Cody also uudecoded the spoiler provided by the author, putting it in [spoiler1.md](/1995/leo/spoiler1.md).