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: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Originator Name: Open/Closed: Open

Add a New Comment (Rich MarkupRich 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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by edwintorok (Submitted the item)
  • -unavailable- added by edwintorok
  •  

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 11 Oct 2013 04:31:08 PM UTCedwintorokCarbon-Copy-=>Added edwintorok

    Back to the top


    Powered by Savane 3.1-cleanup