Index: Tools/gdomap.c =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/base/Tools/gdomap.c,v retrieving revision 1.100 diff -u -r1.100 gdomap.c --- Tools/gdomap.c 15 Jul 2005 22:51:21 -0000 1.100 +++ Tools/gdomap.c 11 Oct 2005 18:44:21 -0000 @@ -23,8 +23,8 @@ /* Ported to mingw 07/12/00 by Björn Giesler */ #ifdef __MINGW32__ -#ifndef __MINGW__ -#define __MINGW__ +#ifndef __MINGW32__ +#define __MINGW32__ #endif #endif @@ -32,20 +32,20 @@ #include #include #include /* for gethostname() */ -#ifndef __MINGW__ +#ifndef __MINGW32__ #include /* for MAXHOSTNAMELEN */ #include #include #include #include /* for inet_ntoa() */ -#endif /* !__MINGW__ */ +#endif /* !__MINGW32__ */ #include #include #include /* for strchr() */ #include /* for strchr() */ #include #include "config.h" -#ifdef __MINGW__ +#ifdef __MINGW32__ #include #include #include @@ -93,7 +93,7 @@ #if defined(__svr4__) #include #endif -#endif /* !__MINGW__ */ +#endif /* !__MINGW32__ */ #ifdef HAVE_SYSLOG_H @@ -133,7 +133,7 @@ __a*((__v+__a-1)/__a); }) typedef unsigned char *uptr; -#ifndef __MINGW__ +#ifndef __MINGW32__ static int is_daemon = 0; /* Currently running as daemon. */ #endif static int debug = 0; /* Extra debug gdomap_logging. */ @@ -165,7 +165,7 @@ * Predeclare some of the functions used. */ static void dump_stats(); -#ifndef __MINGW__ +#ifndef __MINGW32__ static void dump_tables(); #endif static void handle_accept(); @@ -186,7 +186,7 @@ char *xgethostname (void); -#ifdef __MINGW__ +#ifdef __MINGW32__ #ifndef HAVE_GETOPT /* A simple implementation of getopt() */ @@ -382,11 +382,11 @@ Bjoern Giesler to work on Win32. */ typedef struct { -#ifdef __MINGW__ +#ifdef __MINGW32__ SOCKET s; #else int s; -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ struct sockaddr_in addr; /* Address of process making request. */ unsigned int pos; /* Position reading data. */ union { @@ -396,11 +396,11 @@ } RInfo; /* State of reading each request. */ typedef struct { -#ifdef __MINGW__ +#ifdef __MINGW32__ SOCKET s; #else int s; -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ int len; /* Length of data to be written. */ int pos; /* Amount of data already written. */ char* buf; /* Buffer for data. */ @@ -414,11 +414,11 @@ static unsigned _wInfoCount = 0; static void -#ifdef __MINGW__ +#ifdef __MINGW32__ delRInfo(SOCKET s) #else delRInfo(int s) -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ { unsigned int i; @@ -445,7 +445,7 @@ static RInfo * -#ifdef __MINGW__ +#ifdef __MINGW32__ getRInfo(SOCKET s, int make) #else getRInfo(int s, int make) @@ -487,11 +487,11 @@ } static void -#ifdef __MINGW__ +#ifdef __MINGW32__ delWInfo(SOCKET s) #else delWInfo(int s) -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ { unsigned int i; @@ -518,7 +518,7 @@ static WInfo * -#ifdef __MINGW__ +#ifdef __MINGW32__ getWInfo(SOCKET s, int make) #else getWInfo(int s, int make) @@ -968,7 +968,7 @@ static void clear_chan(int desc) { -#ifdef __MINGW__ +#ifdef __MINGW32__ if (desc != INVALID_SOCKET) #else if (desc >= 0 && desc < FD_SETSIZE) @@ -984,7 +984,7 @@ else { FD_CLR(desc, &read_fds); -#ifdef __MINGW__ +#ifdef __MINGW32__ closesocket(desc); #else close(desc); @@ -1038,7 +1038,7 @@ gdomap_log(LOG_INFO); } -#ifndef __MINGW__ +#ifndef __MINGW32__ static void dump_tables() { @@ -1085,7 +1085,7 @@ static void init_iface() { -#ifdef __MINGW__ +#ifdef __MINGW32__ INTERFACE_INFO InterfaceList[20]; unsigned long nBytesReturned; int i, countActive, nNumInterfaces; @@ -1642,9 +1642,9 @@ { int r; struct sockaddr_in sa; -#ifdef __MINGW__ +#ifdef __MINGW32__ unsigned long dummy; -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ /* * Now we set up the sockets to accept incoming connections and set @@ -1653,7 +1653,7 @@ */ udp_desc = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); -#ifdef __MINGW__ +#ifdef __MINGW32__ if (udp_desc == INVALID_SOCKET) #else if (udp_desc < 0) @@ -1692,7 +1692,7 @@ gdomap_log(LOG_WARNING); } } -#ifdef __MINGW__ +#ifdef __MINGW32__ dummy = 1; if (ioctlsocket(udp_desc, FIONBIO, &dummy) < 0) { @@ -1700,7 +1700,7 @@ gdomap_log(LOG_CRIT); exit(EXIT_FAILURE); } -#else /* !__MINGW__ */ +#else /* !__MINGW32__ */ if ((r = fcntl(udp_desc, F_GETFL, 0)) >= 0) { r |= NBLK_OPT; @@ -1746,7 +1746,7 @@ * Now we do the TCP socket. */ tcp_desc = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); -#ifdef __MINGW__ +#ifdef __MINGW32__ if (tcp_desc == INVALID_SOCKET) #else if (tcp_desc < 0) @@ -1776,7 +1776,7 @@ } #endif -#ifdef __MINGW__ +#ifdef __MINGW32__ dummy = 1; if (ioctlsocket(tcp_desc, FIONBIO, &dummy) < 0) { @@ -1784,7 +1784,7 @@ gdomap_log(LOG_CRIT); exit(EXIT_FAILURE); } -#else /* !__MINGW__ */ +#else /* !__MINGW32__ */ if ((r = fcntl(tcp_desc, F_GETFL, 0)) >= 0) { r |= NBLK_OPT; @@ -1801,7 +1801,7 @@ gdomap_log(LOG_CRIT); exit(EXIT_FAILURE); } -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ memset(&sa, '\0', sizeof(sa)); sa.sin_family = AF_INET; @@ -1841,7 +1841,7 @@ FD_SET(tcp_desc, &read_fds); FD_SET(udp_desc, &read_fds); -#ifndef __MINGW__ +#ifndef __MINGW32__ /* * Turn off pipe signals so we don't get interrupted if we attempt * to write a response to a process which has died. @@ -1851,7 +1851,7 @@ * Enable table dumping to /tmp/gdomap.dump */ signal(SIGUSR1, dump_tables); -#endif /* !__MINGW__ */ +#endif /* !__MINGW32__ */ } @@ -2158,11 +2158,11 @@ if (desc >= 0) { RInfo *ri; -#ifdef __MINGW__ +#ifdef __MINGW32__ unsigned long dummy = 1; #else int r; -#endif /* !__MINGW__ */ +#endif /* !__MINGW32__ */ FD_SET(desc, &read_fds); ri = getRInfo(desc, 1); @@ -2178,7 +2178,7 @@ /* * Ensure that the connection is non-blocking. */ -#ifdef __MINGW__ +#ifdef __MINGW32__ if (ioctlsocket(desc, FIONBIO, &dummy) < 0) { if (debug) @@ -2188,7 +2188,7 @@ } clear_chan(desc); } -#else /* !__MINGW__ */ +#else /* !__MINGW32__ */ if ((r = fcntl(desc, F_GETFL, 0)) >= 0) { r |= NBLK_OPT; @@ -2211,16 +2211,16 @@ } clear_chan(desc); } -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ } else if (debug) { sprintf(ebuf, "accept failed - errno %d", -#ifdef __MINGW__ +#ifdef __MINGW32__ WSAGetLastError()); #else errno); -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ gdomap_log(LOG_DEBUG); } } @@ -2342,7 +2342,7 @@ /* * Got some descriptor activity - deal with it. */ -#ifdef __MINGW__ +#ifdef __MINGW32__ /* read file descriptors */ for (i = 0; i < rfds.fd_count; i++) { @@ -2374,7 +2374,7 @@ handle_write(wfds.fd_array[i]); } } -#else /* !__MINGW__ */ +#else /* !__MINGW32__ */ for (i = 0; i < FD_SETSIZE; i++) { if (FD_ISSET(i, &rfds)) @@ -2408,7 +2408,7 @@ } } } -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ } } } @@ -2432,7 +2432,7 @@ while (ri->pos < GDO_REQ_SIZE && done == 0) { -#ifdef __MINGW__ +#ifdef __MINGW32__ r = recv(desc, &ptr[ri->pos], GDO_REQ_SIZE - ri->pos, 0); #else @@ -2454,7 +2454,7 @@ tcp_read++; handle_request(desc); } -#ifdef __MINGW__ +#ifdef __MINGW32__ else if (WSAGetLastError() != WSAEWOULDBLOCK || nothingRead == 1) #else else if (errno != EWOULDBLOCK || nothingRead == 1) @@ -2510,7 +2510,7 @@ if (debug) { sprintf(ebuf, "recvfrom returned %d - " -#ifdef __MINGW__ +#ifdef __MINGW32__ "WSAGetLastError() = %d\n", r, WSAGetLastError()); #else "%m", r); @@ -2708,7 +2708,7 @@ *(unsigned long*)wi->buf = port; } } -#ifdef __MINGW__ +#ifdef __MINGW32__ /* closesocket(sock); */ #else close(sock); @@ -2795,11 +2795,11 @@ otherwise the system will try to bind on any of the local addresses (including 127.0.0.1), which works. - bjoern */ -#ifdef __MINGW__ +#ifdef __MINGW32__ sa.sin_addr.s_addr = addr[0].s_addr; #else sa.sin_addr.s_addr = htonl(INADDR_ANY); -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ sa.sin_port = htons(p); result = bind(sock, (void*)&sa, sizeof(sa)); if (result == 0) @@ -2808,7 +2808,7 @@ m = 0; } } -#ifdef __MINGW__ +#ifdef __MINGW32__ closesocket(sock); #else close(sock); @@ -2953,7 +2953,7 @@ sprintf(ebuf, "Probe from '%s'", inet_ntoa(sin)); gdomap_log(LOG_DEBUG); } -#ifdef __MINGW__ +#ifdef __MINGW32__ if (IN_CLASSA(sin.s_addr)) { net = sin.s_addr & IN_CLASSA_NET; @@ -3088,7 +3088,7 @@ sprintf(ebuf, "Probe reply from '%s'", inet_ntoa(sin)); gdomap_log(LOG_DEBUG); } -#ifdef __MINGW__ +#ifdef __MINGW32__ if (IN_CLASSA(sin.s_addr)) { net = sin.s_addr & IN_CLASSA_NET; @@ -3190,7 +3190,7 @@ */ if (entry->pos != entry->len) { -#ifdef __MINGW__ +#ifdef __MINGW32__ if (WSAGetLastError() != WSAEWOULDBLOCK) #else if (errno != EWOULDBLOCK) @@ -3253,7 +3253,7 @@ ptr = wi->buf; len = wi->len; -#ifdef __MINGW__ +#ifdef __MINGW32__ r = send(desc, &ptr[wi->pos], len - wi->pos, 0); #else r = write(desc, &ptr[wi->pos], len - wi->pos); @@ -3362,14 +3362,14 @@ } else if (len > 0) { -#ifdef __MINGW__ +#ifdef __MINGW32__ rval = recv(desc, &dat[pos], len - pos, 0); #else rval = read(desc, &dat[pos], len - pos); #endif if (rval < 0) { -#ifdef __MINGW__ +#ifdef __MINGW32__ if (WSAGetLastError() != WSAEWOULDBLOCK) #else if (errno != EWOULDBLOCK) @@ -3468,7 +3468,7 @@ } else if (len > 0) { -#ifdef __MINGW__ /* FIXME: Is this correct? */ +#ifdef __MINGW32__ /* FIXME: Is this correct? */ rval = send(desc, &dat[pos], len - pos, 0); #else void (*ifun)(); @@ -3484,7 +3484,7 @@ if (rval <= 0) { -#ifdef __MINGW__ +#ifdef __MINGW32__ if (WSAGetLastError() != WSAEWOULDBLOCK) #else if (errno != EWOULDBLOCK) @@ -3524,9 +3524,9 @@ unsigned long port = *p; gdo_req msg; struct sockaddr_in sin; -#ifdef __MINGW__ +#ifdef __MINGW32__ unsigned long dummy; -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ *p = 0; if (desc < 0) @@ -3534,7 +3534,7 @@ return 1; /* Couldn't create socket. */ } -#ifdef __MINGW__ +#ifdef __MINGW32__ dummy = 1; if (ioctlsocket(desc, FIONBIO, &dummy) < 0) { @@ -3543,7 +3543,7 @@ WSASetLastError(e); return 2; /* Couldn't set non-blocking. */ } -#else /* !__MINGW__ */ +#else /* !__MINGW32__ */ if ((e = fcntl(desc, F_GETFL, 0)) >= 0) { e |= NBLK_OPT; @@ -3562,12 +3562,12 @@ errno = e; return 2; /* Couldn't set non-blocking. */ } -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ memcpy(&sin, addr, sizeof(sin)); if (connect(desc, (struct sockaddr*)&sin, sizeof(sin)) != 0) { -#ifdef __MINGW__ +#ifdef __MINGW32__ if (WSAGetLastError() == WSAEWOULDBLOCK) #else if (errno == EINPROGRESS) @@ -3577,7 +3577,7 @@ if (e == -2) { e = errno; -#ifdef __MINGW__ +#ifdef __MINGW32__ closesocket(desc); #else close(desc); @@ -3588,7 +3588,7 @@ else if (e == -1) { e = errno; -#ifdef __MINGW__ +#ifdef __MINGW32__ closesocket(desc); #else close(desc); @@ -3600,7 +3600,7 @@ else { e = errno; -#ifdef __MINGW__ +#ifdef __MINGW32__ closesocket(desc); #else close(desc); @@ -3624,7 +3624,7 @@ e = tryWrite(desc, 10, (uptr)&msg, GDO_REQ_SIZE); if (e != GDO_REQ_SIZE) { -#ifdef __MINGW__ +#ifdef __MINGW32__ e = WSAGetLastError(); closesocket(desc); WSASetLastError(e); @@ -3638,7 +3638,7 @@ e = tryRead(desc, 3, (uptr)&port, 4); if (e != 4) { -#ifdef __MINGW__ +#ifdef __MINGW32__ e = WSAGetLastError(); closesocket(desc); WSASetLastError(e); @@ -3663,7 +3663,7 @@ if (tryRead(desc, 3, b, len) != len) { free(b); -#ifdef __MINGW__ +#ifdef __MINGW32__ e = WSAGetLastError(); closesocket(desc); WSASetLastError(e); @@ -3689,7 +3689,7 @@ if (tryRead(desc, 3, b, len) != len) { free(b); -#ifdef __MINGW__ +#ifdef __MINGW32__ e = WSAGetLastError(); closesocket(desc); WSASetLastError(e); @@ -3720,7 +3720,7 @@ } *p = (unsigned short)port; -#ifdef __MINGW__ +#ifdef __MINGW32__ closesocket(desc); #else close(desc); @@ -4171,7 +4171,7 @@ exit(EXIT_SUCCESS); } -#ifdef __MINGW__ +#ifdef __MINGW32__ static char* quoteArg(const char *arg) { @@ -4278,7 +4278,7 @@ #endif #endif -#ifdef __MINGW__ +#ifdef __MINGW32__ WORD wVersionRequested; WSADATA wsaData; @@ -4290,7 +4290,7 @@ * Would use inet_aton(), but older systems don't have it. */ loopback.s_addr = inet_addr("127.0.0.1"); -#ifdef __MINGW__ +#ifdef __MINGW32__ class_a_net = IN_CLASSA_NET; class_a_mask.s_addr = class_a_net; class_b_net = IN_CLASSB_NET; @@ -4569,7 +4569,7 @@ exit (0); } -#ifdef __MINGW__ /* On Win32, we don't fork */ +#ifdef __MINGW32__ /* On Win32, we don't fork */ if (nofork == 0) { char **a = malloc((argc+2) * sizeof(char*)); @@ -4667,7 +4667,7 @@ gdomap_log(LOG_DEBUG); } -#endif /* !__MINGW__ */ +#endif /* !__MINGW32__ */ init_my_port(); /* Determine port to listen on. */ init_ports(); /* Create ports to handle requests. */ @@ -4711,7 +4711,7 @@ { FILE *fptr; -#ifndef __MINGW__ +#ifndef __MINGW32__ if (getuid () == 0) #endif { @@ -4728,7 +4728,7 @@ fclose(fptr); chmod(pidfile, 0644); } -#ifndef __MINGW__ +#ifndef __MINGW32__ else { sprintf(ebuf, "Only root user can write to pid file\n"); @@ -4737,7 +4737,7 @@ #endif } { -#ifndef __MINGW__ +#ifndef __MINGW32__ int uid = -2; int gid = -2; #endif @@ -4758,7 +4758,7 @@ /* * As another level of paranoia - restrict this process to /tmp */ -#ifndef __MINGW__ +#ifndef __MINGW32__ if (chdir("/tmp") < 0) { sprintf(ebuf, "Unable to change directory to /tmp"); @@ -4776,10 +4776,10 @@ } chdir("/"); } -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ #endif /* __svr4__ */ -#ifndef __MINGW__ +#ifndef __MINGW32__ /* * Try to become a 'safe' user now that we have * done everything that needs root priv. @@ -4810,7 +4810,7 @@ gdomap_log(LOG_CRIT); exit(EXIT_FAILURE); } -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ } init_probe(); /* Probe other name servers on net. */ Index: config/config.reuseaddr.c =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/base/config/config.reuseaddr.c,v retrieving revision 1.3 diff -u -r1.3 config.reuseaddr.c --- config/config.reuseaddr.c 15 Jul 2005 22:51:23 -0000 1.3 +++ config/config.reuseaddr.c 27 Oct 2005 15:54:38 -0000 @@ -5,7 +5,7 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. */ -#if defined(__MINGW__) || defined(__MINGW32__) +#if defined(__MINGW32__) #include #include #else @@ -16,7 +16,7 @@ #include #include #include -#endif /* __MINGW__ */ +#endif /* __MINGW32__ */ #include #include