mirror of
https://github.com/troglobit/finit.git
synced 2026-10-20 11:19:35 +00:00
Follow-up to 70ca64a, handle missing bool argument to cmdnline opts
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
97a0baaf93
commit
27a4c8cd9a
1 file changed
+4
-1
+4
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user