-/* $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
*/
*/
#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"
else if (eq(vp, STRbackslash_quote)) {
bslash_quote = 1;
}
+ else if (eq(vp, STRcompat_expr)) {
+ compat_expr = 1;
+ }
else if (eq(vp, STRdirstack)) {
dsetstack();
}
{
int n;
int sign;
+ int base;
if (!cp) /* PWP: extra error checking */
stderror(ERR_NAME | ERR_BADNUM);
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);
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)