Add 2015/endoh4/try.sh + format/typo checks

This commit is contained in:
Cody Boone Ferguson committed 2023-12-08 10:38:42 -08:00
1 parent d9b2810392
commit 549633020f
3 files changed
+77 -12

No files matched your search

+14 -12
View File
@@ -5,6 +5,10 @@ make
```
There is an alt version which is the originally submitted entry. See [Alternate
code](#alternate-code) below for details.
## To use:
```sh
@@ -15,29 +19,27 @@ make
### Try:
```sh
./prog @ @ @ @ @ @
./prog @ @ @ @ @ @ @ @ @ @ @ @
./prog $(perl -e 'print "@ " x (2*3*5*7);')
./prog $(< Makefile)
./try.sh
```
## Alternate code:
An alternate version of this entry, `prog.alt.c`, is provided.\
An alternate version of this entry, [prog.alt.c](prog.alt.c), is provided.
This alternate code does not contain improvements suggested by [Gil
Dogon](/winners.html#Gil_Dogon); it is
the author's original entry.
Dogon](/winners.html#Gil_Dogon); it is the author's original entry.
### Alternate build:
To compile this alternate version:
```sh
make alt
```
### Alternate use:
Use `prog.alt` as you would `prog` above.
@@ -67,7 +69,7 @@ gcc -o prog prog.c
Inspired by [Animated Factorization
Diagrams](http://www.datapointed.net/visualizations/math/factorization/animated-diagrams/).
`prog.alt.c` is the original version that I submitted. [Gil
[prog.alt.c](prog.alt.c) is the original version that I submitted. [Gil
Dogon](/winners.html#Gil_Dogon) kindly improved it during the review. Thank
you!
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2015/endoh4
#
# 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
PERL="$(type -P perl)"
echo "$ ./prog @" 1>&2
./prog @
echo "$ ./prog @ @" 1>&2
./prog @ @
echo "$ ./prog @ @ @" 1>&2
./prog @ @ @
echo "$ ./prog @ @ @ @ @" 1>&2
./prog @ @ @ @ @
echo "$ ./prog @ @ @ @ @ @" 1>&2
./prog @ @ @ @ @ @
echo "$ ./prog @ @ @ @ @ @ @" 1>&2
./prog @ @ @ @ @ @ @
echo "$ ./prog @ @ @ @ @ @ @ @" 1>&2
./prog @ @ @ @ @ @ @ @
echo "$ ./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @" 1>&2
./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
echo "$ ./prog @ @ @ @ @ @ @ @ @ @ @ @" 1>&2
./prog @ @ @ @ @ @ @ @ @ @ @ @
echo "$ ./prog \"\$(< Makefile)\"" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
./prog "$(< Makefile)"
if [[ -n "$PERL" ]]; then
echo "$ ./prog \$($PERL -e 'print "@ " x (2*3*5*7);')" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
./prog "$($PERL -e 'print "@ " x (2*3*5*7);')"
fi
+5
View File
@@ -3825,6 +3825,11 @@ simply typing `make back_to` or `make mullender`) and then runs the famous
[1984/mullender.c](/1984/mullender/mullender.c).
## [2015/endoh4](2015/endoh4/prog.c) ([README.md](2015/endoh4/README.md]))
[Cody](#cody) added the [try.sh](2015/endoh4/try.sh) script.
## [2015/hou](2015/hou/prog.c) ([README.md](2015/hou/README.md))
[Cody](#cody) added explicit linking of libm (`-lm`) for systems that do not do this