Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: subtle `echo' bug



Bart Schaefer wrote:
> On Jun 27, 11:03am, Peter Stephenson wrote:
> }
> } Are we going to do this?
> 
> I don't see any harm in it, but I have one last question ...
> 
> In looking at the code earlier in this function, I find that it's zsh
> that does (the equivalent of) val |= 0200 before testing (val & 0200).
> This makes me wonder if we should be using (val & ~0200) rather than
> WTERMSIG(val) here.

What zsh is setting is (removing some tests)

val = 0200 | WTERMSIG(p->status)

so I suppose you're right.

Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.39
diff -u -r1.39 jobs.c
--- Src/jobs.c	1 Jun 2005 10:45:42 -0000	1.39
+++ Src/jobs.c	27 Jun 2005 14:44:05 -0000
@@ -383,7 +383,8 @@
 		}
 		/* If we have `foo|while true; (( x++ )); done', and hit
 		 * ^C, we have to stop the loop, too. */
-		if ((val & 0200) && inforeground == 1) {
+		if ((val & 0200) && inforeground == 1 &&
+		    ((val & ~0200) == SIGINT || (val & ~0200) == SIGQUIT)) {
 		    if (!errbrk_saved) {
 			errbrk_saved = 1;
 			prev_breaks = breaks;
@@ -399,7 +400,8 @@
 		adjustwinsize(0);
 	    }
 	}
-    } else if (list_pipe && (val & 0200) && inforeground == 1) {
+    } else if (list_pipe && (val & 0200) && inforeground == 1 &&
+	       ((val & ~0200) == SIGINT || (val & ~0200) == SIGQUIT)) {
 	if (!errbrk_saved) {
 	    errbrk_saved = 1;
 	    prev_breaks = breaks;

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author