[PATCH 1/6] menu: enable the fancy color support only if HUSH is enabled

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Apr 14 12:02:18 EDT 2012


So we can use the menu for the xloader too.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 common/menu.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/common/menu.c b/common/menu.c
index 50af36e..83821ec 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -174,12 +174,17 @@ static void print_menu_entry(struct menu *m, struct menu_entry *me,
 		puts("   ");
 	}
 
-	process_escape_sequence(me->display, m->display_buffer,
-				m->display_buffer_size);
+	if (IS_ENABLED(CONFIG_SHELL_HUSH))
+		process_escape_sequence(me->display, m->display_buffer,
+					m->display_buffer_size);
+
 	printf(" %d: ", me->num);
 	if (selected)
 		puts("\e[7m");
-	puts(m->display_buffer);
+	if (IS_ENABLED(CONFIG_SHELL_HUSH))
+		puts(m->display_buffer);
+	else
+		puts(me->display);
 
 	if (selected)
 		puts("\e[m");
@@ -236,9 +241,13 @@ static void print_menu(struct menu *m)
 	clear();
 	gotoXY(1, 2);
 	if(m->display) {
-		process_escape_sequence(m->display, m->display_buffer,
-					m->display_buffer_size);
-		puts(m->display_buffer);
+		if (IS_ENABLED(CONFIG_SHELL_HUSH)) {
+			process_escape_sequence(m->display, m->display_buffer,
+						m->display_buffer_size);
+			puts(m->display_buffer);
+		} else {
+			puts(m->display);
+		}
 	} else {
 		puts("Menu : ");
 		puts(m->name);
-- 
1.7.9.1




More information about the barebox mailing list