Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!linus!necntc!jeff From: jeff@necntc.UUCP Newsgroups: net.sources Subject: nuisance block comments (nbc) Message-ID: <1363@necntc.UUCP> Date: Thu, 12-Mar-87 12:06:17 EST Article-I.D.: necntc.1363 Posted: Thu Mar 12 12:06:17 1987 Date-Received: Fri, 13-Mar-87 20:52:31 EST Organization: NEC Electronics Inc. Natick, MA 01760 Lines: 51 I happened to make a comment about how annoying large intro comments in source are to one of the programmers here. Here is what we came up with - Here's to DEC and others for making programs like this worthwhile... Do with this code as you see fit... [send commment/whatever to rpk@necntc.nec.com] Cheers, --- Jeff Janock - NEC Electronics +1 617 655 8833 jeff@necntc.NEC.COM / jeff@necntc.UUCP ..!{mit-eddie, ames, decvax, pyramid, husc6, mirror}!necntc!jeff gatech!gt-eedsp!/ --- /* nbc.c v 1.0.00 11-mar-87 rpk * * remove first block comment from a source file */ #include main( argc, argv) int argc; char *argv[]; { FILE *fp; char ch, buffer[BUFSIZ]; ; if ( (fp = argc < 2 ? stdin : fopen( argv[1], "r" )) == NULL ) { perror( argv[1] ); exit( 1 ); } while ( fgets( buffer, BUFSIZ, fp ) ) { if ( strncmp( buffer, "/*******", 8 ) == 0 ) { while ( fgets( buffer, BUFSIZ, fp ) ) { if ( strncmp( buffer, " *******", 8 ) == 0 ) goto zip; } } else { fputs( buffer, stdout ); } } zip: while ( (ch = getc( fp )) != EOF ) putchar( ch ); exit( 0 ); }