From de699accf6804e8b1d8042b46c85500ee8c672c6 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 31 Dec 2014 16:22:31 -0600 Subject: 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. --- lib/portability.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/portability.h') diff --git a/lib/portability.h b/lib/portability.h index 1464c656..8bbbdb25 100644 --- a/lib/portability.h +++ b/lib/portability.h @@ -60,6 +60,15 @@ int wcwidth(wchar_t wc); #include 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 -- cgit v1.2.3