Subject: bin/1816: tn3270 lacks escape
To: None <gnats-bugs@gnats.netbsd.org>
From: Simon J. Gerraty <sjg@hobbit.dn.itg.telecom.com.au>
List: netbsd-bugs
Date: 12/06/1995 17:15:58
>Number:         1816
>Category:       bin
>Synopsis:       tn3270 does not support telnet escape
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec  6 01:35:01 1995
>Last-Modified:
>Originator:     Simon J. Gerraty
>Organization:
	
>Release:        1995-08-18
>Environment:
	
System: NetBSD hobbit 1.0A NetBSD 1.0A (HOBBIT) #0: Thu Aug 17 13:06:38 EST 1995 root@hobbit:/usr/bsd_src/usr.src/sys/arch/sparc/compile/HOBBIT sparc


>Description:
	
Once tn3270 has connected to an IBM host, there is no way out short of 
killing it from another terminal or having the host close the session.

>How-To-Repeat:
	
tn3270 mvs_host

>Fix:
	
The following simple patch adds detection of the telnet escape and appears
not to interfere with tn3270 opperation.


*** tn3270/ascii/termin.c.~1~	Tue Apr 11 18:52:07 1995
--- tn3270/ascii/termin.c	Wed Dec  6 11:34:41 1995
***************
*** 53,58 ****
--- 53,78 ----
  
  #include "../general/globals.h"
  
+ #ifdef	USE_TERMIO
+ # ifndef	VINTR
+ #  ifdef SYSV_TERMIO
+ #   include <sys/termio.h>
+ #  else
+ #   include <sys/termios.h>
+ #   define termio termios
+ #  endif
+ # endif
+ #endif
+ #if defined(NO_CC_T) || !defined(USE_TERMIO)
+ # if !defined(USE_TERMIO)
+ typedef char cc_t;
+ # else
+ typedef unsigned char cc_t;
+ # endif
+ #endif
+ 
+ extern cc_t escape;
+ 
  #define IsControl(c)	(!isprint(c) || (isspace(c) && ((c) != ' ')))
  
  #define NextState(x)	(x->next)
***************
*** 191,197 ****
  register int	count;			/* how many bytes in this buffer */
  {
      register state *regControlPointer;
!     register char c;
      register int result;
      int origCount;
      extern int bellwinup;
--- 211,217 ----
  register int	count;			/* how many bytes in this buffer */
  {
      register state *regControlPointer;
!     register int c;
      register int result;
      int origCount;
      extern int bellwinup;
***************
*** 228,233 ****
--- 248,264 ----
      while (count) {
  	c = *buffer++&0x7f;
  	count--;
+ 
+ 	if (c == escape) {
+ 		if (count && (*buffer&0x7f) == escape) {
+ 			buffer++;
+ 			count--;
+ 		} else {
+ 			command(0, (char *)0, 0);
+ 			RefreshScreen();
+ 			continue;
+ 		}
+ 	}
  
  	if (!InControl && !IsControl(c)) {
  	    AddChar(c);			/* add ascii character */
>Audit-Trail:
>Unformatted: