bugGNU Gengetopt - Bugs: bug #40244, please #include <unistd.h>...

 
 

bug #40244: please #include <unistd.h> in generated code

Submitted by:  Török Edwin <edwintorok>
Submitted on:  Fri 11 Oct 2013 04:31:08 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.

 

Fri 11 Oct 2013 04:31:08 PM UTC, original submission:

According to getopt(3) the variables optarg, optind, etc. are declared in <unistd.h>, so it should be included before using it.

For example when trying to build gengetopt generated code with the LSB SDK I get errors like:
cmdline.c:483:3: error: 'optarg' undeclared (first use in this function)
cmdline.c:483:3: note: each undeclared identifier is reported only once for each function it appears in
cmdline.c:484:3: error: 'optind' undeclared (first use in this function)
cmdline.c:485:3: error: 'opterr' undeclared (first use in this function)
cmdline.c:486:3: error: 'optopt' undeclared (first use in this function)

Adding #include <unistd.h> to config.h works around the problem in an ugly way, but it would be better if gengetopt's generated code had that include already. (or if I could add that #include to .ggo to instruct gengetopt to include it for me).

Thanks.

Török Edwin <edwintorok>

 

(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 edwintorok (Submitted the item)
  • -email is unavailable- added by edwintorok
  •  

    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.

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-11 edwintorok Carbon-Copy- => Added edwintorok

    Back to the top


    Powered by Savane 3.3