aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-10-22 03:55:39 +0000
committerRichard M. Stallman1994-10-22 03:55:39 +0000
commit437f611246ec01dcc65cefff02735abd6f662ccb (patch)
tree715c5d455ae7b7392623cde5926c6ff7aae038fb /src
parent0217ed574e39e56c061e25a9532cf129086cc735 (diff)
downloademacs-437f611246ec01dcc65cefff02735abd6f662ccb.tar.gz
emacs-437f611246ec01dcc65cefff02735abd6f662ccb.zip
(read_avail_input): Use input_fd.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 8b305381c06..27d79ea6908 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -73,7 +73,8 @@ int interrupt_input_pending;
73 73
74 74
75#ifdef HAVE_X_WINDOWS 75#ifdef HAVE_X_WINDOWS
76extern Lisp_Object Vmouse_grabbed; 76/* File descriptor to use for input. */
77extern int input_fd;
77 78
78/* Make all keyboard buffers much bigger when using X windows. */ 79/* Make all keyboard buffers much bigger when using X windows. */
79#define KBD_BUFFER_SIZE 4096 80#define KBD_BUFFER_SIZE 4096
@@ -3515,7 +3516,8 @@ read_avail_input (expected)
3515 3516
3516 if (read_socket_hook) 3517 if (read_socket_hook)
3517 /* No need for FIONREAD or fcntl; just say don't wait. */ 3518 /* No need for FIONREAD or fcntl; just say don't wait. */
3518 nread = (*read_socket_hook) (0, buf, KBD_BUFFER_SIZE, expected, expected); 3519 nread = (*read_socket_hook) (input_fd, buf, KBD_BUFFER_SIZE,
3520 expected, expected);
3519 else 3521 else
3520 { 3522 {
3521 /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than 3523 /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than
@@ -3532,7 +3534,7 @@ read_avail_input (expected)
3532#else /* not MSDOS */ 3534#else /* not MSDOS */
3533#ifdef FIONREAD 3535#ifdef FIONREAD
3534 /* Find out how much input is available. */ 3536 /* Find out how much input is available. */
3535 if (ioctl (0, FIONREAD, &n_to_read) < 0) 3537 if (ioctl (input_fd, FIONREAD, &n_to_read) < 0)
3536 /* Formerly simply reported no input, but that sometimes led to 3538 /* Formerly simply reported no input, but that sometimes led to
3537 a failure of Emacs to terminate. 3539 a failure of Emacs to terminate.
3538 SIGHUP seems appropriate if we can't reach the terminal. */ 3540 SIGHUP seems appropriate if we can't reach the terminal. */
@@ -3548,7 +3550,7 @@ read_avail_input (expected)
3548#if defined(USG) || defined(DGUX) 3550#if defined(USG) || defined(DGUX)
3549 /* Read some input if available, but don't wait. */ 3551 /* Read some input if available, but don't wait. */
3550 n_to_read = sizeof cbuf; 3552 n_to_read = sizeof cbuf;
3551 fcntl (fileno (stdin), F_SETFL, O_NDELAY); 3553 fcntl (input_fd, F_SETFL, O_NDELAY);
3552#else 3554#else
3553 you lose; 3555 you lose;
3554#endif 3556#endif
@@ -3563,7 +3565,7 @@ read_avail_input (expected)
3563 cbuf[0] = dos_keyread(); 3565 cbuf[0] = dos_keyread();
3564 nread = 1; 3566 nread = 1;
3565#else 3567#else
3566 nread = read (fileno (stdin), cbuf, n_to_read); 3568 nread = read (input_fd, cbuf, n_to_read);
3567#endif 3569#endif
3568#if defined (AIX) && (! defined (aix386) && defined (_BSD)) 3570#if defined (AIX) && (! defined (aix386) && defined (_BSD))
3569 /* The kernel sometimes fails to deliver SIGHUP for ptys. 3571 /* The kernel sometimes fails to deliver SIGHUP for ptys.
@@ -3595,7 +3597,7 @@ read_avail_input (expected)
3595 3597
3596#ifndef FIONREAD 3598#ifndef FIONREAD
3597#if defined (USG) || defined (DGUX) 3599#if defined (USG) || defined (DGUX)
3598 fcntl (fileno (stdin), F_SETFL, 0); 3600 fcntl (input_fd, F_SETFL, 0);
3599#endif /* USG or DGUX */ 3601#endif /* USG or DGUX */
3600#endif /* no FIONREAD */ 3602#endif /* no FIONREAD */
3601 for (i = 0; i < nread; i++) 3603 for (i = 0; i < nread; i++)