diff --git a/src/conf.c b/src/conf.c index b5a8c6b5..c1633dc6 100644 --- a/src/conf.c +++ b/src/conf.c @@ -78,14 +78,14 @@ static void hide_args(int argc, char *argv[]) } } -int get_bool(char *ptr, int default_value) +int get_bool(char *arg, int default_value) { - if (!ptr) + if (!arg) goto fallback; - if (string_compare(ptr, "true") || string_compare(ptr, "on") || string_compare(ptr, "1")) + if (string_compare(arg, "true") || string_compare(arg, "on") || string_compare(arg, "1")) return 1; - if (string_compare(ptr, "false") || string_compare(ptr, "off") || string_compare(ptr, "0")) + if (string_compare(arg, "false") || string_compare(arg, "off") || string_compare(arg, "0")) return 0; fallback: return default_value; @@ -97,19 +97,24 @@ fallback: */ static void parse_finit_opts(char *opt) { - char *ptr; + char *arg; - ptr = strchr(opt, '='); - if (ptr) - *ptr++ = 0; + arg = strchr(opt, '='); + if (arg) + *arg++ = 0; if (string_compare(opt, "debug")) { - debug = get_bool(ptr, 1); + debug = get_bool(arg, 1); return; } if (string_compare(opt, "status_style")) { - if (string_compare(ptr, "old") || string_compare(ptr, "classic")) + if (!arg) { + _e("status_style option requires an argument, skipping."); + return; + } + + if (string_compare(arg, "old") || string_compare(arg, "classic")) show_progress(PROGRESS_CLASSIC); else show_progress(PROGRESS_MODERN); @@ -117,7 +122,7 @@ static void parse_finit_opts(char *opt) } if (string_compare(opt, "show_status")) { - show_progress(get_bool(ptr, 1) ? PROGRESS_DEFAULT : PROGRESS_SILENT); + show_progress(get_bool(arg, 1) ? PROGRESS_DEFAULT : PROGRESS_SILENT); return; } }