diff lib/portability.h @ 1632:aafd2f28245a draft

When you include the posix header libgen.h, glibc #defines basename to some random other symbol name (because gnu) and this screws up nontrivial macro expansions of NEWTOY(basename), so work around it in portability.h.
author Rob Landley <rob@landley.net>
date Wed, 31 Dec 2014 16:22:31 -0600
parents ce22ad7a26c1
children b84024067049
line wrap: on
line diff
--- a/lib/portability.h	Tue Dec 30 14:49:02 2014 -0600
+++ b/lib/portability.h	Wed Dec 31 16:22:31 2014 -0600
@@ -60,6 +60,15 @@
 #include <time.h>
 char *strptime(const char *buf, const char *format, struct tm *tm);
 
+// They didn't like posix basename so they defined another function with the
+// same name and if you include libgen.h it #defines basename to something
+// else (where they implemented the real basename), and that define breaks
+// the table entry for the basename command. They didn't make a new function
+// with a different name for their new behavior because gnu.
+//
+// Implement our own in portability.c and don't use their broken header.
+char *basename(char *path);
+
 // uClibc pretends to be glibc and copied a lot of its bugs, but has a few more
 #if defined(__UCLIBC__)
 #include <unistd.h>