6 #include "ntp_stdlib.h"
9 * atouint() - convert an ascii string representing a whole base 10
10 * number to u_long *uval, returning TRUE if successful.
11 * Does not modify *uval and returns FALSE if str is not
12 * a positive base10 integer or is too large for a u_int32.
13 * this function uses u_long but should use u_int32, and
14 * probably be renamed.
31 if (!isdigit((unsigned char)*cp))
33 if (u > 429496729 || (u == 429496729 && *cp >= '6'))
34 return 0; /* overflow */
35 /* hand-optimized u *= 10; */
36 u = (u << 3) + (u << 1);
37 u += *cp++ - '0'; /* not '\0' */