Merge pull request #1924 from xexyl/savastio95-bugs-try
Add 1995/savastio/try.sh and update bugs.md
This commit is contained in:
8 files changed
+142
-4
No files matched your search
@@ -17,7 +17,7 @@ where num is a non-negative number.
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./heathbar 4253 2281
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 1995/heathbar
|
||||
#
|
||||
|
||||
# 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
|
||||
|
||||
heathbar()
|
||||
{
|
||||
if [[ "$#" -ne 2 ]]; then
|
||||
echo "$0: heathbar() expects two args, got $#" 1>&2
|
||||
return
|
||||
elif [[ "$1" -lt 0 || "$2" -lt 0 ]]; then
|
||||
echo "$0: heathbar() expects two positive digits, got $1 $2" 1>&2
|
||||
return
|
||||
fi
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./heathbar $1 $2: "
|
||||
echo 1>&2
|
||||
./heathbar "$1" "$2"
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo \$(($1 + $2)): "
|
||||
echo 1>&2
|
||||
echo "$(("$1" + "$2"))"
|
||||
echo 1>&2
|
||||
|
||||
if [[ $(("$1"+"$2")) == "$(./heathbar "$1" "$2")" ]]; then
|
||||
echo "\$(($1+$2)) == ./heathbar $1 $2: $(./heathbar "$1" "$2")" 1>&2
|
||||
else
|
||||
echo "ERROR: \$(($1+$2)) != ./heathbar $1 $2: $(($1+$2)) != $(./heathbar "$1" "$2")" 1>&2
|
||||
fi
|
||||
|
||||
echo 1>&2
|
||||
}
|
||||
heathbar 4253 2281
|
||||
heathbar 1 2
|
||||
heathbar 3 5
|
||||
heathbar 1234 999
|
||||
read -r -n 1 -p "Press any key to try non-numbers: "
|
||||
echo 1>&2
|
||||
heathbar foo bar
|
||||
@@ -1,6 +1,8 @@
|
||||
#
|
||||
# sort with: sort -d -u
|
||||
*.dSYM
|
||||
bar.txt
|
||||
foo.txt
|
||||
indent
|
||||
indent.c
|
||||
indent.o
|
||||
|
||||
@@ -39,7 +39,8 @@ include ../../var.mk
|
||||
# Common C compiler warnings to silence
|
||||
#
|
||||
CSILENCE= -Wno-empty-body -Wno-format -Wno-incompatible-library-redeclaration \
|
||||
-Wno-non-literal-null-conversion -Wno-deprecated-non-prototype -Wno-strict-prototypes
|
||||
-Wno-non-literal-null-conversion -Wno-deprecated-non-prototype -Wno-strict-prototypes \
|
||||
-Wno-implicit-int
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
|
||||
+16
-2
@@ -5,18 +5,32 @@ make all
|
||||
```
|
||||
|
||||
|
||||
### Bugs and (Mis)features:
|
||||
|
||||
The current status of this entry is:
|
||||
|
||||
```
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
```
|
||||
|
||||
For more detailed information see [1995 savastio in bugs.md](/bugs.md#1995-savastio).
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./savastio
|
||||
# enter a number such as 100
|
||||
# enter a POSITIVE number such as 100
|
||||
```
|
||||
|
||||
NOTE: if you specify a negative number it will get stuck, showing no output. But
|
||||
what happens if you give a non-number?
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
echo 42 | ./savastio
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 1995/savastio
|
||||
#
|
||||
|
||||
# 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: echo 42 | ./savastio: "
|
||||
echo 1>&2
|
||||
echo 42 | ./savastio
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo 24 | ./savastio: "
|
||||
echo 1>&2
|
||||
echo 24 | ./savastio
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo 6 | ./savastio: "
|
||||
echo 1>&2
|
||||
echo 6 | ./savastio
|
||||
echo 1>&2
|
||||
|
||||
rm -f foo.txt
|
||||
read -r -n 1 -p "Press any key to run: echo foo | ./savastio | tee foo.txt: "
|
||||
echo 1>&2
|
||||
echo foo | ./savastio | tee foo.txt
|
||||
echo 1>&2
|
||||
|
||||
rm -f bar.txt
|
||||
read -r -n 1 -p "Press any key to run: echo bar | ./savastio | tee bar.txt: "
|
||||
echo 1>&2
|
||||
echo bar | ./savastio | tee bar.txt
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to show the diff of foo.txt and bar.txt: "
|
||||
echo 1>&2
|
||||
diff -s foo.txt bar.txt
|
||||
echo 1>&2
|
||||
rm foo.txt bar.txt
|
||||
@@ -1479,6 +1479,16 @@ 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 savastio
|
||||
|
||||
### STATUS: INABIAF - please **DO NOT** fix
|
||||
### Source code: [1995/savastio/savastio.c](1995/savastio/savastio.c)
|
||||
### Information: [1995/savastio/README.md](1995/savastio/README.md)
|
||||
|
||||
This program expects a POSITIVE number. If you specify a negative number it will
|
||||
not show any output, stuck in a loop.
|
||||
|
||||
|
||||
## 1995 vanschnitz
|
||||
|
||||
### STATUS: missing file - please provide it
|
||||
|
||||
@@ -2052,6 +2052,11 @@ to specify which one to use is to make it easier on the user as typing
|
||||
running `./try.alt.sh`.
|
||||
|
||||
|
||||
## <a name="1995_heathbar"></a>[1995/heathbar](/1995/heathbar/heathbar.c) ([README.md](/1995/heathbar/README.md]))
|
||||
|
||||
[Cody](#cody) added the [try.sh](/1995/heathbar/try.sh) script.
|
||||
|
||||
|
||||
## <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
|
||||
@@ -2066,6 +2071,11 @@ function (`pain()` as it's annoying that clang is this way :-) ) that `main()`
|
||||
calls which has the four args.
|
||||
|
||||
|
||||
## <a name="1995_savastio"></a>[1995/savastio](/1995/savastio/savastio.c) ([README.md](/1995/savastio/README.md]))
|
||||
|
||||
[Cody](#cody) added the [try.sh](/1995/savastio/try.sh) script.
|
||||
|
||||
|
||||
## <a name="1995_vanschnitz"></a>[1995/vanschnitz](/1995/vanschnitz/vanschnitz.c) ([README.md](/1995/vanschnitz/README.md))
|
||||
|
||||
[Cody](#cody) added the authors' [spoiler as a C
|
||||
|
||||
Reference in new issue
Block a user