From 9fbfac25daaf6bdaab4c1213a294b59bded29b24 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 7 May 2012 23:51:58 +0300 Subject: options: change -v parsing Handle -v flags as a special case in command line preparsing stage, and change the option entry into a dummy one. Specifying "v" in config file no longer works (and the dummy entry shows an error in this case); "msglevel" can still be used for that purpose. Because the flag is now interpreted at an earlier parsing stage, it now affects the printing of some early messages that were only affected by the MPLAYER_VERBOSE environment variable before. The main motivation for this change is to get rid of the last CONF_TYPE_FUNC option. --- parser-mpcmd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'parser-mpcmd.c') diff --git a/parser-mpcmd.c b/parser-mpcmd.c index 49b4e0c5fd..93011d3760 100644 --- a/parser-mpcmd.c +++ b/parser-mpcmd.c @@ -308,7 +308,8 @@ extern int mp_msg_levels[]; * command line parsing), and --really-quiet suppresses messages printed * during normal options parsing. */ -int m_config_preparse_command_line(m_config_t *config, int argc, char **argv) +int m_config_preparse_command_line(m_config_t *config, int argc, char **argv, + int *verbose) { int ret = 0; @@ -330,6 +331,11 @@ int m_config_preparse_command_line(m_config_t *config, int argc, char **argv) // Ignore invalid options if (map_to_option(config, old_syntax, NULL, &opt, ¶m) < 0) continue; + // "-v" is handled here + if (!bstrcmp0(opt, "v")) { + (*verbose)++; + continue; + } // Set, non-pre-parse options will be ignored int r = m_config_set_option(config, opt, param, old_syntax); if (r < 0) -- cgit v1.2.3