From 1fc630c45fcbc29966a4cb07694658a59ab214a8 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Wed, 31 Jan 2024 10:19:20 -0800
Subject: [PATCH] Add 2019/giles/try.sh
---
2019/giles/README.md | 10 ++++------
2019/giles/try.sh | 40 ++++++++++++++++++++++++++++++++++++++++
thanks-for-help.md | 5 +++++
3 files changed, 49 insertions(+), 6 deletions(-)
create mode 100755 2019/giles/try.sh
diff --git a/2019/giles/README.md b/2019/giles/README.md
index 9acd8a397..ac74a8e21 100644
--- a/2019/giles/README.md
+++ b/2019/giles/README.md
@@ -15,15 +15,13 @@ make
## Try:
```sh
-play MonodyVocals.wav
-./prog MonodyVocals.wav
-play out.wav
+./try.sh
```
-NOTE: `play` comes from SoX, the Swiss Army Knife of sound processing programs.
-If you don't have this installed, see [FAQ 3.10: How do I compile and use an
-IOCCC winner that requires sound](/faq.md#faq3_10).
+NOTE: `play`, which [try.sh](try.sh) uses, comes from SoX, the Swiss Army Knife
+of sound processing programs. If you don't have this installed, see [FAQ 3.10:
+How do I compile and use an IOCCC winner that requires sound](/faq.md#faq3_10).
## Judges' remarks:
diff --git a/2019/giles/try.sh b/2019/giles/try.sh
new file mode 100755
index 000000000..ac7c7138e
--- /dev/null
+++ b/2019/giles/try.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+#
+# try.sh - demonstrate IOCCC winner 2019/giles
+#
+
+# 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
+
+# find out if SoX is installed
+PLAY="$(type -P play)"
+
+if [[ -n "$PLAY" ]]; then
+ read -r -n 1 -p "Press any key to run: $PLAY MonodyVocals.wav: "
+ echo 1>&2
+ "$PLAY" MonodyVocals.wav
+ echo 1>&2
+
+ read -r -n 1 -p "Press any key to run: ./prog MonodyVocals.wav: "
+ echo 1>&2
+ ./prog MonodyVocals.wav
+ echo 1>&2
+
+ read -r -n 1 -p "Press any key to run: $PLAY MonodyVocals.wav: "
+ echo 1>&2
+ "$PLAY" MonodyVocals.wav
+ echo 1>&2
+else
+ echo "play(1) from SoX not installed." 1>&2
+ echo "NOTE: see https://github.com/ioccc-src/temp-test-ioccc/blob/master/faq.md#sox." 1>&2
+fi
+
diff --git a/thanks-for-help.md b/thanks-for-help.md
index acefd8efa..2886a8801 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -4623,6 +4623,11 @@ to easily reconstruct the source code through GDB by the fact it's a backtrace
quine.
+## [2019/giles](/2019/giles/prog.c) ([README.md](/2019/giles/README.md]))
+
+[Cody](#cody) added the [try.sh](/2019/giles/try.sh) script.
+
+
## [2019/karns](/2019/karns/prog.c) ([README.md](/2019/karns/README.md]))
[Cody](#cody) reported that with `-O` level > 0 this program segfaults (sometimes?). He's