Re: fix in --help output

From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: fix in --help output
Date: 2008-02-21 22:22:52
Message-ID: 47BDF9BC.6070605@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Andrew Dunstan napsal(a):
>
>
> Zdenek Kotala wrote:
>> Tom Lane napsal(a):
>>> Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> writes:
>>>> I attach fix for --help output. I replaced --NAME... with -NAME and
>>>> add some example. getopt parse -- as a end of options and rest of
>>>> line is not parsed.
>>>
>>> Surely this is outright wrong. Or if you do have a getopt that acts
>>> that way, the bug is that we are using it rather than one that acts
>>> the way we want.
>>
>> Ah, sorry it really does not work.
>>
>> However, I get following error on Solaris:
>>
>> bash-3.2$ /usr/postgres/8.2/bin/postgres -D /tmp/db --share_buffers=16000
>> /usr/postgres/8.2/bin/postgres: illegal option -- share_buffers=16000
>> Try "postgres --help" for more information.
>>
>> but following command works fine:
>>
>> /usr/postgres/8.2/bin/postgres -D /tmp/db -c shared_buffers=16000
>>
>>
>> By my opinion problem is in getopt which interprets -- as a end of
>> options list.
>>
>> See
>> http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02
>>
>> Guideline 10
>>
>> It maybe work on linux but I think it is not portable solution.
>>
>>
>>
>
> -- on its own might indicate the end of arguments, but that's quite
> different from --foo=bar. Guideline 10 of the above surely only refers
> to -- as an entire argument, not to -- as the first two characters of an
> argument. If your getopt treats *any* -- as the end of options then I
> think it is broken (complain to your vendor ;-) ). And the answer is
> known - use the one we have in src/port.

You are not correct (I pointed to wrong Guidline). If you look to
Guidline 3 it specific only alphanumeric character. And you can read
"The implementation may accept other characters as an extension." in
http://www.opengroup.org/onlinepubs/009695399/functions/getopt.html

It means that Solaris implementation is OK. Linux uses some extensions
but it is not portable. If we want to use long options. We have
getop_long for it.

Zdenek

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Stephen Davies 2008-02-22 00:07:32 Re: ts_headline
Previous Message Andrew Dunstan 2008-02-21 21:31:41 Re: fix in --help output