From 7fe56f16026d6b2440e879078f8848a5056f1da8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 18 Sep 2012 15:50:24 +0200 Subject: 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. --- m_option.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'm_option.c') 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", -- cgit v1.2.3