Add 1998/bas1/bas1.sh

This simplifies the running of the program as the command lines
(different options) can be long and more complicated to type, especially
the last one. The script is menu driven. Initially I made it a loop so
one can run the command once to try multiple modes but this seems
unnecessary and created some display problems (depending on how
invocations were done).
This commit is contained in:
Cody Boone Ferguson committed 2024-01-20 06:21:54 -08:00
1 parent 5e25056532
commit 9c43c0c90a
3 files changed
+40 -15

No files matched your search

+1 -15
View File
@@ -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
```
+36
View File
@@ -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
+3
View File
@@ -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.
## <a name="1998_bas2"></a>[1998/bas2](/1998/bas2/bas2.c) ([README.md](/1998/bas2/README.md]))