Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YeALp-0002f6-66 for pgsql-bugs@arkaria.postgresql.org; Fri, 03 Apr 2015 22:46:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YeALn-0004hZ-TZ for pgsql-bugs@arkaria.postgresql.org; Fri, 03 Apr 2015 22:46:07 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YeALm-0004hS-TO for pgsql-bugs@postgresql.org; Fri, 03 Apr 2015 22:46:07 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YeALe-0004IS-U4 for pgsql-bugs@postgresql.org; Fri, 03 Apr 2015 22:46:05 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id 91757860002; Sat, 4 Apr 2015 00:45:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (p5DDC6CF2.dip0.t-ipconnect.de [93.220.108.242]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id CA9C4860001; Sat, 4 Apr 2015 00:45:44 +0200 (CEST) Received: by anarazel.de (Postfix, from userid 1000) id 34717100BE6; Sat, 4 Apr 2015 00:45:44 +0200 (CEST) Date: Sat, 4 Apr 2015 00:45:44 +0200 From: Andres Freund To: Alvaro Herrera Cc: Peter Eisentraut , Tom Lane , Michael Paquier , pgsql-bugs@postgresql.org Subject: Re: src/port/getopt_long.c lossy with arguments having no option characters Message-ID: <20150403224544.GI17586@awork2.anarazel.de> References: <28931.1428070107@sss.pgh.pa.us> <551EEE5A.10709@gmx.net> <20150403220638.GA4369@alvh.no-ip.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150403220638.GA4369@alvh.no-ip.org> X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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