1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-27 18:36:05 +02:00

show current/previous job in $jobstates (3503)

This commit is contained in:
Sven Wischnowsky 2000-11-02 08:12:44 +00:00
parent 2557464cf5
commit da9b5bb81a
4 changed files with 25 additions and 12 deletions

View File

@ -1,3 +1,8 @@
2000-11-02 Sven Wischnowsky <wischnow@zsh.org>
* users/3503: Doc/Zsh/mod_parameter.yo, Src/jobs.c,
Src/Modules/parameter.c: show current/previous job in $jobstates
2000-11-01 Sven Wischnowsky <wischnow@zsh.org>
* 13107: Functions/Misc/zed: don't reset just-edited trap function

View File

@ -127,12 +127,13 @@ item(tt(jobstates))(
This associative array gives information about the states of the jobs
currently known. The keys are the job numbers and the values are
strings of the form
`var(job-state):var(pid)tt(=)var(state)tt(...)'. The var(job-state)
gives the state the whole job is currently in, one of `tt(running)',
`tt(suspended)', or `tt(done)'. This is followed by one
`var(pid)tt(=)var(state)' for every process in the job. The var(pid)s
are, of course, the process IDs and the var(state) describes the state
of that process.
`var(job-state):var(mark):var(pid)tt(=)var(state)tt(...)'. The
var(job-state) gives the state the whole job is currently in, one of
`tt(running)', `tt(suspended)', or `tt(done)'. The var(mark) is
`tt(+)' for the current job, `tt(-)' for the previous job and empty
otherwise. This is followed by one `var(pid)tt(=)var(state)' for every
process in the job. The var(pid)s are, of course, the process IDs and
the var(state) describes the state of that process.
)
vindex(nameddirs)
item(tt(nameddirs))(

View File

@ -1222,14 +1222,21 @@ static char *
pmjobstate(int job)
{
Process pn;
char buf[256], buf2[128], *ret, *state;
char buf[256], buf2[128], *ret, *state, *cp;
if (job == curjob)
cp = ":+";
else if (job == prevjob)
cp = ":-";
else
cp = ":";
if (jobtab[job].stat & STAT_DONE)
ret = dupstring("done");
ret = dyncat("done", cp);
else if (jobtab[job].stat & STAT_STOPPED)
ret = dupstring("suspended");
ret = dyncat("suspended", cp);
else
ret = dupstring("running");
ret = dyncat("running", cp);
for (pn = jobtab[job].procs; pn; pn = pn->next) {

View File

@ -43,12 +43,12 @@ mod_export int thisjob;
/* the current job (+) */
/**/
int curjob;
mod_export int curjob;
/* the previous job (-) */
/**/
int prevjob;
mod_export int prevjob;
/* the job table */