#!/bin/sh # copyright 2002 yenar@host.sk # covered by GNU LGPL tl=0 tb=0 filter=$1 if [ -z "$filter" ]; then filter="cat" fi for d in $(find -type d -not -name CVS -not -name .libs -not -name .deps); do dl=0 db=0 for f in $(cd $d && echo *.c *.h); do fl=$(cat $d/$f 2>/dev/null | $filter | wc -l) fb=$(cat $d/$f 2>/dev/null | $filter | wc -c) fl=$(($fl)) fb=$(($fb)) if [ "$fb" != "0" ] && ! echo $f | grep '\*' >& /dev/null; then echo -e "$d/$f:\t$fl\t$fb" | expand -t 30 fi dl=$(($dl+$fl)) db=$(($db+$fb)) done if [ $db != 0 ]; then dirs="$dirs\n$d:\t$dl\t$db" echo fi tl=$(($tl+$dl)) tb=$(($tb+$db)) done echo -e $dirs | expand -t 30 echo -e "\ntotal:\t$tl\t$tb" | expand -t 30;