Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!munnari!otc!mikem From: mikem@otc.oz (Mike Mowbray) Newsgroups: comp.lang.c++ Subject: Alternate +i option to CC Message-ID: <266@otc.oz> Date: Sun, 25-Oct-87 18:18:25 EST Article-I.D.: otc.266 Posted: Sun Oct 25 18:18:25 1987 Date-Received: Wed, 28-Oct-87 04:12:34 EST Organization: OTC Development Unit, Australia Lines: 67 Here's a small mod to the way the CC script handles the +i option. It is intended to make the ..c code more readable. Where CC has: if test "$PLUSI" #leave ..c's lying around ... use the following instead: if test "$PLUSI" #leave ..c's lying around then #remove #line's from the ..c's for sdb for f in $C do echo "Beautifying $f" sed "/^#/d" $f | cb -s -j | postcb > temp$$ mv temp$$ $f done fi Where "postcb" is just the following shell script: sed -e 's/\([A-Za-z_0-9(]\) *( */\1(/g s/ *)/)/g s/ *\*)/\*)/g s/ *;/;/g s/ *,/,/g s/ *\. */\./g s/ *-> */->/g s/ *\[/\[/g s/ *\]/\]/g s/\([ ]\)for(/\1for (/g s/\([ ]\)if(/\1if (/g s/\([ ]\)while(/\1while (/g s/\([ ]\)switch(/\1switch (/g s/\([ ]\)return(/\1return (/g s/ / /g' Note that for bsd systems the -j option to cb may not work, so the result will be less good. Later on, where __ctdt.c is removed you may also wish to include the following: if test "$PLUSI" != 1 then rm __ctdt.c fi ........ if test "$R" then if test ! "$PLUSI" then rm $C fi fi Running this version of the +i option can take a while, but you'd only use it occasionally to see what was going on. Mike Mowbray Systems Development |||| OTC || ACSnet: mikem@otc.oz UUCP: {uunet,mcvax}!otc.oz!mikem Phone: +61 2 287 4104 Snail: GPO Box 7000, Sydney 2001, Australia