diff -urN /tmp/sendmail-8.9.0/BuildTools/OS/CYGWIN32 sendmail-8.9.0/BuildTools/OS/CYGWIN32
--- /tmp/sendmail-8.9.0/BuildTools/OS/CYGWIN32	Thu Jan 01 03:00:00 1970
+++ sendmail-8.9.0/BuildTools/OS/CYGWIN32	Wed Jun 03 15:32:05 1998
@@ -0,0 +1,18 @@
+#	@(#)CygWin32	8.4	(Berkeley)	3/22/98
+define(`confSTDIR', `/etc')
+define(`confHFDIR', `/usr/lib')
+define(`confCC', `gcc')
+define(`confDEPEND_TYPE', `CC-M')
+define(`confOPTIMIZE', `-O2')
+define(`confLIBS', `-ladvapi32')
+define(`confMANROOT', `/usr/man/man')
+define(`confENVDEF', `-DNETUNIX=0')
+define(`confMBINDIR', `/bin')
+define(`confSBINDIR', `/bin')
+define(`confEBINDIR', `/bin')
+define(`confMANOWN', `Administrator')
+define(`confMANGRP', `Administrators')
+define(`confSBINOWN', `Administrator')
+define(`confSBINGRP', `Administrators')
+define(`confUBINOWN', `Administrator')
+define(`confUBINGRP', `Administrators')
diff -urN /tmp/sendmail-8.9.0/BuildTools/bin/Build sendmail-8.9.0/BuildTools/bin/Build
--- /tmp/sendmail-8.9.0/BuildTools/bin/Build	Wed May 20 03:33:54 1998
+++ sendmail-8.9.0/BuildTools/bin/Build	Fri May 22 18:50:48 1998
@@ -234,6 +234,7 @@
 			rel=`uname -v | sed -e 's/\(V.*\)L.*/\1/'`
 		fi;;
   SINIX-?)	os=SINIX;;
+  CYGWIN*)	os=CYGWIN32;;
 esac
 
 # get "base part" of operating system release
diff -urN /tmp/sendmail-8.9.0/mail.local/mail.local.c sendmail-8.9.0/mail.local/mail.local.c
--- /tmp/sendmail-8.9.0/mail.local/mail.local.c	Wed May 20 03:41:42 1998
+++ sendmail-8.9.0/mail.local/mail.local.c	Tue Jun 02 15:35:44 1998
@@ -94,6 +94,13 @@
 # define _PATH_MAILDIR	"/usr/spool/mail"
 #endif
 
+#if defined(__CYGWIN32__)
+# define USE_LOCKF	1
+# define USE_SETEUID	1
+# define USE_VSYSLOG	0
+# define _PATH_MAILDIR	"/usr/spool/mail"
+#endif
+
 #if defined(ultrix)
 # define USE_VSYSLOG	0
 #endif
@@ -749,6 +756,7 @@
 	if (lstat(path, &sb) < 0) {
 		mbfd = open(path,
 			O_APPEND|O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR);
+#ifndef __CYGWIN32__
 		if (lstat(path, &sb) < 0)
 		{
 			eval = EX_CANTCREAT;
@@ -757,10 +765,17 @@
 		}
 		else
 			sb.st_uid = pw->pw_uid;
+#endif
 		if (mbfd == -1) {
 			if (errno == EEXIST)
 				goto tryagain;
-		} else if (fchown(mbfd, pw->pw_uid, pw->pw_gid)) {
+		} else if (
+#ifndef __CYGWIN32__
+			   fchown(mbfd,
+#else
+			   chown(path,
+#endif
+					 pw->pw_uid, pw->pw_gid)) {
 			mailerr("451 4.3.0", "chown %u.%u: %s",
 				pw->pw_uid, pw->pw_gid, name);
 			goto err1;
@@ -768,11 +783,13 @@
 	} else if (sb.st_nlink != 1 || !S_ISREG(sb.st_mode)) {
 		mailerr("550 5.2.0", "%s: irregular file", path);
 		goto err0;
+#ifndef __CYGWIN32__
 	} else if (sb.st_uid != pw->pw_uid) {
 		eval = EX_CANTCREAT;
 		mailerr("550 5.2.0", "%s: wrong ownership (%d)",
 				path, sb.st_uid);
 		goto err0;
+#endif
 	} else {
 		mbfd = open(path, O_APPEND|O_WRONLY, 0);
 	}
@@ -780,7 +797,9 @@
 	if (mbfd == -1) {
 		mailerr("450 4.2.0", "%s: %s", path, strerror(errno));
 		goto err0;
-	} else if (fstat(mbfd, &fsb) < 0 ||
+	}
+#ifndef __CYGWIN32__
+	  else if (fstat(mbfd, &fsb) < 0 ||
 	    fsb.st_nlink != 1 ||
 	    sb.st_nlink != 1 ||
 	    !S_ISREG(fsb.st_mode) ||
@@ -800,6 +819,7 @@
 		mailerr("450 4.2.0", "%s: %s", path, strerror(errno));
 		goto err1;
 	}
+#endif
 
 	/* Get the starting offset of the new message for biff. */
 	curoff = lseek(mbfd, (off_t)0, SEEK_END);
diff -urN /tmp/sendmail-8.9.0/rmail/rmail.c sendmail-8.9.0/rmail/rmail.c
--- /tmp/sendmail-8.9.0/rmail/rmail.c	Wed May 20 03:35:51 1998
+++ sendmail-8.9.0/rmail/rmail.c	Fri May 22 19:36:30 1998
@@ -66,6 +66,7 @@
 # undef EX_OK		/* unistd.h may have another use for this */
 #endif
 #include <sysexits.h>
+#include <errno.h>
 
 #ifndef MAX
 # define MAX(a, b)	((a) < (b) ? (b) : (a))
diff -urN /tmp/sendmail-8.9.0/src/conf.h sendmail-8.9.0/src/conf.h
--- /tmp/sendmail-8.9.0/src/conf.h	Wed May 20 03:36:04 1998
+++ sendmail-8.9.0/src/conf.h	Wed Jun 03 14:29:12 1998
@@ -532,6 +532,26 @@
 # endif
 #endif
 
+/* Cygwin32 */
+#ifdef	__CYGWIN32__
+# define LA_TYPE	LA_ZERO
+# define HASSETREUID	0	/* has setreuid(2) call */
+# define HASUNAME	1	/* use System V uname(2) system call */
+# define HASSETSID	1	/* has Posix setsid(2) call */
+# define HASINITGROUPS	0	/* has initgroups(3) call */
+# define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
+# define HASGETUSERSHELL 0	/* does not have getusershell(3) */
+# define HASUNSETENV	1
+# ifndef IDENTPROTO
+#  define IDENTPROTO	0	/* TCP/IP implementation is broken */
+# endif
+# define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
+# define SFS_TYPE	SFS_2ARGS	/* two argument statfs() call */
+# define setgroups(a,b) -1
+# define minor(x)	(x&0xff)
+# define major(x)	((x>>8)&0xff)
+
+#endif
 
 /*
 **  Digital Ultrix 4.2A or 4.3
diff -urN /tmp/sendmail-8.9.0/src/daemon.c sendmail-8.9.0/src/daemon.c
--- /tmp/sendmail-8.9.0/src/daemon.c	Wed May 20 03:36:06 1998
+++ sendmail-8.9.0/src/daemon.c	Wed Jun 03 00:29:31 1998
@@ -1162,6 +1162,7 @@
 	**  All in all, a bit of a mess.
 	*/
 
+#ifndef __CYGWIN32__
 	if (strchr(hostbuf, '.') == NULL &&
 	    !getcanonname(hostbuf, size, TRUE))
 	{
@@ -1180,6 +1181,7 @@
 				hostbuf);
 		}
 	}
+#endif
 	return (hp);
 }
 /*
diff -urN /tmp/sendmail-8.9.0/src/deliver.c sendmail-8.9.0/src/deliver.c
--- /tmp/sendmail-8.9.0/src/deliver.c	Wed May 20 03:36:08 1998
+++ sendmail-8.9.0/src/deliver.c	Tue Jun 02 15:49:08 1998
@@ -1821,7 +1821,11 @@
 			(void) setsid();
 
 			/* try to execute the mailer */
+#ifndef __CYGWIN32__
 			execve(m->m_mailer, (ARGV_T) pv, (ARGV_T) UserEnviron);
+#else
+			execv(m->m_mailer, (ARGV_T) pv);
+#endif
 			saveerrno = errno;
 			syserr("Cannot exec %s", m->m_mailer);
 			if (bitnset(M_LOCALMAILER, m->m_flags) ||
diff -urN /tmp/sendmail-8.9.0/src/main.c sendmail-8.9.0/src/main.c
--- /tmp/sendmail-8.9.0/src/main.c	Wed May 20 03:36:03 1998
+++ sendmail-8.9.0/src/main.c	Wed Jun 03 15:14:34 1998
@@ -416,7 +416,9 @@
 	/* clear sendmail's environment */
 	ExternalEnviron = environ;
 	emptyenviron[0] = NULL;
+#ifndef __CYGWIN32__
 	environ = emptyenviron;
+#endif
 
 	/*
 	** restore any original TZ setting until TimeZoneSpec has been
@@ -972,7 +974,13 @@
 
 	/* check for permissions */
 	if ((OpMode == MD_DAEMON || OpMode == MD_FGDAEMON ||
-	     OpMode == MD_PURGESTAT) && RealUid != 0)
+	     OpMode == MD_PURGESTAT) && RealUid
+#ifndef __CYGWIN32__
+						 != 0
+#else
+						 > 1000
+#endif
+							)
 	{
 		if (LogLevel > 1)
 			sm_syslog(LOG_ALERT, NOQID,
diff -urN /tmp/sendmail-8.9.0/src/queue.c sendmail-8.9.0/src/queue.c
--- /tmp/sendmail-8.9.0/src/queue.c	Wed May 20 03:36:08 1998
+++ sendmail-8.9.0/src/queue.c	Fri May 22 21:00:16 1998
@@ -431,13 +431,19 @@
 	{
 		/* rename (locked) tf to be (locked) qf */
 		qf = queuename(e, 'q');
+#ifdef __CYGWIN32__
+		if (e->e_lockfp != NULL)
+			(void) xfclose(e->e_lockfp, "queueup lockfp", e->e_id);
+#endif
 		if (rename(tf, qf) < 0)
 			syserr("cannot rename(%s, %s), uid=%d",
 				tf, qf, geteuid());
 
 		/* close and unlock old (locked) qf */
+#ifndef __CYGWIN32__
 		if (e->e_lockfp != NULL)
 			(void) xfclose(e->e_lockfp, "queueup lockfp", e->e_id);
+#endif
 		e->e_lockfp = tfp;
 	}
 	else
diff -urN /tmp/sendmail-8.9.0/src/safefile.c sendmail-8.9.0/src/safefile.c
--- /tmp/sendmail-8.9.0/src/safefile.c	Wed May 20 03:36:11 1998
+++ sendmail-8.9.0/src/safefile.c	Wed Jun 03 13:30:49 1998
@@ -191,6 +191,7 @@
 		if (!bitset(SFF_CREAT, flags) || file_errno != ENOENT)
 			return ret;
 
+#ifndef __CYGWIN32__
 		/* check to see if legal to create the file */
 		p = strrchr(dir, '/');
 		if (p == NULL)
@@ -229,6 +230,7 @@
 			if ((stbuf.st_mode & md) != md)
 				errno = EACCES;
 		}
+#endif /* __CYGWIN32__*/
 		ret = errno;
 		if (tTd(44, 4))
 			printf("\t[final dir %s uid %d mode %lo] %s\n",
diff -urN /tmp/sendmail-8.9.0/src/sendmail.h sendmail-8.9.0/src/sendmail.h
--- /tmp/sendmail-8.9.0/src/sendmail.h	Wed May 20 03:36:06 1998
+++ sendmail-8.9.0/src/sendmail.h	Tue Jun 02 15:50:30 1998
@@ -1284,7 +1284,9 @@
 EXTERN char	**ExternalEnviron;	/* input environment */
 EXTERN char	*UserEnviron[MAXUSERENVIRON + 1];
 					/* saved user environment */
+#ifndef __CYGWIN32__
 extern int	errno;
+#endif
 
 /*
 ** Queue Run Limitations
diff -urN /tmp/sendmail-8.9.0/src/util.c sendmail-8.9.0/src/util.c
--- /tmp/sendmail-8.9.0/src/util.c	Wed May 20 03:36:07 1998
+++ sendmail-8.9.0/src/util.c	Tue Jun 02 15:51:39 1998
@@ -1611,7 +1611,11 @@
 	}
 
 	/* now exec the process */
+#ifndef __CYGWIN32__
 	execve(argv[0], (ARGV_T) argv, (ARGV_T) UserEnviron);
+#else
+	execv(argv[0], (ARGV_T) argv);
+#endif
 
 	/* woops!  failed */
 	saveerrno = errno;
