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