Add 2019/diels-grabsch1/try.sh + other fixes

Add Shakespeare.txt from 2019/mills. This was used in the try commands
(now try.sh) by doing cd ../mills ; make ; cd ../diels-grabsch1 but this
is problematic because it requires that one has the same directory
structure. Even more than that there's talk about having a tarball with
each entry by itself so the text file has to be in this entry's
directory too.

The prog.c was reverted back to the original source code and the
Makefile updated to have a -Wno- option. Originally the idea was to make
the author's remarks true that even -Weverything of clang shows no
warnings (which certainly did at the time) be true. I had the thought
that it would be nice to keep CSILENCE empty. But this was bordering on
going too far and more recent versions of clang have yet another dubious
warning and it seems that that warning one cannot even prevent (but
doing so here would obviously not be okay) so if that is silenced it
would mean that CSILENCE is no longer empty anyway. This way is better
anyway as the code is now the same. Of course the statement by the
author that a certain paragraph in README.md is the same shape and size
as prog.c is no longer true but that can't be helped.

Format/typo check README.md file.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-15 12:44:34 -08:00
1 parent 70b085933c
commit 4fc1683dc0
6 files changed
+40065 -19

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2019/diels-grabsch1
#
# 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 "$ dd bs=1024 count=2048 < /dev/zero | compress > ref.Z" 1>&2
dd bs=1024 count=2048 < /dev/zero | compress > ref.Z
echo 1>&2
echo "$ dd bs=1024 count=2048 < /dev/zero | ./prog > dg1.Z" 1>&2
dd bs=1024 count=2048 < /dev/zero | ./prog > dg1.Z
echo 1>&2
echo "$ cmp ref.Z dg1.Z" 1>&2
cmp ref.Z dg1.Z
echo "Exit code of: cmp ref.Z dg1.Z: $?" 1>&2
echo 1>&2
echo "$ compress < Shakespeare.txt > ref.Z" 1>&2
compress < Shakespeare.txt > ref.Z
echo 1>&2
echo "$ ./prog < Shakespeare.txt > dg1.Z" 1>&2
./prog < Shakespeare.txt > dg1.Z
echo 1>&2
echo "Notice how the files differ:" 1>&2
echo "$ cmp ref.Z dg1.Z" 1>&2
cmp ref.Z dg1.Z # Oops, the files differ
echo "Exit code of: cmp ref.Z dg1.Z: $?" 1>&2
echo 1>&2
echo "... and notice how this works fine:" 1>&2
echo "$ zcat < dg1.Z | cmp - Shakespeare.txt" 1>&2
zcat < dg1.Z | cmp - Shakespeare.txt
echo "What happened?"