No empty .Rs/.Re
[netbsd-mini2440.git] / share / man / tools / ckcrefs
blob7177b76fa5222519c40532039f79e8362f85a8a8
1 set x $*
2 . ./.param
4 for dir in $DIRLST
5 do
6         > $TMPDIR/cref$dir
7         cd $MANDIR/man$dir
8         for file in $FILLST
9         do
10                 so=`line < $file | sed "s/ .*$//"`
11                 if test "$so" = ".so"
12                 then
13                         continue
14                 fi
15                 grep ".*([1-9][cmsgxjvCMSGXJV]*)" $file >> $TMPDIR/cref$dir
16         done
18         cd $TMPDIR
19         echo "   ," >> cref$dir
20         date > lower.suf$dir
21         echo >> lower.suf$dir
22         date > badcref$dir
23         echo >> badcref$dir
24         ed - cref$dir >> lower.suf$dir <<!
25                 g/ *\(([1-9][CMSGXJVcmsgxjv]*)\)/s//\1/
26                 1,\$s/ /\\
28                 1,\$s/  /\\
30                 1,\$s/,/\\
32                 v/(/d
33                 g/\\\\\^/s///
34                 g/\\\\\|/s///
35                 g/([1-9][cgmsxjv])/p
36                 g//d
37                 g/^(/d
38                 g/(/s//./
39                 g/^\./d
40                 g/C).*/s//c/
41                 g/G).*/s//g/
42                 g/M).*/s//m/
43                 g/S).*/s//s/
44                 g/X).*/s//x/
45                 g/J).*/s//j/
46                 g/V).*/s//v/
47                 g/).*/s///
48                 w
49                 q
51         sort -i cref$dir | uniq > tmp.$$
52         while read cref
53         do
54                 sect=`echo $cref | sed "s/.*\.\(.\).*/\1/"`
55                 try=`ls $MANDIR/man$sect/$cref 2>&1`
56                 if test "$try" = "$MANDIR/man$sect/$cref"
57                 then
58                         continue
59                 else
60                         echo $try | sed -e "s;$MANDIR/man..;;" -e "s; not found;;" >> badcref$dir
61                 fi
62         done < tmp.$$
63         ed - badcref$dir <<!
64                 g/\.\([1-9]\)/s//(\1/
65                 g/c$/s//C)/
66                 g/m$/s//M)/
67                 g/s$/s//S)/
68                 g/g$/s//G)/
69                 g/x$/s//X)/
70                 g/j$/s//J)/
71                 g/v$/s//V)/
72                 g/[^)]$/s/$/)/
73                 1s/.$//
74                 w
75                 q
77         rm -f tmp.$$ cref$dir
78 done