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

Lorenzo Bettini <[email protected]>
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <[email protected]>
Thomas Boehne wrote:
> 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
> 

yes, this really looks like a bug!

I'll try to fix this as soon as possible and provide a candidate release.

thanks for the report
cheers
	Lorenzo

-- 
Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
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.