File: cpp

package info (click to toggle)
perl 5.8.4-8sarge6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 58,128 kB
  • ctags: 31,422
  • sloc: perl: 224,262; ansic: 155,398; sh: 32,253; pascal: 7,747; lisp: 6,121; makefile: 2,341; cpp: 2,035; yacc: 1,019; java: 23
file content (24 lines) | stat: -rw-r--r-- 573 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /bin/sh
#__USAGE
#%C	[-P] [-C] other options
#	cpp is a wrapper for wcc to make it work like other cpp's
#	-P omit #line directives from the output
#	-C pass comments through to the output
#
#Submitted by Norton T. Allen (allen@huarp.harvard.edu)

typeset lines=l comments="" redir=""
while :; do
  case $1 in
	-P) lines=""; shift; continue;;
	-C) comments=c; shift; continue;;
  esac
  break
done
if [ ! -t 0 ]; then
  cat >.$$.c
  redir=.$$.c
fi
cc -c -Wc,-p$lines$comments -Wc,-pw=0 $* $redir |
  awk 'NR>1||NF>0 {sub("^ ","");print}'
[ -n "$redir" ] && rm -f $redir