From 0b32f6e068762ddbc995ff07f9609aaa30174b37 Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Sat, 29 Nov 1997 02:28:37 +0000 Subject: [PATCH] Change binary mode to do just that, and add a eight-bit mode for just passing all characters. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4064 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/telnet/telnet/externs.h | 1 + appl/telnet/telnet/main.c | 3 +++ appl/telnet/telnet/telnet.c | 11 ++++++----- appl/telnet/telnet/terminal.c | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/appl/telnet/telnet/externs.h b/appl/telnet/telnet/externs.h index bcee2b764..183a588c5 100644 --- a/appl/telnet/telnet/externs.h +++ b/appl/telnet/telnet/externs.h @@ -56,6 +56,7 @@ extern int autologin, /* Autologin enabled */ skiprc, /* Don't process the ~/.telnetrc file */ eight, /* use eight bit mode (binary in and/or out */ + binary, flushout, /* flush output */ connected, /* Are we connected to the other side? */ globalmode, /* Mode tty should be in */ diff --git a/appl/telnet/telnet/main.c b/appl/telnet/telnet/main.c index 547bdbc99..a2b9e4dbd 100644 --- a/appl/telnet/telnet/main.c +++ b/appl/telnet/telnet/main.c @@ -127,6 +127,9 @@ main(int argc, char **argv) case '7': eight = 0; break; + case 'b': + binary = 3; + break; case 'D': { /* sometimes we don't want a mangled display */ char *p; diff --git a/appl/telnet/telnet/telnet.c b/appl/telnet/telnet/telnet.c index 436e769ec..f3a4f8028 100644 --- a/appl/telnet/telnet/telnet.c +++ b/appl/telnet/telnet/telnet.c @@ -35,7 +35,7 @@ RCSID("$Id$"); -#define strip(x) ((my_want_state_is_wont(TELOPT_BINARY)) ? ((x)&0x7f) : (x)) +#define strip(x) (eight ? (x) : ((x) & 0x7f)) static unsigned char subbuffer[SUBBUFSIZE], *subpointer, *subend; /* buffer for sub-options */ @@ -56,6 +56,7 @@ char will_wont_resp[256]; int eight = 3, + binary = 0, autologin = 0, /* Autologin anyone? */ skiprc = 0, connected, @@ -1594,9 +1595,9 @@ telrcv(void) telrcv_state = TS_IAC; break; } - /* + /* * The 'crmod' hack (see following) is needed - * since we can't * set CRMOD on output only. + * since we can't set CRMOD on output only. * Machines like MULTICS like to send \r without * \n; since we must turn off CRMOD to get proper * input, the mapping is done here (sigh). @@ -2026,8 +2027,8 @@ telnet(char *user) send_do(TELOPT_STATUS, 1); if (env_getvalue((unsigned char *)"DISPLAY")) send_will(TELOPT_XDISPLOC, 1); - if (eight) - tel_enter_binary(eight); + if (binary) + tel_enter_binary(binary); } for (;;) { diff --git a/appl/telnet/telnet/terminal.c b/appl/telnet/telnet/terminal.c index e6afebf53..ce80e0873 100644 --- a/appl/telnet/telnet/terminal.c +++ b/appl/telnet/telnet/terminal.c @@ -163,10 +163,10 @@ getconnmode(void) if (localflow) mode |= MODE_FLOW; - if (my_want_state_is_will(TELOPT_BINARY)) + if ((eight & 1) || my_want_state_is_will(TELOPT_BINARY)) mode |= MODE_INBIN; - if (his_want_state_is_will(TELOPT_BINARY)) + if ((eight & 2) || his_want_state_is_will(TELOPT_BINARY)) mode |= MODE_OUTBIN; #ifdef KLUDGELINEMODE