version 1.8, 2010/05/03 18:34:01 |
version 1.9, 2013/12/09 02:35:09 |
|
|
#!/bin/sh |
#!/bin/ksh |
# $OpenBSD$ |
# $OpenBSD$ |
|
|
# |
# |
|
|
TRAD=-traditional |
TRAD=-traditional |
DGNUC="@GNUC@" |
DGNUC="@GNUC@" |
STDINC="-I/usr/include" |
STDINC="-I/usr/include" |
DOLLAR="@dollaropt@" |
set -A OPTS |
OPTS="" |
set -A INCS -- "-nostdinc" |
INCS="-nostdinc" |
|
FOUNDFILES=false |
FOUNDFILES=false |
|
|
CPP=/usr/libexec/cpp |
CPP=/usr/libexec/cpp |
|
|
-notraditional) |
-notraditional) |
TRAD= |
TRAD= |
;; |
;; |
|
# options that take an argument and that should be sorted before |
|
# the $STDINC option |
|
-I | -imacros | -include | -idirafter | -iprefix | -iwithprefix | \ |
|
-iwithprefixbefore | -isysroot | -imultilib | -isystem | -iquote) |
|
INCS[${#INCS[@]}]=$A |
|
INCS[${#INCS[@]}]=$1 |
|
shift |
|
;; |
-I*) |
-I*) |
INCS="$INCS $A" |
INCS[${#INCS[@]}]=$A |
;; |
;; |
|
# other options that take an argument |
|
-MF | -MT | -MQ | -x | -D | -U | -o | -A) |
|
OPTS[${#OPTS[@]}]=$A |
|
OPTS[${#OPTS[@]}]=$1 |
|
shift |
|
;; |
-U__GNUC__) |
-U__GNUC__) |
DGNUC= |
DGNUC= |
|
OPTS[${#OPTS[@]}]=$A |
;; |
;; |
-imacros|-include|-idirafter|-iprefix|-iwithprefix) |
|
INCS="$INCS '$A' '$1'" |
|
shift |
|
;; |
|
-*) |
-*) |
OPTS="$OPTS '$A'" |
OPTS[${#OPTS[@]}]=$A |
;; |
;; |
*) |
*) |
FOUNDFILES=true |
FOUNDFILES=true |
eval $CPP $TRAD $DGNUC $DOLLAR $INCS $STDINC $OPTS $A || exit $? |
$CPP $TRAD $DGNUC "${INCS[@]}" $STDINC "${OPTS[@]}" "$A" || |
|
exit |
;; |
;; |
esac |
esac |
done |
done |
|
|
if ! $FOUNDFILES |
if ! $FOUNDFILES |
then |
then |
# read standard input |
# read standard input |
eval exec $CPP $TRAD $DGNUC $DOLLAR $INCS $STDINC $OPTS |
exec $CPP $TRAD $DGNUC "${INCS[@]}" $STDINC "${OPTS[@]}" |
fi |
fi |
|
|
exit 0 |
exit 0 |