|
|
@ -5,7 +5,8 @@ unsigned int scan_long(const char *src,long *dest) {
|
|
|
|
register long int l;
|
|
|
|
register long int l;
|
|
|
|
register unsigned char c;
|
|
|
|
register unsigned char c;
|
|
|
|
int neg;
|
|
|
|
int neg;
|
|
|
|
tmp=src; l=0; neg=0;
|
|
|
|
int ok;
|
|
|
|
|
|
|
|
tmp=src; l=0; ok=neg=0;
|
|
|
|
switch (*tmp) {
|
|
|
|
switch (*tmp) {
|
|
|
|
case '-': neg=1;
|
|
|
|
case '-': neg=1;
|
|
|
|
case '+': ++tmp;
|
|
|
|
case '+': ++tmp;
|
|
|
@ -13,7 +14,8 @@ unsigned int scan_long(const char *src,long *dest) {
|
|
|
|
while ((c=*tmp-'0')<10) {
|
|
|
|
while ((c=*tmp-'0')<10) {
|
|
|
|
l=l*10+c;
|
|
|
|
l=l*10+c;
|
|
|
|
++tmp;
|
|
|
|
++tmp;
|
|
|
|
|
|
|
|
ok=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*dest=(neg?-l:l);
|
|
|
|
if (ok) *dest=(neg?-l:l);
|
|
|
|
return tmp-src;
|
|
|
|
return tmp-src;
|
|
|
|
}
|
|
|
|
}
|
|
|
|