help-gengetopt
[Top][All Lists]
Advanced

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

Re: [help-gengetopt] BUG : mutiple and argoptional option fail to fill <


From: Lorenzo Bettini
Subject: Re: [help-gengetopt] BUG : mutiple and argoptional option fail to fill <opt>_args[0] with default value
Date: Fri, 19 Oct 2012 12:54:07 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1

Hi

since you also specify that 'argoptional' then the default value is not
set if you specify no argument to --foo, since the argument is optional,
so that option --foo is meant to be able to deal also with no argument
at all... that's how I interpreted the semantics when I implemented it.

Does it make sense?

hope to hear from you soon
cheers
        Lorenzo

P.S. please take a look at the current open (and closed) bugs to make
sure that this issue has already been raised.

On 10/19/2012 10:57 AM, Frédéric Heitzmann wrote:
> Hi all,
> 
> I defined and option like this :
> 
> option "foo" - "bla bla bla" string typestr="STR" default="default_foo"
> argoptional multiple optional
> 
> If I call with --foo, the default value is not added to foo_args[0].
> Actually, foo_args[0] is a NULL pointer, while I expected that
> foo_args[0] would be string "default_foo".
> 
> If I remove 'default', and set --foo without any argument, this time
> foo_args[0] is set to "default_foo".
> 
> The documentation says :
> "If it is known that a multiple option has a default value, then it can
> be safely assumed that the first element of generated array
> |<option>_arg| is always set. "
> 
> so it really looks like a bug to me.
> 
> Can someone confirm ?
> I may work on a patch if it helps.


-- 
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
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



reply via email to

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