Add alt scripts to 1994/schnitzi
This required an update to the .gitignore file.
This commit is contained in:
1 parent
a8f202d825
commit
3e2287f5ec
7 files changed
+121
-10
No files matched your search
@@ -8,6 +8,11 @@ prog.orig
|
||||
schnitzi
|
||||
schnitzi2
|
||||
schnitzi2.c
|
||||
schnitzi3
|
||||
schnitzi3.c
|
||||
schnitzi.alt
|
||||
schnitzi.alt2
|
||||
schnitzi.orig
|
||||
try1.txt
|
||||
try2.txt
|
||||
try3.txt
|
||||
@@ -39,7 +39,7 @@ include ../../var.mk
|
||||
# Common C compiler warnings to silence
|
||||
#
|
||||
CSILENCE= -Wno-deprecated-declarations -Wno-error -Wno-implicit-function-declaration \
|
||||
-Wno-strict-prototypes
|
||||
-Wno-strict-prototypes -Wno-implicit-int
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
|
||||
+13
-8
@@ -31,12 +31,7 @@ For more detailed information see [1994 schnitzi in bugs.md](/bugs.md#1994-schni
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
./schnitzi < /etc/motd 2>/dev/null
|
||||
./schnitzi < /etc/passwd 2>/dev/null
|
||||
|
||||
./schnitzi < schnitzi.c > schnitzi2.c 2>/dev/null
|
||||
make schnitzi2
|
||||
./schnitzi2 < README.md
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -65,6 +60,13 @@ Use `schnitzi.alt` and `schnitzi.alt2` as you would `schnitzi` above except that
|
||||
feeding the source code to it will not work right.
|
||||
|
||||
|
||||
### Alternate try:
|
||||
|
||||
```sh
|
||||
./try.alt.sh
|
||||
```
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
Try:
|
||||
@@ -77,6 +79,9 @@ Compare the output of the program with its source. Sure the output
|
||||
is different, but there is more than meets the `diff`'s eye. Can you
|
||||
find out why?
|
||||
|
||||
You might also wish to redirect the output to another file,
|
||||
compile it and compare how it works to the original code.
|
||||
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
@@ -92,14 +97,14 @@ line; for instance, for the file 'info', the program
|
||||
would be run as follows:
|
||||
|
||||
```sh
|
||||
schnitzi < info
|
||||
./schnitzi < info
|
||||
```
|
||||
|
||||
The program generates interesting results when its source file is
|
||||
used as input:
|
||||
|
||||
```sh
|
||||
schnitzi < schnitzi.c
|
||||
./schnitzi < schnitzi.c
|
||||
```
|
||||
|
||||
The result of this command is a program which does the exact same
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.alt.sh - demonstrate IOCCC winner 1994/schnitzi alt code
|
||||
#
|
||||
|
||||
# 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" alt >/dev/null || exit 1
|
||||
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./schnitzi.alt < README.md (space = next page, q = quit): "
|
||||
echo 1>&2
|
||||
./schnitzi.alt < README.md | less -rEXF
|
||||
echo 1>&2
|
||||
|
||||
echo "$ ./schnitzi.alt2 < schnitzi.alt2.c | diff - schnitzi.c" 1>&2
|
||||
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
|
||||
echo 1>&2
|
||||
./schnitzi.alt2 < schnitzi.alt2.c | diff - schnitzi.c
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./schnitzi.alt2 < README.md (space = next page, q = quit): "
|
||||
echo 1>&2
|
||||
./schnitzi.alt2 < README.md
|
||||
echo 1>&2
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 1994/schnitzi
|
||||
#
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./schnitzi < schnitzi.c > schnitzi2.c: "
|
||||
echo 1>&2
|
||||
./schnitzi < schnitzi.c > schnitzi2.c 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: make schnitzi2: "
|
||||
echo 1>&2
|
||||
make schnitzi2
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./schnitzi2 < schnitzi2.c > schnitzi3.c: "
|
||||
echo 1>&2
|
||||
./schnitzi2 < schnitzi2.c > schnitzi3.c 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: make schnitzi3: "
|
||||
echo 1>&2
|
||||
make schnitzi3
|
||||
echo 1>&2
|
||||
|
||||
|
||||
read -r -n 1 -p "Press any key to run: diff3 schnitzi.c schnitzi2.c schnitzi3.c (space = next page, q = quit): "
|
||||
echo 1>&2
|
||||
diff3 schnitzi.c schnitzi2.c schnitzi3.c | less -rEXF
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to show try.txt: "
|
||||
echo 1>&2
|
||||
cat try.txt
|
||||
echo 1>&2
|
||||
|
||||
rm -f try1.txt try2.txt try3.txt
|
||||
read -r -n 1 -p "Press any key to run: ./schnitzi < try.txt | tee try1.txt (space = next page, q = quit): "
|
||||
echo 1>&2
|
||||
./schnitzi < try.txt 2>/dev/null | tee try1.txt
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./schnitzi2 < try.txt | tee try2.txt (space = next page, q = quit): "
|
||||
echo 1>&2
|
||||
./schnitzi2 < try.txt 2>/dev/null | tee try2.txt
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./schnitzi3 < try.txt | tee try3.txt (space = next page, q = quit): "
|
||||
echo 1>&2
|
||||
./schnitzi3 < try.txt 2>/dev/null | tee try3.txt
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: diff3 try1.txt try2.txt try3.txt: "
|
||||
echo 1>&2
|
||||
diff3 try1.txt try2.txt try3.txt && echo "All three files are the same!"
|
||||
echo 1>&2
|
||||
@@ -0,0 +1 @@
|
||||
1994/schnitzi IOCCC winner test file.
|
||||
Reference in new issue
Block a user