xref: /csrg-svn/usr.bin/cpp/cpp.sh (revision 61956)
146185Sdonn#!/bin/sh
246185Sdonn#
3*61956Sbostic# Copyright (c) 1990, 1993
4*61956Sbostic#	The Regents of the University of California.  All rights reserved.
546185Sdonn#
646185Sdonn# This code is derived from software contributed to Berkeley by
746185Sdonn# the Systems Programming Group of the University of Utah Computer
846185Sdonn# Science Department.
946185Sdonn#
1046185Sdonn# %sccs.include.redist.sh%
1146185Sdonn#
12*61956Sbostic#	@(#)cpp.sh	8.1 (Berkeley) 06/06/93
1346185Sdonn#
1446185Sdonn# Transitional front end to CCCP to make it behave like (Reiser) CCP:
1546185Sdonn#	specifies -traditional
1646185Sdonn#	doesn't search gcc-include
1746185Sdonn#
1847717SdonnPATH=/usr/bin:/bin
1959712SbosticCPP=/usr/libexec/gcc2/cpp
2047156SdonnALST="-traditional -D__GNUC__ -$ "
2146185SdonnNSI=no
2247593SdonnOPTS=""
2347593SdonnINCS="-nostdinc"
2447717SdonnFOUNDFILES=no
2546185Sdonn
2647575Sdonnfor A
2747575Sdonndo
2846185Sdonn	case $A in
2946185Sdonn	-nostdinc)
3046185Sdonn		NSI=yes
3146185Sdonn		;;
3246185Sdonn	-traditional)
3346185Sdonn		;;
3446185Sdonn	-I*)
3546185Sdonn		INCS="$INCS $A"
3646185Sdonn		;;
3746185Sdonn	-U__GNUC__)
3846185Sdonn		ALST=`echo $ALST | sed -e 's/-D__GNUC__//'`
3946185Sdonn		;;
4047593Sdonn	-*)
4147593Sdonn		OPTS="$OPTS '$A'"
4247593Sdonn		;;
4346185Sdonn	*)
4447717Sdonn		FOUNDFILES=yes
4547593Sdonn		if [ $NSI = "no" ]
4647593Sdonn		then
4747593Sdonn			INCS="$INCS -I/usr/include"
4847593Sdonn			NSI=skip
4947593Sdonn		fi
5047717Sdonn		eval $CPP $ALST $INCS $LIBS $CSU $OPTS $A || exit $?
5146185Sdonn		;;
5246185Sdonn	esac
5346185Sdonndone
5446185Sdonn
5547717Sdonnif [ $FOUNDFILES = "no" ]
5647717Sdonnthen
5747717Sdonn	# read standard input
5847717Sdonn	if [ $NSI = "no" ]
5947717Sdonn	then
6047717Sdonn		INCS="$INCS -I/usr/include"
6147717Sdonn	fi
6247717Sdonn	eval exec $CPP $ALST $INCS $LIBS $CSU $OPTS
6347717Sdonnfi
6447717Sdonn
6547593Sdonnexit 0
66