From 29903d763b534b9a620296df4c1487ff44bb61f7 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 8 Dec 2023 10:01:40 -0800 Subject: [PATCH] Add 2015/endoh2/try.sh + format/typo checks --- 2015/endoh2/README.md | 10 ++++------ 2015/endoh2/try.sh | 36 ++++++++++++++++++++++++++++++++++++ thanks-for-help.md | 5 +++++ 3 files changed, 45 insertions(+), 6 deletions(-) create mode 100755 2015/endoh2/try.sh diff --git a/2015/endoh2/README.md b/2015/endoh2/README.md index 98687b7b0..52982c88b 100644 --- a/2015/endoh2/README.md +++ b/2015/endoh2/README.md @@ -15,9 +15,7 @@ make ### Try: ```sh -cat prog.c - -./prog | diff - prog.c +./try.sh ``` @@ -42,14 +40,14 @@ more prog.c Where did those underscores come from? Well [RTFS](http://acronyms.thefreedictionary.com/RTFS)!\*\* ** Read the Freaking Source (polite form) -** Read The Freakin' Screen (polite form) +** Read The Freaking Screen (polite form) -If you are still puzzled, look at prog.c with your favorite text editor. +If you are still puzzled, look at [prog.c](prog.c) with your favorite text editor. ## Author's remarks: -**Follow this instruction literally!** +**Follow these instructions literally!** ```sh cat prog.c diff --git a/2015/endoh2/try.sh b/2015/endoh2/try.sh new file mode 100755 index 000000000..243663356 --- /dev/null +++ b/2015/endoh2/try.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2015/endoh2 +# + +# 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 prog.c" 1>&2 +cat prog.c +echo 1>&2 + +echo "$ ./prog | diff -s - prog.c" +./prog | diff -s - prog.c +echo 1>&2 + +echo "$ less -EXF prog.c" 1>&2 +read -r -n 1 -p "Press any key to continue: " +less -EXF prog.c +echo 1>&2 + +echo "$ wc -c prog.c" 1>&2 +wc -c prog.c +echo 1>&2 +echo "Can you figure out the inconsistencies?" 1>&2 +echo "If you can't or you're still confused try" 1>&2 +echo "opening prog.c in an editor like vim." 1>&2 diff --git a/thanks-for-help.md b/thanks-for-help.md index 5941015ad..1133900d0 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3807,6 +3807,11 @@ they avoided. [Cody](#cody) added the [try.sh](2015/duble/try.sh) script. +## [2015/endoh2](2015/endoh2/prog.c) ([README.md](2015/endoh2/README.md])) + +[Cody](#cody) added the [try.sh](2015/endoh2/try.sh) script. + + ## [2015/endoh3](2015/endoh3/prog.c) ([README.md](2015/endoh3/README.md])) [Cody](#cody) fixed this to compile with Linux which was having a problem with duplicate