From d08da801604640613ef64282626585e6ae3eece0 Mon Sep 17 00:00:00 2001
From: Erik Ekman <yarrick@kryo.se>
Date: Sat, 24 Jan 2009 22:12:00 +0000
Subject: [PATCH] revert cygwin stuff

---
 src/common.c   |  8 +-------
 src/dns.c      |  4 ----
 src/iodine.c   |  4 ----
 src/iodined.c  |  7 +------
 src/windows.h  | 49 -------------------------------------------------
 tests/Makefile |  2 +-
 tests/dns.c    |  4 ----
 tests/read.c   |  4 ----
 8 files changed, 3 insertions(+), 79 deletions(-)

diff --git a/src/common.c b/src/common.c
index 18e1255..22b6d38 100644
--- a/src/common.c
+++ b/src/common.c
@@ -15,11 +15,7 @@
  */
 
 #include <arpa/inet.h>
-#ifndef __CYGWIN__
 #include <arpa/nameser.h>
-#else
-#include "windows.h"
-#endif
 #include <netinet/in.h>
 #ifdef DARWIN
 #include <arpa/nameser8_compat.h>
@@ -42,7 +38,7 @@
 #include "common.h"
 
 /* daemon(3) exists only in 4.4BSD or later, and in GNU libc */
-#if !(defined(__CYGWIN__)) && !(defined(BSD) && (BSD >= 199306)) && !defined(__GLIBC__)
+#if !(defined(BSD) && (BSD >= 199306)) && !defined(__GLIBC__)
 static int daemon(int nochdir, int noclose)
 {
  	int fd, i;
@@ -90,13 +86,11 @@ int setgroups(int count, int *groups)
 void
 check_superuser(void (*usage_fn)(void))
 {
-#ifndef __CYGWIN__
 	if (geteuid() != 0) {
 		warnx("Run as root and you'll be happy.\n");
 		usage_fn();
 		/* NOTREACHED */
 	}
-#endif
 }
 
 int 
diff --git a/src/dns.c b/src/dns.c
index 670efb6..df06fd1 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -15,11 +15,7 @@
  */
 
 #include <arpa/inet.h>
-#ifndef __CYGWIN__
 #include <arpa/nameser.h>
-#else
-#include "windows.h"
-#endif
 #ifdef DARWIN
 #include <arpa/nameser8_compat.h>
 #endif
diff --git a/src/iodine.c b/src/iodine.c
index 84f948a..67a9bff 100644
--- a/src/iodine.c
+++ b/src/iodine.c
@@ -32,11 +32,7 @@
 #include <pwd.h>
 #include <arpa/inet.h>
 #include <zlib.h>
-#ifndef __CYGWIN__
 #include <arpa/nameser.h>
-#else
-#include "windows.h"
-#endif
 #ifdef DARWIN
 #include <arpa/nameser8_compat.h>
 #endif
diff --git a/src/iodined.c b/src/iodined.c
index 04ac796..3295d44 100644
--- a/src/iodined.c
+++ b/src/iodined.c
@@ -36,11 +36,7 @@
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #include <zlib.h>
-#ifndef __CYGWIN__
 #include <arpa/nameser.h>
-#else
-#include "windows.h"
-#endif
 #ifdef DARWIN
 #include <arpa/nameser8_compat.h>
 #endif
@@ -803,7 +799,6 @@ read_dns(int fd, struct query *q)
 		memcpy((struct sockaddr*)&q->from, (struct sockaddr*)&from, addrlen);
 		q->fromlen = addrlen;
 		
-#ifndef __CYGWIN__
 		for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; 
 			cmsg = CMSG_NXTHDR(&msg, cmsg)) { 
 			
@@ -814,7 +809,7 @@ read_dns(int fd, struct query *q)
 				break;
 			} 
 		}
-#endif
+
 		return strlen(q->name);
 	} else if (r < 0) { 
 		/* Error */
diff --git a/src/windows.h b/src/windows.h
index cf98847..e69de29 100644
--- a/src/windows.h
+++ b/src/windows.h
@@ -1,49 +0,0 @@
-#define T_A 1
-#define T_NS 2
-#define T_NULL 10
-
-#define C_IN 1
-
-#define NOERROR 0
-#define SERVFAIL 2
-#define NXDOMAIN 3
-#define NOTIMP 4
-#define REFUSED 5
-
-typedef struct {
-        unsigned        id :16;         /* query identification number */
-#if BYTE_ORDER == BIG_ENDIAN
-                        /* fields in third byte */
-        unsigned        qr: 1;          /* response flag */
-        unsigned        opcode: 4;      /* purpose of message */
-        unsigned        aa: 1;          /* authoritive answer */
-        unsigned        tc: 1;          /* truncated message */
-        unsigned        rd: 1;          /* recursion desired */
-                        /* fields in fourth byte */
-        unsigned        ra: 1;          /* recursion available */
-        unsigned        unused :1;      /* unused bits (MBZ as of 4.9.3a3) */
-        unsigned        ad: 1;          /* authentic data from named */
-        unsigned        cd: 1;          /* checking disabled by resolver */
-        unsigned        rcode :4;       /* response code */
-#endif
-#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
-                        /* fields in third byte */
-        unsigned        rd :1;          /* recursion desired */
-        unsigned        tc :1;          /* truncated message */
-        unsigned        aa :1;          /* authoritive answer */
-        unsigned        opcode :4;      /* purpose of message */
-        unsigned        qr :1;          /* response flag */
-                        /* fields in fourth byte */
-        unsigned        rcode :4;       /* response code */
-        unsigned        cd: 1;          /* checking disabled by resolver */
-        unsigned        ad: 1;          /* authentic data from named */
-        unsigned        unused :1;      /* unused bits (MBZ as of 4.9.3a3) */
-        unsigned        ra :1;          /* recursion available */
-#endif
-                        /* remaining bytes */
-        unsigned        qdcount :16;    /* number of question entries */
-        unsigned        ancount :16;    /* number of answer entries */
-        unsigned        nscount :16;    /* number of authority entries */
-        unsigned        arcount :16;    /* number of resource entries */
-} HEADER;
-
diff --git a/tests/Makefile b/tests/Makefile
index 6dea799..79f51f0 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -23,5 +23,5 @@ $(TEST): $(OBJS) $(SRCOBJS)
 
 clean:
 	@echo "Cleaning tests/"
-	@rm -f *~ *.core $(TEST){,exe} $(OBJS)
+	@rm -f *~ *.core $(TEST) $(OBJS)
 
diff --git a/tests/dns.c b/tests/dns.c
index eec28e4..185f158 100644
--- a/tests/dns.c
+++ b/tests/dns.c
@@ -23,11 +23,7 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/stat.h>
-#ifndef __CYGWIN__
 #include <arpa/nameser.h>
-#else
-#include "windows.h"
-#endif
 
 #include "common.h"
 #include "dns.h"
diff --git a/tests/read.c b/tests/read.c
index 8c7618b..ab55341 100644
--- a/tests/read.c
+++ b/tests/read.c
@@ -18,11 +18,7 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/stat.h>
-#ifndef __CYGWIN__
 #include <arpa/nameser.h>
-#else
-#include "windows.h"
-#endif
 #ifdef DARWIN
 #include <arpa/nameser8_compat.h>
 #endif