parse-util: add parse_tristate() and use it everywhere

We parse tristates all the time, let's add an explicit parser for them.
This commit is contained in:
Lennart Poettering
2023-11-02 04:52:16 +09:00
committed by Yu Watanabe
parent 6a4d0efa00
commit b71a721fbc
11 changed files with 47 additions and 84 deletions
+4
View File
@@ -12,6 +12,10 @@
typedef unsigned long loadavg_t;
int parse_boolean(const char *v) _pure_;
int parse_tristate_full(const char *v, const char *third, int *ret);
static inline int parse_tristate(const char *v, int *ret) {
return parse_tristate_full(v, NULL, ret);
}
int parse_pid(const char *s, pid_t* ret_pid);
int parse_mode(const char *s, mode_t *ret);
int parse_ifindex(const char *s);