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