Add 2000/dlowe/try.sh, update bugs.md, format

The try.sh script also has some fixes in the author's remarks (as in
they were fixed in the author's remarks) - it had "s in the command line
rather than single quotes but some of these command lines had * which
would expand to the files in the directory, causing errors.

The bugs.md has been updated with the issue of not printing 'poot' when
it should. I did some debugging and removed some (obviously nonsense)
ideas I had put in before (without thinking, being too tired, whatever
other reason or reasons). The real issue is a very strange one to be
sure.

I am pretty sure the reason it does not work with macOS (this was
already noted but worth repeating) is the version of perl as the author
noted this as an issue. We still have it as a known bug (some platforms)
but I don't think it's possible to fix without a higher perl version and
neither MacPorts nor Homebrew seem to have this.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-06 06:40:24 -08:00
1 parent 4714fa739a
commit 07c10027f7
4 files changed
+94 -14

No files matched your search

+7 -7
View File
@@ -127,19 +127,19 @@ Floating point exception (core dumped) (or something to that effect)
### Examples:
```sh
$ echo "12 13 14 15 16 + + + + f" | ./dlowe
$ echo '12 13 14 15 16 + + + + f' | ./dlowe
70
$ echo "12 13 14 15 16 17 + - * / p" | ./dlowe
$ echo '12 13 14 15 16 17 + - * / p' | ./dlowe
-0.0515873015873016
$ echo "+" | ./dlowe
$ echo '+' | ./dlowe
stack empty
$ echo "999999999999999 1 + p" | ./dlowe
$ echo '999999999999999 1 + p' | ./dlowe
1e+15
$ echo "99999999999999 1 + p" | ./dlowe
$ echo '99999999999999 1 + p' | ./dlowe
100000000000000
$ echo "12.5 9 % 10 * 15 + f" | ./dlowe
$ echo '12.5 9 % 10 * 15 + f' | ./dlowe
50
$ echo "7 P 6 d P P 8 p" | ./dlowe | tr 876 tpo
$ echo '7 P 6 d P P 8 p' | ./dlowe | tr 876 tpo
poot
```
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2000/dlowe
#
# 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
echo "$ echo '13 14 15 16 17 + - * / p' | ./dlowe" 1>&2
echo '13 14 15 16 17 + - * / p' | ./dlowe
echo "$ echo '12 13 14 15 16 + + + + f' | ./dlowe" 1>&2
echo '12 13 14 15 16 + + + + f' | ./dlowe
echo "$ echo '12 13 14 15 16 17 + - * / p' | ./dlowe" 1>&2
echo '12 13 14 15 16 17 + - * / p' | ./dlowe
echo "$ echo '+' | ./dlowe" 1>&2
echo '+' | ./dlowe
echo "$ echo '999999999999999 1 + p' | ./dlowe" 1>&2
echo '999999999999999 1 + p' | ./dlowe
echo "$ echo '99999999999999 1 + p' | ./dlowe" 1>&2
echo '99999999999999 1 + p' | ./dlowe
echo "$ echo '12.5 9 % 10 * 15 + f' | ./dlowe" 1>&2
echo '12.5 9 % 10 * 15 + f' | ./dlowe