On Thu, 14 Nov 2013 23:17:24 -0500, Eitan Adler wrote: > Hey all, > > I was looking through some OpenBSD code and noticed that rs and jot are > both missing #include <unistd.h> even though they use getopt. It seems > that stdlib.h defines getopt on OpenBSD. However, this is not the > correct header file, and it makes it not possible to compile OpenBSD's > utilities on other platforms.
I just looked on my linux box and found this in stdlib.h #ifndef _GETOPT_DEFINED_ #define _GETOPT_DEFINED_ int getopt(int, char * const *, const char *); extern char *optarg; /* getopt(3) external variables */ extern int opterr, optind, optopt, optreset; int getsubopt(char **, char * const *, char **); extern char *suboptarg; /* getsubopt(3) external variable */ #endif /* _GETOPT_DEFINED_ */ So I'm wondering about your assertion that this is "not the correct header file"....looking at links in your post, do you really mean "FreeBSD doesn't define them there but everyone else on the planet might"? (Notice: I just paid SCO $600 license as protection against any infringement my posting of part of a linux .h file might cause)
