diff -urN ttyrec-1.0.8/ttyrec.c ttyrec-1.0.8-cygwin/ttyrec.c
--- ttyrec-1.0.8/ttyrec.c	2006-06-12 00:52:50.000000000 +0900
+++ ttyrec-1.0.8-cygwin/ttyrec.c	2007-05-08 22:27:06.000000000 +0900
@@ -72,6 +72,9 @@
 
 #ifdef HAVE_openpty
 #include <libutil.h>
+#elif defined(__CYGWIN__)
+#include <pty.h>
+#define HAVE_openpty
 #endif
 
 #if defined(SVR4) && !defined(CDEL)
@@ -349,6 +352,12 @@
 	rtt.c_cc[VKILL] = CDEL;
 	rtt.c_cc[VEOF] = 1;
 	rtt.c_cc[VEOL] = 0;
+#elif defined(__CYGWIN__)
+	rtt.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+	rtt.c_oflag &= ~OPOST;
+	rtt.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+	rtt.c_cflag &= ~(CSIZE|PARENB);
+	rtt.c_cflag |= CS8;
 #else /* !SVR4 */
 	cfmakeraw(&rtt);
 	rtt.c_lflag &= ~ECHO;
@@ -478,6 +487,8 @@
 	(void) ioctl(slave, TIOCSWINSZ, (char *)&win);
 #endif
 	(void) setsid();
+#if !defined(__CYGWIN__)
 	(void) ioctl(slave, TIOCSCTTY, 0);
+#endif
 #endif /* SVR4 */
 }
