Alt code/try scripts added to 2004/jdalbec

The alt code allows one to set how many numbers to print on a line
before adding a line break. This is done because the more numbers that
there are the harder it is to see where it 'belongs'. Defaults to 11
(protons, salt) but the macro name is Ag, silver (because silver is my
favourite precious metal, it wasn't used already and it allowed for some
irony in the alt build section).

The try.alt.sh script uses the alt code.

The try.sh script uses the fixed code (fixes I made quite a while back).

The bugs.md has had INAFIAB section added to this entry.

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

This should complete the review of 2004/jdalbec.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-19 09:53:30 -08:00
1 parent bd05727ce7
commit 05b41b922e
8 files changed
+409 -9

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
#
# try.alt.sh - demonstrate IOCCC winner 2004/jdalbec 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
# start out with default 11
make clobber CC="$CC" alt >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "$ ./jdalbec.alt 11 | head" 1>&2
./jdalbec.alt 11 | head
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
echo "$ ./jdalbec.alt 47 | grep : | head -n 52572 | grep :" 1>&2
./jdalbec.alt 47 | head -n 52572 | grep :
echo 1>&2
read -r -n 1 -p "Press any key to set 7 numbers per line: "
make clobber CC="$CC" CDEFINE="-DAg=7" alt >/dev/null || exit 1
echo "$ ./jdalbec.alt 101 | head" 1>&2
./jdalbec.alt 101 | head
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
echo "$ ./jdalbec.alt 7 | grep : | head -n 47 | grep :" 1>&2
./jdalbec.alt 7 | head -n 47 | grep :