summaryrefslogtreecommitdiffstats
path: root/contrib/telnet/telnetd/termstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/telnet/telnetd/termstat.c')
-rw-r--r--contrib/telnet/telnetd/termstat.c53
1 files changed, 33 insertions, 20 deletions
diff --git a/contrib/telnet/telnetd/termstat.c b/contrib/telnet/telnetd/termstat.c
index ebc843a..be1372a 100644
--- a/contrib/telnet/telnetd/termstat.c
+++ b/contrib/telnet/telnetd/termstat.c
@@ -32,11 +32,15 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)termstat.c 8.2 (Berkeley) 5/30/95";
+static const char sccsid[] = "@(#)termstat.c 8.2 (Berkeley) 5/30/95";
#endif /* not lint */
#include "telnetd.h"
+#if defined(ENCRYPTION)
+#include <libtelnet/encrypt.h>
+#endif
+
/*
* local variables
*/
@@ -144,8 +148,35 @@ localstat()
#endif /* defined(CRAY2) && defined(UNICOS5) */
/*
+ * Check for changes to flow control if client supports it.
+ */
+ flowstat();
+
+ /*
+ * Check linemode on/off state
+ */
+ uselinemode = tty_linemode();
+
+ /*
+ * If alwayslinemode is on, and pty is changing to turn it off, then
+ * force linemode back on.
+ */
+ if (alwayslinemode && linemode && !uselinemode) {
+ uselinemode = 1;
+ tty_setlinemode(uselinemode);
+ }
+
+ if (uselinemode) {
+ /*
* Check for state of BINARY options.
+ *
+ * We only need to do the binary dance if we are actually going
+ * to use linemode. As this confuses some telnet clients
+ * that don't support linemode, and doesn't gain us
+ * anything, we don't do it unless we're doing linemode.
+ * -Crh (henrich@msu.edu)
*/
+
if (tty_isbinaryin()) {
if (his_want_state_is_wont(TELOPT_BINARY))
send_do(TELOPT_BINARY, 1);
@@ -161,24 +192,6 @@ localstat()
if (my_want_state_is_will(TELOPT_BINARY))
send_wont(TELOPT_BINARY, 1);
}
-
- /*
- * Check for changes to flow control if client supports it.
- */
- flowstat();
-
- /*
- * Check linemode on/off state
- */
- uselinemode = tty_linemode();
-
- /*
- * If alwayslinemode is on, and pty is changing to turn it off, then
- * force linemode back on.
- */
- if (alwayslinemode && linemode && !uselinemode) {
- uselinemode = 1;
- tty_setlinemode(uselinemode);
}
#ifdef ENCRYPTION
@@ -479,7 +492,7 @@ clientstat(code, parm1, parm2)
ack = (useeditmode & MODE_ACK);
useeditmode &= ~MODE_ACK;
- if (changed = (useeditmode ^ editmode)) {
+ if ((changed = (useeditmode ^ editmode))) {
/*
* This check is for a timing problem. If the
* state of the tty has changed (due to the user
OpenPOWER on IntegriCloud