diff --git a/2001/cheong/README.md b/2001/cheong/README.md index d55abe31a..7d2214ed3 100644 --- a/2001/cheong/README.md +++ b/2001/cheong/README.md @@ -15,9 +15,7 @@ make ### Try: ```sh -./cheong 1024 -./cheong 12345678901234567890 -./cheong 05305265226926441255040573044986873789 +./try.sh ``` @@ -40,9 +38,9 @@ For example, ```sh $ cc -o cheong cheong.c -$ cheong 1234567890 +$ ./cheong 1234567890 35136 -$ cheong 0200000000000000000000000000 +$ ./cheong 0200000000000000000000000000 14142135623730 ``` diff --git a/2001/cheong/try.sh b/2001/cheong/try.sh new file mode 100755 index 000000000..d5f989e71 --- /dev/null +++ b/2001/cheong/try.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2001/cheong +# + +# 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 "$ ./cheong 1024" 1>&2 +./cheong 1024 + +echo "$ ./cheong 0512" 1>&2 +./cheong 0512 + +echo "$ ./cheong 12345678901234567890" 1>&2 +./cheong 12345678901234567890 + +echo "$ ./cheong 05305265226926441255040573044986873789" 1>&2 +./cheong 05305265226926441255040573044986873789 + +echo "$ ./cheong 1234567890" 1>&2 +./cheong 1234567890 + +echo "$ ./cheong 0200000000000000000000000000" 1>&2 +./cheong 0200000000000000000000000000 + diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 109f04677..085b34f86 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -2493,6 +2493,8 @@ letter word that would match the format and because it's pain that clang forces this. :-) This fix makes a point of the author's notes on portability no longer valid, btw. +Cody also added the [try.sh](2001/cheong/try.sh) script. + He also fixed it to check the number of args.