Add 1990/scjones/try.sh
The script allows one to more easily see (and verify) what the entry does. This involves a temporary file that is created (and removed at the end of the script but which has also been added to .gitignore).
This commit is contained in:
1 parent
9a69a9dd24
commit
3065fc20d8
4 files changed
+46
No files matched your search
@@ -7,3 +7,4 @@ indent.o
|
|||||||
prog.orig
|
prog.orig
|
||||||
scjones
|
scjones
|
||||||
scjones.orig
|
scjones.orig
|
||||||
|
scjones.tmp.c
|
||||||
@@ -12,6 +12,13 @@ make all
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Try:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./try.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|
||||||
The addition of trigraphs has made it easier to make programs hard to read. It
|
The addition of trigraphs has made it easier to make programs hard to read. It
|
||||||
|
|||||||
Executable
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# try.sh - demonstrate IOCCC winner 1990/scjones
|
||||||
|
#
|
||||||
|
|
||||||
|
# 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 show scjones.c: "
|
||||||
|
echo 1>&2
|
||||||
|
less -rEXF scjones.c
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: ./scjones (space = next page, q = quit): "
|
||||||
|
echo 1>&2
|
||||||
|
./scjones | less -rEXF
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: ./scjones > scjones.tmp.c: "
|
||||||
|
echo 1>&2
|
||||||
|
./scjones > scjones.tmp.c
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to compare scjones.c and scjones.tmp.c: "
|
||||||
|
echo 1>&2
|
||||||
|
diff -s scjones.c scjones.tmp.c
|
||||||
|
rm scjones.tmp.c
|
||||||
@@ -1056,6 +1056,9 @@ something else and is recommended by the author as well.
|
|||||||
[Yusuke](#yusuke) suggested `-ansi` to get the entry to compile due to trigraphs and [Cody](#cody)
|
[Yusuke](#yusuke) suggested `-ansi` to get the entry to compile due to trigraphs and [Cody](#cody)
|
||||||
suggested `-trigraphs`. Both work but we used Yusuke's idea.
|
suggested `-trigraphs`. Both work but we used Yusuke's idea.
|
||||||
|
|
||||||
|
Cody added the [try.sh](/1990/scjones/try.sh) script to show exactly what the
|
||||||
|
entry does.
|
||||||
|
|
||||||
|
|
||||||
## <a name="1990_tbr"></a>[1990/tbr](/1990/tbr/tbr.c) ([README.md](/1990/tbr/README.md]))
|
## <a name="1990_tbr"></a>[1990/tbr](/1990/tbr/tbr.c) ([README.md](/1990/tbr/README.md]))
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user