xref: /csrg-svn/share/man/man0/tocrc (revision 63444)
127960Smckusick#!/bin/sh -
227960Smckusick#
3*63444Smckusick# Copyright (c) 1993 The Regents of the University of California.
4*63444Smckusick# All rights reserved.
527960Smckusick#
6*63444Smckusick# %sccs.include.redist.sh%
727960Smckusick#
8*63444Smckusick#       @(#)tocrc	6.3 (Berkeley) 06/14/93
9*63444Smckusick#
1027960Smckusicktmp=/tmp/toc$$
1127960Smckusicktrap "rm $tmp ; exit" 2 3 15
12*63444Smckusick:   tocx files for all sections and everything else
1327961Smckusick
14*63444Smckusickif [ ! -f tocx8 ]; then
15*63444Smckusick	for x in 1 2 3 4 5 6 7 8; do
16*63444Smckusick		/usr/libexec/getNAME -t `cat man$x` |
17*63444Smckusick			sed \
18*63444Smckusick				-e 's/.s-2//g' \
19*63444Smckusick				-e 's/.s-1//g' \
20*63444Smckusick				-e 's/.s0//g' \
21*63444Smckusick				-e 's/.s+1//g' \
22*63444Smckusick				-e 's/  *.-  */: /' \
23*63444Smckusick				-e 's/ *$/./' \
24*63444Smckusick				-e 's/.TH.*	//' \
25*63444Smckusick			> tocx$x
26*63444Smckusick	done
27*63444Smckusickfi
28*63444Smckusick:   permuted index and toc files
2927960Smckusick
30*63444Smckusickcat tocx* cshcmd > /tmp/cattoc
3127960Smckusick
32*63444Smckusickptx -r -t -b break -f -w 108 -i ignore /tmp/cattoc ptxx
3327960Smckusick
34*63444Smckusickfor x in 1 2 3 4 5 6 7 8; do
35*63444Smckusick	grep '^intro' <tocx$x >$tmp
36*63444Smckusick	sed \
37*63444Smckusick		-e '2,${' \
38*63444Smckusick		-e '/^intro/d' \
39*63444Smckusick		-e '}' \
40*63444Smckusick		-e 's/ .*://' \
41*63444Smckusick		-e 's/.$//' \
42*63444Smckusick		-e 's/([^)]*) /" "/' \
43*63444Smckusick		-e 's/.*/.xx "&"/' \
44*63444Smckusick		-e '/""/d' \
45*63444Smckusick		$tmp tocx$x \
46*63444Smckusick	>toc$x
47*63444Smckusickdone
4827960Smckusickexit
49