Always show messages to the user
This commit is contained in:
parent
92c1bf783f
commit
88e86724c3
29
nncmpp.c
29
nncmpp.c
|
@ -6307,6 +6307,8 @@ signals_setup_handlers (void)
|
||||||
|
|
||||||
// --- Initialisation, event handling ------------------------------------------
|
// --- Initialisation, event handling ------------------------------------------
|
||||||
|
|
||||||
|
static bool g_verbose_mode = false;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
app_on_signal_pipe_readable (const struct pollfd *fd, void *user_data)
|
app_on_signal_pipe_readable (const struct pollfd *fd, void *user_data)
|
||||||
{
|
{
|
||||||
|
@ -6352,19 +6354,16 @@ app_log_handler (void *user_data, const char *quote, const char *fmt,
|
||||||
str_append (&message, quote);
|
str_append (&message, quote);
|
||||||
str_append_vprintf (&message, fmt, ap);
|
str_append_vprintf (&message, fmt, ap);
|
||||||
|
|
||||||
// If the standard error output isn't redirected, try our best at showing
|
// Show it to the user, then maybe log it elsewhere as well.
|
||||||
// the message to the user
|
cstr_set (&g.message, xstrdup (message.str));
|
||||||
if (!isatty (STDERR_FILENO))
|
app_invalidate ();
|
||||||
|
poller_timer_set (&g.message_timer, 5000);
|
||||||
|
|
||||||
|
if (g_verbose_mode && (g.ui != &tui_ui || !isatty (STDERR_FILENO)))
|
||||||
fprintf (stderr, "%s\n", message.str);
|
fprintf (stderr, "%s\n", message.str);
|
||||||
else if (g_debug_tab.active)
|
if (g_debug_tab.active)
|
||||||
debug_tab_push (str_steal (&message),
|
debug_tab_push (str_steal (&message),
|
||||||
user_data == NULL ? 0 : g.attrs[(intptr_t) user_data].attrs);
|
user_data == NULL ? 0 : g.attrs[(intptr_t) user_data].attrs);
|
||||||
else
|
|
||||||
{
|
|
||||||
cstr_set (&g.message, xstrdup (message.str));
|
|
||||||
app_invalidate ();
|
|
||||||
poller_timer_set (&g.message_timer, 5000);
|
|
||||||
}
|
|
||||||
str_free (&message);
|
str_free (&message);
|
||||||
|
|
||||||
in_processing = false;
|
in_processing = false;
|
||||||
|
@ -6434,6 +6433,7 @@ main (int argc, char *argv[])
|
||||||
{ 'x', "x11", NULL, 0, "use X11 even when run from a terminal" },
|
{ 'x', "x11", NULL, 0, "use X11 even when run from a terminal" },
|
||||||
#endif // WITH_X11
|
#endif // WITH_X11
|
||||||
{ 'h', "help", NULL, 0, "display this help and exit" },
|
{ 'h', "help", NULL, 0, "display this help and exit" },
|
||||||
|
{ 'v', "verbose", NULL, 0, "log messages on standard error" },
|
||||||
{ 'V', "version", NULL, 0, "output version information and exit" },
|
{ 'V', "version", NULL, 0, "output version information and exit" },
|
||||||
{ 0, NULL, NULL, 0, NULL }
|
{ 0, NULL, NULL, 0, NULL }
|
||||||
};
|
};
|
||||||
|
@ -6449,15 +6449,18 @@ main (int argc, char *argv[])
|
||||||
case 'd':
|
case 'd':
|
||||||
g_debug_mode = true;
|
g_debug_mode = true;
|
||||||
break;
|
break;
|
||||||
|
case 'x':
|
||||||
|
requested_x11 = true;
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
g_verbose_mode = true;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
opt_handler_usage (&oh, stdout);
|
opt_handler_usage (&oh, stdout);
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
case 'V':
|
case 'V':
|
||||||
printf (PROGRAM_NAME " " PROGRAM_VERSION "\n");
|
printf (PROGRAM_NAME " " PROGRAM_VERSION "\n");
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
case 'x':
|
|
||||||
requested_x11 = true;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
print_error ("wrong options");
|
print_error ("wrong options");
|
||||||
opt_handler_usage (&oh, stderr);
|
opt_handler_usage (&oh, stderr);
|
||||||
|
|
Loading…
Reference in New Issue