xref: /csrg-svn/usr.bin/cpp/cpp.sh (revision 47717)
146185Sdonn#!/bin/sh
246185Sdonn#
346185Sdonn# Copyright (c) 1990 The Regents of the University of California.
446185Sdonn# 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*47717Sdonn#	@(#)cpp.sh	6.5 (Berkeley) 04/01/91
1346185Sdonn#
1446185Sdonn# Transitional front end to CCCP to make it behave like (Reiser) CCP:
1546185Sdonn#	specifies -traditional
1646185Sdonn#	doesn't search gcc-include
1746185Sdonn#
18*47717SdonnPATH=/usr/bin:/bin
19*47717SdonnCPP=/usr/libexec/cpp
2047156SdonnALST="-traditional -D__GNUC__ -$ "
2146185SdonnNSI=no
2247593SdonnOPTS=""
2347593SdonnINCS="-nostdinc"
24*47717SdonnFOUNDFILES=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	*)
44*47717Sdonn		FOUNDFILES=yes
4547593Sdonn		if [ $NSI = "no" ]
4647593Sdonn		then
4747593Sdonn			INCS="$INCS -I/usr/include"
4847593Sdonn			NSI=skip
4947593Sdonn		fi
50*47717Sdonn		eval $CPP $ALST $INCS $LIBS $CSU $OPTS $A || exit $?
5146185Sdonn		;;
5246185Sdonn	esac
5346185Sdonndone
5446185Sdonn
55*47717Sdonnif [ $FOUNDFILES = "no" ]
56*47717Sdonnthen
57*47717Sdonn	# read standard input
58*47717Sdonn	if [ $NSI = "no" ]
59*47717Sdonn	then
60*47717Sdonn		INCS="$INCS -I/usr/include"
61*47717Sdonn	fi
62*47717Sdonn	eval exec $CPP $ALST $INCS $LIBS $CSU $OPTS
63*47717Sdonnfi
64*47717Sdonn
6547593Sdonnexit 0
66