diff options
Diffstat (limited to 'contrib/tcsh/sh.func.c')
-rw-r--r-- | contrib/tcsh/sh.func.c | 72 |
1 files changed, 50 insertions, 22 deletions
diff --git a/contrib/tcsh/sh.func.c b/contrib/tcsh/sh.func.c index a2e8989..bd253e7 100644 --- a/contrib/tcsh/sh.func.c +++ b/contrib/tcsh/sh.func.c @@ -1,4 +1,4 @@ -/* $Header: /src/pub/tcsh/sh.func.c,v 3.93 2001/03/13 12:53:50 christos Exp $ */ +/* $Header: /src/pub/tcsh/sh.func.c,v 3.103 2002/07/09 12:56:55 christos Exp $ */ /* * sh.func.c: csh builtin functions */ @@ -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: sh.func.c,v 3.93 2001/03/13 12:53:50 christos Exp $") +RCSID("$Id: sh.func.c,v 3.103 2002/07/09 12:56:55 christos Exp $") #include "ed.h" #include "tw.h" @@ -304,7 +300,7 @@ doalias(v, c) plist(&aliases, VAR_ALL); else if (*v == 0) { vp = adrof1(strip(p), &aliases); - if (vp) + if (vp && vp->vec) blkpr(vp->vec), xputchar('\n'); } else { @@ -446,7 +442,7 @@ reexecute(kp) * pgrp's as the jobs would then have no way to get the tty (we can't give * it to them, and our parent wouldn't know their pgrp, etc. */ - execute(kp, (tpgrp > 0 ? tpgrp : -1), NULL, NULL); + execute(kp, (tpgrp > 0 ? tpgrp : -1), NULL, NULL, TRUE); } /*ARGSUSED*/ @@ -731,21 +727,23 @@ dorepeat(v, kp) Char **v; struct command *kp; { - register int i; + int i = 1; #ifdef BSDSIGS register sigmask_t omask = 0; - #endif /* BSDSIGS */ - i = getn(v[1]); + do { + i *= getn(v[1]); + lshift(v, 2); + } while (v[0] != NULL && Strcmp(v[0], STRrepeat) == 0); + if (setintr) #ifdef BSDSIGS omask = sigblock(sigmask(SIGINT)) & ~sigmask(SIGINT); #else /* !BSDSIGS */ (void) sighold(SIGINT); #endif /* BSDSIGS */ - lshift(v, 2); while (i > 0) { if (setintr) #ifdef BSDSIGS @@ -1313,6 +1311,16 @@ dosetenv(v, c) vp = *v++; + lp = vp; + if (!letter(*lp)) + stderror(ERR_NAME | ERR_VARBEGIN); + + for (; alnum(*lp); lp++) + continue; + + if (*lp != '\0') + stderror(ERR_NAME | ERR_SYNTAX); + if ((lp = *v++) == 0) lp = STRNULL; @@ -1382,6 +1390,13 @@ dosetenv(v, c) return; } +#ifdef NLS_CATALOGS + if (eq(vp, STRNLSPATH)) { + (void) catclose(catd); + nlsinit(); + } +#endif + if (eq(vp, STRNOREBIND)) { NoNLSRebind = 1; MapsAreInited = 0; @@ -1576,6 +1591,12 @@ dounsetenv(v, c) else if (eq(name, STRLS_COLORS)) parseLS_COLORS(n); #endif /* COLOR_LS_F */ +#ifdef NLS_CATALOGS + else if (eq(name, STRNLSPATH)) { + (void) catclose(catd); + nlsinit(); + } +#endif /* * start again cause the environment changes */ @@ -1711,15 +1732,15 @@ doumask(v, c) # define toset(a) ((a) + 1) # endif /* aiws */ # else /* BSDLIMIT */ -# if defined(BSD4_4) && !defined(__386BSD__) - typedef quad_t RLIM_TYPE; +# if (defined(BSD4_4) || defined(__linux__)) && !defined(__386BSD__) + typedef rlim_t RLIM_TYPE; # else # if defined(SOLARIS2) || (defined(sgi) && SYSVREL > 3) typedef rlim_t RLIM_TYPE; # else # if defined(_SX) typedef long long RLIM_TYPE; -# else /* _SX */ +# else /* !_SX */ typedef unsigned long RLIM_TYPE; # endif /* _SX */ # endif /* SOLARIS2 || (sgi && SYSVREL > 3) */ @@ -1825,9 +1846,13 @@ struct limits limits[] = { RLIMIT_NPROC, "maxproc", 1, "" }, # endif /* RLIMIT_NPROC */ -# ifdef RLIMIT_OFILE +# if defined(RLIMIT_OFILE) && !defined(RLIMIT_NOFILE) { RLIMIT_OFILE, "openfiles", 1, "" }, -# endif /* RLIMIT_OFILE */ +# endif /* RLIMIT_OFILE && !defined(RLIMIT_NOFILE) */ + +# ifdef RLIMIT_SBSIZE + { RLIMIT_SBSIZE, "sbsize", 1, "" }, +# endif /* RLIMIT_SBSIZE */ { -1, NULL, 0, NULL } }; @@ -2143,6 +2168,9 @@ setlim(lp, hard, limit) else rlim.rlim_cur = limit; + if (rlim.rlim_cur > rlim.rlim_max) + rlim.rlim_max = rlim.rlim_cur; + if (setrlimit(lp->limconst, &rlim) < 0) { # else /* BSDLIMIT */ if (limit != RLIM_INFINITY && lp->limconst == RLIMIT_FSIZE) @@ -2153,10 +2181,10 @@ setlim(lp, hard, limit) # endif /* aiws */ if (ulimit(toset(lp->limconst), limit) < 0) { # endif /* BSDLIMIT */ - xprintf(CGETS(15, 1, "%s: %s: Can't %s%s limit\n"), bname, lp->limname, - limit == RLIM_INFINITY ? CGETS(15, 2, "remove") : - CGETS(15, 3, "set"), - hard ? CGETS(14, 4, " hard") : ""); + xprintf(CGETS(15, 1, "%s: %s: Can't %s%s limit (%s)\n"), bname, + lp->limname, limit == RLIM_INFINITY ? CGETS(15, 2, "remove") : + CGETS(15, 3, "set"), hard ? CGETS(14, 4, " hard") : "", + strerror(errno)); return (-1); } return (0); |