Path: utzoo!attcan!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: cpp, Using it to process shell scripts Keywords: comments,#directive,cpp,scripts Message-ID: <3642@auspex.auspex.com> Date: 13 Jul 90 17:23:56 GMT References: <11272@hydra.gatech.EDU> Organization: Auspex Systems, Santa Clara Lines: 32 >When using cpp to process the source to a script file, cpp always >puts a blank line in the output for everytime it encounters a >#directive or a /*comment*/. (This is SunOS 4.1) Is this normal >behavior? Yes. >If so, why? It's the way the S5R3 C preprocessor, upon which the SunOS 4.x one is based, happens to sync up line numbers. I've seen cases where older pre-processors caused the compiler to get line numbers wrong, and where the later one doesn't. >It really makes the resulting shell script messy with all those blank >lines... "cpp" stands for C Pre-Processor, not "shell script preprocessor" nor "Makefile preprocessor". The fact that it happens to be usable, in some cases, for other languages is pure serendipity. >My manual suggests m4 as an alternative but I'm not sure it won't >do the same thing. More importantly, this is a X11 shell script >with an Imakefile with all the predefined rules pointing to cpp >already. > >If m4 is the correct choice, why didn't MIT choose to use it? Dunno. They may switch to using the DECUS C preprocessor, which comes on recent (and perhaps not-so-recent) X11 source tapes, which means they'll no longer be depending so much on the kindness of strangers. You might want to look into doing the same.