projects
/
platform
/
upstream
/
coreutils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bc70df0
)
(toarith): Don't accept plain "-" as a valid integer.
author
Jim Meyering
<jim@meyering.net>
Sat, 18 Aug 2001 16:39:33 +0000
(16:39 +0000)
committer
Jim Meyering
<jim@meyering.net>
Sat, 18 Aug 2001 16:39:33 +0000
(16:39 +0000)
src/expr.c
patch
|
blob
|
history
diff --git
a/src/expr.c
b/src/expr.c
index 50930d289ad2c33edf65121aad922ba2c071e2c3..8702dd19cf1f239c27f8ddedc141034e70ab43d8 100644
(file)
--- 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;