Files
unix-v6/source/s4/atoi.c
T
2018-01-27 22:35:41 +09:00

25 lines
268 B
C

atoi(ap)
char *ap;
{
register n, c;
register char *p;
int f;
p = ap;
n = 0;
f = 0;
loop:
while(*p == ' ' || *p == ' ')
p++;
if(*p == '-') {
f++;
p++;
goto loop;
}
while(*p >= '0' && *p <= '9')
n = n*10 + *p++ - '0';
if(f)
n = -n;
return(n);
}