help-gengetopt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help-gengetopt] group opton with override


From: gerzson
Subject: Re: [help-gengetopt] group opton with override
Date: Sat, 28 May 2005 13:55:58 +0200

Oops, this message has accidentally sent.

# test.ggo:
package "group override"
version "1.0"

defgroup "grp"
groupoption "opt1" 1 "string 1" group="grp"
groupoption "opt2" 2 "string 2" group="grp"


/* test.c */
#include <stdio.h>
#include "cmdline.h"

int main (int argc, char **argv)
{
    struct gengetopt_args_info args_info;
    int result = 0;

    result = cmdline_parser2 (argc, argv, &args_info, 1, 1, 0);
    printf ("override result = %d, group counter = %d\n", result,
args_info.grp_group_counter);

    result = cmdline_parser2 (argc, argv, &args_info, 0, 1, 0);
    printf ("no override result = %d, group counter = %d\n", result,
args_info.grp_group_counter);
}

prints:

$ ./test -1 -2
override result = 0, group counter = 1
./test: 2 options of group grp were given. At most one is required.
no override result = 1, group counter = 2

 
As you can see in the first case the parser does not produce an error
but it silently overrides the group counter. In the latter case the
message is displayed and the function result is non-zero indicating
the error.

> On 5/28/05, Lorenzo Bettini <address@hidden> wrote:
> > address@hidden wrote:
> > > Hi,
> > >
> > > it may be worth noting in the docs that if getoptions2() called with
> > > override set on then multiple group options will silently override each
> > > other without  emitting a message like "2 options of group ... were given.
> > > At most one is required".
> >
> > Hi there
> >
> > nice to hear from you again :-)
> >
> > could you please make an example of this situation?
> >
> > thanks
> >         Lorenzo
> >
> > --
> > +-----------------------------------------------------+
> > |  Lorenzo Bettini          ICQ# lbetto, 16080134     |
> > |  PhD in Computer Science                            |
> > |  Dip. Sistemi e Informatica, Univ. di Firenze       |
> > |  Florence - Italy        (GNU/Linux User # 158233)  |
> > |  Home Page        : http://www.lorenzobettini.it    |
> > |  http://music.dsi.unifi.it         XKlaim language  |
> > |  http://www.lorenzobettini.it/purple    Cover Band  |
> > |  http://www.gnu.org/software/src-highlite           |
> > |  http://www.gnu.org/software/gengetopt              |
> > |  http://www.lorenzobettini.it/software/gengen       |
> > |  http://www.lorenzobettini.it/software/doublecpp    |
> > +-----------------------------------------------------+
> >
> >
> > _______________________________________________
> > Help-gengetopt mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/help-gengetopt
> >
> 
> 
> --
> Papp, Gyozo
> 


-- 
Papp, Gyozo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]