[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apr-cvs
Subject:    svn commit: r179243 - /apr/apr/trunk/build/jlibtool.c
From:       pquerna () apache ! org
Date:       2005-05-31 17:48:26
Message-ID: 20050531174826.93595.qmail () minotaur ! apache ! org
[Download RAW message or body]

Author: pquerna
Date: Tue May 31 10:48:24 2005
New Revision: 179243

URL: http://svn.apache.org/viewcvs?rev=179243&view=rev
Log:
jlibtool: Fix escaping of args with spaces, for example: -DFOO="Text With Spaces".

Modified:
    apr/apr/trunk/build/jlibtool.c

Modified: apr/apr/trunk/build/jlibtool.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/build/jlibtool.c?rev=179243&r1=179242&r2=179243&view=diff
 ==============================================================================
--- apr/apr/trunk/build/jlibtool.c (original)
+++ apr/apr/trunk/build/jlibtool.c Tue May 31 10:48:24 2005
@@ -364,6 +364,7 @@
 
 char *shell_esc(const char *str)
 {
+    int in_quote = 0;
     char *cmd;
     unsigned char *d;
     const unsigned char *s;
@@ -373,7 +374,11 @@
     s = (const unsigned char *)str;
 
     for (; *s; ++s) {
-        if (*s == '"' || *s == '\\') {
+        if (*s == '"') {
+            *d++ = '\\';
+            in_quote++;
+        }
+        else if (*s == '\\' || (*s == ' ' && (in_quote % 2))) {
             *d++ = '\\';
         }
         *d++ = *s;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic