Commit | Line | Data |
---|---|---|
b1d508ab PK |
1 | /* Copyright (c) 1979 Regents of the University of California */ |
2 | ||
72fbef68 | 3 | #ifndef lint |
9b844fb6 | 4 | static char sccsid[] = "@(#)ato.c 2.1 %G%"; |
72fbef68 | 5 | #endif |
27dc948e | 6 | /* This is an sccs experiment */ |
b1d508ab PK |
7 | |
8 | #include "whoami.h" | |
9 | #include "0.h" | |
10 | ||
11 | long | |
12 | a8tol(cp) | |
13 | char *cp; | |
14 | { | |
15 | int err; | |
16 | long l; | |
17 | register CHAR c; | |
18 | ||
19 | l = 0; | |
20 | err = 0; | |
21 | while ((c = *cp++) != '\0') { | |
22 | if (c == '8' || c == '9') | |
23 | if (err == 0) { | |
24 | error("8 or 9 in octal number"); | |
25 | err++; | |
26 | } | |
27 | c -= '0'; | |
6cbd3a07 | 28 | if ((l & 016000000000L) != 0) |
b1d508ab PK |
29 | if (err == 0) { |
30 | error("Number too large for this implementation"); | |
31 | err++; | |
32 | } | |
33 | l = (l << 3) | c; | |
34 | } | |
35 | return (l); | |
36 | } | |
37 | ||
38 | /* | |
39 | * Note that the version of atof | |
40 | * used in this compiler does not | |
41 | * (sadly) complain when floating | |
42 | * point numbers are too large. | |
43 | */ |