pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Peter Eisentraut <peter_e@gmx.net>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: src/port/getopt_long.c lossy with arguments having no option characters
Date: Sat, 4 Apr 2015 00:45:44 +0200
Message-ID: <20150403224544.GI17586@awork2.anarazel.de> (raw)
In-Reply-To: <20150403220638.GA4369@alvh.no-ip.org>
References: <CAB7nPqQ45JbD1ZBvbD7gqQK4diGZXmGw56zp7R_DvEKO8EdMbQ@mail.gmail.com>
	<28931.1428070107@sss.pgh.pa.us>
	<551EEE5A.10709@gmx.net>
	<20150403220638.GA4369@alvh.no-ip.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 2015-04-03 19:06:38 -0300, Alvaro Herrera wrote:
> 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 think that's primarily a different issue though. For some reason I
have yet to figure out --help is usually treated explicitly. E.g.:
	if (argc > 1)
	{
		if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
		{
			usage();
			exit(0);
		}
		else if (strcmp(argv[1], "-V") == 0
				 || strcmp(argv[1], "--version") == 0)
		{
			puts("pg_basebackup (PostgreSQL) " PG_VERSION);
			exit(0);
		}
	}

	while ((c = getopt_long(argc, argv, "D:F:r:RT:xX:l:zZ:d:c:h:p:U:s:wWvP",
							long_options, &option_index)) != -1)

Some tools then copy the --help/-? handling to the normal option parsing
(like IIRC psql) but others don't (like pg_basebackup).

Greetings,

Andres Freund


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (10+ messages)  latest in thread

Message-ID: <20150403224544.GI17586@awork2.anarazel.de>
Permalink:  ../20150403224544.GI17586@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20150403224544.GI17586@awork2.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@anarazel.de, alvherre@2ndquadrant.com, peter_e@gmx.net, tgl@sss.pgh.pa.us, michael.paquier@gmail.com
  Subject: Re: src/port/getopt_long.c lossy with arguments having no option characters
  In-Reply-To: <20150403224544.GI17586@awork2.anarazel.de>
  References: <CAB7nPqQ45JbD1ZBvbD7gqQK4diGZXmGw56zp7R_DvEKO8EdMbQ@mail.gmail.com> <28931.1428070107@sss.pgh.pa.us> <551EEE5A.10709@gmx.net> <20150403220638.GA4369@alvh.no-ip.org> <20150403224544.GI17586@awork2.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox