about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-11-02 08:12:44 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-11-02 08:12:44 +0000
commitda9b5bb81a87fdbab6c74c75c904e9c4bd44f252 (patch)
treeda97783158bf15560f81887ba9f62b3206119db5
parent2557464cf55adee5d67ac683f154715854e43312 (diff)
downloadzsh-da9b5bb81a87fdbab6c74c75c904e9c4bd44f252.tar.gz
zsh-da9b5bb81a87fdbab6c74c75c904e9c4bd44f252.tar.xz
zsh-da9b5bb81a87fdbab6c74c75c904e9c4bd44f252.zip
show current/previous job in $jobstates (3503)
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/mod_parameter.yo13
-rw-r--r--Src/Modules/parameter.c15
-rw-r--r--Src/jobs.c4
4 files changed, 25 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 71abedb04..30a2f838b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/Doc/Zsh/mod_parameter.yo b/Doc/Zsh/mod_parameter.yo
index dc611258e..2d2847af2 100644
--- a/Doc/Zsh/mod_parameter.yo
+++ b/Doc/Zsh/mod_parameter.yo
@@ -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))(
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index df4d1020e..2df362faa 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -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) {
 
diff --git a/Src/jobs.c b/Src/jobs.c
index ca4b12004..a938e774b 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -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 */