What about the idea of updating our getopt and getopt_long to a more modern version by porting over netBSD getopt?
The current situation is confusing for users, as "psql databasename -p port" type of calls works on almost all
platforms,but not on those using the internal getopt/getopt_long. For those, you get "-p" is not a valid user.
This is because MAC, BSD and GNU getopt_long permutes the arguments, and our getopt_long does not.
> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Tuesday, March 17, 2009 11:02 AM
> To: Zdenek Kotala
> Cc: Chuck McDevitt; pgsql-hackers@postgresql.org
> Subject: Re: [HACKERS] Solaris getopt_long and PostgreSQL
>
> Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
> > [ use Solaris' version of getopt_long ]
>
> The reason not to do that was discussed in this thread:
>
> http://archives.postgresql.org//pgsql-patches/2008-02/msg00075.php
>
> While Chuck is certainly free to build his local copy however he wants,
> I don't think we're going to revert this change in the community
> sources.
>
> regards, tom lane