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
+30
View File
@@ -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
+3 -1
View File
@@ -2061,7 +2061,9 @@ added.
## <a name="1995_leo"></a>[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).