X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/fd9e470e763ba12c4c4d4f43b0c4cae5d21b282d..45c6d8c4132b612b445b858c6ed1d930140bc840:/contrib/tcsh-6/sh.set.c diff --git a/contrib/tcsh-6/sh.set.c b/contrib/tcsh-6/sh.set.c index e9204a18a8..1876b485e1 100644 --- a/contrib/tcsh-6/sh.set.c +++ b/contrib/tcsh-6/sh.set.c @@ -1,4 +1,4 @@ -/* $Header: /p/tcsh/cvsroot/tcsh/sh.set.c,v 3.70 2006/08/24 20:56:31 christos Exp $ */ +/* $Header: /p/tcsh/cvsroot/tcsh/sh.set.c,v 3.72 2007/09/28 21:02:03 christos Exp $ */ /* * sh.set.c: Setting and Clearing of variables */ @@ -32,7 +32,7 @@ */ #include "sh.h" -RCSID("$tcsh: sh.set.c,v 3.70 2006/08/24 20:56:31 christos Exp $") +RCSID("$tcsh: sh.set.c,v 3.72 2007/09/28 21:02:03 christos Exp $") #include "ed.h" #include "tw.h" @@ -173,6 +173,9 @@ update_vars(Char *vp) else if (eq(vp, STRbackslash_quote)) { bslash_quote = 1; } + else if (eq(vp, STRcompat_expr)) { + compat_expr = 1; + } else if (eq(vp, STRdirstack)) { dsetstack(); } @@ -524,6 +527,7 @@ getn(Char *cp) { int n; int sign; + int base; if (!cp) /* PWP: extra error checking */ stderror(ERR_NAME | ERR_BADNUM); @@ -537,9 +541,19 @@ getn(Char *cp) if (!Isdigit(*cp)) stderror(ERR_NAME | ERR_BADNUM); } + + if (cp[0] == '0' && cp[1]) + base = 8; + else + base = 10; + n = 0; while (Isdigit(*cp)) - n = n * 10 + *cp++ - '0'; + { + if (base == 8 && *cp >= '8') + stderror(ERR_NAME | ERR_BADNUM); + n = n * base + *cp++ - '0'; + } if (*cp) stderror(ERR_NAME | ERR_BADNUM); return (sign ? -n : n); @@ -749,6 +763,8 @@ unset(Char **v, struct command *c) editing = 0; if (adrof(STRbackslash_quote) == 0) bslash_quote = 0; + if (adrof(STRcompat_expr) == 0) + compat_expr = 0; if (adrof(STRsymlinks) == 0) symlinks = 0; if (adrof(STRimplicitcd) == 0)