isonlydigit() will return true also for negative integers
This commit is contained in:
parent
83345932a5
commit
b1f72ada59
22
src/token.c
22
src/token.c
|
|
@ -3203,13 +3203,23 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int
|
||||||
|
|
||||||
int isonlydigit(const char *s)
|
int isonlydigit(const char *s)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
if(s == NULL || *s == '\0') return 0;
|
int res = 1;
|
||||||
while( (c = *s) ) {
|
int first = 1;
|
||||||
if(c < '0' || c > '9') return 0;
|
if(s == NULL || *s == '\0') return 0;
|
||||||
++s;
|
while( (c = *s++) ) {
|
||||||
|
if(first == 1) {
|
||||||
|
first = 0;
|
||||||
|
if(c == '-') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
if(c < '0' || c > '9') {
|
||||||
|
res = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue