diff options
Diffstat (limited to 'tools/perf/util/ui/util.c')
-rw-r--r-- | tools/perf/util/ui/util.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c index ef9b79332fe8..45daa7c41dad 100644 --- a/tools/perf/util/ui/util.c +++ b/tools/perf/util/ui/util.c | |||
@@ -121,43 +121,48 @@ int ui__help_window(const char *text) | |||
121 | return ui__question_window("Help", text, "Press any key...", 0); | 121 | return ui__question_window("Help", text, "Press any key...", 0); |
122 | } | 122 | } |
123 | 123 | ||
124 | bool ui__dialog_yesno(const char *msg) | 124 | int ui__dialog_yesno(const char *msg) |
125 | { | 125 | { |
126 | int answer = ui__question_window(NULL, msg, "Enter: Yes, ESC: No", 0); | 126 | return ui__question_window(NULL, msg, "Enter: Yes, ESC: No", 0); |
127 | |||
128 | return answer == K_ENTER; | ||
129 | } | 127 | } |
130 | 128 | ||
131 | static void __ui__warning(const char *title, const char *format, va_list args) | 129 | int __ui__warning(const char *title, const char *format, va_list args) |
132 | { | 130 | { |
133 | char *s; | 131 | char *s; |
134 | 132 | ||
135 | if (use_browser > 0 && vasprintf(&s, format, args) > 0) { | 133 | if (use_browser > 0 && vasprintf(&s, format, args) > 0) { |
134 | int key; | ||
135 | |||
136 | pthread_mutex_lock(&ui__lock); | 136 | pthread_mutex_lock(&ui__lock); |
137 | ui__question_window(title, s, "Press any key...", 0); | 137 | key = ui__question_window(title, s, "Press any key...", 0); |
138 | pthread_mutex_unlock(&ui__lock); | 138 | pthread_mutex_unlock(&ui__lock); |
139 | free(s); | 139 | free(s); |
140 | return; | 140 | return key; |
141 | } | 141 | } |
142 | 142 | ||
143 | fprintf(stderr, "%s:\n", title); | 143 | fprintf(stderr, "%s:\n", title); |
144 | vfprintf(stderr, format, args); | 144 | vfprintf(stderr, format, args); |
145 | return K_ESC; | ||
145 | } | 146 | } |
146 | 147 | ||
147 | void ui__warning(const char *format, ...) | 148 | int ui__warning(const char *format, ...) |
148 | { | 149 | { |
150 | int key; | ||
149 | va_list args; | 151 | va_list args; |
150 | 152 | ||
151 | va_start(args, format); | 153 | va_start(args, format); |
152 | __ui__warning("Warning", format, args); | 154 | key = __ui__warning("Warning", format, args); |
153 | va_end(args); | 155 | va_end(args); |
156 | return key; | ||
154 | } | 157 | } |
155 | 158 | ||
156 | void ui__error(const char *format, ...) | 159 | int ui__error(const char *format, ...) |
157 | { | 160 | { |
161 | int key; | ||
158 | va_list args; | 162 | va_list args; |
159 | 163 | ||
160 | va_start(args, format); | 164 | va_start(args, format); |
161 | __ui__warning("Error", format, args); | 165 | key = __ui__warning("Error", format, args); |
162 | va_end(args); | 166 | va_end(args); |
167 | return key; | ||
163 | } | 168 | } |