--- tf-40s1/src/socket.c Sat Mar 6 22:43:25 1999 +++ tf-40s1-patched/src/socket.c Thu Jun 21 22:35:33 2001 @@ -228,6 +228,7 @@ static int FDECL(is_quiet,(CONST char *str)); static int FDECL(is_bamf,(CONST char *str)); static void FDECL(do_naws,(Sock *sock)); +static void FDECL(do_ttype,(Sock *sock)); static void FDECL(telnet_debug,(CONST char *dir, CONST char *str, int len)); static void NDECL(preferred_telnet_options); @@ -292,6 +293,8 @@ #define TN_DONT '\376' /* Stop ~ing!, or nack for WILL */ #define TN_IAC '\377' /* telnet Is A Command character */ +#define TN_Q_IS '\000' /* telnet TELQUAL_IS */ + #define UCHAR unsigned char #define IS_DO(sock, opt) VEC_ISSET((UCHAR)(opt), &(sock)->tn_do) @@ -364,6 +367,7 @@ telnet_label[(UCHAR)TN_DO] = "DO"; telnet_label[(UCHAR)TN_DONT] = "DONT"; telnet_label[(UCHAR)TN_IAC] = "IAC"; + telnet_label[(UCHAR)TN_TTYPE] = "TTYPE"; } /* main_loop @@ -1852,6 +1856,9 @@ telnet_recv(TN_DO, *place); if (IS_WILL(xsock, *place)) { /* we're already in the WILL state; ignore DO */ + } else if (*place == TN_TTYPE) { + WILL(TN_TTYPE); + do_ttype(xsock); } else if (*place == TN_NAWS) { /* handle and acknowledge */ WILL(TN_NAWS); @@ -2065,6 +2072,24 @@ xsock = old_xsock; } +static void do_ttype(sock) + Sock *sock; +{ + unsigned int width, height, i; + UCHAR octet[4]; + Sock *old_xsock; + + width = columns; + height = lines - (visual ? isize+1 : 0); + + Sprintf(telbuf, 0, "%c%c%c%c%s%c%c", TN_IAC, TN_SB, TN_TTYPE, TN_Q_IS, TERM, TN_IAC, TN_SE); + + old_xsock = xsock;; + xsock = sock; + telnet_send(telbuf); + xsock = old_xsock; +} + static void telnet_debug(dir, str, len) CONST char *dir, *str; int len; @@ -2136,6 +2161,9 @@ { WILL(TN_NAWS); set_WONT(TN_NAWS); /* so when we receive DO, we'll really do it */ + WILL(TN_TTYPE); + set_WONT(TN_TTYPE); /* so when we receive DO, we'll really do it */ + #if 0 WILL(TN_BINARY); /* allow us to send 8-bit data */ DO(TN_BINARY); /* allow server to send 8-bit data */