[comp.sources.unix] v12i015: Cake, a make replacement, Part09/09

rsalz@uunet.UU.NET (Rich Salz) (10/17/87)

Submitted-by: Zoltan Somogyi <zs@munnari.oz>
Posting-number: Volume 12, Issue 15
Archive-name: cake/part09

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	README
#	ccs
#	cs
#	defn
#	double
#	extract
#	fix
#	gred
#	grei
#	gres
#	irrel
#	isoption
#	mainfile
#	nonnull
#	ol
#	rmv
#	soincl
#	ssize
#	yygram
#	yyrepl
#	yystat
# This archive created: Wed Oct 14 20:30:12 1987
export PATH; PATH=/bin:/usr/bin:$PATH
echo mkdir Script
mkdir Script
echo cd Script
cd Script
echo shar: "extracting 'README'" '(754 characters)'
if test -f 'README'
then
	echo shar: "will not over-write existing file 'README'"
else
sed 's/^X//' << \SHAR_EOF > 'README'
XThis directory contains those commands used by the "standard" cakefiles
Xwhich are implemented by scripts.
X
XThe commands reporting on cake stats (cs and ccs) have embedded in them
Xthe name of the cake stats file; if you change the macro STATS_FILE
Xin ../conf.h, you should change these also (unless you turn off stats
Xaltogether, of course). Apart from this, "fix" is the only program
Xthat will require adjustments, at least on Berkeley systems.
X
XHowever, on systems without #!, you will need to do some work
Xto replace #! /bin/sh lines with : lines and convert /bin/awk
Xinterpreted scripts into Bourne shell scripts; on systems which don't
Xeven recognize # as signifying a C-shell script, you will also need
Xto convert C-shell scripts into Bourne shell.
SHAR_EOF
if test 754 -ne "`wc -c < 'README'`"
then
	echo shar: "error transmitting 'README'" '(should have been 754 characters)'
fi
fi
echo shar: "extracting 'ccs'" '(538 characters)'
if test -f 'ccs'
then
	echo shar: "will not over-write existing file 'ccs'"
else
sed 's/^X//' << \SHAR_EOF > 'ccs'
X#! /bin/sh
Xcat > /tmp/ccs$$ << END_PROG
X	{
X		if (NF == 10)
X		{
X			otried += \$7;
X			ofound += \$8;
X			stried += \$9;
X			sfound += \$10;
X		}
X	}
XEND	{
X		printf "output cache accesses:  %8d\n", otried;
X		printf "output cache hits:      %8d\n", ofound;
X		printf "output cache hit ratio: %8.2f\n", (ofound*100)/otried;
X		printf "status cache accesses:  %8d\n", stried;
X		printf "status cache hits:      %8d\n", sfound;
X		printf "status cache hit ratio: %8.2f\n", (sfound*100)/stried;
X	}
XEND_PROG
Xawk -f /tmp/ccs$$ < /u/pgrad/zs/lib/cake_stats
SHAR_EOF
if test 538 -ne "`wc -c < 'ccs'`"
then
	echo shar: "error transmitting 'ccs'" '(should have been 538 characters)'
fi
chmod +x 'ccs'
fi
echo shar: "extracting 'cs'" '(1432 characters)'
if test -f 'cs'
then
	echo shar: "will not over-write existing file 'cs'"
else
sed 's/^X//' << \SHAR_EOF > 'cs'
X#! /bin/sh
Xcat > /tmp/cs.prog$$ << END_PROG
XBEGIN	{
X		printf "%8s%5s%8s", "", "", "";
X		printf "%8s%8s%8s%8s", "self", "self", "child", "child";
X		printf "%8s%10s%8s", "", "", "o/h";
X		printf "\n";
X		printf "%-8s%5s%8s", "user", "inv", "mem";
X		printf "%8s%8s%8s%8s", "usr", "sys", "usr", "sys";
X		printf "%8s%10s%8s", "all", "total", "ratio";
X		printf "\n\n";
X	}
X	{
X		inv[\$1] += 1;		inv["total"] += 1;
X		su[\$1]  += \$2;	su["total"]  += \$2;
X		ss[\$1]  += \$3;	ss["total"]  += \$3;
X		cu[\$1]  += \$4;	cu["total"]  += \$4;
X		cs[\$1]  += \$5;	cs["total"]  += \$5;
X		mem[\$1] += \$6;	mem["total"] += \$6;
X	}
XEND	{
X		for (u in inv)
X		{
X			opt   = (su[u])/100;
X			unopt = (ss[u] + cu[u] + cs[u])/100;
X			all   = (su[u] + ss[u] + cu[u] + cs[u])/100;
X
X			printf "%-8s%5d", u, inv[u]		> "/tmp/cs.out$$";
X			printf "%7dk", mem[u]/(1000*inv[u])	> "/tmp/cs.out$$";
X			printf "%8.2f", su[u]/(100*inv[u])	> "/tmp/cs.out$$";
X			printf "%8.2f", ss[u]/(100*inv[u])	> "/tmp/cs.out$$";
X			printf "%8.2f", cu[u]/(100*inv[u])	> "/tmp/cs.out$$";
X			printf "%8.2f", cs[u]/(100*inv[u])	> "/tmp/cs.out$$";
X			printf "%8.2f%10.2f", all/inv[u], all	> "/tmp/cs.out$$";
X			if (opt > 0)
X				printf "%8.2f", unopt/opt	> "/tmp/cs.out$$";
X			else
X				printf "%s", "infinity"		> "/tmp/cs.out$$";
X			printf "\n"				> "/tmp/cs.out$$";
X		}
X	}
XEND_PROG
Xawk -f /tmp/cs.prog$$ < /u/pgrad/zs/lib/cake_stats
Xsort +8n /tmp/cs.out$$
X/bin/rm -f /tmp/cs.prog$$ /tmp/cs.out$$
SHAR_EOF
if test 1432 -ne "`wc -c < 'cs'`"
then
	echo shar: "error transmitting 'cs'" '(should have been 1432 characters)'
fi
chmod +x 'cs'
fi
echo shar: "extracting 'defn'" '(515 characters)'
if test -f 'defn'
then
	echo shar: "will not over-write existing file 'defn'"
else
sed 's/^X//' << \SHAR_EOF > 'defn'
Xgrep -n "^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]" $* > /tmp/$$
Xed - /tmp/$$ <<'EOF'
Xg/extern/d
Xg/^\(.*:\).*[ 	]\**\([^ 	][^ 	]*(.*)\).*$/s//\1\2/
Xv/(.*)/d
Xg/[-;\*\[\]%!<>=]/d
Xg/,.*(/d
Xg/:.*:.*:/d
Xg/	/s// /g
Xg/:$/d
Xg/^\(.*(.*)\).*/s//\1/
Xg/^\(.*:.............................................\).*/s//\1/
X1,$s/\(.*:\)\(.*\)/\2|\1/
Xg/^[^a-zA-Z_]/d
X1,$s/|/                                                 /
X1,$s/^\(................................................\) */\1/
Xw
Xq
XEOF
Xcat /tmp/$$
Xrm /tmp/$$
SHAR_EOF
if test 515 -ne "`wc -c < 'defn'`"
then
	echo shar: "error transmitting 'defn'" '(should have been 515 characters)'
fi
chmod +x 'defn'
fi
echo shar: "extracting 'double'" '(424 characters)'
if test -f 'double'
then
	echo shar: "will not over-write existing file 'double'"
else
sed 's/^X//' << \SHAR_EOF > 'double'
X#! /bin/csh -f
Xforeach file ($*)
Xcat > /tmp/double$$ << ENDPROG
XBEGIN	{
X		lastword = "";
X		lastfile = "";
X	}
X	{
X	}
XNF > 0	{
X		if (\$1 == lastword)
X			printf "file %s, line %d: double %s\n", "$file", NR, \$1;
X
X		for (i = 2; i <= NF; i++)
X			if (\$i == \$(i-1))
X				printf "file %s, line %d: double %s\n", "$file", NR, \$i;
X
X		lastword = \$NF;
X	}
XENDPROG
Xtr A-Z a-z < $file | awk -f /tmp/double$$
Xend
X/bin/rm -f /tmp/double$$
SHAR_EOF
if test 424 -ne "`wc -c < 'double'`"
then
	echo shar: "error transmitting 'double'" '(should have been 424 characters)'
fi
chmod +x 'double'
fi
echo shar: "extracting 'extract'" '(315 characters)'
if test -f 'extract'
then
	echo shar: "will not over-write existing file 'extract'"
else
sed 's/^X//' << \SHAR_EOF > 'extract'
X#! /bin/sh
Xcase $# in
X	2) file=$1; suff=$2; conf=Conf;;
X	3) file=$1; suff=$2; conf=$3;;
X	*) echo "Usage: $0 mainfile suffix [Conf]"; exit 1;;
Xesac
Xcat > /tmp/extract$$ << END_PROG
X/^$file/{
X		for (i = 2; i <= NF; i++)
X			printf "%s%s\n", \$i, "$suff";
X	}
XEND_PROG
Xawk -f /tmp/extract$$ $conf
X/bin/rm /tmp/extract$$
SHAR_EOF
if test 315 -ne "`wc -c < 'extract'`"
then
	echo shar: "error transmitting 'extract'" '(should have been 315 characters)'
fi
chmod +x 'extract'
fi
echo shar: "extracting 'fix'" '(5686 characters)'
if test -f 'fix'
then
	echo shar: "will not over-write existing file 'fix'"
else
sed 's/^X//' << \SHAR_EOF > 'fix'
X#! /bin/sh
X# fix	Ver. 2.0, 20/1/86
X# interactive spelling checker and fixer
X#   Rex Sanders, USGS Pacific Marine Geology
X#   Modifications by Bill Silvert, MEL
X#   Modifications by Ed Reeder, Intel
X#   Rewritten by Bill Ross and Zoltan Somogyi, University of Melbourne
X#
X# usage:
X#     fix [-d dict] [-l local] [-p pnouns] [-s] [-a] [-b] [-o out] [-i in] files
X#		-d use dict as your private dictionary
X#			this is the only dictionary that gets uppercase
X#			folded to lower (default $HOME/lib/dict/words)
X#			the directory $HOME/lib/dict MUST exist
X#		-p use pnouns as the dictionary of proper nouns
X#					(default=$HOME/lib/dict/proper-nouns)
X#		-l use local as the dictionary specific to this paper
X#					(default=./.words)
X#		-a use american spelling
X#		-b use british spelling (default)
X#		-s don't assume the dictionaries are sorted
X#		   by default we assume dict, local and pnouns
X#		   are all sorted, and dict is all lower case,
X#		   because sorting takes time.
X#		-o write the mistakes to a file, and exit
X#		-i read mistakes in from a file instead of running spell
X#
X# to come:
X#		preservation of case for beginning of sentence
X#		allow >1 word to be typed for a correction
X#			(at the moment it creates a file of the name of
X#			 the second word---weird!)
X# bugs:
X#		painfully slow on substitutions
X
Xmis=/tmp/spf$$.mis
Xsub=/tmp/spf$$.sub
Xmrk=/tmp/spf$$.mrk
Xtmp=/tmp/spf$$.tmp
XFILES=
XSORTED=
XSPELLOPT="-b"
XOUTFILE=
XINFILE=
XWORDS=$HOME/lib/dict/words
XPNOUNS=$HOME/lib/dict/proper-nouns
XLWORDS=./.words
XSPELLEDITOR=${SPELLEDITOR-'vi +/###/'}
XWJRBIN=/u/hons/wjr/bin
X
Xtrap "/bin/rm -f $mis $tmp $sub $mrk ; exit" 0 1 2 15
X
Xwhile test -n "$1"
Xdo
X	case $1 in
X	-d)	shift
X		WORDS=$1
X		;;
X	-l)	shift
X		LWORDS=$1
X		;;
X	-p)	shift
X		PNOUNS=$1
X		;;
X	-a)	SPELLOPT=
X		;;
X	-b)	SPELLOPT="-b"
X		;;
X	-s)	SORTED="n"
X		;;
X	-i)	shift
X		INFILE=$1
X		;;
X	-o)	shift
X		OUTFILE=$1
X		;;
X	*)	FILES="$FILES $1"
X		;;
X	esac
X	shift
Xdone
X
Xif test -n "$INFILE"
Xthen
X	echo "Reading mistakes from $INFILE for corrections to $FILES"
X	cp $INFILE $mis
Xelse
X	echo "Looking for spelling errors in $FILES ..."
X
X	touch $LWORDS		# we remove this at the end if it wasn't used
X
X	if test "$SORTED"
X	then
X		# -s option - force a sort of the dictionaries
X		if test ! -s $WORDS
X		then
X			touch $WORDS
X		else
X			tr A-Z a-z < $WORDS > $tmp
X			sort -u -f $tmp -o $WORDS
X		fi
X
X		if test ! -s $LWORDS
X		then
X			touch $LWORDS
X		else
X			sort -u  $LWORDS -o $LWORDS
X		fi
X
X		if test ! -s $PNOUNS
X		then
X			touch $PNOUNS
X		else
X			sort -u  $PNOUNS -o $PNOUNS
X		fi
X	fi
X
X	# ignore numbers, but keep alpha-numerics
X	/usr/bin/spell -b $FILES | egrep -v '^[0-9]+$' > $tmp
X	# remove the possessive apostrophe
X	if egrep \'s\$ $tmp > /dev/null
X	then
X		$WJRBIN/gres \'s\$ "" $tmp
X	fi
X	
X	sort -u $tmp -o $mis	# must be sorted for comm
X
X	# remove the words we know about
X	comm -23 $mis $PNOUNS | comm -23 - $LWORDS | comm -23 - $WORDS > $tmp
X	# now get rid of words in with (some) upper case that appear in words
X	egrep -v [A-Z] $tmp > $mis
X	for word in `egrep [A-Z] $tmp`
X	do
X		if grep -i -w $word $WORDS > /dev/null
X		then
X			echo -n	# a nop ! (continue does the wrong thing)
X		else
X			echo $word >> $mis
X		fi
X	done
X	sort -u $mis -o $mis
Xfi
X
Xif test ! -s $mis
Xthen
X	echo "No spelling errors found in $FILES"
X	/bin/rm -f $mis $sub $mrk $tmp
X	if test ! -s $LWORDS
X	then
X		/bin/rm -f $LWORDS
X	fi
X	exit 0
Xfi
X
Xif test -n "$OUTFILE"
Xthen
X	mv $mis $OUTFILE
X	/bin/rm -f $mis $sub $mrk $tmp
X	if test ! -s $LWORDS
X	then
X		/bin/rm -f $LWORDS
X	fi
X	exit 0
Xfi
X
Xecho "Found `/usr/ucb/wc -l < $mis` misspellings"
Xecho "Responses:"
Xecho "g=add to user (global) dictionary"
Xecho "p=add to user (global) dictionary of proper-nouns"
Xecho "l=add to user (local) dictionary"
Xecho "f=use a regular expression to look for correct spelling"
Xecho "m=mark for correction, b=bypass"
Xecho "Anything else is the correction"
X
Xfor word in `cat $mis`
Xdo
X	egrep $word $FILES
X	while true
X	do
X		echo -n "${word}: [correction or bglpfm] "
X		read response
X		case $response in
X		G|g)
X			echo $word >> $WORDS
X			##echo adding $word to global dictionary
X			addedg=y
X			break 
X			;;
X		P|p)
X			echo $word >> $PNOUNS
X			##echo adding $word to proper-noun dictionary
X			addedp=y
X			break 
X			;;
X		L|l)
X			echo $word >> $LWORDS
X			##echo adding $word to local dictionary
X			addedl=y
X			break 
X			;;
X		""|B|b)
X			##echo bypass on $word
X			break
X			;;
X		F|f)
X			echo -n "Search pattern for word: "
X			read response
X			if test "$response"
X			then
X				cat $PNOUNS $LWORDS $WORDS | egrep "$response" > $tmp
X				egrep "$response" /usr/dict/words | sort -f - $tmp | more
X			fi
X			;;
X		M|m)
X			echo "$WJRBIN/grei \"\\<${word}\\>\" \"### spell: ${word} %%%\" $FILES" >> $mrk
X			##echo marking $word
X			break
X			;;
X		*)	
X			echo "$WJRBIN/gres \"\\<${word}\\>\" ${response} $FILES" >> $sub
X			##echo changing $word to $response
X			break
X			;;
X		esac
X	done
Xdone
X
Xif test ${addedg-n} = y
Xthen
X	tr A-Z a-z < $WORDS > $tmp
X	sort -u -f $tmp -o $WORDS
Xfi
Xif test ${addedl-n} = y
Xthen
X	sort -u $LWORDS -o $LWORDS
Xelif test ! -s $LWORDS
Xthen
X	/bin/rm -f $LWORDS
Xfi
Xif test ${addedp-n} = y
Xthen
X	sort -u $PNOUNS -o $PNOUNS
Xfi
X
Xif test ! -s $sub -a ! -s $mrk
Xthen
X	/bin/rm -f $mis $sub $mrk $tmp
X	exit 0
Xfi
X
Xwhile true
Xdo
X	echo -n "Do you want to overwrite $FILES [yn] "
X	read reply
X	case "$reply" in
X	y*|Y*)
X		break
X		;;
X	n*|N*)
X		/bin/rm -f $mis $sub $mrk $tmp
X		exit 0
X		;;
X	*)
X		continue
X		;;
X	esac
Xdone
X
Xif test -s $sub
Xthen
X	echo -n "Substituting.... "
X	. $sub
X	echo "done."
Xfi
X
Xif test -s $mrk
Xthen
X	echo -n "Marking.... "
X	. $mrk
X	echo "done."
X	mod=""
X	for file in $FILES
X	do
X		if fgrep '###' $file > /dev/null
X		then
X			mod="$mod $file"
X		fi
X	done
X	$SPELLEDITOR $mod
Xfi
X
X/bin/rm -f $mis $sub $mrk $tmp
SHAR_EOF
if test 5686 -ne "`wc -c < 'fix'`"
then
	echo shar: "error transmitting 'fix'" '(should have been 5686 characters)'
fi
chmod +x 'fix'
fi
echo shar: "extracting 'gred'" '(309 characters)'
if test -f 'gred'
then
	echo shar: "will not over-write existing file 'gred'"
else
sed 's/^X//' << \SHAR_EOF > 'gred'
X#! /bin/sh
X# gred - delete regular expression
X# usage: gred pattern file ...
X
Xcase $# in
X	0|1) echo 1>&2 Usage: gred pattern file ...; exit 1;;
Xesac
XTERMCAP=/etc/termcap; export TERMCAP
Xpattern=$1
Xshift
Xfor file in $*
Xdo
X	ex - $file << END ; : use ex so that \< \> can be used
X	g/${pattern}/d
X	w!
X	q
XEND
Xdone
SHAR_EOF
if test 309 -ne "`wc -c < 'gred'`"
then
	echo shar: "error transmitting 'gred'" '(should have been 309 characters)'
fi
chmod +x 'gred'
fi
echo shar: "extracting 'grei'" '(341 characters)'
if test -f 'grei'
then
	echo shar: "will not over-write existing file 'grei'"
else
sed 's/^X//' << \SHAR_EOF > 'grei'
X#! /bin/sh
X# grei - insert at regular expressions
X# usage: grei where what file ...
X
Xcase $# in
X	0|1|2) echo 1>&2 Usage: grei where what file ...; exit 1;;
Xesac
XTERMCAP=/etc/termcap; export TERMCAP
Xwhere=$1
Xwhat=$2
Xshift; shift
Xfor file in $*
Xdo
X	ex - $file << END ; : use ex so that \< \> can be used
X	g/${where}/i\\
X${what}
X	w
X	q
XEND
Xdone
SHAR_EOF
if test 341 -ne "`wc -c < 'grei'`"
then
	echo shar: "error transmitting 'grei'" '(should have been 341 characters)'
fi
chmod +x 'grei'
fi
echo shar: "extracting 'gres'" '(338 characters)'
if test -f 'gres'
then
	echo shar: "will not over-write existing file 'gres'"
else
sed 's/^X//' << \SHAR_EOF > 'gres'
X#! /bin/sh
X# gres - substitute regular expressions
X# usage: gres from to file ...
X
Xcase $# in
X	0|1|2) echo 1>&2 Usage: gres from to file ...; exit 1;;
Xesac
XTERMCAP=/etc/termcap; export TERMCAP
Xfrom=$1
Xto=$2
Xshift; shift
Xfor file in $*
Xdo
X	ex - $file << END ; : use ex so that \< \> can be used
X	g/${from}/s/${from}/${to}/g
X	w
X	q
XEND
Xdone
SHAR_EOF
if test 338 -ne "`wc -c < 'gres'`"
then
	echo shar: "error transmitting 'gres'" '(should have been 338 characters)'
fi
chmod +x 'gres'
fi
echo shar: "extracting 'irrel'" '(197 characters)'
if test -f 'irrel'
then
	echo shar: "will not over-write existing file 'irrel'"
else
sed 's/^X//' << \SHAR_EOF > 'irrel'
X#! /bin/sh
X# irrel - delete irrelevant error messages
X# usage: ... |& irrel pattern ...
X
Xcat - > /tmp/irrel$$
Xfor pat in $*
Xdo
X	gred $pat /tmp/irrel$$
Xdone
Xcat /tmp/irrel$$
X/bin/rm -f /tmp/irrel$$
SHAR_EOF
if test 197 -ne "`wc -c < 'irrel'`"
then
	echo shar: "error transmitting 'irrel'" '(should have been 197 characters)'
fi
chmod +x 'irrel'
fi
echo shar: "extracting 'isoption'" '(46 characters)'
if test -f 'isoption'
then
	echo shar: "will not over-write existing file 'isoption'"
else
sed 's/^X//' << \SHAR_EOF > 'isoption'
X#! /bin/csh
Xsub \\-X option "$1" >& /dev/null
SHAR_EOF
if test 46 -ne "`wc -c < 'isoption'`"
then
	echo shar: "error transmitting 'isoption'" '(should have been 46 characters)'
fi
chmod +x 'isoption'
fi
echo shar: "extracting 'mainfile'" '(172 characters)'
if test -f 'mainfile'
then
	echo shar: "will not over-write existing file 'mainfile'"
else
sed 's/^X//' << \SHAR_EOF > 'mainfile'
X#! /bin/sh
Xcase $# in
X	1) suff=$1; conf=Conf;;
X	2) suff=$1; conf=$2;;
X	*) echo "Usage: $0 suffix [Conf]"; exit 1;;
Xesac
Xawk "{ printf \"%s%s\\n\", \$1, \"$suff\"; }" $conf
SHAR_EOF
if test 172 -ne "`wc -c < 'mainfile'`"
then
	echo shar: "error transmitting 'mainfile'" '(should have been 172 characters)'
fi
chmod +x 'mainfile'
fi
echo shar: "extracting 'nonnull'" '(53 characters)'
if test -f 'nonnull'
then
	echo shar: "will not over-write existing file 'nonnull'"
else
sed 's/^X//' << \SHAR_EOF > 'nonnull'
X#! /bin/sh
Xcase $# in
X	0) exit 1;;
X	*) exit 0;;
Xesac
SHAR_EOF
if test 53 -ne "`wc -c < 'nonnull'`"
then
	echo shar: "error transmitting 'nonnull'" '(should have been 53 characters)'
fi
chmod +x 'nonnull'
fi
echo shar: "extracting 'ol'" '(3070 characters)'
if test -f 'ol'
then
	echo shar: "will not over-write existing file 'ol'"
else
sed 's/^X//' << \SHAR_EOF > 'ol'
X#! /bin/awk -f
XBEGIN		{
X			for (i = 1; i <= 6; i++)
X			{
X				sect_no[i] = 0;
X				sect_line[i] = 0;
X				sect_start[i] = 0;
X			}
X
X			curr_ind = "";
X			sect_ind = "    "
X			theo_ind = "    "
X			offset = "			";
X			lineno = 0;
X		}
X/^\.sh/		{
X			for (i = $2; i <= 6; i++)
X			{
X				if (sect_line[i] != 0)
X				{
X					line[sect_line[i]] = sprintf(line[sect_line[i]], NR-sect_start[i]);
X				}
X			}
X
X			++sect_no[$2];
X			sect_line[$2] = lineno+1;
X			sect_start[$2] = NR;
X
X			for (i = $2+1; i <= 6; i++)
X			{
X				sect_no[i] = 0;
X				sect_line[i] = 0;
X				sect_start[i] = 0;
X			}
X
X			curr_ind = "";
X			for (i = 2; i <= $2; i++)
X				curr_ind = curr_ind sect_ind;
X
X			if ($2 == 1)
X				theo_num = 0;
X
X			line[++lineno] = sprintf("%4d: %s(%%3d) section ", NR, curr_ind);
X			pre = "";
X			for (i = 1; i <= $2; i++)
X			{
X				line[lineno] = line[lineno] sprintf("%s%d", pre, sect_no[i]);
X				pre = ".";
X			}
X
X			line[lineno] = line[lineno] offset;
X			pre = "";
X			for (i = 3; i <= NF; i++)
X			{
X				line[lineno] = line[lineno] sprintf("%s%s", pre, $i);
X				pre = " ";
X			}
X
X			line[lineno] = line[lineno] "\n";
X		}
X/^\.uh/		{
X			line[++lineno] = sprintf("%4d:      %s section ", NR, curr_ind);
X			line[lineno] = line[lineno] offset;
X			pre = "";
X			for (i = 2; i <= NF; i++)
X			{
X				line[lineno] = line[lineno] sprintf("%s%s", pre, $i);
X				pre = " ";
X			}
X
X			line[lineno] = line[lineno] "\n";
X		}
X/^\.tr/		{
X			line[++lineno] = sprintf("%4d:      %s%s theorem ", NR, curr_ind, theo_ind);
X			line[lineno] = line[lineno] sprintf("%d.%d ", sect_no[1], ++theo_num);
X			line[lineno] = line[lineno] offset;
X			pre = "";
X			for (i = 2; i <= NF; i++)
X			{
X				line[lineno] = line[lineno] sprintf("%s%s", pre, $i);
X				pre = " ";
X			}
X
X			line[lineno] = line[lineno] "\n";
X		}
X/^\.le/		{
X			line[++lineno] = sprintf("%4d:      %s%s lemma ", NR, curr_ind, theo_ind);
X			line[lineno] = line[lineno] sprintf("%d.%d ", sect_no[1], ++theo_num);
X			line[lineno] = line[lineno] offset;
X
X			pre = "";
X			for (i = 2; i <= NF; i++)
X			{
X				line[lineno] = line[lineno] sprintf("%s%s", pre, $i);
X				pre = " ";
X			}
X
X			line[lineno] = line[lineno] "\n";
X		}
X/^\.co/		{
X			line[++lineno] = sprintf("%4d:      %s%s corollary ", NR, curr_ind, theo_ind);
X			line[lineno] = line[lineno] sprintf("%d.%d ", sect_no[1], ++theo_num);
X			line[lineno] = line[lineno] offset;
X
X			pre = "";
X			for (i = 2; i <= NF; i++)
X			{
X				line[lineno] = line[lineno] sprintf("%s%s", pre, $i);
X				pre = " ";
X			}
X
X			line[lineno] = line[lineno] "\n";
X		}
X/^\.dt/		{
X			line[++lineno] = sprintf("%4d:      %s%s definition ", NR, curr_ind, theo_ind);
X			line[lineno] = line[lineno] offset;
X
X			pre = "";
X			for (i = 2; i <= NF; i++)
X			{
X				line[lineno] = line[lineno] sprintf("%s%s", pre, $i);
X				pre = " ";
X			}
X
X			line[lineno] = line[lineno] "\n";
X		}
XEND		{
X			line[++lineno] = sprintf("%4d:       END\n", NR);
X
X			for (i = 1; i <= 6; i++)
X			{
X				if (sect_line[i] != 0)
X				{
X					line[sect_line[i]] = sprintf(line[sect_line[i]], NR-sect_start[i]);
X				}
X			}
X
X			for (i = 1; i <= lineno; i++)
X				printf "%s", line[i];
X		}
SHAR_EOF
if test 3070 -ne "`wc -c < 'ol'`"
then
	echo shar: "error transmitting 'ol'" '(should have been 3070 characters)'
fi
chmod +x 'ol'
fi
echo shar: "extracting 'rmv'" '(22 characters)'
if test -f 'rmv'
then
	echo shar: "will not over-write existing file 'rmv'"
else
sed 's/^X//' << \SHAR_EOF > 'rmv'
X#! /bin/sh
Xmv $* /tmp
SHAR_EOF
if test 22 -ne "`wc -c < 'rmv'`"
then
	echo shar: "error transmitting 'rmv'" '(should have been 22 characters)'
fi
chmod +x 'rmv'
fi
echo shar: "extracting 'soincl'" '(46 characters)'
if test -f 'soincl'
then
	echo shar: "will not over-write existing file 'soincl'"
else
sed 's/^X//' << \SHAR_EOF > 'soincl'
X#! /bin/csh -f
Xawk '/^\.so/ { print $2; }' $*
SHAR_EOF
if test 46 -ne "`wc -c < 'soincl'`"
then
	echo shar: "error transmitting 'soincl'" '(should have been 46 characters)'
fi
chmod +x 'soincl'
fi
echo shar: "extracting 'ssize'" '(294 characters)'
if test -f 'ssize'
then
	echo shar: "will not over-write existing file 'ssize'"
else
sed 's/^X//' << \SHAR_EOF > 'ssize'
X: ssize - sort files by size, with wc info
X: usage: sortsize file ...
X
XTERMCAP=/etc/termcap; export TERMCAP
Xwc -v $* > /tmp/ssize1$$
Xex - /tmp/ssize1$$ << END > /dev/null;
X1,1w /tmp/ssize2$$
X1d
Xw
Xq
XEND
X(cat /tmp/ssize2$$; sort -n +2 /tmp/ssize1$$) | more
X/bin/rm -f /tmp/ssize1$$ /tmp/ssize2$$
SHAR_EOF
if test 294 -ne "`wc -c < 'ssize'`"
then
	echo shar: "error transmitting 'ssize'" '(should have been 294 characters)'
fi
chmod +x 'ssize'
fi
echo shar: "extracting 'yygram'" '(377 characters)'
if test -f 'yygram'
then
	echo shar: "will not over-write existing file 'yygram'"
else
sed 's/^X//' << \SHAR_EOF > 'yygram'
X#!/bin/awk -f
X
X# extract the grammar from a yacc file 
X# usage yygram file ...
X
XBEGIN	{
X		num = 0;
X		braces = 0;
X	}
X/^%%$/	{
X		braces++;
X		next;
X	}
X/JUNK/	{	exit;		}
XNF == 0	{	next;		}
X/\t;/	{	next;		}
X	{	
X		if (index($0, "{") > 0)
X			num++;
X		if (num == 0 && braces == 1)
X			print;
X		if (index($0, "}") > 0)
X			num--;
X	}	
XEND	{
X		if (num != 0)
X			print "Unmatched braces";
X	}
SHAR_EOF
if test 377 -ne "`wc -c < 'yygram'`"
then
	echo shar: "error transmitting 'yygram'" '(should have been 377 characters)'
fi
chmod +x 'yygram'
fi
echo shar: "extracting 'yyrepl'" '(424 characters)'
if test -f 'yyrepl'
then
	echo shar: "will not over-write existing file 'yyrepl'"
else
sed 's/^X//' << \SHAR_EOF > 'yyrepl'
X#! /bin/csh -f
Xcat > /tmp/yyrepl1$$ << END_PROG
XBEGIN		{
X			found = 0;
X		}
X/^YYREPL/	{
X			if (NF < 3)
X				next;
X
X			found = 1;
X			printf "gres yy %s\n", \$2;
X			printf "gres YY %s\n", \$3;
X			exit;
X		}
XEND		{
X			if (found == 0)
X				printf "gres yy yy\n";
X		}
XEND_PROG
Xawk -f /tmp/yyrepl1$$ $1 > /tmp/yyrepl2$$
Xex - /tmp/yyrepl2$$ << END
X%s/\$/ $argv[2-]/g
Xw
Xq
XEND
Xsource /tmp/yyrepl2$$
X/bin/rm /tmp/yyrepl1$$ /tmp/yyrepl2$$
SHAR_EOF
if test 424 -ne "`wc -c < 'yyrepl'`"
then
	echo shar: "error transmitting 'yyrepl'" '(should have been 424 characters)'
fi
chmod +x 'yyrepl'
fi
echo shar: "extracting 'yystat'" '(35 characters)'
if test -f 'yystat'
then
	echo shar: "will not over-write existing file 'yystat'"
else
sed 's/^X//' << \SHAR_EOF > 'yystat'
X#! /bin/csh -f 
Xtail -13 $* | more
SHAR_EOF
if test 35 -ne "`wc -c < 'yystat'`"
then
	echo shar: "error transmitting 'yystat'" '(should have been 35 characters)'
fi
chmod +x 'yystat'
fi
exit 0
#	End of shell archive