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 6.2 (Berkeley) 05/16/86 8# 9tmp=/tmp/toc$$ 10trap "rm $tmp ; exit" 2 3 15 11if [ $# -eq 2 -a $1 = "3" ] 12then 13 : create toc input files for section 3 only 14 15 ( cd ../man3 ; /usr/lib/getNAME -t `ls *.3 *.3[mnsxc] | sort` | sed \ 16 -e 's/.s-2//g' \ 17 -e 's/.s-1//g' \ 18 -e 's/.s0//g' \ 19 -e 's/.s+1//g' \ 20 -e 's/ *.- */: /' \ 21 -e 's/ *$/./' \ 22 -e 's/.TH.* //' \ 23 > ../man0/tocx3 ; 24 /usr/lib/getNAME -t *.3f | sed \ 25 -e 's/.s-2//g' \ 26 -e 's/.s-1//g' \ 27 -e 's/.s0//g' \ 28 -e 's/.s+1//g' \ 29 -e 's/ *.- */: /' \ 30 -e 's/ *$/./' \ 31 -e 's/.TH.* //' \ 32 > ../man0/tocx3f 33 ) 34elif [ $# -eq 2 ] 35then 36 : create toc input file for one section only 37 38 ( cd ../man$1 ; /usr/lib/getNAME -t *.* | 39 sed \ 40 -e 's/.s-2//g' \ 41 -e 's/.s-1//g' \ 42 -e 's/.s0//g' \ 43 -e 's/.s+1//g' \ 44 -e 's/ *.- */: /' \ 45 -e 's/ *$/./' \ 46 -e 's/.TH.* //' \ 47 > ../man0/tocx$1 48 ) 49else case $1 in 50 all ) 51 : tocx files for all sections and everything else 52 53 for x in 1 2 3 4 5 6 7 8 54 do 55 ./$0 $x $x 56 done 57 ./$0 t 58 ;; 59 t ) 60 : permuted index and toc files 61 62 if [ ! -f tocx1 ] 63 then 64 echo "tocx* files missing; must run tocrc all first" 65 exit 66 fi 67 sed \ 68 -e 's/(1c)/(1C)/' \ 69 -e 's/(1g)/(1G)/' \ 70 -e 's/(3c)/(3C)/' \ 71 -e 's/(3m)/(3M)/' \ 72 -e 's/(3n)/(3N)/' \ 73 -e 's/(3s)/(3S)/' \ 74 -e 's/(3x)/(3X)/' \ 75 -e 's/(3f)/(3F)/' \ 76 -e 's/(4f)/(4F)/' \ 77 -e 's/(4n)/(4N)/' \ 78 -e 's/(4p)/(4P)/' \ 79 -e 's/(8c)/(8C)/' \ 80 -e 's/(8v)/(8V)/' \ 81 -e '/"\."/d' \ 82 tocx* cshcmd \ 83 > /tmp/cattoc 84 85 ptx -r -t -b break -f -w 108 -i ignore \ 86 /tmp/cattoc ptxx 87 88 for x in 1 2 3 3f 4 5 6 7 8 89 do 90 < tocx$x grep '^intro' >$tmp 91 sed \ 92 -e '2,${' \ 93 -e '/^intro/d' \ 94 -e '}' \ 95 -e 's/ .*://' \ 96 -e 's/.$//' \ 97 -e 's/([^)]*) /" "/' \ 98 -e 's/.*/.xx "&"/' \ 99 -e '/""/d' \ 100 $tmp tocx$x \ 101 >toc$x 102 done 103 ;; 104 * ) 105 ./$0 $1 $1 106 ;; 107 esac 108fi 109exit 110