summaryrefslogtreecommitdiff
path: root/tools/perf/util/ui/helpline.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-08-10 15:58:50 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-08-10 16:11:38 -0300
commit1e6dd077a880ba5570beb690523b7a78a91a7615 (patch)
tree979b2006c8c1b93dfe1f4e2152af5c5c4c7c6531 /tools/perf/util/ui/helpline.c
parentd1b4f2491c3341c61c752049f73ba12553f978d8 (diff)
perf ui: Complete the breakdown of util/newt.c
LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/ui/helpline.c')
-rw-r--r--tools/perf/util/ui/helpline.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/perf/util/ui/helpline.c b/tools/perf/util/ui/helpline.c
index 6a11e1301559..ff584606a4dc 100644
--- a/tools/perf/util/ui/helpline.c
+++ b/tools/perf/util/ui/helpline.c
@@ -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;
+}