diff options
author | wm4 <wm4@nowhere> | 2012-09-18 15:50:24 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-10-12 10:10:31 +0200 |
commit | 1a5a7a49293c2c70a5caf9d51dad7bd5aa938471 (patch) | |
tree | fd114357155be3267e528d32715ebc7f227d4081 /m_option.c | |
parent | 69ce4591d09f1fda85c6a71d452d26a2712cda4e (diff) | |
download | mpv-1a5a7a49293c2c70a5caf9d51dad7bd5aa938471.tar.bz2 mpv-1a5a7a49293c2c70a5caf9d51dad7bd5aa938471.tar.xz |
options: accept "yes" and "no" only for flags
This removes the alternative values like "off", "0", "false" etc., and
also the non-English versions of these.
This is done for general consistency. It's better to have a single way
of doing things when multiple ways don't add singificant value.
Also update some choices for consistency.
Diffstat (limited to 'm_option.c')
-rw-r--r-- | m_option.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/m_option.c b/m_option.c index 62887f4c48..48539b3a4c 100644 --- a/m_option.c +++ b/m_option.c @@ -94,23 +94,15 @@ static int parse_flag(const m_option_t *opt, struct bstr name, struct bstr param, void *dst) { if (param.len) { - char * const enable[] = { "yes", "on", "ja", "si", "igen", "y", "j", - "i", "tak", "ja", "true", "1" }; - for (int i = 0; i < sizeof(enable) / sizeof(enable[0]); i++) { - if (!bstrcasecmp0(param, enable[i])) { - if (dst) - VAL(dst) = opt->max; - return 1; - } + if (!bstrcasecmp0(param, "yes")) { + if (dst) + VAL(dst) = opt->max; + return 1; } - char * const disable[] = { "no", "off", "nein", "nicht", "nem", "n", - "nie", "nej", "false", "0" }; - for (int i = 0; i < sizeof(disable) / sizeof(disable[0]); i++) { - if (!bstrcasecmp0(param, disable[i])) { - if (dst) - VAL(dst) = opt->min; - return 1; - } + if (!bstrcasecmp0(param, "no")) { + if (dst) + VAL(dst) = opt->min; + return 1; } mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Invalid parameter for %.*s flag: %.*s\n", |