2 * atoint - convert an ascii string to a signed long, with error checking
9 #include "ntp_stdlib.h"
18 register const char *cp;
20 register int oflow_digit;
38 if (!isdigit((unsigned char)*cp))
40 if (u > 214748364 || (u == 214748364 && *cp > oflow_digit))
41 return 0; /* overflow */
42 u = (u << 3) + (u << 1);
43 u += *cp++ - '0'; /* ascii dependent */