Unix Technical Forum

Our getopt_long() doesn't do abbreviations or NLS

This is a discussion on Our getopt_long() doesn't do abbreviations or NLS within the pgsql Hackers forums, part of the PostgreSQL category; --> I just noticed that our port/getopt_long.c substitute implementation does not accept abbreviated names for long options: $ pg_dump --username ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 03:33 AM
Tom Lane
 
Posts: n/a
Default Our getopt_long() doesn't do abbreviations or NLS

I just noticed that our port/getopt_long.c substitute implementation
does not accept abbreviated names for long options:

$ pg_dump --username tgl regression
.... works ...
$ pg_dump --user tgl regression
pg_dump: illegal option -- user
Try "pg_dump --help" for more information.
$

The GNU implementation of getopt_long is documented to allow this:

The getopt_long() function works like getopt() except that it also
accepts long options, started out by two dashes. Long option names
may be abbreviated if the abbreviation is unique or is an exact match
for some defined option. A long option may take a parameter, of the
form --arg=param or --arg param.

and experimentation confirms it works.

Barring objections, I'm going to modify our version to allow unique
abbreviations too.

I also notice that our version isn't i18n-ready:

if (opterr && optstring[0] != ':')
fprintf(stderr,
"%s: illegal option -- %s\n", argv[0], place);

Should it be gettext'ified?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 03:33 AM
Tom Lane
 
Posts: n/a
Default Re: Our getopt_long() doesn't do abbreviations or NLS

Peter Eisentraut <peter_e@gmx.net> writes:
> Tom Lane wrote:
>> Should it be gettext'ified?


> Probably.


I seem to recall that there was some special consideration for files
that would conditionally show up in multiple executables. Or were you
going to fix that by having just one .mo file for all the clients?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 03:34 AM
Peter Eisentraut
 
Posts: n/a
Default Re: Our getopt_long() doesn't do abbreviations or NLS

Tom Lane wrote:
> I just noticed that our port/getopt_long.c substitute implementation
> does not accept abbreviated names for long options:


That is known, but since we don't advertise that feature, it's not a
problem.

> Barring objections, I'm going to modify our version to allow unique
> abbreviations too.


Sure, if you like.

> Should it be gettext'ified?


Probably.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:32 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com