Add alt code to 2014/maffiodo2 + try.sh script

The alt code is from the author.

The try.sh script has the example command provided by the judges as well
as some by the author. One was removed because of a syntax error
(removed from the author's examples).

Format/typo check README.md file.

The only thing that has to be done is to update the references to
twitter to note how the IOCCC no longer endorses twitter or whatever the
rocket destroyer wishes to call it (though certainly it won't be worded
like that :-) ).
This commit is contained in:
Cody Boone Ferguson committed 2023-12-05 13:05:16 -08:00
1 parent 7d432e5f09
commit dc538865af
6 files changed
+128 -9

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2014/maffiodo2
#
# 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
echo "$ cat image.rgb | ./prog ' .,:;!$#@'" 1>&2
read -r -n 1 -p "Press any key to run command (space = next page, q = quit): "
echo 1>&2
# ^-------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat image.rgb | ./prog ' .,:;!$#@' | less -EXF
echo "$ cat image.rgb | ./prog ' .:;Y0'" 1>&2
read -r -n 1 -p "Press any key to run command (space = next page, q = quit): "
echo 1>&2
# ^-------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat image.rgb | ./prog " .:;Y0" | less -EXF
echo "$ cat image.rgb | ./prog ' :1'" 1>&2
read -r -n 1 -p "Press any key to run command (space = next page, q = quit): "
echo 1>&2
# ^-------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat image.rgb | ./prog ' :1' | less -EXF
echo "$ cat image.rgb | ./prog ' .:;Y0'" 1>&2
read -r -n 1 -p "Press any key to run command (space = next page, q = quit): "
echo 1>&2
# ^-------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat image.rgb | ./prog ' .:;Y0' | less -EXF
echo "$ cat image.rgb | ./prog ' .:-=+*#%@'" 1>&2
read -r -n 1 -p "Press any key to run command (space = next page, q = quit): "
echo 1>&2
# ^-------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat image.rgb | ./prog ' .:-=+*#%@' | less -EXF
echo "$ cat image.rgb | ./prog ' .,:!-iots&8%#@$'" 1>&2
read -r -n 1 -p "Press any key to run command (space = next page, q = quit): "
echo 1>&2
# ^-------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat image.rgb | ./prog ' .,:!-iots&8%#@$' | less -EXF