bugGNU Gengetopt - Bugs: bug #37605, mutiple and argoptional option...


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

Submitted by:  Frédéric Heitzmann <iceman>
Submitted on:  Sat 20 Oct 2012 05:20:25 PM UTC  
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Open

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 20 Oct 2012 05:20:25 PM UTC, original submission:  

There are some discrepancies between multiple and non multiple option, regarding default value when no argument is set

Example :

  option "unique" - "set a 'unique' option" string typestr="STR" optional argoptional default="unique_default"
  option "multiple" - "set a 'multiple' option" string typestr="STR" optional argoptional default="multiple_default" multiple

Using a small test program, I see :

$ ./ggotest
unique: unique_arg=unique_default unique_orig=(null) unique_given=0
multiple: multiple_given=0 multiple_arg[0]=multiple_default

 >> expected

$ ./ggotest --unique --multiple
unique: unique_arg=unique_default unique_orig=(null) unique_given=1
multiple: multiple_given=0 multiple_arg[0]=(null) multiple_orig[0]=(null)

 >> oops ! I expected to see the same argument for both options.

This behaviour seems inconsistent, and unaligned with
the documentation :
"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."

Frédéric Heitzmann <iceman>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by iceman (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.5