aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2026-03-14 09:31:51 +0200
committerDylan Araps <dylan.araps@gmail.com>2026-03-14 09:31:51 +0200
commit79eb4385bd34e8ee06b35637f092ee45dc3e3706 (patch)
tree4c3de5583733e9c9cfdc7b5f31a56f8d2ba205ba /lib
parentf3416de0e2fd920dda7379c3b7dc2b3087cc30c6 (diff)
dfm: Add privilege escalation.
Pressing 'Z' (default) will spawn a nested dfm by escalating privileges using the value of DFM_SU (default 'sudo'). Pressing 'Z' again inside of this escalated mode returns to the original dfm.
Diffstat (limited to 'lib')
-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