summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-02-12 02:00:49 +0100
committerLennart Poettering <lennart@poettering.net>2010-02-12 02:00:49 +0100
commit82919e3d3172c85acb80b0e206ae1731863eee6d (patch)
tree95b9a8527d290d07b4f14819fccaafe4a18a65ab /util.h
parent451a074fd589fd90aff91fcf89b2e599b20ae6a0 (diff)
util: add api for iterating through components of a path string
Diffstat (limited to 'util.h')
-rw-r--r--util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/util.h b/util.h
index 8c9dea801e..f5cb165559 100644
--- a/util.h
+++ b/util.h
@@ -97,6 +97,7 @@ int safe_atolli(const char *s, long long int *ret_i);
char *split_spaces(const char *c, size_t *l, char **state);
char *split_quoted(const char *c, size_t *l, char **state);
+char *split_slash(const char *c, size_t *l, char **state);
#define FOREACH_WORD(word, length, s, state) \
for ((state) = NULL, (word) = split_spaces((s), &(l), &(state)); (word); (word) = split_spaces((s), &(l), &(state)))
@@ -104,6 +105,9 @@ char *split_quoted(const char *c, size_t *l, char **state);
#define FOREACH_WORD_QUOTED(word, length, s, state) \
for ((state) = NULL, (word) = split_quoted((s), &(l), &(state)); (word); (word) = split_quoted((s), &(l), &(state)))
+#define FOREACH_WORD_SLASH(word, length, s, state) \
+ for ((state) = NULL, (word) = split_slash((s), &(l), &(state)); (word); (word) = split_slash((s), &(l), &(state)))
+
pid_t get_parent_of_pid(pid_t pid, pid_t *ppid);
int write_one_line_file(const char *fn, const char *line);