summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-03-13 08:21:38 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-03-13 08:21:38 +0000
commit2873bc6e90515a8b7086b7e9340f1ec65d9f42f7 (patch)
treee876350ddaae03f3db6824e3ab3d0e718a7e1a00
parent6939434099c5b8e59923bb8b16bd4cb85f049315 (diff)
Interpret zero-filled numbers as decimal; PR 4213; from Alexey
Dobriyan; ok millert@ moritz@ jaredy@
-rw-r--r--bin/ksh/var.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/ksh/var.c b/bin/ksh/var.c
index 52d6e3a7a45..118fdc79cf1 100644
--- a/bin/ksh/var.c
+++ b/bin/ksh/var.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: var.c,v 1.28 2005/12/11 20:31:21 otto Exp $ */
+/* $OpenBSD: var.c,v 1.29 2006/03/13 08:21:37 otto Exp $ */
#include "sh.h"
#include <time.h>
@@ -430,6 +430,9 @@ getint(struct tbl *vp, long int *nump, bool arith)
if (*s == 'x' || *s == 'X') {
s++;
base = 16;
+ } else if (vp->flag & ZEROFIL) {
+ while (*s == '0')
+ s++;
} else
base = 8;
have_base++;