#!/bin/sh # # Simple program to calculate source code statistics for Kannel. # # Run with current working directory being the Kannel source root. # # Output: # # - number of source files # - number of lines total # - number of non-empty files # - number of lines with semicolons DIRS="gw gwlib wmlscript wap" find $DIRS -type f ! -name .cvsignore ! -name control.html \ ! -name '*kannel.conf' ! -name 'wsgram.[ch]' ! -name '*.txt' \ ! -name '*.[ao]' ! -name '*box' ! -name wmlsc ! -name wmlsdasm | grep -v /CVS/ > files.txt cat < Source line statistics `date +%Y-%m-%d` Number of files `wc -l < files.txt` Lines total `xargs cat < files.txt | wc -l` Non-empty lines `xargs grep -v '^[ ]*$' < files.txt | wc -l` Lines with semicolons`xargs grep ';' < files.txt | wc -l` EOF rm -f files.txt