Greatly improve 1992/westley presentation

Added whereami.c and whereami.alt.c which, using curses, gets the number
of columns of the terminal. If < 80 it is an error. Otherwise it will
try compiling the westley.c or westley.alt.c and if successful it will
run the program with the args specified.

The try.sh script will use whereami or whereami.alt if it's possible to
compile and link (it might not if curses is not installed) and otherwise
westley and westley.alt.

Running make all will compile westley.c and also whereami.c; running
make alt will compile westley.alt.c and whereami.alt.c. The try.sh
script does NOT use that but instead uses make westley alt: this is
because we need to be sure that westley.c and westley.alt.c can compile
but it is NOT an error if whereami.c or whereami.alt.c cannot compile.
So the Makefile was done in a special way for this to not be a problem.

The original code of westley.alt.c has been added in westley.alt.orig.c.

The README.md has been updated for these improvements and this should
complete 1992/westley.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-08 04:12:39 -08:00
1 parent 95f9f8ddb5
commit 8adc677fd1
7 files changed
+211 -20

No files matched your search

+17 -1
View File
@@ -24,12 +24,17 @@ If lost:
```sh
./whereami lat long
# or, if you don't have curses installed:
./westley lat long
```
Where `lat` and `long` correspond to your latitude and longitude.
NOTE: you **MUST** have a terminal that is at least 80 columns for this to show
properly.
properly. The `whereami` and `whereami.alt` code checks this but it is not
prohibitive if it cannot be compiled and linked (it uses curses); instead one
should just use the `westley` and `westley.alt` programs directly.
### Try:
@@ -37,6 +42,10 @@ properly.
```sh
./whereami 47 -122 # NOTE: - means west of meridian
./whereami 47 122
# or if you don't have curses installed:
./westley 47 -122
./westley 47 122
```
@@ -56,6 +65,9 @@ make alt
```sh
./whereami.alt lat long
# or if you don't have curses installed:
./westley.alt lat long
```
NOTE: this alternative version also needs a terminal with at least 80 columns.
@@ -67,6 +79,9 @@ To find the approximate place where this entry was judged, type:
```sh
./whereami 37 -122 # NOTE: - means west of meridian
# or if you don't have curses installed:
./westley 37 -122 # NOTE: - means west of meridian
```
@@ -96,6 +111,7 @@ If you run it with fewer than 2 arguments, it will likely
give you an exception, as it will access arguments that
don't exist and characters before a string constant.
### How it works:
The map is printed as one long string of `' '` and `'!'` characters,