On Oct 27, 2007, at 3:02 PM, Seneca Cunningham wrote:
> On Sat, Oct 27, 2007 at 12:56:37PM -0500, Perry Smith wrote:
>> On my Mac systems, this work. On my AIX system it does not. I get:
>>
>> createdb dog -E utf8
>> createdb: too many command-line arguments (first is "utf8")
>> Try "createdb --help" for more information.
>>
>> Has anyone else bumped in to this? Is putting the arguments after
>> the database name known to work? Looking at the code, it seems
>> rather magical that it works but I just looked at the main routine in
>> createdb.c and not the routines it calls.
>
> It's been a while since I've dealt with AIX, but try putting your
> options before the option-less arguments. How it works is not
> magical,
> it's just using getopt_long, and some getopts stop checking for
> options
> after the first non-option argument it receives.
Well, it turns out that if getopt_long is not in the system's libc,
then postgres uses the getopt_long that is packaged with it. This
version works like I think it should -- it expects the non-option
argument at the end.
The getopt_long on Mac and I guess also Linux have been made non-
Posix compliant. They accept options after the non-option argument.
What is really disturbing is they alter argv. I find that somewhat a
bad idea but, I guess no one really cares about consistency or
traditions.
Anyhow... that is the reason AIX does it the way I expect it but the
others do not.
Thank you for your help,
Perry Smith ( pedz@easesoftware.com )
Ease Software, Inc. ( http://www.easesoftware.com )
Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems