mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 13:33:09 +07: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:
+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