X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=util.h;h=9dfe631b8a5aa3b88c033f4fb394c52ddf781737;hp=60dc04e961cadb778a1617041bf48d559091c5d8;hb=a41e8209be729cd8de34d715135fe84920e8016c;hpb=04fd6fe45b6c4e245a621578d2913296d1bb3642 diff --git a/util.h b/util.h index 60dc04e96..9dfe631b8 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