diff options
author | mp <mp@FreeBSD.org> | 2002-07-24 16:23:10 +0000 |
---|---|---|
committer | mp <mp@FreeBSD.org> | 2002-07-24 16:23:10 +0000 |
commit | f2c2aa29b7d05c53575ab7ce4dc5870fd33a1310 (patch) | |
tree | 22260a5dd95c2612c939ecc9dc8166877f07d1d1 /contrib/tcsh/tc.prompt.c | |
parent | e8a1e84ed0d35851468ed9942dd757f1874d0907 (diff) | |
download | FreeBSD-src-f2c2aa29b7d05c53575ab7ce4dc5870fd33a1310.zip FreeBSD-src-f2c2aa29b7d05c53575ab7ce4dc5870fd33a1310.tar.gz |
Import of tcsh-6.12.00
Diffstat (limited to 'contrib/tcsh/tc.prompt.c')
-rw-r--r-- | contrib/tcsh/tc.prompt.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/contrib/tcsh/tc.prompt.c b/contrib/tcsh/tc.prompt.c index 95d5641..6c0a0a4 100644 --- a/contrib/tcsh/tc.prompt.c +++ b/contrib/tcsh/tc.prompt.c @@ -1,4 +1,4 @@ -/* $Header: /src/pub/tcsh/tc.prompt.c,v 3.41 2000/11/11 23:03:39 christos Exp $ */ +/* $Header: /src/pub/tcsh/tc.prompt.c,v 3.46 2002/07/12 13:16:19 christos Exp $ */ /* * tc.prompt.c: Prompt printing stuff */ @@ -14,11 +14,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,7 +32,7 @@ */ #include "sh.h" -RCSID("$Id: tc.prompt.c,v 3.41 2000/11/11 23:03:39 christos Exp $") +RCSID("$Id: tc.prompt.c,v 3.46 2002/07/12 13:16:19 christos Exp $") #include "ed.h" #include "tw.h" @@ -200,8 +196,8 @@ tprintf(what, buf, fmt, siz, str, tim, info) /* prompt stuff */ static Char *olddir = NULL, *olduser = NULL; extern int tlength; /* cache cleared */ - int updirs, sz; - size_t pdirs; + int updirs; + size_t pdirs, sz; for (; *cp; cp++) { if (p >= ep) @@ -424,7 +420,7 @@ tprintf(what, buf, fmt, siz, str, tim, info) *p++ = attributes | '+'; } else *p++ = attributes | ('0' + updirs); - *p++ = attributes | tcsh ? '>' : '%'; + *p++ = attributes | '>'; } } @@ -513,14 +509,30 @@ tprintf(what, buf, fmt, siz, str, tim, info) case 'L': ClearToBottom(); break; + + case 'j': + { + Char buf[128], *ebuf, *q; + int njobs = -1; + struct process *pp; + for (pp = proclist.p_next; pp; pp = pp->p_next) + njobs++; + /* make sure we have space */ + ebuf = Itoa(njobs, buf, 1, attributes); + for (q = buf; q < ebuf; *p++ = *q++) + if (p >= ep) break; + break; + } case '?': if ((z = varval(STRstatus)) != STRNULL) for (; *z; *p++ = attributes | *z++) if (p >= ep) break; break; case '$': - sz = (int) (ep - p); + sz = ep - p; (void) expdollar(&p, &cp, &sz, attributes); + /* cp should point the last char of currnet % sequence */ + cp--; break; case '%': *p++ = attributes | '%'; @@ -604,7 +616,7 @@ expdollar(dstp, srcp, spp, attr) vp = adrof(var); val = (!vp) ? tgetenv(var) : NULL; - if (vp) { + if (vp && vp->vec) { for (i = 0; vp->vec[i] != NULL; i++) { for (val = vp->vec[i]; *spp > 0 && *val; (*spp)--) *dst++ = *val++ | attr; |