PWB1/usr/man/man0/tocrc

: "procedure to produce Table of Contents and Permuted Index"
: "tocrc all"
: "	selects Table of Contents entries from"
: "	all the sections of the PWB/UNIX User's Manual"
: "tocrc t"
: "tocrc t x"
: "	produces TofC entries into xxtoc? and yytoc? files"
: "	and Permuted Index entries into the file ptxx"
: "	(supply 2 args iff Permuted Index is to be typeset)"
: 
: "ptxx and yytoc? are then used in formatting the appropriate pages"
: "see files ptx and toc in this directory"
: "for nroff, files `contents' and `index' are regenerated by"
: "	tocrc all"
: "	tocrc t"
: "	nroff +15 introduction toc ptx"
: "for troff, files `contents' and `index' are regenerated by"
: "	tocrc all"
: "	tocrc t x"
: "	troff +11 introduction toc ptx"
= a /usr/man
if -n "$2" then
	if $1 = t then
		 goto tx
	else
		 goto both
	endif
else
goto $1x
endif
: allx
sh $0 1 I
sh $0 2 II
sh $0 3 III
sh $0 4 IV
sh $0 5 V
sh $0 6 VI
sh $0 7 VII
sh $0 8 VIII
: tx
cat xxtoc? >cattoc
if -n "$2" = b -t
/usr/bin/ptx $b cattoc ptxx
rm cattoc
ed - xxtoc1
1,$s/([IV]*): /" "/
1,$s/.*/.xx "&"/
w yytoc1
e xxtoc2
1,$s/([IV]*): /" "/
1,$s/.*/.xx "&"/
w yytoc2
e xxtoc3
1,$s/([IV]*): /" "/
1,$s/.*/.xx "&"/
w yytoc3
e xxtoc4
1,$s/([IV]*): /" "/
1,$s/.*/.xx "&"/
w yytoc4
e xxtoc5
1,$s/([IV]*): /" "/
1,$s/.*/.xx "&"/
w yytoc5
e xxtoc6
1,$s/([IV]*): /" "/
1,$s/.*/.xx "&"/
w yytoc6
e xxtoc7
1,$s/([IV]*): /" "/
1,$s/.*/.xx "&"/
w yytoc7
e xxtoc8
1,$s/([IV]*): /" "/
1,$s/.*/.xx "&"/
w yytoc8
q
exit
: 1x
sh $0 1 I
exit
: 2x
sh $0 2 II
exit
: 3x
sh $0 3 III
exit
: 4x
sh $0 4 IV
exit
: 5x
sh $0 5 V
exit
: 6x
sh $0 6 VI
exit
: 7x
sh $0 7 VII
exit
: 8x
sh $0 8 VIII
exit
: x
echo "usage: tocrc all;tocrc t"
exit
: both
chdir $a/man$1
ls >xa
ed - xa
v/\.[12345678]$/d
g/^_/d
g/flog.1/d
g/gong.1/d
g/tm.1/d
g/realeqn.1/d
g/intro.2/d
g/terminals.7/d
g/dasi450.7/d
g/gsi300.7/d
g/hp2640.7/d
g/terminet.7/d
g/ti700.7/d
g/^/s//e /\
.a\
/\.sh.*NAME/1p
w
q
ed - <xa |\
sed -e 's/ \\- / QQSV /' -e 's/ \\\*- / QQSV /'>xb
echo '1,$s/ *QQSV */('$2'): /' >xa
if $1 != 2 goto 1f
echo 0a >>xa
echo "intro(II): introduction to system calls" >>xa
echo . >>xa
: 1f
if $1 != 7 goto 2f
echo 0a >>xa
echo "terminals(VII): descriptions of commonly-used terminals" >>xa
echo . >>xa
: 2f
echo w $a/man0/xxtoc$1 >>xa
ed - xb <xa
rm xa xb