lincnt is a source line counting utility for C-like files. It uses a simple parser to recognize C and C++ style comments, as well as quoted strings to count commented and code lines separately.

Syntax: linecnt [-s] [-v] [-d dir-name] [-c] [-j] [ext [ext [ ...]]]

  -s    Process files in the current directory and all subdirectories
  -v    Produce verbose output
  -d    Start in the specified directory
  -c    Add standard C/C++ extensions to the list
  -j    Add standard Java extensions to the list
  -V    Print version information
  -W    Print warranty information
  -h    Print this help

  linecnt cpp c h    ; Count lines in .cpp, .c and .h files
  linecnt -c -j inc  ; Count lines in C/C++, Java and .inc files