xref: /original-bsd/usr.bin/cpp/cpp.sh (revision 1452592a)
18b4d2f25Sdonn#!/bin/sh
28b4d2f25Sdonn#
3*1452592aSbostic# Copyright (c) 1990, 1993
4*1452592aSbostic#	The Regents of the University of California.  All rights reserved.
58b4d2f25Sdonn#
68b4d2f25Sdonn# This code is derived from software contributed to Berkeley by
78b4d2f25Sdonn# the Systems Programming Group of the University of Utah Computer
88b4d2f25Sdonn# Science Department.
98b4d2f25Sdonn#
108b4d2f25Sdonn# %sccs.include.redist.sh%
118b4d2f25Sdonn#
12*1452592aSbostic#	@(#)cpp.sh	8.1 (Berkeley) 06/06/93
138b4d2f25Sdonn#
148b4d2f25Sdonn# Transitional front end to CCCP to make it behave like (Reiser) CCP:
158b4d2f25Sdonn#	specifies -traditional
168b4d2f25Sdonn#	doesn't search gcc-include
178b4d2f25Sdonn#
1804483843SdonnPATH=/usr/bin:/bin
19f4c49249SbosticCPP=/usr/libexec/gcc2/cpp
204a367439SdonnALST="-traditional -D__GNUC__ -$ "
218b4d2f25SdonnNSI=no
226da71724SdonnOPTS=""
236da71724SdonnINCS="-nostdinc"
2404483843SdonnFOUNDFILES=no
258b4d2f25Sdonn
26d64b0929Sdonnfor A
27d64b0929Sdonndo
288b4d2f25Sdonn	case $A in
298b4d2f25Sdonn	-nostdinc)
308b4d2f25Sdonn		NSI=yes
318b4d2f25Sdonn		;;
328b4d2f25Sdonn	-traditional)
338b4d2f25Sdonn		;;
348b4d2f25Sdonn	-I*)
358b4d2f25Sdonn		INCS="$INCS $A"
368b4d2f25Sdonn		;;
378b4d2f25Sdonn	-U__GNUC__)
388b4d2f25Sdonn		ALST=`echo $ALST | sed -e 's/-D__GNUC__//'`
398b4d2f25Sdonn		;;
406da71724Sdonn	-*)
416da71724Sdonn		OPTS="$OPTS '$A'"
426da71724Sdonn		;;
438b4d2f25Sdonn	*)
4404483843Sdonn		FOUNDFILES=yes
456da71724Sdonn		if [ $NSI = "no" ]
466da71724Sdonn		then
476da71724Sdonn			INCS="$INCS -I/usr/include"
486da71724Sdonn			NSI=skip
496da71724Sdonn		fi
5004483843Sdonn		eval $CPP $ALST $INCS $LIBS $CSU $OPTS $A || exit $?
518b4d2f25Sdonn		;;
528b4d2f25Sdonn	esac
538b4d2f25Sdonndone
548b4d2f25Sdonn
5504483843Sdonnif [ $FOUNDFILES = "no" ]
5604483843Sdonnthen
5704483843Sdonn	# read standard input
5804483843Sdonn	if [ $NSI = "no" ]
5904483843Sdonn	then
6004483843Sdonn		INCS="$INCS -I/usr/include"
6104483843Sdonn	fi
6204483843Sdonn	eval exec $CPP $ALST $INCS $LIBS $CSU $OPTS
6304483843Sdonnfi
6404483843Sdonn
656da71724Sdonnexit 0
66