Add 2020/burton/try.sh, improve make test

The make test now uses option -s to show that the output is the same (as
it should be), for better demonstration.

Format/typo check README.md.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-20 12:54:05 -08:00
1 parent b80c4b4b57
commit 67b09c403a
4 files changed
+108 -18

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2020/burton
#
# 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 "$ make test" 1>&2
make test
echo 1>&2
read -r -n 1 -p "Press any key to run: ./check_be.sh (Big Endian) (space = next page, q = quit): "
echo 1>&2
./check_be.sh | less -rEXF
echo 1>&2
read -r -n 1 -p "Press any key to run: ./check_le.sh (Little Endian) (space = next page, q = quit): "
echo 1>&2
./check_le.sh | less -rEXF
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog 128: "
echo 1>&2
./prog 128
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog_le 128: "
echo 1>&2
./prog_le 128
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog_be 128: "
echo 1>&2
./prog_be 128
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog 170: "
echo 1>&2
./prog 170
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog 85: "
echo 1>&2
./prog 85
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog 128 128: "
echo 1>&2
./prog 128 128
echo 1>&2
echo "Why did that print strange output?"
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog 128 128 128: "
echo 1>&2
./prog 128 128 128
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog 128 128 128 128: "
echo 1>&2
./prog 128 128 128 128
echo "Why did that print strange output?"
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog 1; ./prog_be 1: "
echo 1>&2
./prog 1; ./prog_be 1