xref: /original-bsd/usr.bin/cpp/cpp.sh (revision c3e32dec)
1#!/bin/sh
2#
3# Copyright (c) 1990, 1993
4#	The Regents of the University of California.  All rights reserved.
5#
6# This code is derived from software contributed to Berkeley by
7# the Systems Programming Group of the University of Utah Computer
8# Science Department.
9#
10# %sccs.include.redist.sh%
11#
12#	@(#)cpp.sh	8.1 (Berkeley) 06/06/93
13#
14# Transitional front end to CCCP to make it behave like (Reiser) CCP:
15#	specifies -traditional
16#	doesn't search gcc-include
17#
18PATH=/usr/bin:/bin
19CPP=/usr/libexec/gcc2/cpp
20ALST="-traditional -D__GNUC__ -$ "
21NSI=no
22OPTS=""
23INCS="-nostdinc"
24FOUNDFILES=no
25
26for A
27do
28	case $A in
29	-nostdinc)
30		NSI=yes
31		;;
32	-traditional)
33		;;
34	-I*)
35		INCS="$INCS $A"
36		;;
37	-U__GNUC__)
38		ALST=`echo $ALST | sed -e 's/-D__GNUC__//'`
39		;;
40	-*)
41		OPTS="$OPTS '$A'"
42		;;
43	*)
44		FOUNDFILES=yes
45		if [ $NSI = "no" ]
46		then
47			INCS="$INCS -I/usr/include"
48			NSI=skip
49		fi
50		eval $CPP $ALST $INCS $LIBS $CSU $OPTS $A || exit $?
51		;;
52	esac
53done
54
55if [ $FOUNDFILES = "no" ]
56then
57	# read standard input
58	if [ $NSI = "no" ]
59	then
60		INCS="$INCS -I/usr/include"
61	fi
62	eval exec $CPP $ALST $INCS $LIBS $CSU $OPTS
63fi
64
65exit 0
66