v23i108: ABC interactive programming environment, Patch3

Rich Salz rsalz at bbn.com
Wed Jan 9 08:42:49 AEST 1991


Submitted-by: timo at cwi.nl
Posting-number: Volume 23, Issue 108
Archive-name: abc/patch3

This is the second patch from the authors for the ABC interactive
programming environment. It contains some fixes for minor bugs, reported
in comp.sources.d, or already found by us before.

Most fixed problems concern different brands of Unix:
 - the getcwd() problem on ATT System V machines,
 - conflicts with library names, e.g. compound() and remove(),
 - better guess of Unix-brand in the Setup script, leaving the ultimate 
   choice to the installer.

Another major improvement is that the installer does not need to execute
'make makefiles' and 'make depend' anymore; you can immediately start with
'make all'. We experienced that these features, intended to help in
porting ABC to other platforms, only caused confusion in assisting people
with installation problems.

If you have ftp-ed your version of ABC (e.g. as abc.unix.tar.Z) you can
also apply this patch to incorporate these fixes.

If you want to port ABC to other systems, contact us (at abc at cwi.nl) and
we will send you a beta version for porters, with lots of help,
guidelines, etc. shortly.

groetjes, Timo Krijnen (timo at cwi.nl).

PS. This patch will overwrite existing files, without warning.  It also
assumes the program 'patch' is in your $PATH; if you do not have 'patch'
you can apply the patches at the end manually since they are not that
large.

-------
: This is a shell archive.
: Extract with 'sh this_file'.
echo 'Start of second Authors patch for ABC system (bugfixes):'
echo 'x - abc/Setup'
sed 's/^X//' > 'abc/Setup' << 'EOF'
X: 'Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988.'
X
Xecho "Configuration questions for the ABC system."
X
X: some greps do not return status, fix this first.
Xecho "grimblepritz" >grimble
Xif grep blurfldyick grimble >/dev/null 2>&1 ; then
X	contains=./contains
Xelse
X	if grep grimblepritz grimble >/dev/null 2>&1 ; then
X		contains=grep
X	else
X		contains=./contains
X	fi
Xfi
Xrm grimble
X: the following should work in any shell
Xcase $contains in
X./contains)
X	echo " "
X	echo "Grep doesn't return a status; attempting remedial action."
X	cat >contains <<'EOF'
Xgrep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
XEOF
X	chmod 755 ./contains;;
Xesac
X
X: 'Determine if echo -n works'
Xcase  `echo -n foo` in
X-n*) n="" ;;
X*) n=-n ;;
Xesac
X
X: 'Get answers from previous run'
Xif test -r answers
Xthen
X	. ./answers
Xelse
X	rootdef="/tmp/abc"
X	abcdef="/usr/local"
X	libdef="/usr/local/lib/abc"
X	mandef="/usr/man/manl"
Xfi
X
X: 'Are we preparing for cross compilation?'
Xecho " "
Xecho $n "Are you going to cross-compile the ABC system to a remote machine? [no] "
Xif ./readyn "$n"
Xthen
Xremote=" remote"
Xrootdir='blurfl'
Xwhile test ! -d "$rootdir" ; do
X	case $rootdir in
X	blurfl)
X		echo " "
X		echo "Then please type the full pathname of a local directory"
X		echo "where you have write permission"
X		echo "and which we can use as a local root to install"
X		echo "the ABC system for you to copy to the remote machine"
X		echo $n " [default $rootdef] "
X		;;
X	*) 	echo "$rootdir does not appear to exist."
X		echo $n "Are you sure you typed the right name? [no] "
X		if ./readyn "$n"
X		then
X			echo "Don't forget to make $rootdir before 'make install'."
X		else
X			echo $n "Please try again [default $rootdef] "
X		fi
X		;;
X	esac
X	read rootdir
X	case $rootdir in
X	"") rootdir=$rootdef;;
X	esac
Xdone
Xelse
Xecho "No cross compilation worries then."
Xremote=""
Xrootdir=""
Xfi
X
X: 'What C compiler?'
Xecho " "
Xecho $n "C compiler to use [default cc] "
Xread ans
Xcase $ans in
X'')	cc="cc";;
X*)	cc="$ans";;
Xesac
Xecho "We will use '$cc' to invoke the C compiler."
X
X: 'What unix?'
Xecho " "
Xecho $n "Finding out about your brand of unix ... "
Xcat >brand.c <<EOF
X#include <stdio.h>
X#include <signal.h>
Xmain() {
X#ifdef SIGXCPU
X#ifdef SIGVTALRM
X	printf("BSD4_2\n");
X#else
X	printf("BSD\n");
X#endif
X#else
X#ifdef SIGPWR
X	printf("ATT\n");
X#else
X	printf("unknown\n"); /* Version 7 we hope ... */
X#endif
X#endif
X}
XEOF
X$cc brand.c -o brand
Xunix=`./brand`
Xrm -f brand*
X
Xecho " "
Xcase $unix in
XBSD4_2)
X	echo "You seem to be running Berkeley's BSD unix version 4.2,"
X	echo "or some compatible unix version."
X	defunix=1
X	;;
XBSD)
X	echo "You seem to be running Berkeley's BSD unix,"
X	echo "or some compatible unix version."
X	defunix=2
X	;;
XATT)
X	echo "You seem to be running ATT's System III or System V unix,"
X	echo "or some compatible unix version."
X	defunix=3
X	;;
X*)	defunix=5;;
Xesac
X
Xecho "The ABC system can be configured for:"
Xecho "   1) Berkeley's BSD unix, version 4.2 or newer;"
Xecho "   2) Berkeley's BSD unix, version 4.1 or older;"
Xecho "   3) ATT's System III or System V unix;"
Xecho "   4) Bell Labs Version 7;"
Xecho "   5) any other unix."
X
Xans="again"
Xwhile test "$ans" = "again" ; do
X	echo $n "Please type the number of the configuration you want [default $defunix] "
X	read ans
X	case $ans in
X	'')		ans="default";;
X	1|2|3|4|5)	defunix=$ans;;
X	*)		ans="again";;
X	esac
Xdone
X
Xcase $defunix in
X1)	unix="BSD4_2";;
X2)	unix="BSD";;
X3)	unix="ATT";;
X4)	unix="VERSION7";;
X5)	unix="unknown"
X	echo "See ./unix/*.h (especially comp.h and os.h) and ./Problems in case of problems.";;
Xesac
X
X: 'tty or termio system?'
Xecho " "
Xecho $n "Checking for tty or termio system ... "
Xtermio=""
Xcase $unix in
XATT)	files="termio.h sgtty.h";;
X*)	files="sgtty.h termio.h";;
Xesac
Xfor f in $files
Xdo
X	if test -r /usr/include/$f
X	then
X		case $f in
X		termio.h)
X			termio="#define"
X			echo "termio.h found."
X			break;;
X		sgtty.h)
X			termio="#undef"
X			echo "sgtty.h found."
X			break;;
X		esac
X	fi
Xdone
Xcase $termio in
X'')	echo " "
X	echo "Neither termio.h nor sgtty.h found."
X	echo "See ./unix/trm.c, ./unix/keys.c and ./keys/abckeys.c"
X	echo "in case of problems."
X	termio="#undef "
Xesac
X
X: 'Include <strings.h> or <string.h>?'
Xecho " "
Xecho $n "Finding include file for string operations ... "
Xif test -r /usr/include/strings.h
Xthen
X	strs="<strings.h>"
X	echo "strings.h found."
Xelse
X	if test -r /usr/include/string.h
X	then
X		strs="<string.h>"
X		echo "string.h found."
X	else
X		strs="no_strs"
X		echo " "
X		echo "Neither strings.h nor string.h found."
X		echo "We will add some external definitions to ./unix/os.h."
X	fi
Xfi
X
X: 'Some ATT System V have <unistd.h> for <sys/file.h>'
X: 'Some systems have both and may need either one, so we must check'
Xecho " "
Xecho $n "Finding include file for access modes ... "
Xcase $unix in
XATT)	files="sys/file.h unistd.h";;
X*)	files="unistd.h sys/file.h";;
Xesac
Xmodes="no_modes"
Xfor f in $files
Xdo
X	if $contains F_OK /usr/include/$f >/dev/null 2>&1
X	then
X		modes="<$f>"
X		echo "proper $f found."
X		break
X	fi
Xdone
Xcase $modes in
Xno_modes)
X	echo " "
X	echo "No access mode definitions found in sys/file.h or unistd.h."
X	echo "We will substitute our own definitions in ./unix/os.h."
X	;;
Xesac
X
X: 'Some Berkeley systems (and the PC:-) have ftime(), including <sys/timeb.h>'
Xecho " "
Xecho $n "Finding include file for ftime(3) ... "
Xif test -r /usr/include/sys/timeb.h
Xthen
X	ftime="#define"
X	echo "sys/timeb.h found."
Xelse
X	ftime="#undef "
X	echo " "
X	echo "No sys/timeb.h found."
X	echo "We will assume ftime(3) is not available in ./unix/comp.h."
X	echo "The ABC function \"now\" will only return entire seconds."
Xfi
X
X: 'Check for void type'
Xecho " "
Xecho $n "Checking to see if your compiler accepts the void type ... "
Xcat >void.c << EOF
Xvoid main();
XEOF
Xif $cc -c void.c >/dev/null 2>&1
Xthen
X	void="(void)"
X	echo "yes, it does."
Xelse
X	void="      "
X	echo "no, it doesn't."
X	echo "We will use an empty VOID in casts."
Xfi
Xrm -f void.c void.o
X
X: 'Determine type for signal handlers'
Xcase $void in
X"(void)")
Xecho " "
Xecho $n "Finding type for signal handlers ... "
Xecho "#include <signal.h>" >sigtype.c
Xecho "main() { void (*oldsig)(); oldsig= signal(SIGINT, SIG_IGN); }" >>sigtype.c
X$cc -c sigtype.c >warnings 2>&1
Xif test -s warnings
Xthen
X	sigtype=int
X	echo "assuming int."
Xelse
X	sigtype=void
X	echo "found void."
Xfi
Xrm -f sigtype.c sigtype.o warnings
X;;
X*)	sigtype=int;;
Xesac
X
X: 'Floating point arithmetic ok?'
Xecho " "
Xcase $remote in
X" remote")
Xecho "Does your C compiler need a special flag for"
Xecho $n "loading (probably software) floating point routines? "
Xread ans
Xcase $ans in
Xy*|Y*)	echo $n "What flag is needed [default -f] "
X	read fflag
X	case $fflag in
X	'')	fflag="-f";;
X	esac
X	echo "We will try $fflag."
X	;;
X*)	echo "Assuming no flag is needed."
X	fflag=
X	;;
Xesac
X;;
X*)
Xecho $n "Checking your floating point ... "
Xcat >float.c <<EOF
X#include <stdio.h>
Xdouble dadd(a, b) double a, b; {
X	return a+b;
X}
Xmain() {
X	double a, b, c;
X	double dadd();
X	a = 3.14;
X	b = 2.7 * a;
X	c = dadd(a, b);
X	exit(0);
X}
XEOF
X$cc -O float.c -o float >/dev/null 2>&1
Xif sh 2>/dev/null <<EOF
X	if ./float
X	then exit 0
X	else exit 1
X	fi
XEOF
Xthen
X	echo "seems to be alright."
X	fflag=""
Xelse
X	echo " "
X	echo "Your C compiler seems to need a special flag for"
X	echo "loading (probably software) floating point routines."
X	echo $n "What flag is needed [default -f] "
X	read fflag
X	case $fflag in
X	'')	fflag="-f";;
X	esac
X	$cc -O $fflag float.c -o float >/dev/null 2>&1
X	until sh 2>/dev/null <<EOF
X		if ./float
X		then echo "Flag $fflag seems to be allright."
X		     exit 0
X		else exit 1
X		fi
XEOF
X	do
X		echo "This flag doesn't seem to work."
X		echo "Try again ([RETURN] to give up) "
X		read fflag
X		case $fflag in
X		'')	echo "Giving up on floating point flag"
X			break;;
X		esac
X		$cc -O $fflag float.c -o float >/dev/null 2>&1
X	done
Xfi
Xrm -f float* core
X;;
Xesac
X
X: 'termcap library for ABC editor'
Xecho " "
Xecho $n "Searching for your termcap-like library routines ... "
Xif test -r /lib/libtermcap.a -o -r /usr/lib/libtermcap.a
Xthen
X	termlib="-ltermcap"
X	echo "termcap library found."
Xelif test -r /usr/local/lib/libtermcap.a
Xthen
X	termlib="/usr/local/lib/libtermcap.a"
X	echo "local termcap library found."
Xelif test -r /lib/libcurses.a -o -r /usr/lib/libcurses.a
Xthen
X	termlib="-lcurses"
X	echo "terminfo library found."
Xelif test -r /usr/local/lib/libcurses.a
Xthen
X	termlib="/usr/local/lib/libcurses.a"
X	echo "local terminfo library found."
Xelif test -r /lib/libtermlib.a -o -r /usr/lib/libtermlib.a
Xthen
X	termlib="-ltermlib"
X	echo "termlib library found."
Xelif test -r /usr/local/lib/libtermlib.a
Xthen
X	termlib="/usr/local/lib/libtermlib.a"
X	echo "local termlib library found."
Xelse
X	echo " "
X	echo "Your system appears NOT to have any termcap-like library."
X	echo $n "Is this true? "
X	read ans
X	case $ans in
X	n*|N*|f*|F*)	termlib="ask_it"
X		;;
X	*)	termlib="libtermcap.a"
X		cat <<\EOF
XWe will setup ./Makefile to use the public domain version of the
Xtermcap routines from ./tc. Your users must set the $TERMCAP and
X$TERM environment variables appropriately in their profile; or you
Xcan install shell scripts that arrange these.
XHowever, it would be better if your system administrator installs
Xtermcap in the proper places. You should run Setup again after she
Xhas done so.
XSee ./tc/README for details.
XEOF
X		;;
X	esac
Xfi
Xwhile test "$termlib" = "ask_it" -o "$termlib" = "try_again"; do
X	case $termlib in
X	ask_it)
X		echo " "
X		echo "Please specify where the termcap-like routines are kept"
X		echo $n " (either full pathname or -lxxx option) "
X		;;
X	try_again)
X		echo $n "Please try again (full pathname or -lyyy option) "
X		;;
X	esac
X	read termlib
X	case $termlib in
X	-l*)
X		echo "Hope $termlib will do the job."
X		;;
X	/*)
X		if test -r $termlib
X		then
X			echo "Ok, we will try $termlib."
X		else
X			echo "$termlib does not appear to exist."
X			termlib="try_again"
X		fi
X		;;
X	*)
X		echo "$termlib is not a valid library specification."
X		termlib="try_again"
X		;;
X	esac
Xdone
X
X: 'Shall we make ABC public?'
Xpublic="no"
Xecho " "
Xecho $n "Do you want to make ABC publically available? [no] "
Xif ./readyn "$n"
Xthen
Xpublic="yes"
Xabcdir='blurfl'
Xwhile test ! -d "$rootdir$abcdir" ; do
X	case $abcdir in
X	blurfl)
X		echo " "
X		echo "Please type the full pathname of a$remote directory"
X		echo "in which you have write permission, and where you"
X		echo "want the binaries 'abc' and 'abckeys' installed"
X		echo $n " [default $abcdef] "
X		;;
X	*) 	echo "$rootdir$abcdir does not appear to exist."
X		echo $n "Are you sure you typed the right name? "
X		read ans
X		case $ans in
X		y*|Y*)	echo "Don't forget to make $rootdir$abcdir before 'make install'."
X			break
X			;;
X		*)	echo " "
X			echo $n "Please try again [default $abcdef] "
X			;;
X		esac
X		;;
X	esac
X	read abcdir
X	case $abcdir in
X	"") abcdir=$abcdef;;
X	esac
Xdone
Xlibdir='blurfl'
Xwhile test ! -d "$rootdir$libdir" ; do
X	case $libdir in
X	blurfl)
X		echo " "
X		echo "Please type the full pathname of the$remote directory"
X		echo "where you want to install the auxiliary datafiles"
X		echo "needed by the ABC system"
X		echo $n " [default $libdef] "
X		;;
X	*) 	echo "$rootdir$libdir does not appear to exist."
X		echo $n "Are you sure you typed the right name? "
X		read ans
X		case $ans in
X		y*|Y*)	echo "Don't forget to make $rootdir$libdir before 'make install'."
X			break
X			;;
X		*)	echo " "
X			echo $n "Please try again [default $libdef] "
X			;;
X		esac
X		;;
X	esac
X	read libdir
X	case $libdir in
X	"") libdir=$libdef;;
X	esac
Xdone
Xmandir='blurfl'
Xwhile test ! -d "$rootdir$mandir" ; do
X	case $mandir in
X	blurfl)
X		echo " "
X		echo "Please type the full pathname of the$remote directory"
X		echo "where you want to install the 'abc.1' manual page"
X		echo $n " [default $mandef] "
X		;;
X	*) 	echo "$rootdir$mandir does not appear to exist."
X		echo $n "Are you sure you typed the right name? "
X		read ans
X		case $ans in
X		y*|Y*)	echo "Don't forget to make $rootdir$mandir before 'make install'."
X			break
X			;;
X		*)	echo " "
X			echo $n "Please try again [default $mandef] "
X			;;
X		esac
X		;;
X	esac
X	read mandir
X	case $mandir in
X	"") mandir=$mandef;;
X	esac
Xdone
Xelse
Xabcdir="$abcdef"
Xlibdir="$libdef"
Xmandir="$mandef"
Xfi
X
Xcat >answers <<EOF
Xrootdef="$rootdir"
Xabcdef="$abcdir"
Xlibdef="$libdir"
Xmandef="$mandir"
XEOF
X
Xecho " "
Xecho "End of configuration questions for the ABC system."
X
Xrm -f ./contains
X
Xeditor="ed -"
X
X: 'Getting generic copies of Makefile and unix/comp.h and unix/os.h.'
X: 'Since some tars leave the owner of the tape as the owner of the files'
X: 'this will make sure the edit scripts will not fail.'
X
Xecho " "
Xecho "Creating Makefile from Makefile.unix."
X
Xtouch Makefile || (echo "Oops!"; exit 1)
Xcat >Makefile <<EOF
X# This file was generated and edited by the Setup command.
X# To make lasting changes edit the files Makefile.unix and Setup,
X# and run Setup again.
X# 
XEOF
Xchmod 644 Makefile
Xcat Makefile.unix >>Makefile || (echo "Oops!"; exit 1)
X
Xecho "Creating uhdrs/os.h from uhdrs/os.h.gen."
X
Xtouch uhdrs/os.h  || (echo "Oops!"; exit 1)
Xcat >uhdrs/os.h <<EOF
X/* This file was generated and edited by the Setup command. */
X/* To make lasting changes edit the files uhdrs/os.h.gen and Setup, */
X/* and run Setup again. */
X
XEOF
Xchmod 644 uhdrs/os.h
Xcat uhdrs/os.h.gen >>uhdrs/os.h
X
Xecho " "
Xecho $n "Editing appropriate definitions in these files ... "
X
Xcase $unix in
XBSD4_2)
X	make="make \$(MFLAGS)"
X	strchr="index"
X	perror="#define"
X	mkdir="#define"
X	rename="#define"
X	select="#define"
X	readdir="#define"
X	getwd="#define"
X	getcwd="#undef "
X	;;
XBSD)	make="make \$(MFLAGS)"
X	strchr="index"
X	perror="#define"
X	mkdir="#undef "
X	rename="#undef "
X	select="#undef "
X	readdir="#undef "
X	getwd="#undef "
X	getcwd="#undef "
X	;;
XATT)	make="make -\$(MAKEFLAGS)"
X	strchr="strchr"
X	perror="#define"
X	mkdir="#define"
X	rename="#undef "
X	select="#undef "
X	readdir="#undef "
X	getwd="#undef "
X	getcwd="#define"
X	;;
XVERSION7|unknown|*)
X	make="make"
X	strchr="index"
X	perror="#undef "
X	mkdir="#undef "
X	rename="#undef "
X	select="#undef "
X	readdir="#undef "
X	getwd="#undef "
X	getcwd="#undef "
X	;;
Xesac
X
X$editor Makefile <<EOF
X/^MAKE=/s?MAKE=.*?MAKE= $make?
X/^CC=/s?CC=.*?CC= $cc?
X/^FLOAT=/s?FLOAT=.*?FLOAT= $fflag?
X/^TERMLIB=/s?TERMLIB=.*?TERMLIB= $termlib?
Xw
Xq
XEOF
X
Xcase $public in
Xyes)
X	$editor Makefile <<EOF
X	/^DESTABC=/s?DESTABC=.*?DESTABC= $abcdir?
X	/^DESTLIB=/s?DESTLIB=.*?DESTLIB= $libdir?
X	/^DESTMAN=/s?DESTMAN=.*?DESTMAN= $mandir?
X	w
X	q
XEOF
X	;;
Xesac
X
X$editor uhdrs/os.h <<EOF
X/^#include <strings.h>/s?<strings.h>?$strs?
X/^#include <sys\/file.h>/s?<sys/file.h>?$modes?
X/^#define VOID/s?(void)?$void?
X/^#define SIGTYPE/s?int?$sigtype?
X/^#undef  TERMIO/s?#undef ?$termio?
X/^#define HAS_FTIME/s?#define?$ftime?
X/^#define HAS_PERROR/s?#define?$perror?
X/^#define HAS_MKDIR/s?#define?$mkdir?
X/^#define HAS_GETWD/s?#define?$getwd?
X/^#undef  HAS_GETCWD/s?#undef ?$getcwd?
X/^#define HAS_RENAME/s?#define?$rename?
X/^#define HAS_SELECT/s?#define?$select?
X/^#define HAS_READDIR/s?#define?$readdir?
Xw
Xq
XEOF
X
Xcase $strs in
Xno_strs)
X	case $strchr in
X	"index")	index=index; rindex=rindex;;
X	"strchr")	index=strchr; rindex=strrchr;;
X	esac
X	$editor uhdrs/os.h <<EOF
X/#include no_strs/c
X
Xextern char *strcat();
Xextern int strcmp();
Xextern int strncmp();
Xextern char *strcpy();
Xextern char *strncpy();
Xextern int strlen();
Xextern char *$index();
Xextern char *$rindex();
X
X.
Xw
Xq
XEOF
X;;
Xesac
X
Xcase $modes in
Xno_modes)
X	$editor unix/os.h <<EOF
X/#include no_modes/c
X
X#define R_OK 4
X#define W_OK 2
X#define F_OK 0
X.
Xw
Xq
XEOF
X;;
Xesac
X
Xcase $strchr in
Xstrchr)	$editor uhdrs/os.h <<EOF
X/#define strchr/,/#define strrchr/d
Xw
Xq
XEOF
X;;
Xesac
X
Xcase $termlib in
Xlibtermcap.a)
X	$editor Makefile <<EOF
X	/TERMLIB=/s?.*?TERMLIB=?
X	/#OWNTLIB=/s?#??
X	/#KOWNTLIB=/s?#??
X	/#OWNTBASE=/s?#??
X	w
X	q
XEOF
X	;;
Xesac
X
Xecho $n " "
Xecho "done."
X
Xecho " "
Xecho "This completes the setup of the ABC system."
X
Xcase $remote in
X' remote')
X	cat <<EOF
XYou should first compile mkconfig (from ./mkconfig.c and ./uhdrs/os.h)
Xwith 'make mkconfig' here, run it on the remote machine and copy the
Xresult to ./uhdrs/config.h.
XAfter that you can proceed here with 'make all'.
XEOF
X	;;
X*)	echo "You can now try 'make all'."
X	;;
Xesac
X
Xcase $remote in
X" remote")
X	if test ! -d "$rootdir"
X	then
X		echo " "
X		echo "You should 'mkdir $rootdir' before 'make install'."
X	fi
X	;;
Xesac
X
Xcase $public in
Xyes)
X	if test ! -d "$rootdir$abcdir"
X	then
X		echo " "
X		echo "You should 'mkdir $rootdir$abcdir' before 'make install'."
X	fi
X	if test ! -d "$rootdir$libdir"
X	then
X		echo "You should 'mkdir $rootdir$libdir' before 'make install'."
X	fi
X	if test ! -d "$rootdir$mandir"
X	then
X		echo "You should 'mkdir $rootdir$mandir' before 'make install'."
X	fi
X	;;
Xesac
X
Xexit 0
EOF
chmod +x 'abc/Setup'
echo 'x - abc/readyn'
sed 's/^X//' > 'abc/readyn' << 'EOF'
X: 'Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1990.'
X:
X: 'read yes or no [default no]'
X
Xn=$1
X
Xwhile true
Xdo 
X	read ans
X	case $ans in
X	y|Y|t|T|yes|Yes|YES|true|True|TRUE)	exit 0;;
X	''|n|N|f|F|no|No|NO|false|False|FALSE)	exit 1;;
X	*)		echo $n "Please answer with yes or no "
X	esac
Xdone
EOF
chmod +x 'abc/readyn'
echo 'x - abc/Makefile.unix'
sed 's/^X//' > 'abc/Makefile.unix' << 'EOF'
X#######################################################################
X#                                                                     #
X#                 Makefile for ABC system under unix.                 #
X#                                                                     #
X#######################################################################
X
X# --- Some make's only make love with the Bourne shell ---
X#
X
XSHELL=	/bin/sh
X
X
X# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
X# +++ Start of editable macro definitions; filled in by ./Setup      +++
X# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
X
X# --- pass make options ---
X#
X# On 4.{23}BSD the macro $(MFLAGS) is set by make to the collection of
X# command line options (such as -k, -i) and passed to make in subdirectories.
X# For System V use $(MAKEFLAGS). Otherwise just fill in 'make'.
X
XMAKE=	make $(MFLAGS)
X
X
X# --- C compiler to use ---
X#
X# In case you might want to change it to e.g. 'gcc' (the GNU C compiler).
X
XCC=	cc
X
X
X# --- Where to install the stuff ---
X#
X# These should all be absolute pathnames.
X
X# destination directory for binaries 'abc' and 'abckeys':
X
XDESTABC=/usr/local
X
X# destination directory for auxiliary data files:
X
XDESTLIB=/usr/local/lib/abc
X
X# destination directory for 'abc.1' manual page:
X
XDESTMAN=/usr/man/manl
X
X# local destination if you cross-compile; empty otherwise:
X
XDESTROOT=
X# you should first generate uhdrs/config.h remotely;
X# see 'make config' below.
X
X# directory where 'abc' and 'abckeys' should locate auxiliary files,
X# when created in the current directory;
X# change this to some proper absolute pathname, like /ufs/$user,
X# if `pwd` gives an unsteady pathname, e.g. when using NFS mounted filesystems.
X
XDESTALL="`pwd`"
X
X
X# --- Software floating point needed? ---
X
XFLOAT=
X
X
X# --- Flags to the C compiler ---
X
XDEFS=	-DNDEBUG
XCFLAGS= -O $(FLOAT) $(DEFS)
X
X
X# --- Flags to the loader ---
X
XLDFLAGS=
X
X
X# --- Specify termcap or terminfo library ---
X#
X# Set TERMLIB to the appropriate termcap or terminfo library specification
X# (either -lxxx option or absolute pathname) if your system has one.
X# Otherwise leave TERMLIB empty and remove the comment symbols before
X# the definitions of OWNTLIB, KOWNTLIB and OWNTBASE to install the
X# public domain version from ./tc.
X
XTERMLIB= -ltermcap
X
X#OWNTLIB= libtermcap.a
X#KOWNTLIB= ../libtermcap.a
X#OWNTBASE= termcap
X
X
X# --- Libraries for editor-interpreter 'abc' ---
X
XLIBS=	-lm $(TERMLIB) $(OWNTLIB)
X
X
X# --- Libraries for utility 'abckeys' ---
X
XKLIBS=	$(TERMLIB) $(KOWNTLIB)
X
X
X# +++++++++++++++++++++++++++++++++++++++++
X# +++ End of editable macro definitions +++
X# +++++++++++++++++++++++++++++++++++++++++
X#
X# The remaining macro definitions should only have to be edited
X# if you make very drastic changes.
X
X# --- Include flags to the C compiler for editor and interpreter directories ---
X
XBINCL=	-I../bhdrs -I../uhdrs
XEINCL=	-I../bhdrs -I../ehdrs -I../uhdrs -I../btr
XIINCL=	-I../bhdrs -I../ihdrs -I../uhdrs
XUINCL=	-I../bhdrs -I../ehdrs -I../ihdrs -I../uhdrs
X
X# --- Editor and interpreter directories ---
X
XCDIRS=	b bed bint1 bint2 bint3 btr unix stc bio
X
XBDIRS=	b
XEDIRS=	bed
XIDIRS=	bint1 bint2 bint3 btr stc bio
XUDIRS=	unix
X
X# --- Editor and interpreter files ---
X
XBOBJS=	b/*.o
XEOBJS=	bed/*.o
XIOBJS=	bint1/*.o bint2/*.o bint3/*.o btr/*.o stc/*.o bio/*.o
XUOBJS=	unix/*.o
X
XBSRCS=	b/*.c
XESRCS=	bed/*.c
XISRCS=	bint1/*.c bint2/*.c bint3/*.c btr/*.c stc/*.c bio/*.c
XUSRCS=	unix/*.c
X
XBHDRS=	bhdrs/*.h
XEHDRS=	ehdrs/*.h
XIHDRS=	ihdrs/*.h btr/*.h bio/*.h
XUHDRS=	uhdrs/*.h
X
X# --- Preliminary dependencies (do not change for Unix) ---
X
XCONFIG=	uhdrs/config.h
XOSHDIR= uhdrs
X
XDEST=	uhdrs/dest.h
X
X# --- Stuff for programmers ---
X
XLINT=		lint
X# change the next one to -p for ATT System V
XLINTFLAGS=	-abhxp
XLINCL=		-Ibhdrs -Iehdrs -Iihdrs -Iuhdrs -Ibtr
X
XTAGDIRS=b bed bint1 bint2 bint3 btr stc bio unix keys bhdrs ehdrs ihdrs uhdrs
X
X
X# -------------------------------------------
X# ---  make all: make everything locally  ---
X# -------------------------------------------
X#
X# This makes all programs and utilities in the current directory.
X# (Except for the ready-for-use default key definitions files).
X
Xall:	alldest abc.ld abckeys.ld
X	@./ch_all "$(DESTROOT)"
X
X# The target 'alldest' is used to communicate the place of auxiliary files.
X# This target is also used for a separate 'make abc' or 'make abckeys'.
X#
X# Dependency on the (non-existent) file "ALWAYS" causes this entry to
X# be (re)made unconditionally. Make won't complain about ALWAYS not being
X# found because there is also a rule referencing it as target at the
X# very end (which actually doesn't make it, but make doesn't care).
X
Xalldest: ALWAYS
X	echo "#define ABCLIB \"$(DESTALL)\"" >dest
X	if cmp -s dest $(DEST); then rm dest; else mv dest $(DEST); fi
X
X# CONFIG: generate include file with info about the hardware configuration.
X#
X# Special care is taken to remove an incomplete $(CONFIG) if mkconfig
X# fails halfway. Otherwise a subsequent 'make depend' will happily go on.
X
Xconfig: $(CONFIG)
X
X$(CONFIG): mkconfig.c $(OSHDIR)/osconf.h
X	@./ch_config "$(DESTROOT)" "$(CONFIG)"
X	$(CC) -I$(OSHDIR) mkconfig.c -o mkconfig
X	./mkconfig >$(CONFIG) || (rm -f $(CONFIG) && exit 1)
X
X# abc: make the executable that is the kernel of the system.
X#
X# The load must be unconditional, since we cannot know whether
X# any of the submakes had to update some subtarget.
X
Xabc: alldest abc.ld
X
Xabc.ld:	$(CONFIG) $(BDIRS) $(EDIRS) $(IDIRS) $(UDIRS) \
X		$(OWNTLIB) $(OWNTBASE) ALWAYS
X	$(CC) $(LDFLAGS) $(BOBJS) $(EOBJS) $(IOBJS) $(UOBJS) $(LIBS) -o abc
X
X# Call make for each editor and interpreter subdirectory with proper flags.
X#
X# If a dependency line has more than one item left of the colon, the
X# commands are executed for each of the items, with $@ substituted
X# by the item's name.
X
X$(BDIRS): $(CONFIG) ALWAYS
X	cd $@; $(MAKE) -f MF -f DEP CFLAGS='$(CFLAGS) $(BINCL)' all
X
X$(EDIRS): $(CONFIG) ALWAYS
X	cd $@; $(MAKE) -f MF -f DEP CFLAGS='$(CFLAGS) $(EINCL)' all
X
X$(IDIRS): $(CONFIG) ALWAYS
X	cd $@; $(MAKE) -f MF -f DEP CFLAGS='$(CFLAGS) $(IINCL)' all
X
X$(UDIRS): $(CONFIG) ALWAYS
X	cd $@; $(MAKE) -f MF -f DEP CFLAGS='$(CFLAGS) $(UINCL)' all
X
X# Make utility 'abckeys' for redefinition of keybindings.
X#
X# The submake will find out whether recompilation is necessary.
X
Xabckeys: alldest abckeys.ld
X
Xabckeys.ld: $(CONFIG) $(OWNTLIB) $(OWNTBASE) ALWAYS
X	cd keys; \
X	 $(MAKE) -f Makefile -f DEP \
X	 	CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(KLIBS)" all
X
X
X# ----------------------------------------------
X# --- make examples: try the ABC interpreter ---
X# ----------------------------------------------
X
Xexamples:
X	@cd ex; ./DoExamples local
X#	ch_examples is embedded in DoExamples to cope with cross compilation.
X
X
X# ---------------------------------------------------------
X# --- make try_editor: try the ABC editor interactively ---
X# ---------------------------------------------------------
X
Xtry_editor:
X	@cd ex; ./TryEditor local
X#	ch_tryeditor embedded in TryEditor.
X
X# ---------------------------------------------------------
X# --- make install: install everything in public places ---
X# ---------------------------------------------------------
X#
X# The dependency of 'install' on installdest communicates the place
X# and place of auxiliary files to the binaries 'abc' and 'abckeys'.
X# The unconditional submakes of the targets 'abc.ld' and 'abckeys.ld'
X# causes the proper files to be remade.
X#
X# The directory ukeys contains default keydefinitions files for
X# several terminals.
X
Xinstall: installdest abc.ld abckeys.ld
X	cp abc abckeys $(DESTROOT)$(DESTABC)
X	cp abc.msg abc.hlp $(DESTROOT)$(DESTLIB)
X	cd ukeys; cp abckeys_* $(DESTROOT)$(DESTLIB)
X	cp abc.1 $(DESTROOT)$(DESTMAN)
X	@./ch_install "$(DESTABC)" "$(DESTLIB)" "$(DESTMAN)" "$(DESTROOT)"
X
Xinstalldest: ALWAYS
X	echo "#define ABCLIB \"$(DESTLIB)\"" >dest
X	if cmp -s dest $(DEST); then rm dest; else mv dest $(DEST); fi
X
X
X# -------------------------------------------------
X# --- Make our own termcap library and database ---
X# -------------------------------------------------
X#
X# For systems that really don't have any termlib-like library
X# this makes our own from public domain sources in ./tc.
X# See ./tc/README for details.
X# This happens automatically if you remove the comment symbols before
X# the definitions of OWNTLIB and OWNTBASE above.
X
Xlibtermcap.a:
X	cd tc; make library
X
Xtermcap:
X	cd tc; make database
X
X
X# -----------------------------------
X# ---  make clean: local cleanup  ---
X# -----------------------------------
X
Xclean:
X	rm -f */*.o mkconfig $(CONFIG) $(DEST) core ex/out
X	./ch_clean
X
X
X# ---------------------------------------------
X# ---  Utilities for the programmer/porter  ---
X# ---------------------------------------------
X
Xmflags:
X	echo MFLAGS="$(MFLAGS)", MAKEFLAGS="$(MAKEFLAGS)"
X
X# --- make makefiles: construct trivial makefiles in subdirectories ---
X#
X# This reconstructs trivial makefiles called 'MF' in relevant subdirectories.
X# See ./Port for details.
X
Xmakefiles:
X	for i in $(CDIRS); do \
X		( cd $$i; echo all: *.c | sed 's/\.c/.o/g' >MF ) done
X
X# No automatic makefile in ./keys. Edit that one yourself if need be.
X
X# --- How to generate dependency information for make ---
X#
X# Set MKDEP to $(CC) -M $(DEFS) or to ../scripts/mkdep $(DEFS).
X# 'cc -M' is a 4.2BSD-only feature which causes the C preprocessor
X# to output a list of dependencies that is directly usable by make.
X# This can be simulated exactly by piping the output of your preprocessor
X# through the shell script ./scripts/mkdep.
X# Check the comments there to see if it needs polishing for your system.
X
XMKDEP=	$(CC) -M $(DEFS)
X
X# --- make depend: construct makefiles with dependencies in subdirectories ---
X#
X# This reconstructs additional makefiles called 'DEP' in subdirectories
X# containing the dependency information.
X# Dependencies on system include files are grep'ed out, to make the
X# resulting DEP files distributable.
X# See ./Port.
X
Xdepend: $(CONFIG) $(DEST) bdep edep idep udep kdep
X
Xbdep:
X	for i in $(BDIRS); do \
X	( echo $$i; cd $$i; $(MKDEP) $(BINCL) *.c | grep -v ': /' >DEP ) done
X
Xedep:
X	for i in $(EDIRS); do \
X	( echo $$i; cd $$i; $(MKDEP) $(EINCL) *.c | grep -v ': /' >DEP ) done
X
Xidep:
X	for i in $(IDIRS); do \
X	( echo $$i; cd $$i; $(MKDEP) $(IINCL) *.c | grep -v ': /' >DEP ) done
X
Xudep:
X	for i in $(UDIRS); do \
X	( echo $$i; cd $$i; $(MKDEP) $(UINCL) *.c | grep -v ': /' >DEP ) done
X
Xkdep:
X	cd keys; \
X	$(MAKE) MKDEP="$(MKDEP)" DEFS="$(DEFS)" depend | grep -v ': /' >DEP
X
X$(DEST): alldest
X
X# --- make messages ---
X#
X# Make new messages file when you have changed or added any MESS/GMESS
X# definitions in the source.
X# Note: the Collect and Change scripts can be found in ./scripts.
X# See ./Problems for details.
X
Xmessages: abc.msg
X
Xabc.msg: $(BSRCS) $(ESRCS) $(ISRCS) $(USRCS) \
X		ihdrs/i0err.h ehdrs/erro.h bio/i4bio.h
X	./scripts/Collect $(BSRCS) $(ESRCS) $(ISRCS) $(USRCS) \
X		ihdrs/i0err.h ehdrs/erro.h bio/i4bio.h >abc.msg
X
X# --- make help ---
X#
X# Help file from manual entry.
X# Sorry, the file unix/abc.mac was created from copyrighted material;
X# therefore, it is not in the distribution.
X#
X
Xhelp: abc.hlp
X
Xabc.hlp: unix/abc.mac abc.1
X	nroff unix/abc.mac abc.1 >abc.help
X	(echo "SUMMARY OF SPECIAL ACTIONS"; \
X	 sed -e '1,/^SUMMARY/d' abc.help; \
X	 echo " "; \
X	 sed -e '/^SUMMARY/,$$d' abc.help) >abc.hlp
X	rm abc.help
X
X# ---  make clobber: additional local cleanup   ---
X
Xclobber:
X	rm -f abc abckeys */tags tags ID
X
X# --- make lint, tags and id ---
X
Xlint:	$(DEST) abclint klint
X
Xabclint:
X	$(LINT) $(LINTFLAGS) $(DEFS) $(LINCL) \
X		$(BSRCS) $(ESRCS) $(ISRCS) $(USRCS)
X
Xklint:
X	cd keys; \
X	 $(MAKE) LINT="$(LINT)" LINTFLAGS="$(LINTFLAGS)" DEFS="$(DEFS)" lint
X
Xtags:	ALWAYS
X	etags */*.h */*.c
X	rm -f tags   # Remove it so it will be remade when an interrupt hits
X	for i in $(TAGDIRS); \
X	do \
X		( echo $$i; cd $$i; ctags -w *.[ch]; \
X		  sed "s,	,	$$i/," tags \
X		) \
X	done | sort -o tags
X
X
Xid:	ALWAYS
X	mkid */*.[hc]
X
X
XALWAYS: # Must not exist, but must be mentioned in the makefile
EOF
echo 'x - abc/README'
sed 's/^X//' > 'abc/README' << 'EOF'
XCopyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988.
X
XHOW TO INSTALL ABC:
X
XYou will need 2.5 megabytes in total to compile and load the ABC system.
XTo start type:
X
X        ./Setup
X
Xwhich will ask you some questions to set the ABC system up on your
Xinstallation.  You can call "Setup" any number of times without spoiling
Xfiles.  So run it once to see what questions you will be asked.  If you
Xdon't know the answer to some question, you can run it again.
X
X        make all
X
Xwill compile and load the ABC system, producing the programs "abc" and
X"abckeys" locally in this directory.  You can test the ABC interpreter with:
X
X        make examples
X
XThis runs some examples in ./ex. It does not test the ABC editor, however;
Xthat can only be done interactively with
X
X        make try_editor
X
XConsult the sheet "HOW TO TRY THE ABC EDITOR" (also in ./README2).
X
XIf all is well and you want to make ABC public
X
X        make install
X
Xwill do some compiling to get the right pathnames in, and install the binaries
X"abc" and "abckeys", the "abc.1" manual file, and the auxiliary files in the
Xdirectories you indicated during setup.  Finally
X
X        make clean
X
Xwill clean all intermediate object files from the source directories.
X
XIf you have made ABC public, all necessary files have been copied to the
Xpublic places, and you can get rid of the entire ABC file system hierarchy
Xyou extracted from the tape, if you want.
X
XIf there are any problems, don't panic. See ./Problems for advice.  Also
Xedit the example Bug Report form in ./doc to communicate the problem to us.
XWe can then send out diffs for fixed problems in the future.
X
XAbove all, we would be very grateful to receive any comments you have about
Xthe setup procedure, or the ABC system in general, on how to make it easier
Xto use.
X
XGood luck!
EOF
echo 'x - abc/Problems'
sed 's/^X//' > 'abc/Problems' << 'EOF'
XCopyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988.
X
XHOW TO TACKLE PROBLEMS DURING ABC INSTALLATION
X
XThis file contains some detailed advice in case you run into problems while
Xinstalling the ABC system.
X
XTHE SETUP PROCEDURE
X
XYour best bet if the "Setup" script fails is to read it, locate the
Xproblem, change it and run it again.  You can always shorten its runtime by
Xchanging long pieces into the simple setting of a shell variable.  For
Xinstance, once you are sure your floating point is allright, you might
Xreplace the whole section titled "Floating point arithmetic ok?" by a
Xsimple "fflag=".
X
XNormally you should not edit the files that Setup creates (./Makefile
Xand ./uhdrs/os.h) directly, but their ancestors (./Makefile.unix and
X./uhdrs/os.h.gen) and run Setup to incorporate your changes.
XIf you really want to change them directly, also change Setup to
Xwork on them or remove Setup completely.
X
XMACHINE CONFIGURATION
X
XThe file ./uhdrs/config.h is created by compiling "mkconfig.c" and running
X"mkconfig" on your target machine, since it tries to establish some facts
Xabout the hardware configuration.  (If you are cross-compiling you should
Xdo that before a "make depend" since that would run mkconfig on the local
X(compiling) machine.)
X
XIf you really have to edit uhdrs/config.h, you should edit the Makefile (or
XMakefile.unix) so that it will not overwrite it anymore.
X
XThe problem most encountered with mkconfig is "unexpected over/underflow".
XThis is usually caused by a bug in "printf", where it can't print very
Xlarge or very small numbers.  Look at the last line produced by mkconfig
Xbefore it failed, and then locate the printf after the one that printed
Xthat line.  If it is trying to print a comment (rather than a #define),
Xyou can safely comment out the printf and try again.  (You might also want
Xto report the bug to your UNIX supplier.)
X
XOTHER UNIX's
X
XThe installation of the ABC system has been tested under 4.3 BSD UNIX on
XTahoe, Vax, Sun and Sparc machines, under ATT System V Release 3.0 UNIX on an
XIntel 80386, and under MINIX, which is supposed to be VERSION 7 UNIX
Xcompatible.  The Setup script tries to find out whether your UNIX is one of
Xthese, and creates ./uhdrs/os.h from ./uhdrs/os.h.gen accordingly.  We
Xexpect you will have no problems compiling the ABC system in this case.
X
XIf your UNIX is different, the Setup script will create a file ./uhdrs/os.h
Xwith most defaults setup for a VERSION 7 UNIX system, since that makes a
Xminimum number of assumptions.  Examine the resulting file, and change the
Xnames of system include files if they are different on your system.  Also
Xcheck the definitions and UNIX specific flags in this file.  See the
Xcomments, and use your systems manual to find out how to set them.  Don't
Xforget that this file is created by running Setup; change Setup if you want
Xto edit uhdrs/os.h directly, or edit uhdrs/os.h.gen and run Setup again.
X
XIf your machine's memory is not that big, you might examine ./uhdrs/feat.h
Xto turn off some features in an attempt to make the ABC editor-interpreter
Xsmaller.
X
XWe have tried to gather the operating system dependent parts in ./unix/*.c
Xand ./uhdrs/*.h.  Examine these if any problems in compilation remain.
X
XEDITOR PROBLEMS
X
XOnce the ABC system is compiled, you may encounter problems when you use
Xthe ABC editor.  Our experience is that most of these problems are caused
Xby erroneous or insufficiently detailed termcap entries, which decribe your
Xterminal's capabilities; so first check the "termcap(5)" manual entry (or
X"terminfo(4)" for terminfo systems).  Ask your system's guru to give you a
Xhand if you are not familiar with these.
X
XWe use the following entries from the termcap database if they are defined
Xfor your terminal:
X
X       Name   Type   Description
X
X       AL     str    add n new blank lines
X       CM     str    screen-relative cursor motion
X       DL     str    delete n lines
X       al     str    add new blank line
X       am     bool   has automatic margins
X       bc     str    backspace character
X       bs     bool   terminal can backspace
X       cd     str    clear to end of display
X       ce     str    clear to end of line
X       cl     str    cursor home and clear screen
X       cm     str    cursor motion
X       co     num    number of columns in a line
X       cp     str    cursor position sense reply
X       cr     str    carriage return
X       cs     str    change scrolling region
X       da     bool   display may be retained above screen
X       db     bool   display may be retained below screen
X       dc     str    delete character
X       dl     str    delete line
X       dm     str    enter delete mode
X       do     str    cursor down one line
X       ed     str    end delete mode
X       ei     str    end insert mode
X       hc     bool   hardcopy terminal
X       ho     str    cursor home
X       ic     str    insert character (if necessary; may pad)
X       im     str    enter insert mode
X       in     bool   not save to have null chars on the screen
X       ke     str    keypad mode end
X       ks     str    keypad mode start
X       le     str    cursor left
X       li     num    number of lines on screen
X       mi     bool   move safely in insert (and delete?) mode
X       ms     bool   move safely in standout mode
X       nd     str    cursor right (non-destructive space)
X       nl     str    newline
X       pc     str    pad character
X       se     str    end standout mode
X       sf     str    scroll text up (from bottom of region)
X       sg     num    number of garbage characters left by so or se (default 0)
X       so     str    begin standout mode
X       sp     str    sense cursor position
X       sr     str    scroll text down (from top of region)
X       te     str    end termcap
X       ti     str    start termcap
X       ue     str    end underscore mode
X       up     str    cursor up
X       us     str    start underscore mode
X       vb     str    visible bell
X       ve     str    make cursor visible again
X       vi     str    make cursor invisible
X       xn     bool   newline ignored after 80 cols (VT100 / Concept glitch)
X       xs     bool   standout not erased by overwriting
X
XOf these your termcap entry should at least define the following:
X
X       le OR bc OR bs
X       up
X       cm OR CM OR (ho AND do AND nd)
X       (al AND dl) OR (cs AND sr)
X       ce
X       (so AND se AND sg = 0 [or not defined]) OR (us AND ue)
X
XIf either of these requirements is not fulfilled, the ABC editor will
Xcomplain that your terminal is too dumb.
X
XOne common problem on terminals with resizeable windows is that the ABC
Xprompt shows up like
X
X       >>>
X           ?
X
Xon two lines instead of one.  This means that the "li#" entry in your
XTERMCAP does not accurately reflect the number of lines actually in the
Xwindow.  This can be remedied by changing the setting of your TERMCAP
Xenvironment variable, using the output of "stty size" (see stty(1)).  (On
Xsystems that have the TIOCGWINSZ ioctl, we use it to get the proper window
Xsize; see tty(4) on BSD UNIX systems).
X
XERROR MESSAGES
X
XThe error messages that ABC displays are all gathered in a file and only
Xread when necessary.  This was done to diminish the store used for all
Xthese strings and to enhance the adaptability of ABC to another natural
Xlanguage.
X
XIf you want the error messages in another language, for example French, you
Xonly have to replace the file ./abc.msg by a French version.
EOF
echo 'x - abc/ch_all'
sed 's/^X//' > 'abc/ch_all' << 'EOF'
X: 'Check if make all went allright.'
X
Xdestroot="$1"
X
Xerrors="no"
X
Xecho " "
X
Xfor f in abc abckeys
Xdo
X	if test ! -s $f
X	then
X		echo "*** Failed to make $f"
X		errors="yes"
X	fi
Xdone
X
Xcase $errors in
Xyes)
X	exit 1
X	;;
Xno)
X	case $destroot in
X	'')	echo "The 'abc' command should now work."
X		echo "You can test the ABC interpreter with 'make examples'."
X		;;
X	*)	echo "That 'make all' went well."
X		echo "Say 'make install' to install the ABC system in $destroot."
X		;;
X	esac
X	exit 0
X	;;
Xesac
EOF
chmod +x 'abc/ch_all'
echo 'x - abc/ch_install'
sed 's/^X//' > 'abc/ch_install' << 'EOF'
X: 'Check if make install went allright.'
X
Xabcdir="$1"
Xlibdir="$2"
Xmandir="$3"
Xdestroot="$4"
X
Xerrors="no"
X
Xecho " "
X
Xfor f in abc abckeys
Xdo
X	if test ! -s $destroot$abcdir/$f
X	then
X		echo "*** Failed to install '$f' in $destroot$abcdir"
X		errors="yes"
X	fi
Xdone
X
Xfor f in abc.msg abc.hlp
Xdo
X	if test ! -s $destroot$libdir/$f
X	then
X		echo "*** Failed to install '$f' in $destroot$libdir"
X		errors="yes"
X	fi
Xdone
X
Xif test ! -s $destroot$mandir/abc.1
Xthen
X	echo "*** Failed to install 'abc.1' manual in $destroot$mandir"
X	errors="yes"
Xfi
X
Xcase $errors in
Xyes)
X	exit 1
X	;;
Xno)
X	echo "The ABC system is installed."
X	case $destroot in
X	'')	echo "You can clean up with 'make clean'.";;
X	*)	echo "You can copy from $destroot to the target machine."
X		echo "To test ABC there also copy ./ex there,"
X		echo "and use ./ex/DoExamples and ./ex/TryEditor"
X		echo "to test the interpreter and the editor, respectively."
X		echo "If all is well, you can clean up here with 'make clean'."
X		;;
X	esac
X	exit 0
X	;;	
Xesac
EOF
chmod +x 'abc/ch_install'
echo 'x - abc/ch_clean'
sed 's/^X//' > 'abc/ch_clean' << 'EOF'
X: 'from make clean to make clobber'
X
Xecho " "
Xecho "You can clean up the results from 'make all' with 'make clobber'."
X
Xexit 0
EOF
chmod +x 'abc/ch_clean'
patch ./abc/bhdrs/bfil.h <<EOF
*** /ufs/timo/abcdist/abc/bhdrs/bfil.h	Thu Jan 25 12:54:30 1990
--- ./abc/bhdrs/bfil.h	Fri Jan  4 09:46:54 1991
***************
*** 1,8 ****
  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */
  
! /* MESSFILE and HELPFILE in ../?hdrs/dest.h. */
! 
  #define KEYSFILE	"abc.key"
  
  #define PERMFILE	"perm.abc"
  #define SUGGFILE	"suggest.abc"
--- 1,8 ----
  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1988. */
  
! #define MESSFILE	"abc.msg"
  #define KEYSFILE	"abc.key"
+ #define HELPFILE	"abc.hlp"
  
  #define PERMFILE	"perm.abc"
  #define SUGGFILE	"suggest.abc"
EOF
patch ./abc/bhdrs/bobj.h <<EOF
*** /ufs/timo/abcdist/abc/bhdrs/bobj.h	Thu Jan 25 12:54:30 1990
--- ./abc/bhdrs/bobj.h	Thu Jan  3 15:24:27 1991
***************
*** 9,14 ****
--- 9,15 ----
  #define log2 b_log2
  #define pi b_pi
  #define random b_random
+ #define remove b_remove
  
  /****************************** general ******************************/
  
***************
*** 115,121 ****
  value root2();
  value log2();
  value pi();
! value e();
  value nowisthetime();
  value exactly();
  bool exact();
--- 116,122 ----
  value root2();
  value log2();
  value pi();
! value e_natural();
  value nowisthetime();
  value exactly();
  bool exact();
EOF
patch ./abc/bhdrs/release.h <<EOF
*** /ufs/timo/abcdist/abc/bhdrs/release.h	Thu Jan 25 12:54:30 1990
--- ./abc/bhdrs/release.h	Thu Jan  3 15:30:18 1991
***************
*** 1 ****
! #define RELEASE "1.02.01"
--- 1 ----
! #define RELEASE "1.02.02"
EOF
patch ./abc/bint1/i1fun.c <<EOF
*** /ufs/timo/abcdist/abc/bint1/i1fun.c	Thu Jan 25 12:54:13 1990
--- ./abc/bint1/i1fun.c	Thu Jan  3 15:24:26 1991
***************
*** 531,537 ****
  /* The rest of the mathematical functions */
  
  Visible value pi() { return (value) mk_approx(3.141592653589793238463, 0.0); }
! Visible value e() { return (value) mk_approx(2.718281828459045235360, 0.0); }
  
  Hidden real over_two_pi(v) value v; {
  	real two_pi = mk_approx(6.283185307179586476926, 0.0);
--- 531,537 ----
  /* The rest of the mathematical functions */
  
  Visible value pi() { return (value) mk_approx(3.141592653589793238463, 0.0); }
! Visible value e_natural() { return (value) mk_approx(2.718281828459045235360, 0.0); }
  
  Hidden real over_two_pi(v) value v; {
  	real two_pi = mk_approx(6.283185307179586476926, 0.0);
EOF
patch ./abc/bint3/i3fpr.c <<EOF
*** /ufs/timo/abcdist/abc/bint3/i3fpr.c	Thu Jan 25 12:54:20 1990
--- ./abc/bint3/i3fpr.c	Thu Jan  3 15:24:26 1991
***************
*** 55,61 ****
  	{S_NUMBER,	Dfd, Other, size2},
  
  	{F_pi,		Zfd, Other, pi},
! 	{F_e,		Zfd, Other, e},
  	{F_now,		Zfd, Other, nowisthetime},
  	
  	{F_abs,    	Mfd, Nume, absval},
--- 55,61 ----
  	{S_NUMBER,	Dfd, Other, size2},
  
  	{F_pi,		Zfd, Other, pi},
! 	{F_e,		Zfd, Other, e_natural},
  	{F_now,		Zfd, Other, nowisthetime},
  	
  	{F_abs,    	Mfd, Nume, absval},
EOF
patch ./abc/ihdrs/i2par.h <<EOF
*** /ufs/timo/abcdist/abc/ihdrs/i2par.h	Thu Jan 25 12:54:32 1990
--- ./abc/ihdrs/i2par.h	Thu Jan  3 15:19:20 1991
***************
*** 2,11 ****
  
  /***********************************************************************/
  
- #ifdef macintosh
  /* Avoid name conflict with standard header files: */
  #define compound b_compound
- #endif
  
  /* General parsing routines */
  
--- 2,9 ----
EOF
patch ./abc/uhdrs/os.h.gen <<EOF
*** /ufs/timo/abcdist/abc/uhdrs/os.h.gen	Thu Jan 25 12:54:43 1990
--- ./abc/uhdrs/os.h.gen	Thu Jan  3 16:38:30 1991
***************
*** 66,72 ****
--- 66,74 ----
  #define HAS_FTIME	/* ftime() and <sys/timeb.h> available */
  #define HAS_PERROR	/* can use sys_errlist and sys_nerr (from perror(3)) */
  #define HAS_MKDIR	/* mkdir() and rmdir() available */
+ /* define either one of the next two, or neither: */
  #define HAS_GETWD	/* getwd() available */
+ #undef  HAS_GETCWD	/* getcwd() available instead */
  #define HAS_RENAME	/* rename() available */
  #define HAS_SELECT	/* 4.2 BSD select() system call available */
  #define HAS_READDIR	/* Berkeley style directory reading routines */
EOF
patch ./abc/unix/u1file.c <<EOF
*** /ufs/timo/abcdist/abc/unix/u1file.c	Thu Jan 25 12:54:26 1990
--- ./abc/unix/u1file.c	Thu Jan  3 16:35:54 1991
***************
*** 9,16 ****
  extern char *getwd();
  
  Visible char *curdir() {
! 	static char buffer[SIZE_PATH];
  	return getwd(buffer);
  }
  
  Hidden string searchfile(base, abclib) string base; string abclib; {
--- 9,22 ----
  extern char *getwd();
  
  Visible char *curdir() {
! 	static char buffer[1024];
! #ifdef HAS_GETCWD
! 	char *getcwd();
! 	return getcwd(buffer, 1024);
! #else
! 	char *getwd();
  	return getwd(buffer);
+ #endif
  }
  
  Hidden string searchfile(base, abclib) string base; string abclib; {
EOF
patch ./abc/unix/u1os.c <<EOF
*** /ufs/timo/abcdist/abc/unix/u1os.c	Thu Jan 25 12:54:26 1990
--- ./abc/unix/u1os.c	Thu Jan  3 16:35:54 1991
***************
*** 16,22 ****
--- 16,24 ----
  
  #endif /* !NDEBUG */
  
+ #ifndef HAS_GETCWD
  #ifndef HAS_GETWD
+ /* neither getwd, nor getcwd provided; define our own: */
  
  /* getwd - get working directory */
  
***************
*** 37,42 ****
--- 39,45 ----
  		return (char*) NULL;
  }
  
+ #endif /* !HAS_GETCWD */
  #endif /* !HAS_GETWD */
  
  #ifndef HAS_RENAME
EOF
patch ./abc/doc/BugReport <<EOF
*** abc.1.02.01/doc/BugReport	Thu Jan 25 12:54:44 1990
--- abc/doc/BugReport	Fri Jan  4 21:13:31 1991
***************
*** 19,25 ****
  Operating System:  O 4.3 BSD   O Version 7   O System V   O other: .......
  
  ==========================================================================
! ABC Release 1.02.01.
  ==========================================================================
  
  FAULTY PROGRAM:
--- 19,25 ----
  Operating System:  O 4.3 BSD   O Version 7   O System V   O other: .......
  
  ==========================================================================
! ABC Release 1.02.02.
  ==========================================================================
  
  FAULTY PROGRAM:
EOF
echo 'Second Authors patch for ABC system (bugfixes) complete.'
exit 0

exit 0 # Just in case...
-- 
Please send comp.sources.unix-related mail to rsalz at uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.



More information about the Comp.sources.unix mailing list