🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99852

Re: y-or-n-p uninterruptability

#99852
From: Piet van Oostrum
Date: Fri, 20 Apr 1990 20:38
91 lines
3432 bytes
In article <9004191448.AA05516@mururoa.imag.fr>, macrakis@ri (Stavros Macrakis) writes:
 `GNU Emacs 18.55.1 of Tue Oct 31 1989 on marat (hpux)
 `
 `y-or-n-p is not interruptible by ^G.  This is appropriate for certain
 `
It *IS* !!

Unfortunately, this does not work on HP/UX if you run emacs under X.

The problem is that on HP/UX FIONREAD and SIGIO do not work on sockets.
They only work on terminals. This also causes the problem of ^G not
interrupting long commands.

Here is a patch that solves the first problem, not the second. I am trying
a patch for the second problem next week (unless someone sends me a
solution before that).

*** keyboard.c.~1~	Wed Apr  4 14:53:49 1990
--- keyboard.c	Fri Apr 20 20:28:53 1990
***************
*** 1094,1119 ****
  
  #else /* no FIONREAD */
  #ifdef USG
    if (kbd_count)
      abort ();
  
    fcntl (fileno (stdin), F_SETFL, O_NDELAY);
!   kbd_ptr = kbd_buffer;
    if (read_socket_hook)
!     {
!       kbd_count = (*read_socket_hook) (0, kbd_buffer, sizeof kbd_buffer);
!     }
    else
!     {
!       kbd_count = read (fileno (stdin), kbd_buffer, sizeof kbd_buffer);
!     }
  #ifdef EBADSLT
!   if (kbd_count == -1 && (errno == EAGAIN || errno == EBADSLT))
  #else
!   if (kbd_count == -1 && errno == EAGAIN)
  #endif
!     kbd_count = 0;
    fcntl (fileno (stdin), F_SETFL, 0);
  #else /* not USG */
    you lose
  #endif /* not USG */
--- 1094,1131 ----
  
  #else /* no FIONREAD */
  #ifdef USG
+   char buf[256 * BUFFER_SIZE_FACTOR];
+   register int i;
    if (kbd_count)
      abort ();
  
    fcntl (fileno (stdin), F_SETFL, O_NDELAY);
! 
!   /* Read what is waiting.  */
    if (read_socket_hook)
!     nread = (*read_socket_hook) (0, buf, sizeof buf);
    else
!     nread = read (fileno(stdin), buf, sizeof buf);
  #ifdef EBADSLT
!   if (nread == -1 && (errno == EAGAIN || errno == EBADSLT))
  #else
!   if (nread == -1 && errno == EAGAIN)
  #endif
!     nread = 0;
! 
    fcntl (fileno (stdin), F_SETFL, 0);
+ 
+   /* Scan the chars for C-g and store them in kbd_buffer.  */
+   kbd_ptr = kbd_buffer;
+   for (i = 0; i < nread; i++)
+     {
+       kbd_buffer_store_char (buf[i]);
+       /* Don't look at input that follows a C-g too closely.
+ 	 This reduces lossage due to autorepeat on C-g.  */
+       if (buf[i] == Ctl ('G'))
+ 	break;
+     }
+ 
  #else /* not USG */
    you lose
  #endif /* not USG */
-- 
Piet* van Oostrum, Dept of Computer Science, Utrecht University,
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
Telephone: +31-30-531806   Uucp:   uunet!mcsun!ruuinf!piet
Telefax:   +31-30-513791   Internet:  piet@cs.ruu.nl   (*`Pete')
Technical Details
Message-ID: <3071@ruuinf.cs.ruu.nl>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!hp4nl!ruuinf!piet
References: <9004191448.AA05516@mururoa.imag.fr>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,4d6d9c470b07dc13
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-04-21 07:58:47 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!hp4nl!ruuinf!piet
From: piet@cs.ruu.nl (Piet van Oostrum)
Newsgroups: gnu.emacs.bug
Subject: Re: y-or-n-p uninterruptability
Message-ID: <3071@ruuinf.cs.ruu.nl>
Date: 20 Apr 90 20:38:50 GMT
References: <9004191448.AA05516@mururoa.imag.fr>
Sender: news@ruuinf.cs.ruu.nl
Reply-To: piet@cs.ruu.nl (Piet van Oostrum)
Distribution: gnu
Organization: Dept of Computer Science, Utrecht University, The Netherlands
Lines: 91
Posted: Fri Apr 20 21:38:50 1990
In-reply-to: macrakis@ri.osf.fr (Stavros Macrakis)