Category : Recently Uploaded Files
Archive   : SNIP9503.ZIP
Filename : C_LINES.AWK

 
Output of file : C_LINES.AWK contained in archive : SNIP9503.ZIP
# count lines in a C program, not counting comments, blank lines or
# form feeds
# does separate count of preprocessor directives
# if a preprocessor directive is commented out, it does not count
#
# By: Dan Kozak

{
if (file == "") {
file = FILENAME
}
if (file != FILENAME) {
printf("Number of lines in %s is: %d\n",file,nl+ppd)
printf("Number of preprocessor directives is: %d\n",ppd)
printf("Number of lines excluding preprocessor directives is: %d\n\n",nl)
file = FILENAME
tnl += nl
tppd += ppd
nl = 0
ppd = 0
}

if ($0 == "") { ; }
else if ($1 ~ /^\/\*/ && $NF ~ /\*\/$/) { ; }
else if ($0 ~ /\/\*/ && $0 !~ /\*\//) { in_comment = 1 }
else if ($0 !~ /\/\*/ && $0 ~ /\*\//) { in_comment = 0 }
else if (in_comment) { ; }
else if ($1 ~ /^#/) { ppd++ }
else { nl++ }
}

END { printf("Number of lines in %s is: %d\n",file,nl+ppd)
printf("Number of preprocessor directives is: %d\n",ppd)
printf("Number of lines excluding preprocessor directives is:
%d\n\n",nl)
file = FILENAME
tnl += nl
tppd += ppd
printf("Total number of lines is: %d\n",tnl+tppd)
printf("Number of preprocessor directives is: %d\n",tppd)
printf("Number of lines excluding preprocessor directives is:
%d\n",tnl)
}


  3 Responses to “Category : Recently Uploaded Files
Archive   : SNIP9503.ZIP
Filename : C_LINES.AWK

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/