diff options
Diffstat (limited to 'common/console.c')
| -rw-r--r-- | common/console.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/common/console.c b/common/console.c index 22e554cf203..54d1249422d 100644 --- a/common/console.c +++ b/common/console.c @@ -643,6 +643,15 @@ int tstc(void) return serial_tstc(); } +/** + * console_flush_stdin() - drops all pending characters from stdin + */ +void console_flush_stdin(void) +{ + while (tstc()) + (void)getchar(); +} + #define PRE_CONSOLE_FLUSHPOINT1_SERIAL 0 #define PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL 1 @@ -914,8 +923,7 @@ int confirm_yesno(void) char str_input[5]; /* Flush input */ - while (tstc()) - getchar(); + console_flush_stdin(); i = 0; while (i < sizeof(str_input)) { str_input[i] = getchar(); |
