bugGNU Gengetopt - Bugs: bug #35724, wrong abbreviation of non uniq...

 
 

bug #35724: wrong abbreviation of non uniq long options

Submitter:  Ruediger Meier <rudimeier>
Submitted:  Mon 05 Mar 2012 02:43:57 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
   

Mon 05 Mar 2012 03:50:11 PM UTC, comment #4: 

Ok, attaching foo.ggo
and a patch for the resulting cmdline.c (made by gengetopt -i foo.ggo).

It's not really tested - just to see how to go.
I guess within the new pseudo_shortopt* cases we still need to correct the update_arg() call and maybe removing the useless strcmp().


(file #25267, file #25268)

Ruediger Meier <rudimeier>
Mon 05 Mar 2012 03:07:47 PM UTC, comment #3: 

yes, please! if this fix can be generalized

Lorenzo Bettini <bettini>
Group administrator
Mon 05 Mar 2012 03:06:29 PM UTC, comment #2: 

I haven't fixed it in gengetopt but could send you an example how I would fix the gengetopt generated code if this would be useful for you.

Ruediger Meier <rudimeier>
Mon 05 Mar 2012 02:50:06 PM UTC, comment #1: 

can you please attach an example of fix?

Lorenzo Bettini <bettini>
Group administrator
Mon 05 Mar 2012 02:43:57 PM UTC, original submission:  

If you have long options without corresponding sort opts like this for example:

option "koma" -
"help text koma"
optional

option "komb" -
"help text komb"
optional

then
myprog --ko
does not return an error "option '--f' is ambiguous" like it does if you also specify different shortopts for both --kom* opts.
Instead it just sets koma_given.

The fix would be to use other vals than 0 for such options in
struct option long_options.
For a good example how to do this nicely see ls.c from coreutils how they handle 3 longopts starting with --f.


Ruediger Meier <rudimeier>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #25267:  foo.ggo added by rudimeier (115B - application/octet-stream)
file #25268:  cmdline.patch added by rudimeier (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bettini (Posted a comment)
  • -email is unavailable- added by rudimeier (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.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-03-05 rudimeier Attached File- Added foo.ggo, #25267
        Attached File- Added cmdline.patch, #25268

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code