Clear current line before printing \nPlease press Enter ...

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-10-29 16:52:14 +01:00
parent d31575538c
commit adb4670d2f
+3
View File
@@ -286,6 +286,7 @@ static int activate_console(int noclear, int nowait)
while (!fexist(SYNC_SHUTDOWN)) {
char c;
static const char clr[] = "\r\e[2K";
static const char msg[] = "\nPlease press Enter to activate this console.";
if (fexist(SYNC_STOPPED)) {
@@ -293,6 +294,7 @@ static int activate_console(int noclear, int nowait)
continue;
}
(void)write(STDERR_FILENO, clr, sizeof(clr));
(void)write(STDERR_FILENO, msg, sizeof(msg));
while (read(STDIN_FILENO, &c, 1) == 1 && c != '\n')
continue;
@@ -300,6 +302,7 @@ static int activate_console(int noclear, int nowait)
if (fexist(SYNC_STOPPED))
continue;
(void)write(STDERR_FILENO, clr, sizeof(clr));
ret = 1;
break;
}