comparison 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
comparison
equal deleted inserted replaced
1631:44e86486a57d 1632:aafd2f28245a
57 int wcwidth(wchar_t wc); 57 int wcwidth(wchar_t wc);
58 58
59 // see http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html 59 // see http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html
60 #include <time.h> 60 #include <time.h>
61 char *strptime(const char *buf, const char *format, struct tm *tm); 61 char *strptime(const char *buf, const char *format, struct tm *tm);
62
63 // They didn't like posix basename so they defined another function with the
64 // same name and if you include libgen.h it #defines basename to something
65 // else (where they implemented the real basename), and that define breaks
66 // the table entry for the basename command. They didn't make a new function
67 // with a different name for their new behavior because gnu.
68 //
69 // Implement our own in portability.c and don't use their broken header.
70 char *basename(char *path);
62 71
63 // uClibc pretends to be glibc and copied a lot of its bugs, but has a few more 72 // uClibc pretends to be glibc and copied a lot of its bugs, but has a few more
64 #if defined(__UCLIBC__) 73 #if defined(__UCLIBC__)
65 #include <unistd.h> 74 #include <unistd.h>
66 #include <stdio.h> 75 #include <stdio.h>