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

+9 -6
View File
@@ -121,7 +121,7 @@ ALT_TARGET= ${PROG}.alt
# build the entry
#################
#
all: data ${TARGET}
all: data ${TARGET} whereami whereami.alt
@${TRUE}
.PHONY: all alt data everything diff_orig_prog diff_prog_orig \
@@ -131,21 +131,24 @@ all: data ${TARGET}
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
${RM} -f whereami
${LN} $@ whereami
@echo "NOTE: your terminal must be at least 80 columns wide for this to work right"
whereami: whereami.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} -lcurses
# alternative executable
#
alt: data ${ALT_TARGET}
alt: data ${ALT_TARGET} whereami.alt
@${TRUE}
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
${RM} -f whereami.alt
${LN} $@ whereami.alt
@echo "NOTE: your terminal must be at least 80 columns wide for this to work right"
whereami.alt: whereami.alt.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} -lcurses
# data files
#
data: ${DATA}