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
|
# sort with: sort -d -u
|
||||||
*.dSYM
|
*.dSYM
|
||||||
|
bar.txt
|
||||||
|
foo.txt
|
||||||
indent
|
indent
|
||||||
indent.c
|
indent.c
|
||||||
indent.o
|
indent.o
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ include ../../var.mk
|
|||||||
# Common C compiler warnings to silence
|
# Common C compiler warnings to silence
|
||||||
#
|
#
|
||||||
CSILENCE= -Wno-empty-body -Wno-format -Wno-incompatible-library-redeclaration \
|
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
|
# 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:
|
## To use:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./savastio
|
./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:
|
## Try:
|
||||||
|
|
||||||
```sh
|
```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.
|
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
|
## 1995 vanschnitz
|
||||||
|
|
||||||
### STATUS: missing file - please provide it
|
### STATUS: missing file - please provide it
|
||||||
|
|||||||
@@ -2071,6 +2071,11 @@ function (`pain()` as it's annoying that clang is this way :-) ) that `main()`
|
|||||||
calls which has the four args.
|
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))
|
## <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
|
[Cody](#cody) added the authors' [spoiler as a C
|
||||||
|
|||||||
Reference in new issue
Block a user