From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cagney To: Daniel Jacobowitz Cc: Tom Tromey , Michael Snyder , gdb-patches@sources.redhat.com Subject: Re: RFC: Inferior command line arguments Date: Fri, 28 Sep 2001 12:27:00 -0000 Message-id: <3BB4CF12.3020900@cygnus.com> References: <87zo7gq7gb.fsf@creche.redhat.com> <3BB4C04D.22C3DAB5@cygnus.com> <877kuji2b7.fsf@creche.redhat.com> <20010928145938.A13638@nevyn.them.org> X-SW-Source: 2001-09/msg00430.html > On Fri, Sep 28, 2001 at 12:43:24PM -0600, Tom Tromey wrote: > Rather than continue down this path, I'd much rather see us fix or fork > GNU getopt so that we can detect the presence of '--'; I'd think in > fact we could do it without having to go through all these hoops, but I > haven't actually looked at the code. If nothing else, this should be > possible: > > - scan the command line for '--' > - if found, save what's after as an inferior argv vector > - shrink argv so it stops before the '--' > - go through normal existing getopt loop > and optionally: > - if we found a program name, tack it on at the beginning of the > inferior argv; if we didn't, grab one from the beginning of the > inferior argv. > > The use of -- is pretty standard; I'd like us to support it if we > could. Unfortunatly ``--'' already has certain semantics. Detecting it wouldn't be sufficient. Consider things like: --argument-expected -- -- --poor-programe-name-choice --poor-core-file-choice gdb --args -- gdb --args -- program arg arg Tom's --args -- is somewhat grotesque but at least it is well defined. Something like: gdb --- gdb --- program arg arg might be possible but it is really sugar for ``--args --''. Andrew