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