Commit Graph

5 Commits

Author SHA1 Message Date
bjh21 4be7a2dcf3 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
  can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
  various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
  !defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them.  In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-28 23:16:11 +00:00
ad 813b16106e Pull in <sys/cdefs.h>, since we're using __BEGIN_DECLS/__END_DECLS. 2000-07-07 10:43:54 +00:00
christos d99720e261 Include <unistd.h> to get the rest of the getopt goo. 2000-04-02 22:03:29 +00:00
christos 2effe6c79a backout previous. the definition of struct option caused too many namespace
collisions. Instead, define getopt_long in getopt.h and getopt in unistd.h
where it belongs.
2000-04-02 06:32:41 +00:00
christos a91d8b9ec7 Add getopt.h and collect all the getopt related stuff here.
Make unistd.h include <getopt.h> to get the getopt stuff.
This adds support for getopt_long from Dieter Baron and Thomas Klausner.
2000-04-01 22:37:14 +00:00