Files
velzie 5e7dd28915 gexcc: GNU basename under _GNU_SOURCE, <libgen.h>'s POSIX one winning as in glibc
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_c8c04c00da9a4525ab21b0b9f146c598
(cherry picked from commit 99c791a74e281e1fc2faf25fa9852de392768245)
(cherry picked from commit 9c449b434210c946b1eab8ac1033edf510b87700)
2026-11-11 07:48:05 -05:00

18 lines
600 B
C

/* musl's <string.h>, with glibc's GNU basename under _GNU_SOURCE: the part of
* the path after its last slash, the argument left unchanged and a path
* ending in a slash giving "" (libsemanage, coreutils' gnulib users). musl
* has only the POSIX basename of <libgen.h>; as in glibc, <libgen.h> wins
* when both are included, in either order. */
#include_next <string.h>
#if defined(_GNU_SOURCE) && !defined(_LIBGEN_H) && !defined(basename)
#ifdef __cplusplus
extern "C" {
#endif
char *__gexcc_gnu_basename(const char *);
#ifdef __cplusplus
}
#endif
#define basename __gexcc_gnu_basename
#endif