diff options
Diffstat (limited to 'tools/perf/util/ui/util.c')
-rw-r--r-- | tools/perf/util/ui/util.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c index 9706d9d4027..fdf1fc8f08b 100644 --- a/tools/perf/util/ui/util.c +++ b/tools/perf/util/ui/util.c @@ -9,6 +9,7 @@ #include "../debug.h" #include "browser.h" #include "helpline.h" +#include "ui.h" #include "util.h" static void newt_form__set_exit_keys(newtComponent self) @@ -104,9 +105,26 @@ out_destroy_form: return rc; } +static const char yes[] = "Yes", no[] = "No", + warning_str[] = "Warning!", ok[] = "Ok"; + bool ui__dialog_yesno(const char *msg) { /* newtWinChoice should really be accepting const char pointers... */ - char yes[] = "Yes", no[] = "No"; - return newtWinChoice(NULL, yes, no, (char *)msg) == 1; + return newtWinChoice(NULL, (char *)yes, (char *)no, (char *)msg) == 1; +} + +void ui__warning(const char *format, ...) +{ + va_list args; + + va_start(args, format); + if (use_browser > 0) { + pthread_mutex_lock(&ui__lock); + newtWinMessagev((char *)warning_str, (char *)ok, + (char *)format, args); + pthread_mutex_unlock(&ui__lock); + } else + vfprintf(stderr, format, args); + va_end(args); } |