| 1 | #! /bin/sh |
| 2 | #__USAGE |
| 3 | #%C [-P] [-C] other options |
| 4 | # cpp is a wrapper for wcc to make it work like other cpp's |
| 5 | # -P omit #line directives from the output |
| 6 | # -C pass comments through to the output |
| 7 | # |
| 8 | #Submitted by Norton T. Allen (allen@huarp.harvard.edu) |
| 9 | |
| 10 | typeset lines=l comments="" redir="" |
| 11 | while :; do |
| 12 | case $1 in |
| 13 | -P) lines=""; shift; continue;; |
| 14 | -C) comments=c; shift; continue;; |
| 15 | esac |
| 16 | break |
| 17 | done |
| 18 | if [ ! -t 0 ]; then |
| 19 | cat >.$$.c |
| 20 | redir=.$$.c |
| 21 | fi |
| 22 | cc -c -Wc,-p$lines$comments -Wc,-pw=0 $* $redir | |
| 23 | awk 'NR>1||NF>0 {sub("^ ","");print}' |
| 24 | [ -n "$redir" ] && rm -f $redir |