|
|
1.1 ! root 1: # include <sccs.h> ! 2: ! 3: SCCSID(@(#)oatoi.c 8.1 12/31/84) ! 4: ! 5: /* ! 6: ** OCTAL ASCII TO INTEGER CONVERSION ! 7: ** ! 8: ** The ascii string 'a' which represents an octal number ! 9: ** is converted to binary and returned. Conversion stops at any ! 10: ** non-octal digit. The integer reflects the natural word length of the ! 11: ** machine. ! 12: ** ! 13: ** Note that the number may not have a sign, and may not have ! 14: ** leading blanks. ! 15: ** ! 16: ** (Intended for converting the status codes in users(FILE)) ! 17: */ ! 18: ! 19: oatoi(a) ! 20: char *a; ! 21: { ! 22: register int r; ! 23: register char *p; ! 24: register char c; ! 25: ! 26: r = 0; ! 27: p = a; ! 28: ! 29: while ((c = *p++) >= '0' && c <= '7') ! 30: r = (r << 3) | (c &= 7); ! 31: ! 32: return (r); ! 33: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.