From d73b80bd96246949e2a107c704c5930e90a682e2 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 14 Nov 2023 04:09:20 -0800 Subject: [PATCH] Improve 2000/tomx/try.sh and try.alt.sh Get CC, defaulting to cc. --- 2000/tomx/try.alt.sh | 17 +++++++++++++++-- 2000/tomx/try.sh | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/2000/tomx/try.alt.sh b/2000/tomx/try.alt.sh index 1d8f730d8..0ffb04090 100755 --- a/2000/tomx/try.alt.sh +++ b/2000/tomx/try.alt.sh @@ -1,6 +1,19 @@ #!/usr/bin/env bash -# -# try.sh - script to show 2000/tomx +# +# try.alt.sh - demonstrate IOCCC winner 2000/tomx alt code +# + +# 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" alt >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear echo "Using tomx.alt.c to compile mkentry.c directly:" 1>&2 echo "$ chmod +x tomx.alt.c" 1>&2 diff --git a/2000/tomx/try.sh b/2000/tomx/try.sh index db719b5b8..e3bb764dc 100755 --- a/2000/tomx/try.sh +++ b/2000/tomx/try.sh @@ -1,6 +1,19 @@ #!/usr/bin/env bash -# -# try.sh - script to show 2000/tomx +# +# try.sh - demonstrate IOCCC winner 2000/tomx +# + +# 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 if [[ ! -f "tomx" || ! -e "tomx" ]]; then echo "Compiling tomx.c:" 1>&2