changeset 9652:13a13988685a

(read_avail_input): Use input_fd.
author Richard M. Stallman <rms@gnu.org>
date Sat, 22 Oct 1994 03:55:39 +0000
parents 3c2685c4e09d
children cfc5e15e0baf
files src/keyboard.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Sat Oct 22 03:55:00 1994 +0000
+++ b/src/keyboard.c	Sat Oct 22 03:55:39 1994 +0000
@@ -73,7 +73,8 @@
 
 
 #ifdef HAVE_X_WINDOWS
-extern Lisp_Object Vmouse_grabbed;
+/* File descriptor to use for input.  */
+extern int input_fd;
 
 /* Make all keyboard buffers much bigger when using X windows.  */
 #define KBD_BUFFER_SIZE 4096
@@ -3515,7 +3516,8 @@
 
   if (read_socket_hook)
     /* No need for FIONREAD or fcntl; just say don't wait.  */
-    nread = (*read_socket_hook) (0, buf, KBD_BUFFER_SIZE, expected, expected);
+    nread = (*read_socket_hook) (input_fd, buf, KBD_BUFFER_SIZE,
+				 expected, expected);
   else
     {
       /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than
@@ -3532,7 +3534,7 @@
 #else /* not MSDOS */
 #ifdef FIONREAD
       /* Find out how much input is available.  */
-      if (ioctl (0, FIONREAD, &n_to_read) < 0)
+      if (ioctl (input_fd, FIONREAD, &n_to_read) < 0)
 	/* Formerly simply reported no input, but that sometimes led to
 	   a failure of Emacs to terminate.
 	   SIGHUP seems appropriate if we can't reach the terminal.  */
@@ -3548,7 +3550,7 @@
 #if defined(USG) || defined(DGUX)
       /* Read some input if available, but don't wait.  */
       n_to_read = sizeof cbuf;
-      fcntl (fileno (stdin), F_SETFL, O_NDELAY);
+      fcntl (input_fd, F_SETFL, O_NDELAY);
 #else
       you lose;
 #endif
@@ -3563,7 +3565,7 @@
 	  cbuf[0] = dos_keyread();
 	  nread = 1;
 #else
-	  nread = read (fileno (stdin), cbuf, n_to_read);
+	  nread = read (input_fd, cbuf, n_to_read);
 #endif
 #if defined (AIX) && (! defined (aix386) && defined (_BSD))
 	  /* The kernel sometimes fails to deliver SIGHUP for ptys.
@@ -3595,7 +3597,7 @@
 
 #ifndef FIONREAD
 #if defined (USG) || defined (DGUX)
-      fcntl (fileno (stdin), F_SETFL, 0);
+      fcntl (input_fd, F_SETFL, 0);
 #endif /* USG or DGUX */
 #endif /* no FIONREAD */
       for (i = 0; i < nread; i++)