Re: ecpg -? option doesn't work in windows

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ecpg -? option doesn't work in windows
Date: 2016-09-18 11:14:51
Message-ID: ea900cc9-e0ec-2c0e-d277-f112e9da80e6@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08/29/2016 09:10 AM, Haribabu Kommi wrote:
> ecpg option --help alternative -? doesn't work in windows.
> In windows, the PG provided getopt_long function is used
> for reading the provided options.
>
> The getopt_long function returns '?' for invalid characters
> also but it sets optopt option to 0 in case if the character
> itself is a '?'. But this works for Linux and others, whereas
> for windows, optopt is not 0. Because of this reason it is
> failing.
>
> I feel, from this commit 5b88b85c on wards, it is not working.
> I feel instead of fixing the getopt_long function to reset optopt
> parameter to zero whenever it is returning '?', I prefer fixing
> the ecpg in handling the version and help options seperate.

Agreed. This does have one annoying consequence, though: --help and
--version are now only accepted as the first argument. But that's
consistent with most of our binaries. psql does this slightly
differently, though, so e.g. "psql --t --help" works. It might be worth
changing all our binaries to follow psql's example, but that's another
story.

> Patch is attached. Any one prefers the getopt_long function
> fix, I can produce the patch for the same.

Committed, thanks!

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-09-18 11:44:29 Re: Event trigger and CREATE/ALTER ROLE/USER
Previous Message Fabien COELHO 2016-09-18 11:13:44 Re: pgbench - allow to store select results into variables