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