kvm tools, setup: Create private directory
[linux-2.6/next.git] / tools / perf / util / ui / setup.c
blobee46d671db5990a9c453447e065bf95864943385
1 #include <newt.h>
2 #include <signal.h>
3 #include <stdbool.h>
5 #include "../cache.h"
6 #include "../debug.h"
7 #include "browser.h"
8 #include "helpline.h"
9 #include "ui.h"
11 pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
13 static void newt_suspend(void *d __used)
15 newtSuspend();
16 raise(SIGTSTP);
17 newtResume();
20 void setup_browser(bool fallback_to_pager)
22 if (!isatty(1) || !use_browser || dump_trace) {
23 use_browser = 0;
24 if (fallback_to_pager)
25 setup_pager();
26 return;
29 use_browser = 1;
30 newtInit();
31 newtCls();
32 newtSetSuspendCallback(newt_suspend, NULL);
33 ui_helpline__init();
34 ui_browser__init();
37 void exit_browser(bool wait_for_ok)
39 if (use_browser > 0) {
40 if (wait_for_ok) {
41 char title[] = "Fatal Error", ok[] = "Ok";
42 newtWinMessage(title, ok, ui_helpline__last_msg);
44 newtFinished();