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