summaryrefslogtreecommitdiff
path: root/src/shared/path-util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/path-util.h')
-rw-r--r--src/shared/path-util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/shared/path-util.h b/src/shared/path-util.h
index 9452931586..03f2cf273c 100644
--- a/src/shared/path-util.h
+++ b/src/shared/path-util.h
@@ -51,3 +51,6 @@ int path_is_read_only_fs(const char *path);
int path_is_os_tree(const char *path);
int find_binary(const char *name, char **filename);
+
+#define PATH_FOREACH_PREFIX(prefix, path) \
+ for (char *_slash = strrchr(path_kill_slashes(strcpy(prefix, path)), '/'); _slash && !(*_slash = 0); _slash = strrchr((prefix), '/'))