diff --git a/common/autoboot.c b/common/autoboot.c index e39f4a32f95..1783ef92c94 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -376,19 +377,24 @@ static int abortboot_key_sequence(int bootdelay) return abort; } +static void print_boot_delay(int bootdelay) +{ + printf(ANSI_CLEAR_LINE "\rHit any key to stop autoboot: %d", bootdelay); +} + static int abortboot_single_key(int bootdelay) { int abort = 0; unsigned long ts; - printf("Hit any key to stop autoboot: %2d ", bootdelay); + print_boot_delay(bootdelay); /* * Check if key already pressed */ if (tstc()) { /* we got a key press */ getchar(); /* consume input */ - puts("\b\b\b 0"); + print_boot_delay(0); abort = 1; /* don't auto boot */ } @@ -410,7 +416,7 @@ static int abortboot_single_key(int bootdelay) udelay(10000); } while (!abort && get_timer(ts) < 1000); - printf("\rHit any key to stop autoboot: %1d\033[K", bootdelay); + print_boot_delay(bootdelay); } putc('\n');