diff -aurN kterm-6.2.0-orig/Imakefile kterm-6.2.0/Imakefile
--- kterm-6.2.0-orig/Imakefile	Fri Jul 12 14:01:04 1996
+++ kterm-6.2.0/Imakefile	Fri Aug 31 22:05:08 2001
@@ -57,7 +57,8 @@
            SRCS = $(SRCS1)
            OBJS = $(OBJS1)
        DEPLIBS1 = XkbClientDepLibs XawClientDepLibs
-       PROGRAMS = kterm
+XCOMM       PROGRAMS = kterm
+       PROGRAMS = kterm.exe
 
 #ifndef TermcapLibrary
 #if SystemV && !defined(MacIIArchitecture)
@@ -71,7 +72,8 @@
 #endif
 #endif
 
-     TERMCAPLIB = TermcapLibrary
+XCOMM     TERMCAPLIB = TermcapLibrary
+     TERMCAPLIB = -ltermcap
 
 AllTarget($(PROGRAMS))
 
diff -aurN kterm-6.2.0-orig/KTerm.ad kterm-6.2.0/KTerm.ad
--- kterm-6.2.0-orig/KTerm.ad	Sun Jun 23 17:00:22 1996
+++ kterm-6.2.0/KTerm.ad	Fri Aug 31 22:03:01 2001
@@ -123,3 +123,5 @@
 *tek4014*font3: 6x13
 *tek4014*fontSmall: 6x10
 
+*VT100.translations: #override Alt <Key>Kanji: begin-conversion()
+*VT100*kanjiMode:		sjis
diff -aurN kterm-6.2.0-orig/main.c kterm-6.2.0/main.c
--- kterm-6.2.0-orig/main.c	Fri Jul 12 14:01:38 1996
+++ kterm-6.2.0/main.c	Sat Sep  1 20:05:58 2001
@@ -97,8 +97,8 @@
 #define USE_SYSV_SIGNALS
 #endif
 
-#ifdef SVR4
-#ifndef SYSV
+#if defined(SVR4)
+#if !defined(SYSV)
 #define SYSV			/* SVR4 is (approx) superset of SVR3 */
 #endif
 #define ATT
@@ -142,6 +142,21 @@
 #define WTMP
 #endif
 
+#ifdef __CYGWIN__
+#define LASTLOG
+#define WTMP
+#define ATT
+#define USE_USG_PTYS
+#define USE_SYSV_TERMIO
+#define USE_SYSV_SIGNALS
+#define USE_SYSV_PGRP
+#define USE_SYSV_ENVVARS		/* COLUMNS/LINES vs. TERMCAP */
+/* #define USE_SYSV_UTMP */
+#define USE_HANDSHAKE
+#define USE_SYSV_SIGHUP
+/* #define KANJI */
+#endif
+
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 
@@ -155,12 +170,12 @@
 #undef TCSETA
 #define TCSETA TCSETS
 #else /* USE_TERMIOS */
-#ifdef SYSV
+#if defined(SYSV) || defined(__CYGWIN__)
 #include <sys/termio.h>
 #endif /* SYSV */
 #endif /* USE_TERMIOS else */
 
-#ifdef SVR4
+#if defined(SVR4) || defined(__CYGWIN__)
 #undef TIOCSLTC				/* defined, but not useable */
 #endif
 
@@ -168,11 +183,13 @@
 #undef TIOCLSET				/* defined, but not useable */
 #endif
 
-#ifdef SYSV /* { */
+#if defined(SYSV) || defined(__CYGWIN__) /* { */
 #ifdef USE_USG_PTYS			/* AT&T SYSV has no ptyio.h */
+#ifndef __CYGWIN__
 #include <sys/stream.h>			/* get typedef used in ptem.h */
 #include <sys/stropts.h>		/* for I_PUSH */
-#ifndef SVR4
+#endif
+#if !defined(SVR4) && !defined(__CYGWIN__)
 #include <sys/ptem.h>			/* get struct winsize */
 #endif
 #include <poll.h>			/* for POLLIN */
@@ -224,7 +241,7 @@
 #define HAS_UTMP_UT_HOST
 #endif
 #else /* } !SYSV { */			/* BSD systems */
-#ifndef linux
+#if !defined(linux)
 #include <sgtty.h>
 #endif
 #include <sys/resource.h>
@@ -239,7 +256,7 @@
 #ifdef _POSIX_SOURCE
 #define USE_POSIX_WAIT
 #endif
-#ifdef SVR4
+#if defined(SVR4) || defined(__CYGWIN__)
 #define USE_POSIX_WAIT
 #endif
 
@@ -264,7 +281,7 @@
 #define ttyslot() 1
 #endif /* apollo */
 
-#ifdef SVR4
+#if defined(SVR4)
 #include <utmpx.h>
 #define setutent setutxent
 #define getutent getutxent
@@ -321,7 +338,7 @@
 #ifdef _PATH_WTMP
 #define WTMP_FILENAME _PATH_WTMP
 #else
-#ifdef SYSV
+#if defined(SYSV) || defined(__CYGWIN__)
 #define WTMP_FILENAME "/etc/wtmp"
 #else
 #define WTMP_FILENAME "/usr/adm/wtmp"
@@ -381,7 +398,7 @@
 #include <locale.h>
 #endif
 
-#ifdef SYSV
+#if defined(SYSV) || defined(__CYGWIN__)
 extern char *ptsname();
 #endif
 
@@ -1148,7 +1165,9 @@
     	d_tio.c_cc[VEOF] = CEOF;
 	d_tio.c_cc[VEOL] = CNUL;
 	d_tio.c_cc[VEOL2] = CNUL;
+#ifndef __CYGWIN__
 	d_tio.c_cc[VSWTCH] = CNUL;
+#endif
 
 #ifdef USE_TERMIOS /* { */
 	d_tio.c_cc[VSUSP] = CSUSP;
@@ -1715,7 +1734,7 @@
 	if ((*pty = open ("/dev/ptmx", O_RDWR)) < 0) {
 	    return 1;
 	}
-#if defined(SVR4) || defined(i386)
+#if defined(SVR4) || defined(i386) || defined(__CYGWIN__)
 	strcpy(ttydev, ptsname(*pty));
 #if defined (SYSV) && defined(i386) && !defined(SVR4)
 	IsPts = True;
@@ -2060,7 +2079,7 @@
 #endif	/* sun */
 	struct passwd *pw = NULL;
 #ifdef UTMP
-#ifdef SVR4
+#if defined(SVR4)
 	struct utmpx utmp;
 #else
 	struct utmp utmp;
@@ -2105,6 +2124,12 @@
  		alarm(2);		/* alarm(1) might return too soon */
  		if (! setjmp(env)) {
  			tty = open ("/dev/tty", O_RDWR, 0);
+#ifdef __CYGWIN__
+			if (tty == -1) {	/* retry for Cygwin */
+				alarm(2);
+				tty = open("/dev/tty", O_RDWR, 0);
+			}
+#endif
  			alarm(0);
  		} else {
 			tty_got_hung = True;
@@ -2334,7 +2359,7 @@
 		 * now in child process
 		 */
 		extern char **environ;
-#if defined(_POSIX_SOURCE) || defined(SVR4) || defined(__convex__)
+#if defined(_POSIX_SOURCE) || defined(SVR4) || defined(__convex__) || defined(__CYGWIN__)
 		int pgrp = setsid();
 #else
 		int pgrp = getpid();
@@ -2361,18 +2386,22 @@
 		if ((ptyfd = open (ptsname(screen->respond), O_RDWR)) < 0) {
 		    SysError (1);
 		}
+#if !defined(__CYGWIN__)
 		if (ioctl (ptyfd, I_PUSH, "ptem") < 0) {
 		    SysError (2);
 		}
-#if !defined(SVR4) && !(defined(SYSV) && defined(i386))
+#endif
+#if !defined(SVR4) && !(defined(SYSV) && defined(i386)) && !defined(__CYGWIN__)
 		if (!getenv("CONSEM") && ioctl (ptyfd, I_PUSH, "consem") < 0) {
 		    SysError (3);
 		}
 #endif /* !SVR4 */
+#if !defined(__CYGWIN__)
 		if (ioctl (ptyfd, I_PUSH, "ldterm") < 0) {
 		    SysError (4);
 		}
-#ifdef SVR4			/* from Sony */
+#endif
+#if defined(SVR4)  /* from Sony */
 		if (ioctl (ptyfd, I_PUSH, "ttcompat") < 0) {
 		    SysError (5);
 		}
@@ -2946,7 +2975,7 @@
 
 		/* set up the new entry */
 		utmp.ut_type = USER_PROCESS;
-#ifndef linux
+#if !defined(linux) && !defined(__CYGWIN__)
 		utmp.ut_exit.e_exit = 2;
 #endif
 		(void) strncpy(utmp.ut_user,
@@ -2978,7 +3007,7 @@
 			       sizeof(utmp.ut_name));
 
 		utmp.ut_pid = getpid();
-#ifdef SVR4
+#if defined(SVR4)
 		utmp.ut_session = getsid(0);
 		utmp.ut_xtime = time ((Time_t *) 0);
 		utmp.ut_tv.tv_usec = 0;
@@ -2990,7 +3019,7 @@
 		if (!resource.utmpInhibit)
 		    (void) pututline(&utmp);
 #ifdef WTMP
-#ifdef SVR4
+#if defined(SVR4)
 		if (term->misc.login_shell)
 		    updwtmpx(WTMPX_FILE, &utmp);
 #else
@@ -3388,7 +3417,7 @@
         int pty = term->screen.respond;  /* file descriptor of pty */
 #ifdef UTMP
 #ifdef USE_SYSV_UTMP
-#ifdef SVR4
+#if defined(SVR4)
 	struct utmpx utmp;
 	struct utmpx *utptr;
 #else
@@ -3429,7 +3458,7 @@
 	    /* write it out only if it exists, and the pid's match */
 	    if (utptr && (utptr->ut_pid == screen->pid)) {
 		    utptr->ut_type = DEAD_PROCESS;
-#ifdef SVR4
+#if defined(SVR4)
 		    utmp.ut_session = getsid(0);
 		    utmp.ut_xtime = time ((Time_t *) 0);
 		    utmp.ut_tv.tv_usec = 0;
@@ -3438,7 +3467,7 @@
 #endif
 		    (void) pututline(utptr);
 #ifdef WTMP
-#ifdef SVR4
+#if defined(SVR4)
 		    updwtmpx(WTMPX_FILE, &utmp);
 #else
 		    /* set wtmp entry if wtmp file exists */
@@ -3696,6 +3725,16 @@
 #else
 #if defined(KTERM_XAW3D) && defined(FIORDCK)
     return ioctl (fd, FIORDCHK, NULL);
+#elif defined(__CYGWIN__)
+    fd_set set;
+    struct timeval timeout = {0, 0};
+
+    FD_ZERO (&set);
+    FD_SET (fd, &set);
+    if (select (fd+1, &set, NULL, NULL, &timeout) > 0)
+      return 1;
+    else
+      return 0;
 #else /* !KTERM_XAW3D || !FIORDCK */
     struct pollfd pollfds[1];
 
@@ -3717,7 +3756,7 @@
 #ifndef X_NOT_POSIX
     return kill (-pid, sig);
 #else
-#if defined(SVR4) || defined(SYSV)
+#if defined(SVR4) || defined(SYSV) || defined(__CYGWIN__)
     return kill (-pid, sig);
 #else
     return killpg (pid, sig);
