freebsd-dev/share/man/tools/pgcnt

93 lines
1.4 KiB
Plaintext
Raw Normal View History

1994-05-30 19:09:18 +00:00
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.$$