There's really no need for all the complex #ifdefs present and, on top
of that, it didn't even work correctly for all NetBSD architectures.
Simply use endian.h and drop the rest. (Since there is no upstream for
this code anymore, there's no concern about complicating future merges,
either. This change is also consistent with what FreeBSD and OpenBSD
did years ago.)
Addresses PR toolchain/53880 (reported by maya@, originally encountered
by me on macppc when building a package that pulls in nameser_compat.h
before nameser.h by necessity -- necessity, that is, on another OS).
- define u_{char,short,int,long} if we don't have _NETBSD_SOURCE defined
so that this compiles (and resolv.h since it includes this). This is
the simplest solution. Others:
- always define them (bad, pollutes namespace)
- create <sys/utypes.h> (bad, overkill)
- change them to unsigned {char, short, int long} (bad, too disruptive)
and inet_network() to match XNS and (where applicable) POSIX. This is largely
just the replacement of unsigned long with in_addr_t.
This constitutes a small ABI change on sh5, but scw (sh5 portmaster) thinks
that both the users of that port will be able to cope. kleink claims the
change is ABI-neutral on other LP64 ports, and it's a no-op on ILP32 ports.
Hence, I'm doing it this way and avoiding the whole __RENAME dance.
* Don't include <sys/param.h>
* Assume that NetBSD is a BSD system and hence has <sys/types.h>
* inet_pton() and inet_ntop() were in XNS 5.2 (not 5.0) and POSIX 2001.
Update #ifdefs accordingly.
XXX Types of inet_addr() and inet_makeaddr() are still wrong.
XXX Might want __restrict on inet_ntop() and inet_pton().
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.
IPv6 transport-ready resolvers/DNS servers. need careful configuration
when enable it. (default config is not affected).
see manpage for details.
XXX visible symbol __res_opt() is added, however, it is not supposed to be
called from outside, libc minor is not bumped.