diff options
Diffstat (limited to 'tools/perf/util/ui/browser.c')
-rw-r--r-- | tools/perf/util/ui/browser.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c index d2051be04f12..556829124b02 100644 --- a/tools/perf/util/ui/browser.c +++ b/tools/perf/util/ui/browser.c @@ -176,16 +176,29 @@ void ui_browser__handle_resize(struct ui_browser *browser) ui_browser__refresh(browser); } -int ui_browser__warning(struct ui_browser *browser, const char *format, ...) +int ui_browser__warning(struct ui_browser *browser, int timeout, + const char *format, ...) { va_list args; - int key; + char *text; + int key = 0, err; va_start(args, format); - while ((key = __ui__warning("Warning!", format, args)) == K_RESIZE) - ui_browser__handle_resize(browser); + err = vasprintf(&text, format, args); va_end(args); + if (err < 0) { + va_start(args, format); + ui_helpline__vpush(format, args); + va_end(args); + } else { + while ((key == ui__question_window("Warning!", text, + "Press any key...", + timeout)) == K_RESIZE) + ui_browser__handle_resize(browser); + free(text); + } + return key; } |