Hi there!
I'm using gengetopt-2.17rc3? and have found an interesting thing.
Help strings are doubled for public (not hidden) options into two dedicated
const array: *_options_help and *_options_full_help and *_print_help() and
*_print_full_help() now iterates on these arrays, respectively.
It would be easy to define a struct including the help string and a hidden flag
and that's way only one array would suffice our needs.
My approach would be:
struct options_desc {
char *help
,int hidden
/* open for further extension */
};
void
getoptions_print_help (void)
{
getoptions_print_help_internal ( 0 );
}
void
getoptions_print_full_help (void)
{
getoptions_print_help_internal ( 1 );
}
void
getoptions_print_help_internal (int all)
{
int i = 0;
getoptions_print_version ();
if (strlen(cmdline_options_purpose) > 0)
printf("\n%s\n", cmdline_options_purpose);
printf("\n%s\n\n", cmdline_options_usage);
for ( i = 0; cmdline_options[i].help; i++ )
{
if ( all || !cmdline_options[i].hidden )
printf("%s\n", cmdline_options[i].help);
}
}
--
Papp, Győző
VirusBuster Kft
_______________________________________________
Help-gengetopt mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gengetopt