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