Path: utzoo!attcan!uunet!wugate!wuarchive!texbell!merch!cpe!hal6000!trsvax!carver
From: carver@trsvax.UUCP
Newsgroups: comp.lang.c
Subject: Re: C source lines in file
Message-ID: <192800007@trsvax>
Date: 11 Aug 89 21:03:00 GMT
References: <35120@ccicpg.UUCP>
Lines: 23
Nf-ID: #R:ccicpg.UUCP:35120:trsvax:192800007:000:844
Nf-From: trsvax.UUCP!carver    Aug 11 16:03:00 1989


> Does anyone have a program or a method of determing
> the number of C source lines in a source file?
> My assumption is that comments don't count as source
> lines unless the comment is on a line with code.

Try using the friendly UNIX 'awk' program and do a search for ';' and '}'.

This seemed to work very well for a project I had in school.  In addition,
you can search for comments, blank lines, declarations of variables, ect,
and come up with a few good measurements of complexity like percentages of
statements vs. total lines and the like.

Of course, all of this is for naught if you aren't in a UNIX envirnment.

Hope this helps.

David "carver" Forney 

---------------------------------------------------------------------

DISCLAIMER:  All of the views expressed are my own and do not necessarily
reflect those of my employer.