// Author: A. Torpy // Updated: 14 Jul 2011 // select directory to scan dirsel DS dirsel.Init &DS NULL if > return 0 endif string DirName set DirName // count .cpp files varlist filels set filels if > return 0 endif // also count .c files varlist ls2 set ls2 if if > return 0 endif endif // also count .h files set ls2 if if > return 0 endif endif // also count .def files set ls2 if if > return 0 endif endif // ...and finally, .zs files set ls2 if if > return 0 endif endif int nFiles set nFiles int64 nLines set nLines 0 progbox pb progbox.ShowWnd2 &pb 0x5 int i set i 0 do // get filename from list hvar hString set hString progbox.SetTitle &pb > if > return 0 endif // echo filename to event log echo *hString // open file voidptr fp if > return 0 endif // prepare variables int64 nLinesInFile set nLinesInFile 0 bool IsLineEmpty set IsLineEmpty true int c // begin reading char by char do set c // read a character if // newline found; increment counter if line isn't empty if incr nLines incr nLinesInFile endif set IsLineEmpty true // reset flag elseif // ignore carriage returns // do nothing elseif // ignore tabs // do nothing elseif // ignore spaces // do nothing else set IsLineEmpty false // otherwise, the line is valid endif while > // -1 == EOF // close file fclose fp // echo count in file to event log echo " > while nFiles> // echo count in all files to event log echo