From 90496f3088fb635916fd97ffa5bcdc57d281e1ca Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 6 Mar 2015 10:53:49 +0100 Subject: player: fix operation if command line is empty main() being called with argc==0 is probably possible. Fix by skipping the program name early. (I already changed and reverted this once, but this time we make sure that it's less likely to confuse the skipped argv with main()'s argv by naming it "options".) --- options/parse_commandline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'options') diff --git a/options/parse_commandline.c b/options/parse_commandline.c index 06a6cb639b..6898075430 100644 --- a/options/parse_commandline.c +++ b/options/parse_commandline.c @@ -142,7 +142,7 @@ int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files, mode = GLOBAL; - struct parse_state p = {config, argv + 1}; + struct parse_state p = {config, argv}; while (split_opt(&p)) { if (p.is_opt) { int flags = M_SETOPT_FROM_CMDLINE; @@ -286,7 +286,7 @@ void m_config_preparse_command_line(m_config_t *config, struct mpv_global *globa // Hack to shut up parser error messages mp_msg_mute(global, true); - struct parse_state p = {config, argv + 1}; + struct parse_state p = {config, argv}; while (split_opt_silent(&p) == 0) { if (p.is_opt) { // Ignore non-pre-parse options. They will be set later. -- cgit v1.2.3