This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFC: Inferior command line arguments
> From: Tom Tromey <tromey@redhat.com>
> 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.