Add 2020/otterness/try.sh

The .gitignore was updated but it cannot be sorted because it excludes
'*.mid' but then negates the .mid files in the repo, cvikl.mid and
entertainer.mid. These have to come after the exclusion of '*.mid'. This
is important as one might use the entry to create a .mid file that is
not done in the try script. The make clobber rule does not remove
'*.mid' files as doing so would remove the ones we want to keep.
This commit is contained in:
Cody Boone Ferguson committed 2024-02-01 07:45:59 -08:00
1 parent 06f291dc19
commit 5574f865cf
4 files changed
+37 -6

No files matched your search

+5 -1
View File
@@ -1,8 +1,12 @@
#
# sort with: sort -d -u
# Don't sort because of the exclusion of *.mid with the exception
# of the cvikl.mid and the entertainer.mid.
*.dSYM
indent
indent.c
indent.o
prog
prog.orig
*.mid
!cvikl.mid
!entertainer.mid
+4 -5
View File
@@ -26,13 +26,12 @@ For more detailed information see [2020 otterness in bugs.md](/bugs.md#2020-otte
## Try:
```sh
./prog < cvikl.mid > output.mid
# Play output.mid with your favorite player
./prog < entertainer.mid > output2.mid
# Play output2.mid with your favorite player
./try.sh
```
Now play `output.mid` and `output2.mid` in an audio player that can play MIDI
files.
## Judges' remarks:
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2020/otterness
#
# 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.
[[ -z "$CC" || ! -f "$CC" || ! -x "$CC" ]] && CC="cc"
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: ./prog < cvikl.mid > output.mid: "
echo 1>&2
./prog < cvikl.mid > output.mid
echo "Now play output.wav in an audio player that can play MIDI files." 1>&2
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog < entertainer.mid > output2.mid: "
echo 1>&2
./prog < entertainer.mid > output2.mid
echo "Now play output2.wav in an audio player that can play MIDI files." 1>&2
echo 1>&2
+2
View File
@@ -4872,6 +4872,8 @@ J.R.R. Tolkien).
that one need not download them and to make sure they can always be obtained
even if the domain or link goes dead.
Cody also added the [try.sh](/2020/otterness/try.sh) script.
## <a name="2020_tsoj"></a>[2020/tsoj](/2020/tsoj/prog.c) ([README.md](/2020/tsoj/README.md))