summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6501dcc)
SCCS-vsn: bin/csh/proc.c 4.2
-static char *sccsid = "@(#)proc.c 4.1 %G%";
+static char *sccsid = "@(#)proc.c 4.2 %G%";
#include "sh.h"
#include "sh.dir.h"
#include "sh.h"
#include "sh.dir.h"
} while((fp = fp->p_friends) != pp);
while(fp->p_pid != fp->p_jobid)
fp = fp->p_friends;
} while((fp = fp->p_friends) != pp);
while(fp->p_pid != fp->p_jobid)
fp = fp->p_friends;
+ if (jobflags&PSTOPPED) {
+ if (pcurrent && pcurrent != fp)
+ pprevious = pcurrent;
+ pcurrent = fp;
+ } else
+ pclrcurr(fp);
- if (jobflags&PSTOPPED) {
- if (pcurrent && pcurrent != fp)
- pprevious = pcurrent;
- pcurrent = fp;
- } else
- pclrcurr(fp);
if (jobflags & (PSIGNALED|PSTOPPED|PPTIME) ||
#ifdef IIASA
jobflags & PAEXITED ||
if (jobflags & (PSIGNALED|PSTOPPED|PPTIME) ||
#ifdef IIASA
jobflags & PAEXITED ||
if ((jobflags&PSTOPPED) == 0)
pflush(pp);
} else {
if ((jobflags&PSTOPPED) == 0)
pflush(pp);
} else {
- if ((jobflags&PSTOPPED) == 0)
- pclrcurr(fp);
fp->p_flags |= PNEEDNOTE;
neednote++;
}
fp->p_flags |= PNEEDNOTE;
neednote++;
}
for (np = proclist.p_next; np; np = np->p_next)
if (np->p_index == i)
goto tryagain;
for (np = proclist.p_next; np; np = np->p_next)
if (np->p_index == i)
goto tryagain;
- pmaxindex = pp->p_index = i;
+ pp->p_index = i;
+ if (i > pmaxindex)
+ pmaxindex = i;
np->p_flags &= ~PFOREGND;
}
} while((np = np->p_friends) != pp);
np->p_flags &= ~PFOREGND;
}
} while((np = np->p_friends) != pp);
+ if (!foregnd)
+ pclrcurr(pp);
pprint(pp, foregnd ? NAME|JOBDIR : NUMBER|NAME|AMPERSAND);
if (foregnd)
ioctl(FSHTTY, TIOCSPGRP, &pp->p_jobid);
pprint(pp, foregnd ? NAME|JOBDIR : NUMBER|NAME|AMPERSAND);
if (foregnd)
ioctl(FSHTTY, TIOCSPGRP, &pp->p_jobid);
- * pgetcurr - find a job that is not pp and ``most recent''
+ * pgetcurr - find most recent job that is not pp, preferably stopped
*/
struct process *
pgetcurr(pp)
register struct process *pp;
{
register struct process *np;
*/
struct process *
pgetcurr(pp)
register struct process *pp;
{
register struct process *np;
+ register struct process *xp = PNULL;
for (np = proclist.p_next; np; np = np->p_next)
if (np != pcurrent && np != pp && np->p_pid &&
np->p_pid == np->p_jobid) {
for (np = proclist.p_next; np; np = np->p_next)
if (np != pcurrent && np != pp && np->p_pid &&
np->p_pid == np->p_jobid) {
+ if (np->p_flags & PSTOPPED)
+ return (np);
+ if (xp == PNULL)
+ xp = np;