delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1999/01/21/02:20:56

From: fujieda AT jaist DOT ac DOT jp (Kazuhiro Fujieda)
Subject: Re: relative path script
21 Jan 1999 02:20:56 -0800 :
Message-ID: <uhftlhqt9.fsf.cygnus.cygwin32.developers@parvati.will.or.jp>
References: <ubtjx80o1 DOT fsf AT parvati DOT will DOT or DOT jp>
Mime-Version: 1.0 (generated by SEMI MIME-Edit 0.100 - "Shijima")
To: cygwin32-developers AT cygnus DOT com

>>> On Wed, 20 Jan 1999 14:46:59 -0500
>>> Christopher Faylor <cgf AT cygnus DOT com> said:

> I've actually been checking this out in my spare time.  I've
> rewritten the section of code that deals with this.  It's a major
> change, so I could have broken something, but here it is.
(snip)

There is a bug in this patch.  The argument parser can't convert
arguments rightly. For example, it convert `foo "bar" foo' to
`"foo """bar" foo"'. This should be `"foo ""bar"" foo"'.

Then, It should check not only ' ' but also '\n', '\r' and '\t'
in order to be consistent with build_argv() in dcrt0.cc.

--- spawn.cc.chris	Thu Jan 21 18:20:22 1999
+++ spawn.cc	Thu Jan 21 18:49:35 1999
@@ -383,17 +383,16 @@ spawn_guts (HANDLE hToken, const char * 
 
       newargv0 = NULL;
       int len = strlen (a);
-      if (len != 0 && !(p = strpbrk (a, " \"")))
+      if (len != 0 && !(p = strpbrk (a, " \t\n\r\"")))
 	one_line.add (a, len);
       else
 	{
 	  one_line.add ("\"", 1);
-	  for (; p; a = p, p = strchr (p, '"'))
+	  for (; p; a = p++, p = strchr(p, '"'))
 	    {
-	      if (*p++ == '"')
-		one_line.add ("\"", 1);
 	      one_line.add (a, p - a);
-	      a = p;
+	      if (*p == '"')
+                one_line.add ("\"", 1);
 	    }
 	  if (*a)
 	    one_line.add (a, strlen (a));

____
  | AIST      Kazuhiro Fujieda <fujieda AT jaist DOT ac DOT jp>
  | HOKURIKU  School of Information Science
o_/ 1990      Japan Advanced Institute of Science and Technology

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019