chiark / gitweb /
utils: show help blurb when run without any arguments
[elogind.git] / src / util.h
index 864d98fa635549f568f2f1d4365c6f20a16f2d01..241031242121c21f46232c375269c248dd431e78 100644 (file)
@@ -30,6 +30,8 @@
 #include <stdio.h>
 #include <signal.h>
 
+#include "macro.h"
+
 typedef uint64_t usec_t;
 
 typedef struct timestamp {
@@ -113,6 +115,16 @@ int parse_pid(const char *s, pid_t* ret_pid);
 int safe_atou(const char *s, unsigned *ret_u);
 int safe_atoi(const char *s, int *ret_i);
 
+static inline int safe_atou32(const char *s, uint32_t *ret_u) {
+        assert_cc(sizeof(uint32_t) == sizeof(unsigned));
+        return safe_atou(s, (unsigned*) ret_u);
+}
+
+static inline int safe_atoi32(const char *s, int32_t *ret_u) {
+        assert_cc(sizeof(int32_t) == sizeof(int));
+        return safe_atoi(s, (int*) ret_u);
+}
+
 int safe_atolu(const char *s, unsigned long *ret_u);
 int safe_atoli(const char *s, long int *ret_i);