X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=util.h;h=60dc04e961cadb778a1617041bf48d559091c5d8;hb=04fd6fe45b6c4e245a621578d2913296d1bb3642;hp=5d9ef39e04ad2e510e49b59742f713ebe8e412e8;hpb=6091827530d6dd43479d6709fb6e9f745c11e900;p=elogind.git diff --git a/util.h b/util.h index 5d9ef39e0..60dc04e96 100644 --- a/util.h +++ b/util.h @@ -41,9 +41,22 @@ static inline const char* strnull(const char *s) { return s ? s : "(null)"; } +static inline const char *strna(const char *s) { + return s ? s : "n/a"; +} + +static inline bool is_path_absolute(const char *p) { + return *p == '/'; +} + bool endswith(const char *s, const char *postfix); bool startswith(const char *s, const char *prefix); int nointr_close(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); + #endif