mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 13:33:09 +07:00
Clear current line before printing \nPlease press Enter ...
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user