xref: /original-bsd/share/man/man0/tocrc (revision 2a44b01a)
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.2 (Berkeley) 05/05/94
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				-e 's/@g@//' \
26				-e 's/@G@//' \
27			> tocx$x
28	done
29fi
30:   permuted index and toc files
31
32cat tocx* cshcmd > /tmp/cattoc
33
34ptx -r -t -b break -f -w 108 -i ignore /tmp/cattoc ptxx
35
36for x in 1 2 3 4 5 6 7 8; do
37	grep '^intro' <tocx$x >$tmp
38	sed \
39		-e '2,${' \
40		-e '/^intro/d' \
41		-e '}' \
42		-e 's/ .*://' \
43		-e 's/.$//' \
44		-e 's/([^)]*) /" "/' \
45		-e 's/.*/.xx "&"/' \
46		-e '/""/d' \
47		$tmp tocx$x \
48	>toc$x
49done
50exit
51