From 1ecc8af5ce440003f32a66d3e0047150a7d4beab Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 24 Feb 2015 20:33:35 +0100 Subject: nvramcui: don't init curses too early Init curses as late as possible and tear them down early. There are possible error outs after that and they don't look nice with curses initialized. Change-Id: I9128ae8eee25940716b8d223cc7ec6c0abb6838e Signed-off-by: Lubomir Rintel Reviewed-on: http://review.coreboot.org/8528 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Patrick Georgi --- payloads/nvramcui/nvramcui.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'payloads/nvramcui') diff --git a/payloads/nvramcui/nvramcui.c b/payloads/nvramcui/nvramcui.c index b6cc4cda07..5a8ca5047a 100644 --- a/payloads/nvramcui/nvramcui.c +++ b/payloads/nvramcui/nvramcui.c @@ -76,21 +76,6 @@ int main() halt(); } - /* display initialization */ - initscr(); - keypad(stdscr, TRUE); - cbreak(); - noecho(); - - start_color(); - leaveok(stdscr, TRUE); - curs_set(1); - - erase(); - box(stdscr, 0, 0); - mvaddstr(0, 2, "coreboot configuration utility"); - refresh(); - /* prep CMOS layout into libcurses data structures */ /* determine number of options, and maximum option name length */ @@ -178,6 +163,23 @@ int main() } fields[2*numopts]=NULL; + /* display initialization */ + initscr(); + keypad(stdscr, TRUE); + cbreak(); + noecho(); + + if (start_color()) { + assume_default_colors (COLOR_BLUE, COLOR_CYAN); + } + leaveok(stdscr, TRUE); + curs_set(1); + + erase(); + box(stdscr, 0, 0); + mvaddstr(0, 2, "coreboot configuration utility"); + refresh(); + FORM *form = new_form(fields); int numlines = min(numopts*2, 16); WINDOW *w = newwin(numlines+2, 70, 2, 1); @@ -230,6 +232,8 @@ int main() } } + endwin(); + for (i = 0; i < numopts; i++) { char *name = field_buffer(fields[2*i], 0); char *value = field_buffer(fields[2*i+1], 0); @@ -242,10 +246,7 @@ int main() unpost_form(form); free_form(form); - touchwin(stdscr); - refresh(); - endwin(); /* TODO: reboot */ halt(); } -- cgit v1.2.3