[coreboot-gerrit] New patch to review for coreboot: e3a36a3 nvramcui: don't init curses too early

Lubomir Rintel (lkundrak@v3.sk) gerrit at coreboot.org
Tue Feb 24 20:39:01 CET 2015


Lubomir Rintel (lkundrak at v3.sk) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8528

-gerrit

commit e3a36a35db2a1c972a9a929b2d63f8379994a101
Author: Lubomir Rintel <lkundrak at v3.sk>
Date:   Tue Feb 24 20:33:35 2015 +0100

    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 at v3.sk>
---
 payloads/nvramcui/nvramcui.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/payloads/nvramcui/nvramcui.c b/payloads/nvramcui/nvramcui.c
index b6cc4cd..5a8ca50 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();
 }



More information about the coreboot-gerrit mailing list