Re: createdb argument question

From: Perry Smith <pedz(at)easesoftware(dot)com>
To: Seneca Cunningham <tentra(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: createdb argument question
Date: 2007-10-28 14:16:02
Message-ID: 4DD0C4C5-0B2B-4708-95C6-8F22AAF6856E@easesoftware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)easesoftware(dot)com )
Ease Software, Inc. ( http://www.easesoftware.com )

Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Perry Smith 2007-10-28 14:25:11 Re: I want to search my project source code
Previous Message Abandoned 2007-10-28 13:09:59 Which index can i use ?