#!/bin/sh

[ ! "$1" ] && exit 2
 
[ "$STTA" ] && . $STTA/envprofile

[ ! -d $WEBMINDIR/$1 ] && exit 2

cd $WEBMINDIR/$1
list_ext="cgi pl sh js idx tcl shells" 
dn=/dev/null

nfiles=0
nlines=0
for ext in ` echo $list_ext `
do
    dest="*."$ext
    [ "$ext" == "idx" ] && dest="index/*.pl" 
    [ "$ext" == "shells" ] && dest="shells/*.sh" 
    eval "nlines_$ext=`(cat $dest | wc -l | sed s'/ //g') 2>$dn`"
    eval "nfiles_$ext=`(ls $dest | wc -l | sed 's/ //g' ) 2>$dn`"
    eval "cnt=\$nlines_$ext"
    nlines=`expr $nlines + $cnt 2>$dn` 
    eval "cnt=\$nfiles_$ext"
    nfiles=`expr \$nfiles + $cnt 2>$dn`
    [ "$2" != "-t" ] && eval "echo \"$ext: \$nlines_$ext lines in \$nfiles_$ext files\" "
done 
echo "TOTAL $WEBMINDIR in $1 ...:"
echo "$nfiles files with $nlines lines"
