about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/prompt.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/Src/prompt.c b/Src/prompt.c
index d5df9d1ce..9b6edfcc6 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -202,7 +202,7 @@ static int
 putpromptchar(int doprint, int endchar)
 {
     char *ss, *tmbuf = NULL, *hostnam;
-    int t0, arg, test, sep;
+    int t0, arg, test, sep, j, numjobs;
     struct tm *tm;
     time_t timet;
     Nameddir nd;
@@ -286,6 +286,13 @@ putpromptchar(int doprint, int endchar)
 		    if (getegid() == arg)
 			test = 1;
 		    break;
+		case 'j':
+		    for (numjobs = 0, j = 1; j < MAXJOB; j++)
+			if (jobtab[j].stat && jobtab[j].procs &&
+		    	    !(jobtab[j].stat & STAT_NOPRINT)) numjobs++;
+		    if (numjobs >= arg)
+		    	test = 1;
+		    break;
 		case 'l':
 		    *bp = '\0';
 		    countprompt(bufline, &t0, 0, 0);
@@ -371,6 +378,14 @@ putpromptchar(int doprint, int endchar)
 		sprintf(bp, "%d", curhist);
 		bp += strlen(bp);
 		break;
+	    case 'j':
+		for (numjobs = 0, j = 1; j < MAXJOB; j++)
+		    if (jobtab[j].stat && jobtab[j].procs &&
+		    	!(jobtab[j].stat & STAT_NOPRINT)) numjobs++;
+		addbufspc(DIGBUFSIZE);
+		sprintf(bp, "%d", numjobs);
+		bp += strlen(bp);
+		break;
 	    case 'M':
 		queue_signals();
 		if ((hostnam = getsparam("HOST")))