From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eli Zaretskii" To: tromey@redhat.com Cc: gdb-patches@sources.redhat.com Subject: Re: RFC: Inferior command line arguments Date: Fri, 28 Sep 2001 09:25:00 -0000 Message-id: <1858-Fri28Sep2001182535+0300-eliz@is.elta.co.il> References: <87zo7gq7gb.fsf@creche.redhat.com> <2593-Fri28Sep2001103201+0300-eliz@is.elta.co.il> <87u1xnh4ns.fsf@creche.redhat.com> <4331-Fri28Sep2001162207+0300-eliz@is.elta.co.il> <8766a3gy0m.fsf@creche.redhat.com> X-SW-Source: 2001-09/msg00419.html > From: Tom Tromey > Date: 28 Sep 2001 09:01:29 -0600 > > Eli> Oh, so in the comment above that confused me you meant ``...will > Eli> be parsed _by_the_shell_ to yield the same vector'', yes? > > Yeah. I changed it to read: > > /* Given a vector of command-line arguments, return a newly allocated > string which, when passed to the create_inferior function, will be > parsed (on Unix systems, by the shell) to yield the same vector. Thanks. > Eli> AFAIK, CreateProcess acts like a stock Windows shell wrt the > Eli> command line handling. > > I ended up implementing this for win32-nat.c: > > /* We quote each argument by adding "..." around it. If the > argument contains a quote character, we quote that with a > backslash. */ > > I did this based on some readings I found via a google search. I > really know very little about Windows. Does this approach sound > reasonable? That is correct AFAIK, but there are complications: the case where the embedded quote is already preceded by a backslash, and the case where the argument that needs to be wrapped in quotes ends in a backslash. And running Cygwin applications needs yet another modification. For the full story, see the function sys_spawnve on w32proc.c in the Emacs distribution.