X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=util.h;h=67314146f3a7516dd6e38dbe52468a78fca3e243;hb=83c60c9f0c7581b607dc5c0f84582978894e3d4a;hp=60dc04e961cadb778a1617041bf48d559091c5d8;hpb=04fd6fe45b6c4e245a621578d2913296d1bb3642;p=elogind.git diff --git a/util.h b/util.h index 60dc04e96..67314146f 100644 --- a/util.h +++ b/util.h @@ -7,6 +7,7 @@ #include #include #include +#include typedef uint64_t usec_t; @@ -52,11 +53,16 @@ static inline bool is_path_absolute(const char *p) { bool endswith(const char *s, const char *postfix); bool startswith(const char *s, const char *prefix); -int nointr_close(int fd); +int close_nointr(int fd); 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