BUG : mutiple and argoptional option fail to fill <opt>_args[0] with default value

Frédéric Heitzmann <[email protected]> Fri, 19 Oct 2012 10:57:40 +0200
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <CALeToSUZoAJ=qjPTUPzsBwsTkvygqixU5ft9yu27harNhPLv5g@mail.gmail.com>
--===============5364111187304182008==
Content-Type: multipart/alternative; boundary=14dae9341039a2b0a404cc65b41c

--14dae9341039a2b0a404cc65b41c
Content-Type: text/plain; charset=UTF-8

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.

--
Fred

--14dae9341039a2b0a404cc65b41c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi all,<br><br>I defined and option like this :<br><br><div style=3D"margin=
-left:40px">option &quot;foo&quot; - &quot;bla bla bla&quot; string typestr=
=3D&quot;STR&quot; default=3D&quot;default_foo&quot; argoptional multiple o=
ptional<br>

</div><br>If I call with --foo, the default value is not added to foo_args[=
0].<br>Actually, foo_args[0] is a NULL pointer, while I expected that foo_a=
rgs[0] would be string &quot;default_foo&quot;.<br><br>If I remove &#39;def=
ault&#39;, and set --foo without any argument, this time foo_args[0] is set=
 to &quot;default_foo&quot;.<br>

<br>The documentation says :<br>&quot;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
<code>&lt;option&gt;_arg</code> is always set.
&quot;<br><br>so it really looks like a bug to me.<br><br>Can someone confi=
rm ?<br>I may work on a patch if it helps.<br><br>--<br>Fred<br><br><br><br=
><br>

--14dae9341039a2b0a404cc65b41c--


--===============5364111187304182008==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Help-gengetopt mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-gengetopt

--===============5364111187304182008==--