From 339ddc413559d4cb117a72f87b2a70dae6911c32 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 7 Aug 2008 10:23:19 -0400 Subject: Massive ifdef cleanup, dropping a ton of unsupported platform code. --- Xtranssock.c | 131 ++++------------------------------------------------------- 1 file changed, 8 insertions(+), 123 deletions(-) (limited to 'Xtranssock.c') diff --git a/Xtranssock.c b/Xtranssock.c index ff37782..bb1c792 100644 --- a/Xtranssock.c +++ b/Xtranssock.c @@ -69,21 +69,14 @@ from the copyright holders. #ifdef UNIXCONN #ifndef X_NO_SYS_UN -#ifndef Lynx #include -#else -#include -#endif #endif #include #endif -#if defined(hpux) || (defined(MOTOROLA) && defined(SYSV)) -#define NO_TCP_H -#endif #ifndef NO_TCP_H -#if defined(__osf__) || defined(linux) || defined(__GLIBC__) || defined(AIXV5) +#if defined(linux) || defined(__GLIBC__) #include #endif /* osf */ #if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) @@ -94,7 +87,7 @@ from the copyright holders. #endif /* !NO_TCP_H */ #include -#if defined(SVR4) && !defined(DGUX) && !defined(_SEQUENT_) +#if defined(SVR4) #include #endif @@ -102,7 +95,7 @@ from the copyright holders. #include #endif -#if (defined(__i386__) && defined(SYSV)) && (!defined(ISC) || !defined(I_NREAD) || defined(SCO325)) || defined(_SEQUENT_) +#if defined(__i386__) && defined(SYSV) #include #endif @@ -130,33 +123,8 @@ from the copyright holders. #undef SO_DONTLINGER #endif -#if defined(__UNIXOS2__) -#if defined(NOT_EMX09A) -static int IBMsockInit = 0; -#define SocketInitOnce()\ - if (!IBMsockInit) {\ - sock_init();\ - IBMsockInit = 1;\ - } -#undef EINTR -#define EINTR SOCEINTR -#undef EINVAL -#define EINVAL SOCEINVAL -#undef errno -#define errno sock_errno() -#undef close -#define close soclose -#undef ioctl -#define ioctl sockioctl -#else -#define SocketInitOnce() /**/ -#endif -/* this is still not there */ -#define SOCKET int -#else /* others don't need this */ #define SocketInitOnce() /**/ -#endif #ifdef linux #define HAVE_ABSTRACT_SOCKETS @@ -215,36 +183,6 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr); #ifdef UNIXCONN -#ifdef hpux - -#if defined(X11_t) -#define UNIX_PATH "/usr/spool/sockets/X11/" -#define UNIX_DIR "/usr/spool/sockets/X11" -#define OLD_UNIX_PATH "/tmp/.X11-unix/X" -#endif /* X11_t */ -#if defined(XIM_t) -#define UNIX_PATH "/usr/spool/sockets/XIM/" -#define UNIX_DIR "/usr/spool/sockets/XIM" -#define OLD_UNIX_PATH "/tmp/.XIM-unix/XIM" -#endif /* XIM_t */ -#if defined(FS_t) || defined(FONT_t) -#define UNIX_PATH "/usr/spool/sockets/fontserv/" -#define UNIX_DIR "/usr/spool/sockets/fontserv" -#endif /* FS_t || FONT_t */ -#if defined(ICE_t) -#define UNIX_PATH "/usr/spool/sockets/ICE/" -#define UNIX_DIR "/usr/spool/sockets/ICE" -#endif /* ICE_t */ -#if defined(TEST_t) -#define UNIX_PATH "/usr/spool/sockets/xtrans_test/" -#define UNIX_DIR "/usr/spool/sockets/xtrans_test" -#endif -#if defined(LBXPROXY_t) -#define UNIX_PATH "/usr/spool/sockets/X11/" -#define UNIX_DIR "/usr/spool/sockets/X11" -#endif - -#else /* !hpux */ #if defined(X11_t) #define UNIX_PATH "/tmp/.X11-unix/X" @@ -271,7 +209,6 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr); #define UNIX_DIR "/tmp/.X11-unix" #endif -#endif /* hpux */ #endif /* UNIXCONN */ @@ -1168,7 +1105,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port, return TRANS_CREATE_LISTENER_FAILED; } -#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) && !defined(Lynx) +#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) sockname.sun_len = strlen(sockname.sun_path); #endif @@ -1722,25 +1659,11 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) return TRANS_CONNECT_FAILED; } -#if defined(CRAY) && defined(OLDTCP) - /* Only Cray UNICOS3 and UNICOS4 will define this */ - { - long t; - memcpy ((char *)&t, (char *) hostp->h_addr, sizeof (t)); - sockname.sin_addr = t; - } -#else memcpy ((char *) &sockname.sin_addr, (char *) hostp->h_addr, sizeof (sockname.sin_addr)); -#endif /* CRAY and OLDTCP */ } else { -#if defined(CRAY) && defined(OLDTCP) - /* Only Cray UNICOS3 and UNICOS4 will define this */ - sockname.sin_addr = tmpaddr; -#else sockname.sin_addr.s_addr = tmpaddr; -#endif /* CRAY and OLDTCP */ } /* @@ -2029,10 +1952,6 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) struct sockaddr_un sockname; SOCKLEN_T namelen; -#if defined(hpux) && defined(X11_t) - struct sockaddr_un old_sockname; - SOCKLEN_T old_namelen; -#endif int abstract = 0; #ifdef HAVE_ABSTRACT_SOCKETS @@ -2080,7 +1999,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) return TRANS_CONNECT_FAILED; } -#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) && !defined(Lynx) +#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) sockname.sun_len = strlen (sockname.sun_path); #endif @@ -2091,18 +2010,6 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) #endif -#if defined(hpux) && defined(X11_t) - /* - * This is gross, but it was in Xlib - */ - old_sockname.sun_family = AF_UNIX; - if (set_sun_path(port, OLD_UNIX_PATH, old_sockname.sun_path, abstract) != 0) { - PRMSG (1, "SocketUNIXConnect: path too long\n", 0, 0, 0); - return TRANS_CONNECT_FAILED; - } - old_namelen = strlen (old_sockname.sun_path) + - offsetof(struct sockaddr_un, sun_path); -#endif /* * Adjust the socket path if using abstract sockets. @@ -2111,9 +2018,6 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) if (abstract) { sockname.sun_path[0] = '\0'; -#if defined(hpux) && defined(X11_t) - old_sockname.sun_path[0] = '\0'; -#endif } /* @@ -2125,18 +2029,6 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) int olderrno = errno; int connected = 0; -#if defined(hpux) && defined(X11_t) - if (olderrno == ENOENT) - { - if (connect (ciptr->fd, - (struct sockaddr *) &old_sockname, old_namelen) >= 0) - { - connected = 1; - } - else - olderrno = errno; - } -#endif if (!connected) { errno = olderrno; @@ -2215,9 +2107,6 @@ TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) { PRMSG (2,"SocketBytesReadable(%p,%d,%p)\n", ciptr, ciptr->fd, pend); -#if defined(QNX4) - *pend = 0L; /* FIONREAD only returns a short. Zero out upper bits */ -#endif #ifdef WIN32 { int ret = ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend); @@ -2225,14 +2114,10 @@ TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) return ret; } #else -#if (defined(__i386__) && defined(SYSV) && !defined(SCO325)) || (defined(_SEQUENT_) && _SOCKET_VERSION == 1) +#if defined(__i386__) && defined(SYSV) && !defined(SCO325) return ioctl (ciptr->fd, I_NREAD, (char *) pend); -#else -#if defined(__UNIXOS2__) - return ioctl (ciptr->fd, FIONREAD, (char*) pend, sizeof(int)); #else return ioctl (ciptr->fd, FIONREAD, (char *) pend); -#endif /* __UNIXOS2__ */ #endif /* __i386__ && SYSV || _SEQUENT_ && _SOCKET_VERSION == 1 */ #endif /* WIN32 */ } @@ -2244,7 +2129,7 @@ TRANS(SocketRead) (XtransConnInfo ciptr, char *buf, int size) { PRMSG (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, buf, size); -#if defined(WIN32) || defined(__UNIXOS2__) +#if defined(WIN32) { int ret = recv ((SOCKET)ciptr->fd, buf, size, 0); #ifdef WIN32 @@ -2264,7 +2149,7 @@ TRANS(SocketWrite) (XtransConnInfo ciptr, char *buf, int size) { PRMSG (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, buf, size); -#if defined(WIN32) || defined(__UNIXOS2__) +#if defined(WIN32) { int ret = send ((SOCKET)ciptr->fd, buf, size, 0); #ifdef WIN32 -- cgit v1.2.3