From 1ea5fe55b8ca8931c160e2d26f6476338beb5bfa Mon Sep 17 00:00:00 2001 From: cracauer Date: Sat, 3 Apr 1999 12:55:51 +0000 Subject: In interactive shells, break loops to the topmost level when a child is killed by a signal. (In non-interactive shells - that means a shellscript - the shell just exits, this was already working) PR: bin/9173 --- bin/sh/eval.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bin/sh') diff --git a/bin/sh/eval.c b/bin/sh/eval.c index 8b4fb62f..36552c4 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -39,11 +39,12 @@ static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; #endif static const char rcsid[] = - "$Id: eval.c,v 1.15 1998/05/18 06:43:34 charnier Exp $"; + "$Id: eval.c,v 1.16 1999/04/01 13:27:35 cracauer Exp $"; #endif /* not lint */ #include #include +#include /* For WIFSIGNALED(status) */ /* * Evaluate a command. @@ -862,6 +863,10 @@ parent: /* parent process gets here (if we forked) */ INTOFF; exitstatus = waitforjob(jp); INTON; + if (iflag && loopnest > 0 && WIFSIGNALED(exitstatus)) { + evalskip = SKIPBREAK; + skipcount = loopnest; + } } else if (mode == 2) { backcmd->fd = pip[0]; close(pip[1]); -- cgit v1.1