wrappers/cc: also process forbidden -I/-L paths with blanks.

like "-I   /usr/include".
This commit is contained in:
Juan RP 2015-10-25 10:47:15 +01:00
parent f1faf02d82
commit 1b0a232b20

View file

@ -8,12 +8,30 @@ ARGS=("$@")
i=0
while [ $i -lt ${#ARGS[@]} ]; do
arg="${ARGS[$i]}"
if [ "$arg" = "-I/usr/include" -o "$arg" = "-L/usr/lib" ]; then
if [ "$incpath" ]; then
if [ "$arg" = "/usr/include" ]; then
echo "[cc-wrapper] ignoring -I $arg"
unset incpath
else
MYARGS+=("-I${arg}")
fi
elif [ "$libpath" ]; then
if [ "$arg" = "/usr/lib" ]; then
echo "[cc-wrapper] ignoring -L $arg"
unset libpath
else
MYARGS+=("-L${arg}")
fi
elif [ "$arg" = "-I" ]; then
incpath=1
elif [ "$arg" = "-L" ]; then
libpath=1
elif [ "$arg" = "-I/usr/include" -o "$arg" = "-L/usr/lib" ]; then
echo "[cc-wrapper] ignoring $arg"
else
MYARGS+=("${arg}")
fi
i=$((i+1))
done
#echo "[cc-wrapper] ${MYARGS[@]}"
#echo "[cc-wrapper] @BIN@ ${MYARGS[@]}"
exec @BIN@ "${MYARGS[@]}"