getopt_long (was Re: [HACKERS] postmaster dead on startup ...)
От | Peter Eisentraut |
---|---|
Тема | getopt_long (was Re: [HACKERS] postmaster dead on startup ...) |
Дата | |
Msg-id | Pine.LNX.4.10.9910022006080.371-100000@peter-e.yi.org обсуждение исходный текст |
Ответ на | Re: [HACKERS] postmaster dead on startup from unportable SSL patch (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
On Oct 2, Tom Lane mentioned: > Er, you had better be writing your own getopt replacement if you want > to provide GNU-style options in psql. Or have you forgotten that the > code must be portable to non-GNU platforms? I don't think it would be > a good idea to support long options only on boxes with a suitable > getopt, either. That would create a documentation, scripting, and > support nightmare (because the same psql command line would work for > some people and not others). Naturally this whole thing will be #ifdef'ed out and depending on an autoconf test for getopt_long. Also there will be a short option for every long one and vice versa. I also gave the documentation issue some thought and I agree that this might not be fun to support. But then I don't really see too many support questions regarding psql _invocation_. At this point I'm just going to leave it undocumented, pending further complaints. I just like the self-documenting elegancy of $ psql --host=localhost --port=5432 --dbname=foo --username=joe --from-file=myfile.sql --out-file=result.txt But you can also get (actual output): $ ./psql --list This version of psql was compiled without support for long options. Use -? for help on invocation options. It's not too hard to check for that: just include "-" in your options list for the regular getopt. > If it weren't for the license conflict between BSD and GPL, I'd suggest Okay, while we're at it: Someone wrote me regarding readline (GPL) vs libedit (BSD). If you look at the code, readline is pretty deeply integrated. This is almost the same issue. But there has not been any support nightmare I was aware of. On the other hand there are even backslash commands (\s) that only work with readline. I even wrote an SQL-aware readline tab completion which I intend to incorporate in one form or another. This is true added functionality, while you might get away with saying that long options are just a toy. And of course we don't even want to talk about the requirements regarding GNU make, GNU flex, GNU tar, or this whole autoconf business. Of course, we could write ./configure -e locale -w perl, but that's no fun . . . -- Peter Eisentraut - peter_e@gmx.net http://yi.org/peter-e
В списке pgsql-hackers по дате отправления: