Add 2018/hou/try.sh + format/typo checks

This commit is contained in:
Cody Boone Ferguson committed 2023-12-11 09:38:46 -08:00
1 parent 1959925eda
commit 26c4717ad4
3 files changed
+47 -9

No files matched your search

+4 -9
View File
@@ -28,15 +28,10 @@ View `output.html` in a browser.
### Try:
```sh
grep -e '[-?+*/^&|.<>=]' prog.c
(cd ..; ls -lS */prog.c) | \
awk 'BEGIN { print "["; } { print "{\"winner\":\"",$9,"\", \"size\":",$5,"},"} END { print "]"}' \
> ioccc.json
./prog < ioccc.json > ioccc.html
./try.sh
```
View `output.html` in a browser.
As the script says, open `output.html` in a browser.
What's not right with the output? How can one fix it?
@@ -44,7 +39,7 @@ What's not right with the output? How can one fix it?
## Judges' remarks:
This entry exhibits a way of obfuscation we haven't seen before, we think.
The rulez of programming in an imperative language are violated, aren't they?
The `rulez` of programming in an imperative language are violated, aren't they?
Try figuring out how to increase the number of different colors, if you can.
@@ -58,7 +53,7 @@ to generate an HTML page from a JSON feed.
This entry takes such decadence to an extreme. It just calls a bunch of
libraries to generate an HTML page from a JSON feed, literally. There is no
variable (function parameters included), no operator, no flow control statements
except a few decorative returns. In compliance to production coding standards,
except a few decorative `return`s. In compliance to production coding standards,
the code is littered with fashionable jargon, doxygen comment, and license text.
As one would expect from such an approach, this program is much more resource
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2018/hou
#
# 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 run: grep -e '[-?+*/^&|.<>=]' prog.c (space = next page, q = quit): "
echo 1>&2
grep -e '[-?+*/^&|.<>=]' prog.c | less -EXF
echo 1>&2
# ^-- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
# ^-- SC1083 (warning): This { is literal. Check expression (missing ;/\n?) or quote it.
# ^-- SC1083 (warning): This } is literal. Check expression (missing ;/\n?) or quote it.
# ^-- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
# shellcheck disable=SC2140
# shellcheck disable=SC1083
echo "(cd ..; ls -lS -- */prog.c) | \
awk 'BEGIN { print "["; } { print "{\"winner\":\"",\$9,"\", \"size\":",\$5,"},"} END { print "]"}' \
> ioccc.json"
(cd ..; ls -lS -- */prog.c) | \
awk 'BEGIN { print "["; } { print "{\"winner\":\"",$9,"\", \"size\":",$5,"},"} END { print "]"}' \
> ioccc.json
./prog < ioccc.json > ioccc.html
echo 1>&2
echo "Now open ioccc.html in your browser." 1>&2
exit 0
+2
View File
@@ -3974,6 +3974,8 @@ that's probably true: let's just say that for the IOCCC I'm (Cody) a weasel! :-)
[Cody](#cody) added explicit linking of libm (`-lm`) for systems that do not do this
(Linux doesn't seem to but macOS does).
Cody also added the [try.sh](/2018/hou/try.sh) script.
## <a name="2018_vokes"></a>[2018/vokes](/2018/vokes/prog.c) ([README.md](/2018/vokes/README.md))