From 04fd6fe45b6c4e245a621578d2913296d1bb3642 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 19 Nov 2009 00:47:41 +0100 Subject: [PATCH] util: add strna() and is_path_absolute() --- util.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/util.h b/util.h index 2df67b73df..60dc04e961 100644 --- a/util.h +++ b/util.h @@ -41,6 +41,14 @@ 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);