aboutsummaryrefslogtreecommitdiff
path: root/lib/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.h')
-rw-r--r--lib/util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/util.h b/lib/util.h
index 9a69746..1eeb8dd 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -336,5 +336,14 @@ path_resolve(char *s, usize l)
return w;
}
+static inline const char *
+basename_l(const char *s, usize l)
+{
+ for (usize i = l; i; i--)
+ if (s[i - 1] == '/')
+ return s + i;
+ return s;
+}
+
#endif // DYLAN_UTIL_H