|
|
1.1 root 1: #if defined(LIBC_SCCS) && !defined(lint)
2: static char sccsid[] = "@(#)atoi.c 5.2 (Berkeley) 3/9/86";
3: #endif LIBC_SCCS and not lint
4:
5: atoi(p)
6: register char *p;
7: {
8: register int n;
9: register int f;
10:
11: n = 0;
12: f = 0;
13: for(;;p++) {
14: switch(*p) {
15: case ' ':
16: case '\t':
17: continue;
18: case '-':
19: f++;
20: case '+':
21: p++;
22: }
23: break;
24: }
25: while(*p >= '0' && *p <= '9')
26: n = n*10 + *p++ - '0';
27: return(f? -n: n);
28: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.