Next approach to make loops in interactive interruptable.
PR: bin/9173
This commit is contained in:
parent
29ddf5ab88
commit
57b2932a14
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=45916
@ -39,7 +39,7 @@
|
||||
static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: eval.c,v 1.16 1999/04/01 13:27:35 cracauer Exp $";
|
||||
"$Id: eval.c,v 1.17 1999/04/03 12:55:51 cracauer Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <signal.h>
|
||||
@ -410,7 +410,7 @@ evalsubshell(n, flags)
|
||||
}
|
||||
if (! backgnd) {
|
||||
INTOFF;
|
||||
exitstatus = waitforjob(jp);
|
||||
exitstatus = waitforjob(jp, (int *)NULL);
|
||||
INTON;
|
||||
}
|
||||
}
|
||||
@ -509,7 +509,7 @@ evalpipe(n)
|
||||
INTON;
|
||||
if (n->npipe.backgnd == 0) {
|
||||
INTOFF;
|
||||
exitstatus = waitforjob(jp);
|
||||
exitstatus = waitforjob(jp, (int *)NULL);
|
||||
TRACE(("evalpipe: job done exit status %d\n", exitstatus));
|
||||
INTON;
|
||||
}
|
||||
@ -602,6 +602,7 @@ evalcommand(cmd, flags, backcmd)
|
||||
struct localvar *volatile savelocalvars;
|
||||
volatile int e;
|
||||
char *lastarg;
|
||||
int realstatus;
|
||||
#if __GNUC__
|
||||
/* Avoid longjmp clobbering */
|
||||
(void) &argv;
|
||||
@ -861,9 +862,9 @@ evalcommand(cmd, flags, backcmd)
|
||||
parent: /* parent process gets here (if we forked) */
|
||||
if (mode == 0) { /* argument to fork */
|
||||
INTOFF;
|
||||
exitstatus = waitforjob(jp);
|
||||
exitstatus = waitforjob(jp, &realstatus);
|
||||
INTON;
|
||||
if (iflag && loopnest > 0 && WIFSIGNALED(exitstatus)) {
|
||||
if (iflag && loopnest > 0 && WIFSIGNALED(realstatus)) {
|
||||
evalskip = SKIPBREAK;
|
||||
skipcount = loopnest;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: expand.c,v 1.25 1999/04/09 15:23:48 tegge Exp $";
|
||||
"$Id: expand.c,v 1.26 1999/04/13 04:13:09 tegge Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -493,7 +493,7 @@ expbackq(cmd, quoted, flag)
|
||||
if (in.buf)
|
||||
ckfree(in.buf);
|
||||
if (in.jp)
|
||||
exitstatus = waitforjob(in.jp);
|
||||
exitstatus = waitforjob(in.jp, (int *)NULL);
|
||||
if (quoted == 0)
|
||||
recordregion(startloc, dest - stackblock(), 0);
|
||||
TRACE(("evalbackq: size=%d: \"%.*s\"\n",
|
||||
|
@ -39,7 +39,7 @@
|
||||
static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: jobs.c,v 1.22 1998/08/25 09:33:34 cracauer Exp $";
|
||||
"$Id: jobs.c,v 1.23 1998/09/08 13:16:52 cracauer Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <fcntl.h>
|
||||
@ -213,7 +213,7 @@ fgcmd(argc, argv)
|
||||
#endif
|
||||
restartjob(jp);
|
||||
INTOFF;
|
||||
status = waitforjob(jp);
|
||||
status = waitforjob(jp, (int *)NULL);
|
||||
INTON;
|
||||
return status;
|
||||
}
|
||||
@ -702,9 +702,10 @@ forkshell(jp, n, mode)
|
||||
*/
|
||||
|
||||
int
|
||||
waitforjob(jp)
|
||||
waitforjob(jp, origstatus)
|
||||
struct job *jp;
|
||||
{
|
||||
int *origstatus;
|
||||
{
|
||||
#if JOBS
|
||||
int mypgrp = getpgrp();
|
||||
#endif
|
||||
@ -730,6 +731,8 @@ waitforjob(jp)
|
||||
curjob = jp - jobtab + 1;
|
||||
#endif
|
||||
status = jp->ps[jp->nprocs - 1].status;
|
||||
if (origstatus != NULL)
|
||||
*origstatus = status;
|
||||
/* convert to 8 bits */
|
||||
if (WIFEXITED(status))
|
||||
st = WEXITSTATUS(status);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)jobs.h 8.2 (Berkeley) 5/4/95
|
||||
* $Id: jobs.h,v 1.9 1998/09/08 13:16:52 cracauer Exp $
|
||||
* $Id: jobs.h,v 1.10 1998/09/10 22:09:11 cracauer Exp $
|
||||
*/
|
||||
|
||||
/* Mode argument to forkshell. Don't change FORK_FG or FORK_BG. */
|
||||
@ -91,7 +91,7 @@ int waitcmd __P((int, char **));
|
||||
int jobidcmd __P((int, char **));
|
||||
struct job *makejob __P((union node *, int));
|
||||
int forkshell __P((struct job *, union node *, int));
|
||||
int waitforjob __P((struct job *));
|
||||
int waitforjob __P((struct job *, int *));
|
||||
int stoppedjobs __P((void));
|
||||
char *commandtext __P((union node *));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user