#!/usr/bin/perl
# count lines of .c and .h starting at the current directory by major directory

@wc = `wc -l \`find . -name '*.[ch]' -print | sort +1\``;

$tot = 0;
foreach (@wc) {
    chomp();
    ($n, @pn) = split(/\//);
    $dn = @pn == 2 ? @pn[0] : "@pn[0]/@pn[1]";
    if (!defined($ldn) or $dn ne $ldn) {
	print "$tot\t$ldn\n" if (defined($ldn));
	$ldn = $dn;
	$tot = 0;
    }
    $tot += $n;
}
print "$tot\tTotal\n";

# For RCS Only -- Do Not Edit
# @(#) $RCSfile: loc,v $ $Date: 2003/04/15 20:47:55 $ $Revision: 1.1.1.1 $ $Name:  $
