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