diff options
Diffstat (limited to 'tools/perf/util/ui/helpline.c')
-rw-r--r-- | tools/perf/util/ui/helpline.c | 26 |
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 @@ | |||
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <newt.h> | 4 | #include <newt.h> |
5 | 5 | ||
6 | #include "../debug.h" | ||
6 | #include "helpline.h" | 7 | #include "helpline.h" |
7 | 8 | ||
8 | void ui_helpline__pop(void) | 9 | void ui_helpline__pop(void) |
@@ -41,3 +42,28 @@ void ui_helpline__puts(const char *msg) | |||
41 | ui_helpline__pop(); | 42 | ui_helpline__pop(); |
42 | ui_helpline__push(msg); | 43 | ui_helpline__push(msg); |
43 | } | 44 | } |
45 | |||
46 | void ui_helpline__init(void) | ||
47 | { | ||
48 | ui_helpline__puts(" "); | ||
49 | } | ||
50 | |||
51 | char ui_helpline__last_msg[1024]; | ||
52 | |||
53 | int ui_helpline__show_help(const char *format, va_list ap) | ||
54 | { | ||
55 | int ret; | ||
56 | static int backlog; | ||
57 | |||
58 | ret = vsnprintf(ui_helpline__last_msg + backlog, | ||
59 | sizeof(ui_helpline__last_msg) - backlog, format, ap); | ||
60 | backlog += ret; | ||
61 | |||
62 | if (ui_helpline__last_msg[backlog - 1] == '\n') { | ||
63 | ui_helpline__puts(ui_helpline__last_msg); | ||
64 | newtRefresh(); | ||
65 | backlog = 0; | ||
66 | } | ||
67 | |||
68 | return ret; | ||
69 | } | ||