chiark / gitweb /
util: add strna() and is_path_absolute()
[elogind.git] / util.h
diff --git a/util.h b/util.h
index 5d9ef39e04ad2e510e49b59742f713ebe8e412e8..60dc04e961cadb778a1617041bf48d559091c5d8 100644 (file)
--- 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