From b65a6c3cd0cac1f86a3a5069514867c48a9fa4e3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 15 Dec 2013 23:20:54 +0100 Subject: input: remove weird syntax for skipping optional arguments --- mpvcore/input/input.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/mpvcore/input/input.c b/mpvcore/input/input.c index df6c11b032..c7081e6514 100644 --- a/mpvcore/input/input.c +++ b/mpvcore/input/input.c @@ -142,7 +142,7 @@ static const struct mp_cmd_def mp_cmds[] = { { MP_CMD_SEEK, "seek", { ARG_TIME, - OARG_CHOICE(0, ({"relative", 0}, {"0", 0}, + OARG_CHOICE(0, ({"relative", 0}, {"0", 0}, {"-", 0}, {"absolute-percent", 1}, {"1", 1}, {"absolute", 2}, {"2", 2})), OARG_CHOICE(0, ({"default-precise", 0}, {"0", 0}, @@ -191,7 +191,7 @@ static const struct mp_cmd_def mp_cmds[] = { { MP_CMD_SCREENSHOT, "screenshot", { OARG_CHOICE(2, ({"video", 0}, {"window", 1}, - {"subtitles", 2})), + {"subtitles", 2}, {"-", 2})), OARG_CHOICE(0, ({"single", 0}, {"each-frame", 1})), }}, @@ -1022,14 +1022,8 @@ static int parse_cmd(struct input_ctx *ictx, struct mp_cmd **dest, bstr str, } } else { bool got_token = read_token(str, &str, &arg); - if (is_vararg) { - if (!got_token) - continue; - } else { - // Explicitly select default for an optional argument - if (got_token && opt->defval && bstr_equals0(arg, "-")) - got_token = false; - } + if (is_vararg && !got_token) + continue; // Skip optional arguments if (!got_token && opt->defval) { struct mp_cmd_arg *cmdarg = &cmd->args[cmd->nargs]; -- cgit v1.2.3