Path: utzoo!news-server.csri.toronto.edu!rutgers!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!olivea!oliveb!amdahl!ikluft From: ikluft@uts.amdahl.com (Ian Kluft) Newsgroups: comp.software-eng Subject: Re: WANTED: "C" code line counter program Message-ID: <24gW01hb3c8s00@amdahl.uts.amdahl.com> Date: 12 Mar 91 21:03:28 GMT References: <1991Mar6.214157.18633@ntpal.uucp> <9082@suns6.crosfield.co.uk> Reply-To: ikluft@amdahl.uts.amdahl.com (Ian Kluft) Organization: Amdahl Corporation, Systems Software, Santa Clara CA Lines: 26 In article mitch@hq.af.mil (Mitch Wright) writes: >> I need a "C" code line counter program, [...] > >Ray> So how about one that counts semi-colons :-) > >Because: > >#include >main() >{ > printf(";;;; Hello World ;;;;\n"); >} For any simple data-gathering tool, there's always a pathological case. You just named one. But counting semicolons still isn't a bad idea. It's a little more work, but try counting uncommented, unquoted semicolons. (Lex and yacc could be used to put that together in couple hours. Unfortun- ately, I don't have a couple hours to spare. Maybe someone else can take the idea somewhere.) That ought to give a usable and reasonably accurate count. -- #include #define UTS (( Unix System V ) + ( Amdahl mainframe )) ------------------------------------------------------------------------------- Ian Kluft UTS Systems Software, Amdahl Corporation ikluft@uts.amdahl.com Santa Clara, CA