I wish to first thank the authors of gengetopt for such a lovely
peice of work as it has saved me countless hours of programming.
I'm trying to set the default values for an int array and to
establish that it requires 3 args.
I've gone over the manual and I'm unable to find a solution to enter
in the '.ggo' file which leaves me to do some manual editing.
I assigned the following in ggo file:
_______________________________
option "font_color_selected" - "RColor[0] of selected font
text" int default="51" no multiple
_______________________________
then I edited the cmdline1.c file and changed the following:
_______________________________
else /* set the default value */
{
if (! args_info->font_color_selected_arg && ! args_info-
>font_color_selected_given)
{
args_info->font_color_selected_arg = (int *) malloc
(sizeof (int));
args_info->font_color_selected_arg [0] = 51;
args_info->font_color_selected_orig = (char **) malloc
(sizeof (char *));
args_info->font_color_selected_orig [0] = NULL;
}
}
_______________________________
to:
_______________________________
else /* set the default value */
{
if (! args_info->font_color_selected_arg && ! args_info-
>font_color_selected_given)
{
args_info->font_color_selected_arg = (int *) malloc
(sizeof (int));
args_info->font_color_selected_arg [0] = 51;
args_info->font_color_selected_arg [1] = 51;
args_info->font_color_selected_arg [2] = 51;
args_info->font_color_selected_orig = (char **) malloc
(sizeof (char *));
args_info->font_color_selected_orig [0] = NULL;
args_info->font_color_selected_orig [1] = NULL;
args_info->font_color_selected_orig [2] = NULL;
}
}
_______________________________
The issue now is ensuring that 3 values are passed from the command
line or config file and if the value is < or > 3 complain about it.
-- Dale
_______________________________________________
Help-gengetopt mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gengetopt