diff --git a/1998/bas1/README.md b/1998/bas1/README.md index a5593639c..edc15f82a 100644 --- a/1998/bas1/README.md +++ b/1998/bas1/README.md @@ -7,22 +7,8 @@ make all ## To use: -If `lpr` on your system can print PostScript: - ```sh -./bemazing | gunzip | lpr -``` - -else, while in X Window System, - -```sh -./bemazing | gunzip | gv - -``` - -or: - -```sh -./bemazing | gunzip | gs -sDEVICE=pgmraw -sOutputFile='|xv -' - +./bas1.sh ``` diff --git a/1998/bas1/bas1.sh b/1998/bas1/bas1.sh new file mode 100755 index 000000000..a00ada507 --- /dev/null +++ b/1998/bas1/bas1.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# +# bas1.sh - run IOCCC winner 1998/bas1 +# + +# 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 "** Bemazing Modes ** + +(0) Use lpr (if lpr(1) can print PostScript) +(1) Use X11 (with gv(1)) +(2) Use X11 (with gs(1) and xv(1)) +" + +read -rp "Make a selection (0 - 2 or any other key to exit): " mode +echo 1>&2 + +case "${mode}" in + 0) ./bemazing | gunzip | lpr + ;; + 1) ./bemazing | gunzip | gv - + ;; + 2) ./bemazing | gunzip | gs -sDEVICE=pgmraw -sOutputFile='|xv -' - + ;; + *) exit 0 +esac diff --git a/thanks-for-help.md b/thanks-for-help.md index d0543f890..f3c0185bf 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -2247,6 +2247,9 @@ appears that they do allow 1 but for instance 4 is not allowed. However as it's quite possible they will 'fix' this defect it would be better to have this not be a problem at such a time. +Cody also added the [bas1.sh](/1998/bas1/bas1.sh) script to simplify running the +program. + ## [1998/bas2](/1998/bas2/bas2.c) ([README.md](/1998/bas2/README.md]))