of how much code is developed and how much time it takes.
To do this, a simple utility that scans source code and counts
non-comment source lines is useful. It may also be useful to
know how many comments appear and how many total procedures /
functions are included. This gives an idea of how well the
programmer is commenting his/her code and if the programs are
one big module or broken into smaller modules.
/* CCOUNT - A 'C' program written to gather statistics from 'C'
* source programs. The main number to count is non-comment logical
* statements (NCLS). We also report the number of PROCEDUREs + FUNCTIONs,
* comments, blank lines, and total source lines and lines of code (LOC).
* NCLS is estimated by counting the number of semicolons, not counting
* those in string constants or comments. A line that contains a semicolon
* and a comment will be counted in both categories. Preprocessor
* directives (lines starting with '#') are also included in the NCLS count.
* The program was originally compiled in Turbo C. If it is linked with
* "WILDARGS.OBJ", wildcards can be used for the file name. If no input
* parameter is supplied, it reads the standard input stream. Output is
* both to the console and to a file "CCOUNT.LST".
* Usage: ccount file1.c file2.c ...
* (wildcards are allowed also, e.g.
* ccount *.c *.h
* Hacked by Ted Shapin, 2/9/89 from the code for
* "bldfuncs" in Dr Dobbs Journal, Aug. 1988 by Marvin Hymowech.
* Version 1.1. 3/15/89.
* Removed nested comments and added unexpected EOF error msg.
* Fixed bug in counting comment lines ending in '*'.
* Added LOC count (lines of code except for comment and blank lines).
* Added preprocessor directives to NCLS count.
* Version 1.2 4/6/89. Add preprocessor statements to LOC. Improved
* blank line detection.