aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-12-12 06:39:39 +0000
committerIOhannes m zmölnig <zmoelnig@iem.at>2015-10-14 13:53:22 +0200
commit5a7e7f61c9e5416c71ed4bfef74b09f0a5a556ef (patch)
treea84010f1d9705cf939e3fc598dd9172747b00d5a /src
parentff6b00b82c7f3f1a1efae7ba00894604aa70a60d (diff)
fixes for MinGW
svn path=/trunk/externals/maxlib/; revision=4194
Diffstat (limited to 'src')
-rw-r--r--src/netclient.c6
-rw-r--r--src/netdist.c18
-rw-r--r--src/netrec.c10
-rw-r--r--src/netserver.c10
4 files changed, 21 insertions, 23 deletions
diff --git a/src/netclient.c b/src/netclient.c
index a038ae6..b053101 100644
--- a/src/netclient.c
+++ b/src/netclient.c
@@ -32,7 +32,9 @@
#include <sys/types.h>
#include <string.h>
#include <pthread.h>
-#ifdef UNIX
+#ifdef WIN32
+#include <winsock.h>
+#else
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/errno.h>
@@ -41,8 +43,6 @@
#include <stdio.h>
#include <unistd.h>
#define SOCKET_ERROR -1
-#else
-#include <winsock.h>
#endif
#define INBUFSIZE 4096 /* maximum numbers of characters to read */
diff --git a/src/netdist.c b/src/netdist.c
index 648f093..866dc36 100644
--- a/src/netdist.c
+++ b/src/netdist.c
@@ -29,7 +29,9 @@
#include <sys/types.h>
#include <string.h>
#include <pthread.h>
-#ifdef UNIX
+#ifdef WIN32
+#include <winsock.h>
+#else
#include <sys/socket.h>
#include <sys/errno.h>
#include <netinet/in.h>
@@ -37,8 +39,6 @@
#include <stdio.h>
#include <unistd.h>
#define SOCKET_ERROR -1
-#else
-#include <winsock.h>
#endif
#define MAX_REC 32
@@ -63,11 +63,10 @@ typedef struct _netdist
static void sys_sockerror(char *s)
{
-#ifdef NT
+#ifdef WIN32
int err = WSAGetLastError();
if (err == 10054) return;
-#endif
-#ifdef UNIX
+#else
int err = errno;
#endif
post("%s: %s (%d)\n", s, strerror(err), err);
@@ -75,11 +74,10 @@ static void sys_sockerror(char *s)
static void sys_closesocket(int fd) {
-#ifdef UNIX
- close(fd);
-#endif
-#ifdef NT
+#ifdef WIN32
closesocket(fd);
+#else
+ close(fd);
#endif
}
diff --git a/src/netrec.c b/src/netrec.c
index 754f088..9e89521 100644
--- a/src/netrec.c
+++ b/src/netrec.c
@@ -33,7 +33,11 @@
#include <errno.h>
#include <string.h>
#include <stdio.h>
-#ifdef UNIX
+#ifdef WIN32
+#include <io.h>
+#include <fcntl.h>
+#include <winsock.h>
+#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -43,10 +47,6 @@
#include <stdlib.h>
#include <sys/time.h>
#define SOCKET_ERROR -1
-#else
-#include <io.h>
-#include <fcntl.h>
-#include <winsock.h>
#endif
#define MAX_CONNECT 32 /* maximum number of connections */
diff --git a/src/netserver.c b/src/netserver.c
index 32bb009..196d29f 100644
--- a/src/netserver.c
+++ b/src/netserver.c
@@ -35,7 +35,11 @@
#include <string.h>
#include <stdio.h>
#include <pthread.h>
-#ifdef UNIX
+#ifdef WIN32
+#include <io.h>
+#include <fcntl.h>
+#include <winsock.h>
+#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -45,10 +49,6 @@
#include <stdlib.h>
#include <sys/time.h>
#define SOCKET_ERROR -1
-#else
-#include <io.h>
-#include <fcntl.h>
-#include <winsock.h>
#endif
#define MAX_CONNECT 32 /* maximum number of connections */