mirror of
https://github.com/troglobit/finit.git
synced 2026-11-28 20:58:24 +00:00
Clear current line before printing \nPlease press Enter ...
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
d31575538c
commit
adb4670d2f
1 file changed
+3
@@ -286,6 +286,7 @@ static int activate_console(int noclear, int nowait)
|
|||||||
|
|
||||||
while (!fexist(SYNC_SHUTDOWN)) {
|
while (!fexist(SYNC_SHUTDOWN)) {
|
||||||
char c;
|
char c;
|
||||||
|
static const char clr[] = "\r\e[2K";
|
||||||
static const char msg[] = "\nPlease press Enter to activate this console.";
|
static const char msg[] = "\nPlease press Enter to activate this console.";
|
||||||
|
|
||||||
if (fexist(SYNC_STOPPED)) {
|
if (fexist(SYNC_STOPPED)) {
|
||||||
@@ -293,6 +294,7 @@ static int activate_console(int noclear, int nowait)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void)write(STDERR_FILENO, clr, sizeof(clr));
|
||||||
(void)write(STDERR_FILENO, msg, sizeof(msg));
|
(void)write(STDERR_FILENO, msg, sizeof(msg));
|
||||||
while (read(STDIN_FILENO, &c, 1) == 1 && c != '\n')
|
while (read(STDIN_FILENO, &c, 1) == 1 && c != '\n')
|
||||||
continue;
|
continue;
|
||||||
@@ -300,6 +302,7 @@ static int activate_console(int noclear, int nowait)
|
|||||||
if (fexist(SYNC_STOPPED))
|
if (fexist(SYNC_STOPPED))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
(void)write(STDERR_FILENO, clr, sizeof(clr));
|
||||||
ret = 1;
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user