Follow-up to 70ca64a, handle missing bool argument to cmdnline opts

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-02-21 01:06:02 +01:00
parent 97a0baaf93
commit 27a4c8cd9a
+4 -1
View File
@@ -77,11 +77,14 @@ static void hide_args(int argc, char *argv[])
int get_bool(char *ptr, int default_value)
{
if (!ptr)
goto fallback;
if (string_compare(ptr, "true") || string_compare(ptr, "on") || string_compare(ptr, "1"))
return 1;
if (string_compare(ptr, "false") || string_compare(ptr, "off") || string_compare(ptr, "0"))
return 0;
fallback:
return default_value;
}