home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_100
/
106_01
/
otoi.c
< prev
next >
Wrap
Text File
|
1980-07-09
|
512b
|
25 lines
/*
otoi(n)
this function converts an offset octal number in ASCII
to an integer. the number is in the format xxx.xxx{a} and
may be preceeded by white space.
*/
otoi(n)
char *n;
{
int val, b, i;
char c;
val = 0; b = 16384;
while ((c = *n) == '\t' || c == ' ') ++n;
for (i = 0; i < 7; i++) {
if ((c = *n) == '.') {++n; b = 64;}
else {c = *n++; val = val + (b * (c - '0')); b /= 8;}
}
return val;
}