From 92b78195a1a7c95615add80678b87a6a3f762f48 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 18 Aug 2001 16:39:33 +0000 Subject: (toarith): Don't accept plain "-" as a valid integer. --- src/expr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/expr.c b/src/expr.c index 50930d289..8702dd19c 100644 --- a/src/expr.c +++ b/src/expr.c @@ -320,19 +320,19 @@ toarith (VALUE *v) case string: i = 0; cp = v->u.s; - /* Don't interpret the empty string as an integer. */ - if (*cp == 0) - return 0; neg = (*cp == '-'); if (neg) cp++; - for (; *cp; cp++) + + do { if (ISDIGIT (*cp)) i = i * 10 + *cp - '0'; else return 0; } + while (*++cp); + free (v->u.s); v->u.i = i * (neg ? -1 : 1); v->type = integer; -- cgit v1.2.3-70-g09d2