File: cpp

package info (click to toggle)
rc 1.5b2-0.1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 540 kB
  • ctags: 756
  • sloc: ansic: 5,474; sh: 231; makefile: 138; yacc: 127
file content (38 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

# @(#) cpp.sh 1.3 92/01/15 21:53:22

# Unprototypeing preprocessor for pre-ANSI C compilers.  On some systems,
# this script can be as simple as:
#
#	/lib/cpp "$@" | unproto
#
# However, some cc(1) drivers specify output file names on the
# preprocessor command line, so this shell script must be prepared to
# intercept them.  Depending on the driver program, the cpp options may
# even go before or after the file name argument(s). The script below
# tries to tackle all these cases.
#
# You may want to add -Ipath_to_stdarg.h_file, -Dvoid=, -Dvolatile=, 
# and even -D__STDC__.

## (This is what I used while testing with the SunOS C compiler.
## Also, I added "-Qpath ." to CFLAGS so that cpp would be
## run out of the current directory. --- Byron)
cpp_args="-I/u/byron/lib/sun4 -Dconst= -Dvolatile="

while :
do
	case $1 in
	"")	break;;
	-*)	cpp_args="$cpp_args $1";;
	 *)	cpp_args="$cpp_args $1"
		case $2 in
		""|-*)	;;
		    *)	exec 1> $2 || exit 1; shift;;
		esac;;
	esac
	shift
done

/lib/cpp $cpp_args | unproto