tree-wide: use parse_boolean_argument() for variables with non-boolean type

This still works nicely, but we need to assign the return value ourselves.
As before, one nice effect is that error messages are uniform.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-02-17 21:08:47 +01:00
parent 599c7c545f
commit c3470872c6
6 changed files with 49 additions and 55 deletions
+4 -2
View File
@@ -20,11 +20,13 @@ int parse_boolean_argument(const char *optname, const char *s, bool *ret) {
if (r < 0)
return log_error_errno(r, "Failed to parse boolean argument to %s: %s.", optname, s);
*ret = r;
if (ret)
*ret = r;
return r;
} else {
/* s may be NULL. This is controlled by getopt_long() parameters. */
*ret = true;
if (ret)
*ret = true;
return true;
}
}