about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2000-05-15 17:54:58 +0000
committerClint Adams <clint@users.sourceforge.net>2000-05-15 17:54:58 +0000
commit18b193f241c6d4257a249b174283ba3148710349 (patch)
tree940a1e0ee025a4754da364a11dd246a8d8c57bc0
parent0e5666e2adf19dc86457a958a622a6f58c9f9ff0 (diff)
downloadzsh-18b193f241c6d4257a249b174283ba3148710349.tar.gz
zsh-18b193f241c6d4257a249b174283ba3148710349.tar.xz
zsh-18b193f241c6d4257a249b174283ba3148710349.zip
11385: parse 0[0-9]+ as octal in arithmetic expressions
-rw-r--r--ChangeLog5
-rw-r--r--Src/math.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index fdbe1cbe4..989e9f692 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-05-15  Clint Adams  <schizo@debian.org>
+	* 11385: Src/math.c: interpret integer constants beginning
+	with '0' as octal to conform to IEEE Std 1003.2-1992
+	(ISO 9945-2:1993).
+
 2000-05-15  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* 11380: Src/subst.c: detect additional characters in parameter
diff --git a/Src/math.c b/Src/math.c
index aee318cfc..75f0106bb 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -357,6 +357,10 @@ zzlex(void)
 		yyval.u.l = zstrtol(++ptr, &ptr, lastbase = 16);
 		return NUM;
 	    }
+	    else if (idigit(*ptr) && (memchr(ptr, '.', strlen(ptr)) == NULL)) {
+	        yyval.u.l = zstrtol(ptr, &ptr, lastbase = 8);
+	        return NUM;
+	    }
 	/* Fall through! */
 	default:
 	    if (idigit(*--ptr) || *ptr == '.') {