MiniUnix/usr/man/man0/tocrc
if $2x != x goto both
goto $1x
: 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 tocx? >cattoc
ptx -t cattoc ptxx
rm cattoc
ed - tocx1
1,$s/([IV]*) /" "/
1,$s/.*/.xx "&"/
w toc1
e tocx2
1,$s/([IV]*) /" "/
1,$s/.*/.xx "&"/
w toc2
e tocx3
1,$s/([IV]*) /" "/
1,$s/.*/.xx "&"/
w toc3
e tocx4
1,$s/([IV]*) /" "/
1,$s/.*/.xx "&"/
w toc4
e tocx5
1,$s/([IV]*) /" "/
1,$s/.*/.xx "&"/
w toc5
e tocx6
1,$s/([IV]*) /" "/
1,$s/.*/.xx "&"/
w toc6
e tocx7
1,$s/([IV]*) /" "/
1,$s/.*/.xx "&"/
w toc7
e tocx8
1,$s/([IV]*) /" "/
1,$s/.*/.xx "&"/
w toc8
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: sh tocrc "[12345678]"
exit
: both
chdir /usr/man/man$1
ls >xa
ed - xa
v/\.[12345678]$/d
g/intro.2/d
g/^/s//e /\
.a\
/NAME/1p
w
q
ed - <xa >xb
echo "1,$s/ *\\\*- */("$2") /" >xa
if $1 != 2 goto 1f
echo 0a >>xa
echo "intro(II) introduction to system calls" >>xa
echo . >>xa
: 1f
echo w /usr/man/man0/tocx$1 >>xa
ed - xb <xa
rm xa xb