1bcd8ea591
situation, Fix calculation order of operators description in tcsh manpage, Fix strings which begin with '0' are not recognized as octal numbers, Fix memoryuse description in tcsh manpage, Fix tcsh scripts with multiple case statement with end keywords break with error, Fix description of builtin command 'set' in tcsh manpage
33 lines
790 B
Diff
33 lines
790 B
Diff
diff -up tcsh-6.15.00/sh.set.c.octal tcsh-6.15.00/sh.set.c
|
|
--- tcsh-6.15.00/sh.set.c.octal 2006-08-24 22:56:31.000000000 +0200
|
|
+++ tcsh-6.15.00/sh.set.c 2008-09-03 12:28:10.000000000 +0200
|
|
@@ -525,6 +525,7 @@ getn(Char *cp)
|
|
{
|
|
int n;
|
|
int sign;
|
|
+ int base;
|
|
|
|
if (!cp) /* PWP: extra error checking */
|
|
stderror(ERR_NAME | ERR_BADNUM);
|
|
@@ -538,9 +539,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);
|