2012/endoh2/everything.sh -> try.sh and formatting

To make the script more like the other entries I renamed the script I
originally named everything.sh (because there's so much it does and it
uses 'make everything') to try.sh.

The README.md file has been format and typo checked.

This should complete the review of 2012/endoh2.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-02 09:26:28 -08:00
1 parent c9503446e4
commit 41dd7d842d
4 files changed
+60 -42

No files matched your search

+13 -8
View File
@@ -27,7 +27,7 @@ gcc -o e e.c
### Try:
```sh
./everything.sh
./try.sh
```
@@ -50,7 +50,7 @@ program and [pi](https://en.wikipedia.org/wiki/Pi) or
[e](https://en.wikipedia.org/wiki/E_(mathematical_constant))) computation. I
know you're tired of them.
But have you ever seen **all-in-one**?
But have you ever seen them **all-in-one**?
### What it is
@@ -72,7 +72,7 @@ rather than pi.
### Obfuscation
This program itself is in the shape of a
[spigot](https://en.wikipedia.org/wiki/Tap_(valve)). This is derived from
[spigot](https://en.wikipedia.org/wiki/Tap_(valve)). This is derived as an
analogy with [spigot algorithm](https://en.wikipedia.org/wiki/Spigot_algorithm)
which infinitely computes the value of a mathematical constant such as
[pi](https://en.wikipedia.org/wiki/Pi) or
@@ -103,19 +103,24 @@ directives](https://en.wikipedia.org/wiki/C_preprocessor). In my program,
These design requirements made my program well-obfuscated
willy-nilly.
### Portability
I expect it to work in any major environment and C compiler. To build with no
warning, it requires two C99 features: string literal more than 509 characters
and not requiring a return in `main()` function. In fact, recent compilers with
`-std=c99 -Wall -W -Wextra -pedantic` would say nothing.
warning, it requires two C99 features: allow string literal to be more than 509
characters and not requiring a return in `main()`. In fact, recent compilers
with `-std=c99 -Wall -W -Wextra -pedantic` would say nothing.
gcc -std=c99 -Wall -W -Wextra -pedantic spigot.c
clang -std=c99 -Wall -W -Wextra -pedantic spigot.c
```sh
gcc -std=c99 -Wall -W -Wextra -pedantic spigot.c
clang -std=c99 -Wall -W -Wextra -pedantic spigot.c
```
I've tested with gcc-4.6.3 and clang-3.0 on Linux (Ubuntu 12.04)
and gcc-4.5.3 and clang-3.1 on Cygwin.
### Synopsis
```sh
-33
View File
@@ -1,33 +0,0 @@
#!/usr/bin/env bash
make everything || exit 1
run()
{
local program="$1"
echo "" 1>&2
echo -n "$ ./${program}" 1>&2
sleep 2
"./${program}" | less -K -e
}
echo "running everything with $(type -P less): " 1>&2
echo 1>&2
run pi
run 314
run 3141
run 31415
run 314159
run 3141592
run 31415926
run 314159265
run 3141592653
run 31415926535
run e 271
run 2718
run 27182
run 271828
run 2718281
run 27182818
run 271828182
run 2718281828
run 27182818284
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2000/tomx
#
# 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" everything >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
run()
{
local program="$1"
echo "" 1>&2
read -r -n 1 -p "Press any key to run: ./${program} (space = next page, q = quit): "
"./${program}" | less -K -E -X
}
run pi
run 314
run 3141
run 31415
run 314159
run 3141592
run 31415926
run 314159265
run 3141592653
run 31415926535
run e 271
run 2718
run 27182
run 271828
run 2718281
run 27182818
run 271828182
run 2718281828
run 27182818284
+4 -1
View File
@@ -3363,7 +3363,10 @@ de-obfuscated version.
## [2012/endoh2](2012/endoh2/endoh2.c) ([README.md](2012/endoh2/README.md))
[Cody](#cody) fixed a typo in the ruby script
[Cody](#cody) added the [try.sh](2012/endoh2/try.sh) script that runs
everything, filtered through less.
Cody also fixed a typo in the ruby script
[find-font-table.rb](2012/endoh2/find-font-table.rb).