xref: /original-bsd/share/man/man0/tocrc (revision 3705696b)
1#!/bin/sh -
2#
3# Copyright (c) 1993
4#	The Regents of the University of California.  All rights reserved.
5#
6# %sccs.include.redist.sh%
7#
8#       @(#)tocrc	8.1 (Berkeley) 06/29/93
9#
10tmp=/tmp/toc$$
11trap "rm $tmp ; exit" 2 3 15
12:   tocx files for all sections and everything else
13
14if [ ! -f tocx8 ]; then
15	for x in 1 2 3 4 5 6 7 8; do
16		/usr/libexec/getNAME -t `cat man$x` |
17			sed \
18				-e 's/.s-2//g' \
19				-e 's/.s-1//g' \
20				-e 's/.s0//g' \
21				-e 's/.s+1//g' \
22				-e 's/  *.-  */: /' \
23				-e 's/ *$/./' \
24				-e 's/.TH.*	//' \
25			> tocx$x
26	done
27fi
28:   permuted index and toc files
29
30cat tocx* cshcmd > /tmp/cattoc
31
32ptx -r -t -b break -f -w 108 -i ignore /tmp/cattoc ptxx
33
34for x in 1 2 3 4 5 6 7 8; do
35	grep '^intro' <tocx$x >$tmp
36	sed \
37		-e '2,${' \
38		-e '/^intro/d' \
39		-e '}' \
40		-e 's/ .*://' \
41		-e 's/.$//' \
42		-e 's/([^)]*) /" "/' \
43		-e 's/.*/.xx "&"/' \
44		-e '/""/d' \
45		$tmp tocx$x \
46	>toc$x
47done
48exit
49