From 75d55e3df04432a7720e6d7a373e20d3b71f39ae Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Sat, 27 Jan 2024 00:42:04 -0800
Subject: [PATCH] musl_missing.h: re-add GNU basename macro for musl

musl only provides POSIX basename and not GNU basename.
musl also recently removed their compatibility declaration from string.h:
https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7

reverts 8ca381db232527dd1dfdc772b9845db5ce617bcf
---
 src/basic/musl_missing.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/basic/musl_missing.h b/src/basic/musl_missing.h
index 41c66c9a42..aee6c4f9e2 100644
--- a/src/basic/musl_missing.h
+++ b/src/basic/musl_missing.h
@@ -44,6 +44,10 @@ void elogind_set_program_name(const char* pcall);
 #  define HAVE_SECURE_GETENV 1
 #endif // HAVE_[__]SECURE_GETENV
 
+/* Poor man's basename */
+#define basename(path) \
+        (strrchr(path, '/') ? strrchr(path, '/')+1 : path)
+
 /* strndupa may already be defined in another compatibility header */
 #if !defined(strndupa)
 #define strndupa(x_src, x_n) \
