Am 29.08.2011 02:01, schrieb Tito: > Hi, > attached a alternative version of dirname() > so that we don't need libgen.h for it. > Tested only with dirname applet and seems to work. > Needs to be tested with other code where it is called. > Hints, critics and improvements are welcome.
Why the effort? FreeBSD's dirname() and basename() don't mess with their arguments but allocate a static buffer on first use, so no need to reimplement if there's a good implementation in libc. What I'm saying is that on non-GNU systems you'll usually need libgen.h anyways, and if and only if you can identify GNU libc in platform.h feel free to skip libgen.h and use the _GNU_SOURCE/string.h version, but beware that defining _GNU_SOURCE enables GNU compatibility hacks on other systems, so only do that if you're on Linux AND using glibc. _________ ยน) one might wonder if the POSIX-compliant basename() implementation in GLIBC is intentionally bad so as to trick people into using the non-portable version and lock them in with glibc. Yet another reason not to use GLIBC-specifics. It makes at least the code more complex without any real-world gains. _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
