mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
options: let unknown option case be handled by final option parser
If an option is completely missing, let m_config_parse_option() handle this case, instead of erroring out early. Needed for the following commit.
This commit is contained in:
parent
20b5fecdf1
commit
7c01dee153
@ -82,11 +82,9 @@ static int split_opt_silent(struct parse_state *p)
|
||||
|
||||
bool ambiguous = !bstr_split_tok(p->arg, "=", &p->arg, &p->param);
|
||||
|
||||
int r = m_config_option_requires_param(p->config, p->arg);
|
||||
if (r < 0)
|
||||
return r;
|
||||
bool need_param = m_config_option_requires_param(p->config, p->arg) > 0;
|
||||
|
||||
if (ambiguous && r > 0) {
|
||||
if (ambiguous && need_param) {
|
||||
if (p->argc < 1)
|
||||
return M_OPT_MISSING_PARAM;
|
||||
p->param = bstr0(p->argv[0]);
|
||||
|
@ -228,13 +228,12 @@ int m_config_parse_config_file(m_config_t *config, const char *conffile,
|
||||
goto nextline;
|
||||
}
|
||||
|
||||
tmp = m_config_option_requires_param(config, bopt);
|
||||
if (tmp > 0 && !param_set)
|
||||
tmp = M_OPT_MISSING_PARAM;
|
||||
if (tmp < 0) {
|
||||
bool need_param = m_config_option_requires_param(config, bopt) > 0;
|
||||
if (need_param && !param_set) {
|
||||
PRINT_LINENUM;
|
||||
MP_ERR(config, "error parsing option %.*s=%.*s: %s\n",
|
||||
BSTR_P(bopt), BSTR_P(bparam), m_option_strerror(tmp));
|
||||
BSTR_P(bopt), BSTR_P(bparam),
|
||||
m_option_strerror(M_OPT_MISSING_PARAM));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user