I happened to be looking at some source I have that uses strtonum(3)
this morning and I noted I had to define _OPENBSD_SOURCE to make its
prototype visible on NetBSD, but not on FreeBSD, nor of course on
OpenBSD.

On both OpenBSD and FreeBSD it is protected by __BSD_VISIBLE, which is I
believe defined by default on both systems (especially if _BSD_SOURCE is
defined on OpenBSD).

There is no _OPENBSD_SOURCE on OpenBSD.  It is purely a NetBSD invention.

strfmon(3) is an example of a function taken from FreeBSD that's
protected by _NETBSD_SOURCE, not something unique to indicate it came
from FreeBSD.

Shouldn't strtonum() likewise be protected by _NETBSD_SOURCE on NetBSD?

I see reallocarray() has also been added within the _OPENBSD_SOURCE as
well, and I think it too should only be protected by _NETBSD_SOURCE.

Notably strlcpy() and strlcat() are not protected by this unique
_OPENBSD_SOURCE though they both were invented by and taken from
OpenBSD.  Instead they are protected by _NETBSD_SOURCE.

(Maybe _NETBSD_SOURCE should be changed to __BSD_VISIBLE too?  There
could be some confusion from that I guess given it would offer different
symbols on different systems unless there's a _lot_ more coordination
and cooperation between the system's developers!)

--
                                        Greg A. Woods <gwo...@acm.org>

Kelowna, BC     +1 250 762-7675           RoboHack <wo...@robohack.ca>
Planix, Inc. <wo...@planix.com>     Avoncote Farms <wo...@avoncote.ca>

Attachment: pgpJ_4y4Uby4e.pgp
Description: OpenPGP Digital Signature

Reply via email to