*** kterm-6.1.0/main.c.ORG	Sun Jun  5 00:44:11 1994
--- kterm-6.1.0/main.c	Mon Mar 18 18:24:41 1996
***************
*** 149,154 ****
--- 149,155 ----
  
  #ifdef SVR4
  #undef TIOCSLTC				/* defined, but not useable */
+ #undef TIOCLSET
  #endif
  
  #if defined(sgi) && OSMAJORVERSION >= 5
***************
*** 989,998 ****
--- 990,1006 ----
  	** implementation to implementation).
  	*/
  #if defined(macII) || defined(ATT) || defined(CRAY)
+ #ifdef SVR4
+ 	d_tio.c_iflag = ICRNL|IXON|IGNPAR;
+ 	d_tio.c_oflag = OPOST|ONLCR|TAB3;
+     	d_tio.c_cflag = B9600|CS8|CREAD|HUPCL;
+     	d_tio.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOKE|ECHOCTL|IEXTEN;
+ #else
  	d_tio.c_iflag = ICRNL|IXON;
  	d_tio.c_oflag = OPOST|ONLCR|TAB3;
      	d_tio.c_cflag = B9600|CS8|CREAD|PARENB|HUPCL;
      	d_tio.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK;
+ #endif
  
  #ifndef USE_TERMIOS
  	d_tio.c_line = 0;
***************
*** 1003,1020 ****
  	d_tio.c_cc[VERASE] = CERASE;
  	d_tio.c_cc[VKILL] = CKILL;
      	d_tio.c_cc[VEOF] = CEOF;
! 	d_tio.c_cc[VEOL] = CNUL;
! 	d_tio.c_cc[VEOL2] = CNUL;
  	d_tio.c_cc[VSWTCH] = CNUL;
  
  #ifdef USE_TERMIOS
  	d_tio.c_cc[VSUSP] = CSUSP;
  	d_tio.c_cc[VDSUSP] = CDSUSP;
! 	d_tio.c_cc[VREPRINT] = CNUL;
! 	d_tio.c_cc[VDISCARD] = CNUL;
! 	d_tio.c_cc[VWERASE] = CNUL;
! 	d_tio.c_cc[VLNEXT] = CNUL;
  #endif
  #ifdef TIOCSLTC
          d_ltc.t_suspc = CSUSP;		/* t_suspc */
          d_ltc.t_dsuspc = CDSUSP;	/* t_dsuspc */
--- 1011,1048 ----
  	d_tio.c_cc[VERASE] = CERASE;
  	d_tio.c_cc[VKILL] = CKILL;
      	d_tio.c_cc[VEOF] = CEOF;
! #ifndef CEOL
! #define CEOL	CNULL
! #endif
! #ifndef CEOL2
! #define CEOL2	CNULL
! #endif
! 	d_tio.c_cc[VEOL] = CEOL;
! 	d_tio.c_cc[VEOL2] = CEOL2;
  	d_tio.c_cc[VSWTCH] = CNUL;
  
  #ifdef USE_TERMIOS
  	d_tio.c_cc[VSUSP] = CSUSP;
  	d_tio.c_cc[VDSUSP] = CDSUSP;
! 	d_tio.c_cc[VSTART] = CSTART;
! 	d_tio.c_cc[VSTOP] = CSTOP;
! #ifndef CPRINT
! #define CPRINT	CNULL
  #endif
+ #ifndef CFLUSH
+ #define CFLUSH	CNULL
+ #endif
+ #ifndef CWERASE
+ #define CWERASE	CNULL
+ #endif
+ #ifndef CLNEXT
+ #define CLNEXT	CNULL
+ #endif
+ 	d_tio.c_cc[VREPRINT] = CRPRNT;
+ 	d_tio.c_cc[VDISCARD] = CFLUSH;
+ 	d_tio.c_cc[VWERASE] = CWERASE;
+ 	d_tio.c_cc[VLNEXT] = CLNEXT;
+ #endif
  #ifdef TIOCSLTC
          d_ltc.t_suspc = CSUSP;		/* t_suspc */
          d_ltc.t_dsuspc = CDSUSP;	/* t_dsuspc */
***************
*** 1063,1068 ****
--- 1091,1106 ----
  #ifdef VSWTCH
  		    d_tio.c_cc[VSWTCH] = deftio.c_cc[VSWTCH];
  #endif /* VSWTCH */
+ #ifdef USE_TERMIOS
+ 		    d_tio.c_cc[VSTART] = deftio.c_cc[VSTART];
+ 		    d_tio.c_cc[VSTOP] = deftio.c_cc[VSTOP];
+ 		    d_tio.c_cc[VSUSP] = deftio.c_cc[VSUSP];
+ 		    d_tio.c_cc[VDSUSP] = deftio.c_cc[VDSUSP];
+ 		    d_tio.c_cc[VREPRINT] = deftio.c_cc[VREPRINT];
+ 		    d_tio.c_cc[VWERASE] = deftio.c_cc[VWERASE];
+ 		    d_tio.c_cc[VDISCARD] = deftio.c_cc[VDISCARD];
+ 		    d_tio.c_cc[VLNEXT] = deftio.c_cc[VLNEXT];
+ #endif
  		    break;
  		}
  	    }
***************
*** 1075,1080 ****
--- 1113,1119 ----
          d_ltc.t_werasc = '\377';
          d_ltc.t_lnextc = '\377';
  #endif	/* TIOCSLTC */
+ #if 0
  #ifdef USE_TERMIOS
  	d_tio.c_cc[VSUSP] = '\000';
  #ifndef linux
***************
*** 1085,1090 ****
--- 1124,1130 ----
  	d_tio.c_cc[VWERASE] = '\377';
  	d_tio.c_cc[VLNEXT] = '\377';
  #endif
+ #endif
  #ifdef TIOCLSET
  	d_lmode = 0;
  #endif	/* TIOCLSET */
***************
*** 1887,1892 ****
--- 1927,1935 ----
  		 */
   		if (tty < 0) {
  			if (tty_got_hung || errno == ENXIO || errno == EIO ||
+ #ifdef SVR4
+ 			    errno == EINVAL ||
+ #endif
  			    errno == ENOTTY) {
  				no_dev_tty = TRUE;
  #ifdef TIOCSLTC
***************
*** 2569,2574 ****
--- 2612,2620 ----
  #define PTYCHARLEN 2
  #endif
  
+ #ifdef SVR4
+ 		memset ((void *)&utmp, 0, sizeof(utmp));
+ #endif
  		(void) setutent ();
  		/* set up entry to search for */
  		ptyname = ttydev;
***************
*** 2608,2613 ****
--- 2654,2662 ----
  
  		utmp.ut_pid = getpid();
  #ifdef SVR4
+ 		utmp.ut_syslen = strlen(buf);
+ 		if (utmp.ut_syslen > sizeof(utmp.ut_host))
+ 		    utmp.ut_syslen = sizeof(utmp.ut_host);
  		utmp.ut_session = getsid(0);
  		utmp.ut_xtime = time ((Time_t *) 0);
  		utmp.ut_tv.tv_usec = 0;
***************
*** 2824,2830 ****
  #endif	/* TIOCSSIZE */
  #else	/* not sun */
  #ifdef TIOCSWINSZ
! 		ioctl (0, TIOCSWINSZ, (char *)&ws);
  #endif	/* TIOCSWINSZ */
  #endif	/* sun */
  
--- 2873,2885 ----
  #endif	/* TIOCSSIZE */
  #else	/* not sun */
  #ifdef TIOCSWINSZ
! 		{
! 			struct winsize old_ws;
! 			
! 			if (ioctl (0, TIOCGWINSZ, (char *)&old_ws)
! 			    || old_ws.ws_col <= 0 || old_ws.ws_row <= 0)
! 			    ioctl (0, TIOCSWINSZ, (char *)&ws);
! 		}
  #endif	/* TIOCSWINSZ */
  #endif	/* sun */
  
*** kterm-6.1.0/README.svr4.ORG	Fri Jul 22 12:57:04 1994
--- kterm-6.1.0/README.svr4	Thu Jul 28 11:31:08 1994
***************
*** 0 ****
--- 1,12 ----
+ 
+ This is a patched version of kterm 6.1.0
+ 
+ Some bugs around SVR4 tty mode setting and utmpx handling, which would have
+ been derived from the original xterm, are fixed in this patched version.
+ 
+ 
+ 						    July 28, 1994
+ 
+ 			Hiroshi Nakano <nakano@rins.ryukoku.ac.jp>
+ 			Ryukoku Univ., Seta, Otsu, Japan
+ 
