xref: /csrg-svn/share/man/man0/tocrc (revision 63622)
127960Smckusick#!/bin/sh -
227960Smckusick#
3*63622Sbostic# Copyright (c) 1993
4*63622Sbostic#	The Regents of the University of California.  All rights reserved.
527960Smckusick#
663444Smckusick# %sccs.include.redist.sh%
727960Smckusick#
8*63622Sbostic#       @(#)tocrc	8.1 (Berkeley) 06/29/93
963444Smckusick#
1027960Smckusicktmp=/tmp/toc$$
1127960Smckusicktrap "rm $tmp ; exit" 2 3 15
1263444Smckusick:   tocx files for all sections and everything else
1327961Smckusick
1463444Smckusickif [ ! -f tocx8 ]; then
1563444Smckusick	for x in 1 2 3 4 5 6 7 8; do
1663444Smckusick		/usr/libexec/getNAME -t `cat man$x` |
1763444Smckusick			sed \
1863444Smckusick				-e 's/.s-2//g' \
1963444Smckusick				-e 's/.s-1//g' \
2063444Smckusick				-e 's/.s0//g' \
2163444Smckusick				-e 's/.s+1//g' \
2263444Smckusick				-e 's/  *.-  */: /' \
2363444Smckusick				-e 's/ *$/./' \
2463444Smckusick				-e 's/.TH.*	//' \
2563444Smckusick			> tocx$x
2663444Smckusick	done
2763444Smckusickfi
2863444Smckusick:   permuted index and toc files
2927960Smckusick
3063444Smckusickcat tocx* cshcmd > /tmp/cattoc
3127960Smckusick
3263444Smckusickptx -r -t -b break -f -w 108 -i ignore /tmp/cattoc ptxx
3327960Smckusick
3463444Smckusickfor x in 1 2 3 4 5 6 7 8; do
3563444Smckusick	grep '^intro' <tocx$x >$tmp
3663444Smckusick	sed \
3763444Smckusick		-e '2,${' \
3863444Smckusick		-e '/^intro/d' \
3963444Smckusick		-e '}' \
4063444Smckusick		-e 's/ .*://' \
4163444Smckusick		-e 's/.$//' \
4263444Smckusick		-e 's/([^)]*) /" "/' \
4363444Smckusick		-e 's/.*/.xx "&"/' \
4463444Smckusick		-e '/""/d' \
4563444Smckusick		$tmp tocx$x \
4663444Smckusick	>toc$x
4763444Smckusickdone
4827960Smckusickexit
49