Re: src/port/getopt_long.c lossy with arguments having no option characters

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: src/port/getopt_long.c lossy with arguments having no option characters
Date: 2015-04-03 22:06:38
Message-ID: 20150403220638.GA4369@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Peter Eisentraut wrote:
> On 4/3/15 10:08 AM, Tom Lane wrote:
> > Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
> >> The implementation of getopt_long in src/port has some limitations,
> >> for example such commands do not work but they should:
> >
> > No, those should not work. You're too used to versions that don't insist
> > on switches-before-non-switch-arguments. Such behavior is an extension
> > that is not standard,
>
> It is true that options after non-option arguments are a GNU extension,
> but long options are also a GNU extension. So the behavior we provide
> is neither pure POSIX nor pure GNU. I can see how that would be confusing.

The thing I hate the most about this issue is how some commands fail
with "--help: unrecognized option" or some such, when called as

command --foo=bar --baz --help

I am used to such calls to emit the help, then exit, and the command is
kept in history; that way, it's easy to adjust for the info found in the
help and edit later. As is, I tend to esc-# to save the commented-out
command in history, then call with only --help, then recall the
commented-out version.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2015-04-03 22:45:44 Re: src/port/getopt_long.c lossy with arguments having no option characters
Previous Message Tom Lane 2015-04-03 21:47:31 Re: src/port/getopt_long.c lossy with arguments having no option characters