forked from Imagelibrary/rtems
2009-12-18 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/shell/login_prompt.c: Switch from non-canonical mode with timeout (Case C) to blocking IO waiting for single character on login. In Case C mode, you cannot tell EOF from no data available. This means we cannot tell when a telnet connection is dropped. This was changed from 4.9 and resulted in breakage.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2009-12-18 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
|
* libmisc/shell/login_prompt.c: Switch from non-canonical mode with
|
||||||
|
timeout (Case C) to blocking IO waiting for single character on
|
||||||
|
login. In Case C mode, you cannot tell EOF from no data available.
|
||||||
|
This means we cannot tell when a telnet connection is dropped. This
|
||||||
|
was changed from 4.9 and resulted in breakage.
|
||||||
|
|
||||||
2009-12-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
2009-12-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||||
|
|
||||||
PR 1474
|
PR 1474
|
||||||
|
|||||||
@@ -111,18 +111,18 @@ static bool rtems_shell_get_text(
|
|||||||
return false;
|
return false;
|
||||||
case '\n':
|
case '\n':
|
||||||
case '\r':
|
case '\r':
|
||||||
put( '\n', out);
|
put('\n', out);
|
||||||
line [i] = '\0';
|
line [i] = '\0';
|
||||||
return true;
|
return true;
|
||||||
case 127:
|
case 127:
|
||||||
case '\b':
|
case '\b':
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
put( '\b', out);
|
put('\b', out);
|
||||||
put( ' ', out);
|
put(' ', out);
|
||||||
put( '\b', out);
|
put('\b', out);
|
||||||
--i;
|
--i;
|
||||||
} else {
|
} else {
|
||||||
put( '\a', out);
|
put('\a', out);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -132,10 +132,10 @@ static bool rtems_shell_get_text(
|
|||||||
++i;
|
++i;
|
||||||
put( c, out);
|
put( c, out);
|
||||||
} else {
|
} else {
|
||||||
put( '\a', out);
|
put('\a', out);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
put( '\a', out);
|
put('\a', out);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -159,10 +159,13 @@ bool rtems_shell_login_prompt(
|
|||||||
if (tcgetattr( fd_in, &termios_previous) == 0) {
|
if (tcgetattr( fd_in, &termios_previous) == 0) {
|
||||||
struct termios termios_new = termios_previous;
|
struct termios termios_new = termios_previous;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Stay in canonical mode so we can tell EOF and dropped connections.
|
||||||
|
* But read one character at a time and do not echo it.
|
||||||
|
*/
|
||||||
termios_new.c_lflag &= (unsigned char) ~ECHO;
|
termios_new.c_lflag &= (unsigned char) ~ECHO;
|
||||||
termios_new.c_lflag &= (unsigned char) ~ICANON;
|
termios_new.c_cc [VTIME] = 0;
|
||||||
termios_new.c_cc [VTIME] = 255;
|
termios_new.c_cc [VMIN] = 1;
|
||||||
termios_new.c_cc [VMIN] = 0;
|
|
||||||
|
|
||||||
restore_termios = tcsetattr( fd_in, TCSANOW, &termios_new) == 0;
|
restore_termios = tcsetattr( fd_in, TCSANOW, &termios_new) == 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user