1#!/bin/sh - 2# 3# Copyright (c) 1980 Regents of the University of California. 4# All rights reserved. The Berkeley software License Agreement 5# specifies the terms and conditions for redistribution. 6# 7# @(#)tocrc 4.1 (Berkeley) 05/11/86 8# 9tmp=/tmp/toc$$ 10troff=vtroff 11trap "rm $tmp ; exit" 2 3 15 12if [ $# -eq 2 ] 13then 14 : create toc input file for one section only 15 16 ( cd man$1 ; /usr/lib/getNAME -t *.* | 17 sed \ 18 -e 's/.s-1//g' \ 19 -e 's/.s0//g' \ 20 -e 's/.s+1//g' \ 21 -e 's/ *.- */: /' \ 22 -e 's/$/./' \ 23 -e 's/.TH.* //' \ 24 > ../man0/tocx$1 25 ) 26else case $1 in 27 all ) 28 : tocx files for all sections and everything else 29 30 for x in 1 2 3 4 5 6 7 8 31 do 32 ./$0 $x $x 33 done 34 ./$0 t 35 ;; 36 t ) 37 : permuted index and toc files 38 39 if [ ! -f man0/tocx1 ] 40 then 41 echo "tocx? files missing; must run tocrc all first" 42 exit 43 fi 44 sed \ 45 -e 's/(1c)/(1C)/' \ 46 -e 's/(1m)/(1M)/' \ 47 -e 's/(1g)/(1G)/' \ 48 -e 's/(3c)/(3C)/' \ 49 -e 's/(3m)/(3M)/' \ 50 -e 's/(3s)/(3S)/' \ 51 -e '/"\."/d' \ 52 man0/tocx? man0/cshcmd \ 53 > /tmp/cattoc 54 55 ptx -r -t -b break -f -w 108 -i man0/ignore \ 56 /tmp/cattoc man0/ptxx 57 58 for x in 1 2 3 4 5 6 7 8 59 do 60 < man0/tocx$x grep '^intro' >$tmp 61 sed \ 62 -e '2,${' \ 63 -e '/^intro/d' \ 64 -e '}' \ 65 -e 's/ .*://' \ 66 -e 's/.$//' \ 67 -e 's/([^)]*) /" "/' \ 68 -e 's/.*/.xx "&"/' \ 69 -e '/""/d' \ 70 $tmp man0/tocx$x \ 71 >man0/toc$x 72 done 73 ;; 74 tr ) 75 cd man0; $troff ptx.in ; cd .. 76 cd man0 ; $troff toc.in ; cd .. 77 ;; 78 * ) 79 ./$0 $1 $1 80 ;; 81 esac 82fi 83exit 84