File: source-stats

package info (click to toggle)
kannel 1.4.5-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 15,816 kB
  • sloc: ansic: 105,621; sh: 32,061; xml: 20,360; php: 1,103; perl: 711; makefile: 560; yacc: 548; awk: 133; python: 122; javascript: 27; pascal: 3
file content (31 lines) | stat: -rwxr-xr-x 967 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/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 <<EOF
<table>
<caption>Source line statistics `date +%Y-%m-%d`</caption>
<tr> <td>Number of files<td>       <td>`wc -l < files.txt`</td></tr>
<tr> <td>Lines total</td>          <td>`xargs cat < files.txt | wc -l`</td></tr>
<tr> <td>Non-empty lines</td>      <td>`xargs grep -v '^[ 	]*$' < files.txt | wc -l`</td></tr>
<tr> <td>Lines with semicolons</td><td>`xargs grep ';' < files.txt | wc -l`</td></tr>
</table>
EOF

rm -f files.txt