diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2015-02-24 20:33:35 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-02-25 21:06:22 +0100 |
commit | 1ecc8af5ce440003f32a66d3e0047150a7d4beab (patch) | |
tree | b4a7f21bbf4548138a0808979ca4868c69008d14 /payloads/nvramcui | |
parent | 18860d7a4f06c5b48dcd7ef90e3039cf44b4e57f (diff) | |
download | coreboot-1ecc8af5ce440003f32a66d3e0047150a7d4beab.tar.xz |
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 <lkundrak@v3.sk>
Reviewed-on: http://review.coreboot.org/8528
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'payloads/nvramcui')
-rw-r--r-- | payloads/nvramcui/nvramcui.c | 37 |
1 files changed, 19 insertions, 18 deletions
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(); } |