perf ui: Complete the breakdown of util/newt.c

LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo
2010-08-10 15:58:50 -03:00
parent d1b4f2491c
commit 1e6dd077a8
10 changed files with 96 additions and 78 deletions

View File

@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <newt.h>
#include "../debug.h"
#include "helpline.h"
void ui_helpline__pop(void)
@@ -41,3 +42,28 @@ void ui_helpline__puts(const char *msg)
ui_helpline__pop();
ui_helpline__push(msg);
}
void ui_helpline__init(void)
{
ui_helpline__puts(" ");
}
char ui_helpline__last_msg[1024];
int ui_helpline__show_help(const char *format, va_list ap)
{
int ret;
static int backlog;
ret = vsnprintf(ui_helpline__last_msg + backlog,
sizeof(ui_helpline__last_msg) - backlog, format, ap);
backlog += ret;
if (ui_helpline__last_msg[backlog - 1] == '\n') {
ui_helpline__puts(ui_helpline__last_msg);
newtRefresh();
backlog = 0;
}
return ret;
}