aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui/util.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /tools/perf/util/ui/util.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
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}