1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-26 04:30:27 +01:00

16198: add %j prompt expansion and j test character for no. of jobs in prompt

This commit is contained in:
Oliver Kiddle 2001-11-02 12:35:32 +00:00
parent f3f81f0837
commit 19d2273cb7
4 changed files with 50 additions and 19 deletions

View file

@ -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")))