# HG changeset patch # User Richard M. Stallman # Date 766324768 0 # Node ID 1862df471cac7d57b62f74118fbb35bb84f41da2 # Parent 12dcd89cfd88480e098bc3e227f55d6578b64497 (make_lispy_event): Put mouse event code into MULTI_FRAME conditional. (read_avail_input): Separate local var n_to_read so that reading doesn't clobber that info when it sets nread. diff -r 12dcd89cfd88 -r 1862df471cac src/keyboard.c --- a/src/keyboard.c Thu Apr 14 09:31:42 1994 +0000 +++ b/src/keyboard.c Thu Apr 14 11:59:28 1994 +0000 @@ -2464,6 +2464,7 @@ / sizeof (lispy_function_keys[0]))); break; +#ifdef MULTI_FRAME /* A mouse click. Figure out where it is, decide whether it's a press, click or drag, and build the appropriate structure. */ case mouse_click: @@ -2692,6 +2693,7 @@ Qnil)); } } +#endif /* MULTI_FRAME */ /* The 'kind' field of the event is something we don't recognize. */ default: @@ -3301,14 +3303,17 @@ the kbd_buffer can really hold. That may prevent loss of characters on some systems when input is stuffed at us. */ unsigned char cbuf[KBD_BUFFER_SIZE - 1]; - + int n_to_read; + + /* Determine how many characters we should *try* to read. */ #ifdef MSDOS - nread = dos_keysns (); - if (nread == 0) return 0; + n_to_read = dos_keysns (); + if (n_to_read == 0) + return 0; #else */ not MSDOS */ #ifdef FIONREAD /* Find out how much input is available. */ - if (ioctl (0, FIONREAD, &nread) < 0) + if (ioctl (0, 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. */ @@ -3316,14 +3321,14 @@ rather than to the whole process group? Perhaps on systems with FIONREAD Emacs is alone in its group. */ kill (getpid (), SIGHUP); - if (nread == 0) + if (n_to_read == 0) return 0; - if (nread > sizeof cbuf) - nread = sizeof cbuf; + if (n_to_read > sizeof cbuf) + n_to_read = sizeof cbuf; #else /* no FIONREAD */ #if defined(USG) || defined(DGUX) /* Read some input if available, but don't wait. */ - nread = sizeof cbuf; + n_to_read = sizeof cbuf; fcntl (fileno (stdin), F_SETFL, O_NDELAY); #else you lose; @@ -3331,14 +3336,15 @@ #endif #endif /* not MSDOS */ - /* Now read; for one reason or another, this will not block. */ + /* Now read; for one reason or another, this will not block. + NREAD is set to the number of chars read. */ while (1) { #ifdef MSDOS cbuf[0] = dos_keyread(); nread = 1; #else - nread = read (fileno (stdin), cbuf, nread); + nread = read (fileno (stdin), cbuf, n_to_read); #endif #ifdef AIX /* The kernel sometimes fails to deliver SIGHUP for ptys. @@ -3348,9 +3354,7 @@ if (nread == 0) kill (0, SIGHUP); #endif - /* This code is wrong, but at least it gets the right results. - Fix it for 19.23. */ - /* Retry the read if it is interrupted. */ + /* Retry the read if it was interrupted. */ if (nread >= 0 || ! (errno == EAGAIN #ifdef EFAULT