Add 1995/savastio/try.sh and update bugs.md
The try.sh script demonstrates both positive numbers and input that is not a number at all (comparing two different strings). The bugs.md has a new INABIAF - negative numbers will hang the program. It is not clear if another version should be added to gracefully handle this but that can be decided another time. It is not a documented feature so it might be called a bug to fix.
This commit is contained in:
1 parent
3463d79557
commit
0a4af08ac9
6 files changed
+84
-3
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user