History

msg: change hack to silence command line pre-parse error messages

mp_msg_levels[] will go away.

wm4 committed 12 years ago

Commit 591a6721 parent 78292053 files · +6 −6Browse files

Unified · Split

3 files
  1. common/msg.c +3 −0
  2. common/msg.h +1 −1
  3. options/parse_commandline.c +2 −5
common/msg.c+3−0
@@ -59,6 +59,7 @@ static struct mp_log *legacy_logs[MSGT_MAX]; · 58 unmodified lines
59int mp_msg_levels[MSGT_MAX]; // verbose level of this module. initialized to -259int mp_msg_levels[MSGT_MAX]; // verbose level of this module. initialized to -2
60int mp_msg_level_all = MSGL_STATUS;60int mp_msg_level_all = MSGL_STATUS;
61int verbose = 0;61int verbose = 0;
62bool mp_msg_mute;
62int mp_msg_color = 1;63int mp_msg_color = 1;
63int mp_msg_module = 0;64int mp_msg_module = 0;
64int mp_msg_cancolor = 0;65int mp_msg_cancolor = 0;
@@ -79,6 +80,8 @@ static void mp_msg_do_init(void){ · 14 unmodified lines
79 80
80int mp_msg_test(int mod, int lev)81int mp_msg_test(int mod, int lev)
81{82{
83 if (mp_msg_mute)
84 return false;
82 if (lev == MSGL_STATUS) {85 if (lev == MSGL_STATUS) {
83 // skip status line output if stderr is a tty but in background86 // skip status line output if stderr is a tty but in background
84 if (terminal_in_background())87 if (terminal_in_background())
common/msg.h+1−1
@@ -28,8 +28,8 @@ · 27 unmodified lines
28 28
29struct mp_log;29struct mp_log;
30 30
31// defined in mplayer.c
32extern int verbose;31extern int verbose;
32extern bool mp_msg_mute;
33 33
34// verbosity elevel:34// verbosity elevel:
35 35
options/parse_commandline.c+2−5
@@ -265,8 +265,6 @@ err_out: · 264 unmodified lines
265 return ret;265 return ret;
266}266}
267 267
268extern int mp_msg_levels[];
269
270/* Parse some command line options early before main parsing.268/* Parse some command line options early before main parsing.
271 * --no-config prevents reading configuration files (otherwise done before269 * --no-config prevents reading configuration files (otherwise done before
272 * command line parsing), and --really-quiet suppresses messages printed270 * command line parsing), and --really-quiet suppresses messages printed
@@ -275,8 +273,7 @@ extern int mp_msg_levels[]; · 2 unmodified lines
275void m_config_preparse_command_line(m_config_t *config, int argc, char **argv)273void m_config_preparse_command_line(m_config_t *config, int argc, char **argv)
276{274{
277 // Hack to shut up parser error messages275 // Hack to shut up parser error messages
278 int msg_lvl_backup = mp_msg_levels[MSGT_CFGPARSER];276 mp_msg_mute = true;
279 mp_msg_levels[MSGT_CFGPARSER] = -11;
280 277
281 struct parse_state p = {config, argc, argv};278 struct parse_state p = {config, argc, argv};
282 while (split_opt_silent(&p) == 0) {279 while (split_opt_silent(&p) == 0) {
@@ -290,5 +287,5 @@ void m_config_preparse_command_line(m_config_t *config, int argc, char **argv) · 7 unmodified lines
290 }287 }
291 }288 }
292 289
293 mp_msg_levels[MSGT_CFGPARSER] = msg_lvl_backup;290 mp_msg_mute = false;
294}291}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t