summaryrefslogtreecommitdiff
path: root/lib/string.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/string.h')
-rw-r--r--lib/string.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/string.h b/lib/string.h
index 218f7b1c..0f249d37 100644
--- a/lib/string.h
+++ b/lib/string.h
@@ -24,4 +24,10 @@ void buffer_puts(buffer *buf, const char *str);
int patmatch(const byte *pat, const byte *str);
+static inline char *xbasename(const char *str)
+{
+ char *s = strrchr(str, '/');
+ return s ? s+1 : (char *) str;
+}
+
#endif