tocrc revision 1.1
11.1Smrg#!/bin/sh - 21.1Smrg# 31.1Smrg# Copyright (c) 1993 41.1Smrg# The Regents of the University of California. All rights reserved. 51.1Smrg# 61.1Smrg# Redistribution and use in source and binary forms, with or without 71.1Smrg# modification, are permitted provided that the following conditions 81.1Smrg# are met: 91.1Smrg# 1. Redistributions of source code must retain the above copyright 101.1Smrg# notice, this list of conditions and the following disclaimer. 111.1Smrg# 2. Redistributions in binary form must reproduce the above copyright 121.1Smrg# notice, this list of conditions and the following disclaimer in the 131.1Smrg# documentation and/or other materials provided with the distribution. 141.1Smrg# 3. All advertising materials mentioning features or use of this software 151.1Smrg# must display the following acknowledgement: 161.1Smrg# This product includes software developed by the University of 171.1Smrg# California, Berkeley and its contributors. 181.1Smrg# 4. Neither the name of the University nor the names of its contributors 191.1Smrg# may be used to endorse or promote products derived from this software 201.1Smrg# without specific prior written permission. 211.1Smrg# 221.1Smrg# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231.1Smrg# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241.1Smrg# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251.1Smrg# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261.1Smrg# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271.1Smrg# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281.1Smrg# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291.1Smrg# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301.1Smrg# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311.1Smrg# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321.1Smrg# SUCH DAMAGE. 331.1Smrg# 341.1Smrg# @(#)tocrc 8.2 (Berkeley) 5/5/94 351.1Smrg# 361.1Smrgtmp=/tmp/toc$$ 371.1Smrgtrap "rm $tmp ; exit" 2 3 15 381.1Smrg: tocx files for all sections and everything else 391.1Smrg 401.1Smrgif [ ! -f tocx8 ]; then 411.1Smrg for x in 1 2 3 4 5 6 7 8; do 421.1Smrg /usr/libexec/getNAME -t `cat man$x` | 431.1Smrg sed \ 441.1Smrg -e 's/.s-2//g' \ 451.1Smrg -e 's/.s-1//g' \ 461.1Smrg -e 's/.s0//g' \ 471.1Smrg -e 's/.s+1//g' \ 481.1Smrg -e 's/ *.- */: /' \ 491.1Smrg -e 's/ *$/./' \ 501.1Smrg -e 's/.TH.* //' \ 511.1Smrg -e 's/@g@//' \ 521.1Smrg -e 's/@G@//' \ 531.1Smrg > tocx$x 541.1Smrg done 551.1Smrgfi 561.1Smrg: permuted index and toc files 571.1Smrg 581.1Smrgcat tocx* cshcmd > /tmp/cattoc 591.1Smrg 601.1Smrgptx -r -t -b break -f -w 108 -i ignore /tmp/cattoc ptxx 611.1Smrg 621.1Smrgfor x in 1 2 3 4 5 6 7 8; do 631.1Smrg grep '^intro' <tocx$x >$tmp 641.1Smrg sed \ 651.1Smrg -e '2,${' \ 661.1Smrg -e '/^intro/d' \ 671.1Smrg -e '}' \ 681.1Smrg -e 's/ .*://' \ 691.1Smrg -e 's/.$//' \ 701.1Smrg -e 's/([^)]*) /" "/' \ 711.1Smrg -e 's/.*/.xx "&"/' \ 721.1Smrg -e '/""/d' \ 731.1Smrg $tmp tocx$x \ 741.1Smrg >toc$x 751.1Smrgdone 761.1Smrgexit 77