1 /* Copyright (c) 1979 Regents of the University of California */ 2 3 #ifndef lint 4 static char sccsid[] = "@(#)ato.c 2.1 02/08/84"; 5 #endif 6 /* This is an sccs experiment */ 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'; 28 if ((l & 016000000000L) != 0) 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 */ 44