Subject: Re: query netbsd version
To: Christoph Egger <Christoph_Egger@gmx.de>
From: Klaus Klein <kleink@reziprozitaet.de>
List: current-users
Date: 10/18/2003 19:09:39
On Saturday 18 October 2003 16:45, Christoph Egger wrote:
> I have #defined _POSIX_C_SOURCE and this results in an
>
> implicit declaration of function 'strdup'
>
> in NetBSD 1.6_STABLE.
That's not a bug. _POSIX_C_SOURCE, like other feature macros, also serve to
restrict interface declarations in headers in order to prevent namespace
pollution. strdup(3) isn't part of the POSIX base definitions to date but
an XSI extension; you should #define _XOPEN_SOURCE 600 either on its own or
in addition to that.
For more information on that topic, see the chapter "The Compilation
Environment" of the standard, which is available from
<http://www.unix-systems.org/online.html>.
> I don't get this warning in -current.
I do.
> Is there a way to query the NetBSD version (i.e. via a libc header macro)
> ?
There's __NetBSD_Version__ in <sys/param.h>, but depending on your
application uname(3) may be a better choice.
- Klaus