diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2022-05-01 23:17:18 +0200 |
---|---|---|
committer | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2022-05-03 21:39:22 +0200 |
commit | d1d7ed7b1eb99089cf027cafaa134b75a9cf3348 (patch) | |
tree | 77dd26295aa002ad71ed845e4c363adfee2883ce /cmd | |
parent | f2c534d354a6f4156f3e476f9bc83a7250206eab (diff) | |
download | u-boot-d1d7ed7b1eb99089cf027cafaa134b75a9cf3348.tar.gz u-boot-d1d7ed7b1eb99089cf027cafaa134b75a9cf3348.tar.bz2 u-boot-d1d7ed7b1eb99089cf027cafaa134b75a9cf3348.zip |
cmd: simplify bootmenu
* correct output for timeout > 99 s
* don't use spaces to advance to the output column
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/bootmenu.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c index d573487272..fe35607472 100644 --- a/cmd/bootmenu.c +++ b/cmd/bootmenu.c @@ -68,9 +68,7 @@ static void bootmenu_print_entry(void *data) * Move cursor to line where the entry will be drown (entry->num) * First 3 lines contain bootmenu header + 1 empty line */ - printf(ANSI_CURSOR_POSITION, entry->num + 4, 1); - - puts(" "); + printf(ANSI_CURSOR_POSITION, entry->num + 4, 7); if (reverse) puts(ANSI_COLOR_REVERSE); @@ -86,12 +84,9 @@ static void bootmenu_autoboot_loop(struct bootmenu_data *menu, { int i, c; - if (menu->delay > 0) { - printf(ANSI_CURSOR_POSITION, menu->count + 5, 1); - printf(" Hit any key to stop autoboot: %2d ", menu->delay); - } - while (menu->delay > 0) { + printf(ANSI_CURSOR_POSITION, menu->count + 5, 3); + printf("Hit any key to stop autoboot: %d ", menu->delay); for (i = 0; i < 100; ++i) { if (!tstc()) { WATCHDOG_RESET(); @@ -125,7 +120,6 @@ static void bootmenu_autoboot_loop(struct bootmenu_data *menu, break; --menu->delay; - printf("\b\b\b%2d ", menu->delay); } printf(ANSI_CURSOR_POSITION, menu->count + 5, 1); @@ -407,8 +401,8 @@ static void menu_display_statusline(struct menu *m) printf(ANSI_CURSOR_POSITION, 1, 1); puts(ANSI_CLEAR_LINE); - printf(ANSI_CURSOR_POSITION, 2, 1); - puts(" *** U-Boot Boot Menu ***"); + printf(ANSI_CURSOR_POSITION, 2, 3); + puts("*** U-Boot Boot Menu ***"); puts(ANSI_CLEAR_LINE_TO_END); printf(ANSI_CURSOR_POSITION, 3, 1); puts(ANSI_CLEAR_LINE); @@ -416,8 +410,8 @@ static void menu_display_statusline(struct menu *m) /* First 3 lines are bootmenu header + 2 empty lines between entries */ printf(ANSI_CURSOR_POSITION, menu->count + 5, 1); puts(ANSI_CLEAR_LINE); - printf(ANSI_CURSOR_POSITION, menu->count + 6, 1); - puts(" Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit"); + printf(ANSI_CURSOR_POSITION, menu->count + 6, 3); + puts("Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit"); puts(ANSI_CLEAR_LINE_TO_END); printf(ANSI_CURSOR_POSITION, menu->count + 7, 1); puts(ANSI_CLEAR_LINE); |