aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/ui/util.c')
-rw-r--r--tools/perf/util/ui/util.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c
index 04600e26ceea..fdf1fc8f08bc 100644
--- a/tools/perf/util/ui/util.c
+++ b/tools/perf/util/ui/util.c
@@ -9,10 +9,9 @@
9#include "../debug.h" 9#include "../debug.h"
10#include "browser.h" 10#include "browser.h"
11#include "helpline.h" 11#include "helpline.h"
12#include "ui.h"
12#include "util.h" 13#include "util.h"
13 14
14newtComponent newt_form__new(void);
15
16static void newt_form__set_exit_keys(newtComponent self) 15static void newt_form__set_exit_keys(newtComponent self)
17{ 16{
18 newtFormAddHotKey(self, NEWT_KEY_LEFT); 17 newtFormAddHotKey(self, NEWT_KEY_LEFT);
@@ -22,7 +21,7 @@ static void newt_form__set_exit_keys(newtComponent self)
22 newtFormAddHotKey(self, CTRL('c')); 21 newtFormAddHotKey(self, CTRL('c'));
23} 22}
24 23
25newtComponent newt_form__new(void) 24static newtComponent newt_form__new(void)
26{ 25{
27 newtComponent self = newtForm(NULL, NULL, 0); 26 newtComponent self = newtForm(NULL, NULL, 0);
28 if (self) 27 if (self)
@@ -106,9 +105,26 @@ out_destroy_form:
106 return rc; 105 return rc;
107} 106}
108 107
108static const char yes[] = "Yes", no[] = "No",
109 warning_str[] = "Warning!", ok[] = "Ok";
110
109bool ui__dialog_yesno(const char *msg) 111bool ui__dialog_yesno(const char *msg)
110{ 112{
111 /* newtWinChoice should really be accepting const char pointers... */ 113 /* newtWinChoice should really be accepting const char pointers... */
112 char yes[] = "Yes", no[] = "No"; 114 return newtWinChoice(NULL, (char *)yes, (char *)no, (char *)msg) == 1;
113 return newtWinChoice(NULL, yes, no, (char *)msg) == 1; 115}
116
117void ui__warning(const char *format, ...)
118{
119 va_list args;
120
121 va_start(args, format);
122 if (use_browser > 0) {
123 pthread_mutex_lock(&ui__lock);
124 newtWinMessagev((char *)warning_str, (char *)ok,
125 (char *)format, args);
126 pthread_mutex_unlock(&ui__lock);
127 } else
128 vfprintf(stderr, format, args);
129 va_end(args);
114} 130}