Add 2018/ciura/try.alt.sh

This also fixes the missing reference to try.sh in the README.md file.

Using both scripts one can see the problem the alt code has that was
fixed by the author.
This commit is contained in:
Cody Boone Ferguson committed 2024-02-02 08:37:35 -08:00
1 parent e1a0f7ab93
commit c9f3d42937
3 files changed
+40 -3

No files matched your search

+11 -2
View File
@@ -19,8 +19,7 @@ below for more details.
## Try:
```sh
./prog < Makefile
./prog < README.md
./try.sh
```
@@ -43,6 +42,16 @@ make alt
Use `prog.alt` as you would `prog` above.
### Alternate try:
```sh
./try.alt.sh
```
Do you spot the fix by running both [try.sh](try.sh) and
[try.alt.sh](try.alt.sh)?
## Judges' remarks:
This text was processed by `prog`. You may get confused. We're not really sure:
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
#
# try.alt.sh - demonstrate IOCCC winner 2018/ciura 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
# clear screen after compilation so that only the entry is shown
clear
read -r -n 1 -p "Press any key to run: ./prog.alt < Makefile: "
echo 1>&2
./prog.alt < Makefile
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog.alt < README.md: "
echo 1>&2
./prog.alt < README.md
exit 0