changeset 3924:44fe472b66ba

* xterm.c: Add CPP tangle from process.c to get definitions for FD_SET, etcetera. (XTread_socket): Use those macros when testing for dropped connection.
author Jim Blandy <jimb@redhat.com>
date Tue, 29 Jun 1993 23:07:22 +0000
parents cb16ebff1c44
children f286657c098e
files src/xterm.c
diffstat 1 files changed, 25 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Tue Jun 29 23:04:11 1993 +0000
+++ b/src/xterm.c	Tue Jun 29 23:07:22 1993 +0000
@@ -93,6 +93,27 @@
 /*#include <X/Xproto.h>	*/
 #endif /* ! defined (HAVE_X11) */
 
+#ifdef FD_SET
+/* We could get this from param.h, but better not to depend on finding that.
+   And better not to risk that it might define other symbols used in this
+   file.  */
+#ifdef FD_SETSIZE
+#define MAXDESC FD_SETSIZE
+#else
+#define MAXDESC 64
+#endif
+#define SELECT_TYPE fd_set
+#else /* no FD_SET */
+#define MAXDESC 32
+#define SELECT_TYPE int
+
+/* Define the macros to access a single-int bitmap of descriptors.  */
+#define FD_SET(n, p) (*(p) |= (1 << (n)))
+#define FD_CLR(n, p) (*(p) &= ~(1 << (n)))
+#define FD_ISSET(n, p) (*(p) & (1 << (n)))
+#define FD_ZERO(p) (*(p) = 0)
+#endif /* no FD_SET */
+
 /* For sending Meta-characters.  Do we need this? */
 #define METABIT 0200
 
@@ -3274,12 +3295,12 @@
       /* AOJ 880406: if select returns true but XPending doesn't, it means that
 	 there is an EOF condition; in other words, that X has died.
 	 Act as if there had been a hangup. */
-
       int fd = ConnectionNumber (x_current_display);
-      int mask = 1 << fd;
-
+      SELECT_TYPE mask;
+
+      FD_SET(fd, &mask);
       if (0 != select (fd + 1, &mask, (long *) 0, (long *) 0,
-		       (EMACS_TIME) 0)
+		       (EMACS_TIME *) 0)
 	  && !XStuffPending ())
 	kill (getpid (), SIGHUP);
     }