rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* signals and stuff
@ 1994-05-06 22:09 Scott Schwartz
  0 siblings, 0 replies; 3+ messages in thread
From: Scott Schwartz @ 1994-05-06 22:09 UTC (permalink / raw)
  To: rc


A while back Byron sent me this patch for 1.5beta.  I don't know if it
was sent to the list, but just in case, here it is.

------- Forwarded Message

===================================================================
RCS file: RCS/input.c,v
retrieving revision 1.4
diff -c -r1.4 input.c
*** /tmp/T0a00581       Tue Apr  5 01:12:45 1994
- --- input.c     Tue Apr  5 01:11:01 1994
***************
*** 140,145 ****
- --- 140,147 ----
                                long /*ssize_t*/ r = rc_read(istack->fd, inbuf + 2, BUFSIZE);
                                sigchk();
                                if (r < 0) {
+                                       if (errno == EINTR) /* retry interrupted read */
+                                               continue;
                                        uerror("read");
                                        rc_exit(1);
                                }

(snarfed and pasted from one xterm to another, I don't know how many
of the blanks got hosed...)

------- End of Forwarded Message



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: signals and stuff
@ 1994-05-10 19:53 Tom Culliton x2278
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Culliton x2278 @ 1994-05-10 19:53 UTC (permalink / raw)
  To: culliton, rc, schwartz

Well that patch is an improvement, but it's not perfect yet.  Testing on
my friendly neighborhood Sparc-station with:

	fn sigwinch {eval `/usr/bin/X11/resize; stty sane; echo}

The next command entered after the signal handler is executed complains
about a "parse error".  It also fails to clear errno the next time
through rc_readline so that ^D doesn't work unless another command is
executed first.  8-P Blech!  (This doesn't happen under SCO Unix...)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: signals and stuff
@ 1994-05-10 17:58 Tom Culliton x2278
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Culliton x2278 @ 1994-05-10 17:58 UTC (permalink / raw)
  To: rc, schwartz

Well, the patch to rc-1.5beta1 in Scott's message gave me the clue I
needed.  It fixes the problem (for rc without readline) by ensuring that
interrupted reads aren't treated as an EOF.  Here is a patch to do the
same thing when using readline.  Both patches should be applied if you
use readline.  If you don't, at least apply the patch from Byron that
Scott passed along so that your signal handlers work right.

Tom

------------------------------------------------------------------------------
*** input.c	Tue May 10 13:38:19 1994
--- input.cn	Tue May 10 13:26:13 1994
***************
*** 96,108 ****
  		slow = TRUE;
  		if (!interrupt_happened)
  			r = readline(prompt);
! 		else
  			r = NULL;
! 	} else
  		r = NULL;
- 	slow = FALSE;
- 	if (r == NULL)
  		errno = EINTR;
  	sigchk();
  	return r;
  }
--- 96,110 ----
  		slow = TRUE;
  		if (!interrupt_happened)
  			r = readline(prompt);
! 		else {
  			r = NULL;
! 			errno = EINTR;
! 		}
! 	} else {
  		r = NULL;
  		errno = EINTR;
+ 	}
+ 	slow = FALSE;
  	sigchk();
  	return r;
  }
***************
*** 123,128 ****
--- 125,132 ----
  			if (interactive && istack->fd == 0) {
  				rlinebuf = rc_readline(prompt);
  				if (rlinebuf == NULL) {
+ 					if (errno == EINTR) /* retry interrupted read */
+ 						continue;
  					chars_in = 0;
  				} else {
  					if (*rlinebuf != '\0')



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1994-05-10 21:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-05-06 22:09 signals and stuff Scott Schwartz
1994-05-10 17:58 Tom Culliton x2278
1994-05-10 19:53 Tom Culliton x2278

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).