diff options
Diffstat (limited to 'share/man/tools/pgcnt')
-rwxr-xr-x | share/man/tools/pgcnt | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/share/man/tools/pgcnt b/share/man/tools/pgcnt new file mode 100755 index 0000000..6a7d4f0 --- /dev/null +++ b/share/man/tools/pgcnt @@ -0,0 +1,92 @@ +set x $* +. ./.param + +PATH=$PATH:$MANDIR/tools + +sm= +if test "$PFLAG" -eq 1 +then + sm="-rs1" +fi + +for dir in $DIRLST +do + cd $MANDIR/man$dir + date > $TMPDIR/pages$dir + echo >> $TMPDIR/pages$dir + for file in $FILLST + do + prep="cat $file |" + + first=`line < $file` + case "$first" in + .so*) continue + ;; + \'\\\"*) + option=`expr "$first" : '.* \(.*\)'` + case "$option" in + c) + prep="${prep} cw |" + ;; + e) + prep="${prep} eqn |" + ;; + t) + prep="${prep} tbl |" + ;; + ce | ec) + prep="${prep} cw | eqn" + ;; + ct | tc) + prep="${prep} cw | tbl |" + ;; + et | te) + prep="${prep} tbl | eqn |" + ;; + cet | cte | ect | etc | tce | tec) + prep="${prep} cw | tbl | eqn |" + ;; + esac + ;; + *) + ;; + esac + + numb=`eval ${prep} troff -man $sm -s -f -t | pages` + echo "$file $numb" >> $TMPDIR/pages$dir + done +done + +tsum=0 +cd $TMPDIR +date > totalpgs +echo >> totalpgs + +for dir in $DIRLST +do + ed - pages$dir <<! + 1,2d + w tmp1.$$ + q +! + sum=0 + while read val + do + val=`echo $val | sed "s/.* / /"` + sum=`expr $sum + $val` + if test $? -eq 2 + then + echo "pgcnt: error in summing - sum is $sum, val is $val" + exit + fi + echo $sum > tmp.$$ + done < tmp1.$$ + sumt=`line < tmp.$$` + echo "total pages Section $dir -- $sumt" >> totalpgs + tsum=`expr $tsum + $sumt` +done + +echo >> totalpgs +echo >> totalpgs +echo "total pages -- $tsum" >> totalpgs +rm tmp.$$ tmp1.$$ |