diff options
Diffstat (limited to 'tools/perf/ui/gtk/helpline.c')
-rw-r--r-- | tools/perf/ui/gtk/helpline.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/perf/ui/gtk/helpline.c b/tools/perf/ui/gtk/helpline.c index 2511b3746797..5db4432ff12a 100644 --- a/tools/perf/ui/gtk/helpline.c +++ b/tools/perf/ui/gtk/helpline.c @@ -1,5 +1,10 @@ +#include <stdio.h> +#include <string.h> + #include "gtk.h" +#include "../ui.h" #include "../helpline.h" +#include "../../util/debug.h" static void gtk_helpline_pop(void) { @@ -28,3 +33,24 @@ void perf_gtk__init_helpline(void) { helpline_fns = >k_helpline_fns; } + +int perf_gtk__show_helpline(const char *fmt, va_list ap) +{ + int ret; + char *ptr; + static int backlog; + + ret = vscnprintf(ui_helpline__current + backlog, + sizeof(ui_helpline__current) - backlog, fmt, ap); + backlog += ret; + + /* only first line can be displayed */ + ptr = strchr(ui_helpline__current, '\n'); + if (ptr && (ptr - ui_helpline__current) <= backlog) { + *ptr = '\0'; + ui_helpline__puts(ui_helpline__current); + backlog = 0; + } + + return ret; +} |