Add 1995/leo/try.sh and update bugs.md

There appears to be a bug where the program blocks. In one case another
command makes it work but the judges remarks suggest one way and it does
not. The other command does not seem to work at all, even if used like
the workaround with the first one.

Updated make clobber to remove foo.ps.

Updated .gitignore.
This commit is contained in:
Cody Boone Ferguson committed 2024-02-21 09:26:14 -08:00
1 parent d0e84ad655
commit 92dac816e6
6 files changed
+82 -14

No files matched your search

+1
View File
@@ -1,6 +1,7 @@
#
# sort with: ../../bin/sgi
*.dSYM
foo.ps
indent
indent.c
indent.o
+1 -1
View File
@@ -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'; \
+13 -12
View File
@@ -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:
+34
View File
@@ -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