mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
getty: Disable ECHO, XON/OFF while waiting for initial <CR>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+20
-2
@@ -266,12 +266,22 @@ static void prepare_tty(char *tty, char *procname)
|
||||
|
||||
static int activate_console(int noclear, int nowait)
|
||||
{
|
||||
int ret = 0;
|
||||
struct termios term;
|
||||
|
||||
if (!noclear)
|
||||
(void)write(STDERR_FILENO, "\e[r\e[H\e[J", 9);
|
||||
|
||||
if (nowait)
|
||||
return 1;
|
||||
|
||||
/* Disable ECHO, XON/OFF while waiting for <CR> */
|
||||
if (!tcgetattr(STDIN_FILENO, &term)) {
|
||||
term.c_iflag &= ~(IXON|IXOFF);
|
||||
term.c_lflag &= ~ECHO;
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &term);
|
||||
}
|
||||
|
||||
while (!fexist(SYNC_SHUTDOWN)) {
|
||||
char c;
|
||||
static const char msg[] = "\nPlease press Enter to activate this console.";
|
||||
@@ -288,10 +298,18 @@ static int activate_console(int noclear, int nowait)
|
||||
if (fexist(SYNC_STOPPED))
|
||||
continue;
|
||||
|
||||
return 1;
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
/* Restore ECHO, XON/OFF while waiting for <CR> */
|
||||
if (!tcgetattr(STDIN_FILENO, &term)) {
|
||||
term.c_iflag |= IXON|IXOFF;
|
||||
term.c_lflag |= ECHO;
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &term);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
pid_t run_getty(char *tty, char *speed, char *term, int noclear, int nowait)
|
||||
|
||||
Reference in New Issue
Block a user