X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fncurses%2Fgeneric-main.c;h=d9fd7d2d0415349d05c89a766a15d7e9c17a2449;hp=365034ceea3c402d1870e33fa627d80c9fcb4539;hb=6d1eff1e8e1db12e7aa179e8dc9c65050c045536;hpb=ad781c2aaed011dc704a018b53dcb43e5d90fd85 diff --git a/ui/ncurses/generic-main.c b/ui/ncurses/generic-main.c index 365034c..d9fd7d2 100644 --- a/ui/ncurses/generic-main.c +++ b/ui/ncurses/generic-main.c @@ -18,11 +18,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#if defined(HAVE_CONFIG_H) #include "config.h" -#endif #define _GNU_SOURCE + +#include #include #include #include @@ -143,12 +143,13 @@ static struct pmenu *pb_mm_init(struct pb_cui *pb_cui) return NULL; } - m->on_open = cui_on_open; + m->on_new = cui_item_new; - m->scr.frame.title = talloc_asprintf(m, + m->scr.frame.ltitle = talloc_asprintf(m, "Petitboot (" PACKAGE_VERSION ")"); + m->scr.frame.rtitle = NULL; m->scr.frame.help = talloc_strdup(m, - "ESC=exit, Enter=accept, e=edit, o=open"); + "ESC=exit, Enter=accept, e=edit, n=new"); m->scr.frame.status = talloc_strdup(m, "Welcome to Petitboot"); i = pmenu_item_init(m, 0, "Exit to Shell"); @@ -180,10 +181,6 @@ static void sig_handler(int signum) DBGS("%d\n", signum); switch (signum) { - case SIGALRM: - if (pb.cui) - ui_timer_sigalrm(&pb.cui->timer); - break; case SIGWINCH: if (pb.cui) cui_resize(pb.cui); @@ -210,6 +207,7 @@ int main(int argc, char *argv[]) int result; int cui_result; struct opts opts; + FILE *log; result = opts_parse(&opts, argc, argv); @@ -228,20 +226,15 @@ int main(int argc, char *argv[]) return EXIT_SUCCESS; } + log = stderr; if (strcmp(opts.log_file, "-")) { - FILE *log = fopen(opts.log_file, "a"); + log = fopen(opts.log_file, "a"); if (!log) log = fopen("/dev/null", "a"); + } - assert(log); - pb_log_set_stream(log); - } else - pb_log_set_stream(stderr); - -#if defined(DEBUG) - pb_log_always_flush(1); -#endif + pb_log_init(log); pb_log("--- petitboot-nc ---\n"); @@ -263,7 +256,6 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; pb.mm = pb_mm_init(&pb); - ui_timer_disable(&pb.cui->timer); cui_result = cui_run(pb.cui, pb.mm, 0);