=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cpp/cpp.sh,v retrieving revision 1.8 retrieving revision 1.9 diff -c -r1.8 -r1.9 *** src/usr.bin/cpp/cpp.sh 2010/05/03 18:34:01 1.8 --- src/usr.bin/cpp/cpp.sh 2013/12/09 02:35:09 1.9 *************** *** 1,5 **** ! #!/bin/sh ! # $OpenBSD: cpp.sh,v 1.8 2010/05/03 18:34:01 drahn Exp $ # # Copyright (c) 1990 The Regents of the University of California. --- 1,5 ---- ! #!/bin/ksh ! # $OpenBSD: cpp.sh,v 1.9 2013/12/09 02:35:09 guenther Exp $ # # Copyright (c) 1990 The Regents of the University of California. *************** *** 43,51 **** TRAD=-traditional DGNUC="@GNUC@" STDINC="-I/usr/include" ! DOLLAR="@dollaropt@" ! OPTS="" ! INCS="-nostdinc" FOUNDFILES=false CPP=/usr/libexec/cpp --- 43,50 ---- TRAD=-traditional DGNUC="@GNUC@" STDINC="-I/usr/include" ! set -A OPTS ! set -A INCS -- "-nostdinc" FOUNDFILES=false CPP=/usr/libexec/cpp *************** *** 72,93 **** -notraditional) TRAD= ;; -I*) ! INCS="$INCS $A" ;; -U__GNUC__) DGNUC= ;; - -imacros|-include|-idirafter|-iprefix|-iwithprefix) - INCS="$INCS '$A' '$1'" - shift - ;; -*) ! OPTS="$OPTS '$A'" ;; *) FOUNDFILES=true ! eval $CPP $TRAD $DGNUC $DOLLAR $INCS $STDINC $OPTS $A || exit $? ;; esac done --- 71,104 ---- -notraditional) 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*) ! 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__) DGNUC= + OPTS[${#OPTS[@]}]=$A ;; -*) ! OPTS[${#OPTS[@]}]=$A ;; *) FOUNDFILES=true ! $CPP $TRAD $DGNUC "${INCS[@]}" $STDINC "${OPTS[@]}" "$A" || ! exit ;; esac done *************** *** 95,101 **** if ! $FOUNDFILES then # read standard input ! eval exec $CPP $TRAD $DGNUC $DOLLAR $INCS $STDINC $OPTS fi exit 0 --- 106,112 ---- if ! $FOUNDFILES then # read standard input ! exec $CPP $TRAD $DGNUC "${INCS[@]}" $STDINC "${OPTS[@]}" fi exit 0