Am 27.11.2013 02:53, schrieb Daniel Borca: > I was testing on Darwin. More specifically, iPhoneOS6.1.sdk > > Also, http://www.manpagez.com/man/alpha.php?S does not list strchrnul() > > However, > > #if defined(__FreeBSD__) || defined(__APPLE__) > should really be > #if defined(__APPLE__) > > that is, the old #ifdef was _wrong_. Seems like FreeBSD has strchrnul() > since Feb 13 2013. > > Reference: > http://lists.freebsd.org/pipermail/svn-src-head/2013-February/044883.html
The whole #ifdef approach is massively broken and prone to mis-guess. It denies one of the most basic considerations, and that is: operating systems change over time, and add features missing from earlier versions. Looking at the operating system is insufficient. The code needs to *test for features* of the host OS, rather than second-guess a snapshot of an operating system that still evolves at the point in time when some developer looked at a convenient version. Note I am not saying you need to use a fully-fledged autoconf approach, lighter-weight alternatives have been seen in the wild, and possibly it suffices - for FreeBSD - to have a separate header (.h) file that checks the major FreeBSD version and #defines a few HAVE_SOMEFUNCTION or leaves it #undef'd, so the actual code can then // assume this contains the #ifdef __SOMEOS__ ... // #include <sys/params.h> #ifdef __FreeBSD_version ... #endif: #include <bb_sysfeatures.h> #ifdef HAVE_STRCHRNUL This requires someone with detailed knowledge, or a good amount of time on his hands, so some concept similar to autoconf might work in more places with less human work and more machine work during the build. _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
