summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-11-19 02:50:21 +0100
committerLennart Poettering <lennart@poettering.net>2009-11-19 02:50:21 +0100
commita41e8209be729cd8de34d715135fe84920e8016c (patch)
tree10c0a3e6805a6475c7fb545b0dbc2366097bd778 /util.h
parented5bcfbe3c3b68e59242c03649eea03a9707d318 (diff)
util: add split_spaces() call
Diffstat (limited to 'util.h')
-rw-r--r--util.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/util.h b/util.h
index 60dc04e961..9dfe631b8a 100644
--- a/util.h
+++ b/util.h
@@ -59,4 +59,9 @@ int parse_boolean(const char *v);
int safe_atou(const char *s, unsigned *ret_u);
int safe_atoi(const char *s, int *ret_i);
+char *split_spaces(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)))
+
#endif