diff --git a/1996/rcm/.gitignore b/1996/rcm/.gitignore index 2d74aa8cf..a7113ed57 100644 --- a/1996/rcm/.gitignore +++ b/1996/rcm/.gitignore @@ -6,4 +6,7 @@ indent.c indent.o prog.orig rcm +rcm.cp2.c +rcm.cp.c +rcm.cp.c.gz rcm.orig diff --git a/1996/rcm/README.md b/1996/rcm/README.md index f2032e480..a23a63a6d 100644 --- a/1996/rcm/README.md +++ b/1996/rcm/README.md @@ -8,16 +8,18 @@ make all ## To use: ```sh -./rcm < rfc1951.gz +./rcm < file.gz ``` +where `file.gz` is some gzipped file. + ## Try: For more information try: ```sh -./rcm < rfc1952.gz +./try.sh ``` @@ -29,6 +31,9 @@ For a good no-op try: gzip -c < rcm.c | ./rcm ``` +NOTE: this is done in the [try.sh](try.sh) script as well, along with some other +commands including a way to do the above command but with more steps. + ## Author's remarks: diff --git a/1996/rcm/try.sh b/1996/rcm/try.sh new file mode 100755 index 000000000..8ca9bb960 --- /dev/null +++ b/1996/rcm/try.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# +# try.sh - show IOCCC winner 1996/rcm +# + +# 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: ./rcm < rfc1951.gz (space = next page, q = quit): " +echo 1>&2 +./rcm < rfc1951.gz | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./rcm < rfc1952.gz (space = next page, q = quit): " +echo 1>&2 +./rcm < rfc1952.gz | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: cp -vf rcm.c rcm.cp.c; gzip rcm.cp.c: " +echo 1>&2 +cp -vf rcm.c rcm.cp.c; gzip rcm.cp.c + +read -r -n 1 -p "Press any key to run: ./rcm < rcm.cp.c.gz | tee rcm.cp.c (space = next page, q = quit): " +echo 1>&2 +./rcm < rcm.cp.c.gz | tee rcm.cp.c | less -rEXF +echo 1>&2 +rm rcm.cp.c.gz + +read -r -n 1 -p "Press any key to run: gzip -c < rcm.c | ./rcm | tee rcm.cp2.c (space = next page, q = quit): " +echo 1>&2 +gzip -c < rcm.c | ./rcm | tee rcm.cp2.c | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to show diff between rcm.cp.c and rcm.cp2.c: " +echo 1>&2 +diff -s rcm.cp.c rcm.cp2.c +echo 1>&2 +rm -f rcm.cp.c rcm.cp2.c + diff --git a/thanks-for-help.md b/thanks-for-help.md index c0877cf0b..fd125bb5a 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2166,6 +2166,11 @@ the function in the pointer assignment. NOTE: if there is no X server running this program will still crash. +## [1996/rcm](/1996/rcm/rcm.c) ([README.md](/1996/rcm/README.md])) + +[Cody](#cody) added the [try.sh](/1996/rcm/try.sh) script. + + ## [1996/schweikh1](/1996/schweikh1/schweikh1.c) ([README.md](/1996/schweikh1/README.md])) The author stated that `-I/usr/include` is needed by gcc in Solaris because