diff options
author | wm4 <wm4@nowhere> | 2012-09-18 15:50:24 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-09-23 14:58:21 +0200 |
commit | 7fe56f16026d6b2440e879078f8848a5056f1da8 (patch) | |
tree | eefc51ce3dc65e000bbc8290f50e60889c35ab7f /m_option.c | |
parent | f360f492d6c73197890eeb86759d417b23b52452 (diff) | |
download | mpv-7fe56f16026d6b2440e879078f8848a5056f1da8.tar.bz2 mpv-7fe56f16026d6b2440e879078f8848a5056f1da8.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 2f8daa42de..1fef1fd86e 100644 --- a/m_option.c +++ b/m_option.c @@ -91,23 +91,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", |