Bug in gengetopt (hidden options and no-handle-help)

Thomas Boehne <[email protected]>
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <[email protected]>
thomasb@pc-tb-debian:~/TiCo-MG/test3/cmd_test1 1$ gengetopt --version
GNU gengetopt 2.19.1
[...]

contents of file "test.ggo":
purpose "Foo"
package "bar"
version "1.00.00"

option "par1" - "par 1" string required
option "par2" P "par 2" string optional hidden

invocation of gengetopt:
$ gengetopt --input=test.ggo --no-handle-help


Now cmdline.c contains this:

       case 0: /* Long option with no short option */
          /* Print help, including hidden options, and exit.  */
          if (strcmp (long_options[option_index].name, "full-help") == 0)
          {
            if (local_args_info.full_help_given)
              {
                fprintf (stderr, "%s: `--full-help' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
                goto failure;
              }
            if (args_info->full_help_given && ! override)
              continue;
            local_args_info.full_help_given = 1;
            args_info->full_help_given = 1;

          }
          cmdline_parser_free (&local_args_info);
            return 0;

          /* par 1.  */
          if (strcmp (long_options[option_index].name, "par1") == 0)
          [...]

The code for "par 1" will never be reached, because of the return 0. I
guess it is a bug that only occurs with no-handle-help and hidden
options, but I was not able to really track it down. Maybe somebody
with more knowledge of the gengetopt-code can look into this.

Best regards
Thomas Böhne

-- 
**************************************************************************
* Jäger Computergesteuerte Messtechnik GmbH
* Thomas Böhne
* Rheinstraße 2-4
* 64653 Lorsch, Germany
* http://www.ADwin.de
* Phone: +49 (6251) 9632-0                  Fax: +49 (6251) 56819
**************************************************************************
* Responsible: C.E.O. Hubert Morgenstern
* Commercial Register: Amtsgericht Bensheim, Register no.: B24717
**************************************************************************
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.