|
|
1.1 root 1: /* @(#)atol.c 4.1 (Berkeley) 12/21/80 */
2: long
3: atol(p)
4: register char *p;
5: {
6: long n;
7: register int f;
8:
9: n = 0;
10: f = 0;
11: for(;;p++) {
12: switch(*p) {
13: case ' ':
14: case '\t':
15: continue;
16: case '-':
17: f++;
18: case '+':
19: p++;
20: }
21: break;
22: }
23: while(*p >= '0' && *p <= '9')
24: n = n*10 + *p++ - '0';
25: return(f? -n: n);
26: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.