1: atoi(ap) 2: char *ap; 3: { 4: register 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: }