Re: src/port/getopt_long.c lossy with arguments having no option characters

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: src/port/getopt_long.c lossy with arguments having no option characters
Дата
Msg-id 20150403224544.GI17586@awork2.anarazel.de
обсуждение исходный текст
Ответ на Re: src/port/getopt_long.c lossy with arguments having no option characters  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Ответы Re: src/port/getopt_long.c lossy with arguments having no option characters  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-bugs
On 2015-04-03 19:06:38 -0300, Alvaro Herrera wrote:
> The thing I hate the most about this issue is how some commands fail
> with "--help: unrecognized option" or some such, when called as
>
> command --foo=bar --baz --help

I think that's primarily a different issue though. For some reason I
have yet to figure out --help is usually treated explicitly. E.g.:
    if (argc > 1)
    {
        if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
        {
            usage();
            exit(0);
        }
        else if (strcmp(argv[1], "-V") == 0
                 || strcmp(argv[1], "--version") == 0)
        {
            puts("pg_basebackup (PostgreSQL) " PG_VERSION);
            exit(0);
        }
    }

    while ((c = getopt_long(argc, argv, "D:F:r:RT:xX:l:zZ:d:c:h:p:U:s:wWvP",
                            long_options, &option_index)) != -1)

Some tools then copy the --help/-? handling to the normal option parsing
(like IIRC psql) but others don't (like pg_basebackup).

Greetings,

Andres Freund

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: src/port/getopt_long.c lossy with arguments having no option characters
Следующее
От: Venkata Balaji N
Дата:
Сообщение: Re: Postgresql 9.4.1 stuck all queries when making multi updates