bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch #2507] Patch to update autoconf files


From: Alfred M. Szmidt
Subject: Re: [patch #2507] Patch to update autoconf files
Date: Thu, 02 Jun 2005 15:08:36 -0400

Ok to apply? Fixes so that stuff like -DFOO=\"bar\ baz\" is passed
correctly.  I assume that Thomas has checked that the patch works.

2005-05-27  Thomas Schwinge  <schwinge@nic-nac-project.de>

        * 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.


Index: mig.in
===================================================================
RCS file: /cvsroot/hurd/mig/mig.in,v
retrieving revision 1.11
diff -u -r1.11 mig.in
--- mig.in      2 May 2005 19:51:35 -0000       1.11
+++ mig.in      27 May 2005 18:44:55 -0000
@@ -43,8 +43,34 @@
 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
+# <URL:http://code.dogmap.org/prjlibs/>.
+
+prj_quote_sh() {
+  case $1 in
+    '') echo "''";;
+    
*[!%+,./0123456789:@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-]*) 
sed "
+s/'/'\\\\''/g
+1s/^/'/
+\$s/\$/'/
+" <<EOT
+$1
+EOT
+      ;;
+    -*) cat <<EOT
+$1
+EOT
+      ;;
+    *) echo "$1";;
+  esac
+}
+
+
+# If an argument to this shell script that will be passed to migcom contains
+# whitespace, then we will screw up: migcom will see it as multiple arguments.
+# Arguments that are only passed to $cpp are fine, though.
+# `mig -DFOO=B\ A\ R ...' works.
 #
 # As a special hack, if -i is specified first we don't pass -user to migcom.
 # We do use the -user argument for the dependencies.
@@ -93,17 +119,17 @@
        -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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]