In the last few months there have been requests on USENET for a cross
referencing program.  Standard UNIX usage is, one supposes, to use
egrep on a case by case basis for this purpose.  However, I cobbled up
such a program as an example using of using make, lex and awk for a
short UNIX tutorial.  It has had only minimal testing and is not
especially efficient;  caveat emptor!

This package makes three files:
    xref - a shell script which cross references files
    xreflex - a lex(1) program used by xref
    xref.1 - a manual entry for xref

It was developed on a 4.2BSD system, and assumes that make, lex, cc, 
sh, ed, fgrep, sort, and awk are available under /bin or
/usr/{bin,ucb,local}.  It should run with at worst minimal changes
under any other flavor of UNIX.  If fgrep, sort, and awk are somewhere
else be sure to change the PATH in xrefhead.sh.

The idea is to cross reference files by "xref file1 ... >listing".
A pipeline of the form "lex program | fgrep | sort | awk" extracts
words and their locations, discards extraneous ones, sorts the rest,
and merges the resulting name,file,line triples into a fairly standard
cross reference map.

Various make targets are available:
    make all		# makes xref & xreflex for /usr/local
    make DESTDIR=somewhere all	# ... for somewhere instead.
    make piecetest	# produce intermediate *_out files.
    make DESTDIR=somewhere MANLOC=elsewhere install
			# install xref, xreflex, xref.1
    make clean		# remove computed files

xref is produced by minor editing from xrefhead.sh and mergelines.awk.
xref.1 is produced by minor editing from xref.man.
xreflex is produced by lex and cc from xref.l.

-- Jim Leinweber  (jiml@uwmacc.UUCP, leinwebe@wisc-ai.ARPA)
Madison Academic Computing Center, 1210 W. Dayton ST., Madison Wi 53706
