ack/lang/cem/libcc/gen/atol.c

21 lines
332 B
C
Raw Normal View History

1994-06-24 14:02:31 +00:00
/* $Id$ */
1987-01-27 15:57:55 +00:00
long atol(s)
register char *s;
{
register long total = 0;
register unsigned digit;
int minus = 0;
while (*s == ' ' || *s == '\t') s++;
if (*s == '+') s++;
else if (*s == '-') {
s++;
minus = 1;
}
while ((digit = *s++ - '0') < 10) {
total *= 10;
total += digit;
}
return(minus ? -total : total);
}