Annotation of 41BSD/libc/gen/atoi.c, revision 1.1

1.1     ! root        1: atoi(ap)
        !             2: char *ap;
        !             3: {
        !             4:        register int  n, c;
        !             5:        register char *p;
        !             6:        int f;
        !             7: 
        !             8:        p = ap;
        !             9:        n = 0;
        !            10:        f = 0;
        !            11: loop:
        !            12:        while(*p == ' ' || *p == '      ')
        !            13:                p++;
        !            14:        if(*p == '-') {
        !            15:                f++;
        !            16:                p++;
        !            17:                goto loop;
        !            18:        }
        !            19:        while(*p >= '0' && *p <= '9')
        !            20:                n = n*10 + *p++ - '0';
        !            21:        if(f)
        !            22:                n = -n;
        !            23:        return(n);
        !            24: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.