From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Jacobowitz To: Tom Tromey Cc: Michael Snyder , gdb-patches@sources.redhat.com Subject: Re: RFC: Inferior command line arguments Date: Fri, 28 Sep 2001 11:59:00 -0000 Message-id: <20010928145938.A13638@nevyn.them.org> References: <87zo7gq7gb.fsf@creche.redhat.com> <3BB4C04D.22C3DAB5@cygnus.com> <877kuji2b7.fsf@creche.redhat.com> X-SW-Source: 2001-09/msg00427.html On Fri, Sep 28, 2001 at 12:43:24PM -0600, Tom Tromey wrote: > In my current code, `--args' changes the interpretation of non-option > arguments. It doesn't stop argument processing. If you want that > then you have to use `--' as well. > > So: > > gdb --args gdb -nw > > is a confusing way of writing: > > gdb -nw --args gdb > > This happens because GNU getopt reorders options as it processes the > command line. > > It might be possible to have `--args' stop all other argument > processing. I haven't investigated that. 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. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer