curses: only initialize curses module if actually being used

Fixes display problems with plain ascii output

Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
Thomas Graf 2014-05-08 15:22:00 +02:00
parent 46ec101b00
commit fd461f6568

View File

@ -1202,6 +1202,13 @@ static int handle_input(int ch)
static void curses_pre(void)
{
static int init = 0;
if (!init) {
curses_init();
init = 1;
}
for (;;) {
int ch = getch();
@ -1267,7 +1274,6 @@ static void curses_parse_opt(const char *type, const char *value)
static struct bmon_module curses_ops = {
.m_name = "curses",
.m_flags = BMON_MODULE_DEFAULT,
.m_init = curses_init,
.m_shutdown = curses_shutdown,
.m_pre = curses_pre,
.m_do = curses_draw,