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

 
 

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

Submitter:  Frédéric Heitzmann <iceman>
Submitted:  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
* Mandatory Fields

Add a New Comment Rich Markup
   

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
multiple_orig[0]=(null)

 >> 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:
   
   
Comment:
   

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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code