summaryrefslogtreecommitdiffstats
path: root/parser-mpcmd.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-07-31 01:19:13 +0300
committerUoti Urpala <uau@mplayer2.org>2011-07-31 01:19:13 +0300
commitce9ce9d0c3a7e4e15d816a824f7312ad4c3c7cfc (patch)
tree8e5183b66a0c3ae8920e315a6828f6e0f788def4 /parser-mpcmd.c
parentec72cb7a73535171273013040476b165b980eaae (diff)
downloadmpv-ce9ce9d0c3a7e4e15d816a824f7312ad4c3c7cfc.tar.bz2
mpv-ce9ce9d0c3a7e4e15d816a824f7312ad4c3c7cfc.tar.xz
options: commandline: don't set bogus playtree option params
The command line parsing code recorded the next commandline argument, if any, as the parameter of any option recorded to playtree. Thus a command line like "mplayer file -fs -aid 1" would record option "-fs" with a bogus argument "-aid". Historically this triggered no visible problems because such bogus arguments were silently ignored when interpreting the options later. However after recent commit 507fa7e2c2 ("options: indicate ambiguous option parameters explicitly") parameters to flag options are no longer ignored, and the bogus values now triggered parsing errors. Add a check to stop recording parameters for old-style single-dash options if m_config_check_option() says the option did not consume any arguments.
Diffstat (limited to 'parser-mpcmd.c')
-rw-r--r--parser-mpcmd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/parser-mpcmd.c b/parser-mpcmd.c
index 59b35f0faa..2e4af10fe9 100644
--- a/parser-mpcmd.c
+++ b/parser-mpcmd.c
@@ -186,6 +186,8 @@ play_tree_t *m_config_parse_mp_command_line(m_config_t *config, int argc,
r = m_config_check_option(config, opt, param, old_syntax);
if (r >= 0) {
play_tree_t *pt = last_entry ? last_entry : last_parent;
+ if (r == 0)
+ param = bstr(NULL); // for old_syntax case
play_tree_set_param(pt, opt, param);
}
}