10 if ( $f =~ /\.lhs$/ ) {
11 open(INF, "../utils/unlit/unlit $f - |") || die "Couldn't unlit $f!\n";
13 open(INF, "< $f") || die "Couldn't open $f!\n";
24 $f_wc = `wc $f`; die "wc failed: $f\n" if $? != 0;
25 if ( $f_wc =~ /\s*(\d+)\s*(\d+)\s*(\d+)/ ) {
26 $comments = $1 - $cnt;
28 die "Can't grok wc format: $f_wc";
31 if ( $f =~ /(.*)\/(.*)/ ) {
34 $DirCount{$dir} += $cnt;
35 $ModCount{$mod} += $cnt;
36 $DirComments{$dir} += $comments;
37 $ModComments{$mod} += $comments;
39 print STDERR "not counted in a directory: $f\n";
40 $ModCount{$f} += $cnt;
41 $ModComments{$f} += $comments;
48 foreach $d (sort (keys %DirCount)) {
49 printf "%-20s %6d %6d\n", $d, $DirCount{$d}, $DirComments{$d};
50 $tot += $DirCount{$d};
51 $totcmts += $DirComments{$d};
53 printf "\n%-20s %6d %6d\n\n\n", 'TOTAL:', $tot, $totcmts;
57 printf "\n Code Comments\n";
58 foreach $m (sort (keys %ModCount)) {
59 printf "%-20s %6d %6d\n", $m, $ModCount{$m}, $ModComments{$m};
60 $tot += $ModCount{$m};
61 $totcmts += $ModComments{$m};
63 printf "\n%-20s %6d %6d\n", 'TOTAL:', $tot, $totcmts;