![]() | ![]() |
phd candidate unix geek person |
Non-comment Line CounterThis is a utility that you can use to count non-comment lines of source code. Unlike wc -l, this utility will not count blank lines or lines in C++-style comment blocks. Here's an example of code on 10 lines, 4 of which contain actual code:
#include <iostream>
using namespace std;
// Add j to k and return the result
int add(int j, int k) { return j + k; }
/*
* Subtract j from k and output the result to stdout.
*/
void subtract(int j, int k) { cout << k - j << endl; }
If you run the line counter on this file, you'll see the following output:
Total number of files: 1
Total number of lines: 10
Non-comment lines: 4
Usagelc <file(s)>Example:
% lc *.h *.cc
Total number of files: 67
Total number of lines: 13940
Non-comment lines: 7286
Requirements and DownloadsYou'll need to have python installed. This should work out of the box on any Mac OS X release since Jaguar (10.2) and on most distributions of Linux.Just download lc and put it somewhere in your PATH. LicenseThis software is licensed under the GNU GPLLast modified 8 March 2004 at 4:55 pm by eaganj |