Remove trailing whitespace.
[dragonfly.git] / share / man / tools / pgcnt
1 set x $*
2 . ./.param
3
4 PATH=$PATH:$MANDIR/tools
5
6 sm=
7 if test "$PFLAG" -eq 1
8 then
9         sm="-rs1"
10 fi
11
12 for dir in $DIRLST
13 do
14         cd $MANDIR/man$dir
15         date > $TMPDIR/pages$dir
16         echo >> $TMPDIR/pages$dir
17         for file in $FILLST
18         do
19                 prep="cat $file |"
20
21                 first=`line < $file`
22                 case "$first" in
23                         .so*)   continue
24                                 ;;
25                         \'\\\"*)
26                                 option=`expr "$first" : '.* \(.*\)'`
27                                 case "$option" in
28                                         c)
29                                                 prep="${prep} cw |"
30                                                 ;;
31                                         e)
32                                                 prep="${prep} eqn |"
33                                                 ;;
34                                         t)
35                                                 prep="${prep} tbl |"
36                                                 ;;
37                                         ce | ec)
38                                                 prep="${prep} cw | eqn"
39                                                 ;;
40                                         ct | tc)
41                                                 prep="${prep} cw | tbl |"
42                                                 ;;
43                                         et | te)
44                                                 prep="${prep} tbl | eqn |"
45                                                 ;;
46                                         cet | cte | ect | etc | tce | tec)
47                                                 prep="${prep} cw | tbl | eqn |"
48                                                 ;;
49                                 esac
50                                 ;;
51                         *)
52                                 ;;
53                 esac
54
55                 numb=`eval ${prep} troff -man $sm -s -f -t | pages`
56                 echo "$file     $numb" >> $TMPDIR/pages$dir
57         done
58 done
59
60 tsum=0
61 cd $TMPDIR
62 date > totalpgs
63 echo >> totalpgs
64
65 for dir in $DIRLST
66 do
67         ed - pages$dir <<!
68                 1,2d
69                 w tmp1.$$
70                 q
71 !
72         sum=0
73         while read val
74         do
75                 val=`echo $val | sed "s/.* / /"`
76                 sum=`expr $sum + $val`
77                 if test $? -eq 2
78                 then
79                         echo "pgcnt: error in summing - sum is $sum, val is $val"
80                         exit
81                 fi
82                 echo $sum > tmp.$$
83         done < tmp1.$$
84         sumt=`line < tmp.$$`
85         echo "total pages Section $dir -- $sumt" >> totalpgs
86         tsum=`expr $tsum + $sumt`
87 done
88
89 echo >> totalpgs
90 echo >> totalpgs
91 echo "total pages -- $tsum" >> totalpgs
92 rm tmp.$$ tmp1.$$