From 03b74ca7f4ee84bad91d3925853528b75a8f7719 Mon Sep 17 00:00:00 2001 From: "Alfred M. Szmidt" Date: Mon, 6 Jun 2005 07:48:19 +0000 Subject: 2005-05-27 Thomas Schwinge * mig.in (prj_quote_sh): New shell funcion; copied from Paul Jarc's prjlibs. Use that function to properly quote strings in $cppflags that contain whitespace. --- mig.in | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'mig.in') diff --git a/mig.in b/mig.in index 0d03e59..106a4ef 100644 --- a/mig.in +++ b/mig.in @@ -43,8 +43,34 @@ cppflags= migflags= files= -# If an argument to this shell script contains whitespace, -# then we will screw up. migcom will see it as multiple arguments. + +# prj_quote_sh() is from Paul Jarc's prjlibs available at +# . + +prj_quote_sh() { + case $1 in + '') echo "''";; + *[!%+,./0123456789:@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-]*) sed " +s/'/'\\\\''/g +1s/^/'/ +\$s/\$/'/ +" <. Request assistance at .\ -prefix | -subrprefix ) migflags="$migflags $1 $2"; shift; shift;; -MD ) sawMD=1; cppflags="$cppflags $1"; shift;; - -imacros | -isystem ) cppflags="$cppflags $1 $2"; shift; shift;; + -imacros | -isystem ) cppflags="$cppflags $1 `prj_quote_sh "$2"`"; shift; shift;; -cc) cpp="$2"; shift; shift;; -migcom) migcom="$2"; shift; shift;; - -* ) cppflags="$cppflags $1"; shift;; + -* ) cppflags="$cppflags `prj_quote_sh "$1"`"; shift;; * ) files="$files $1"; shift;; esac done for file in $files do - $cpp $cppflags "$file" | $migcom $migflags || exit + eval "$cpp $cppflags $file | $migcom $migflags || exit" if [ $sawMD ] then -- cgit v1.2.3