5 long strntol(const char *str, size_t sz, char **end, int base)
7 /* Expect that digit representation of LONG_MAX/MIN
8 * not greater than this buffer */
11 const char *beg = str;
13 /* Catch up leading spaces */
14 for (; beg && sz && *beg == ' '; beg++, sz--)
17 if (!sz || sz >= sizeof(buf)) {
25 ret = strtol(buf, end, base);
26 if (ret == LONG_MIN || ret == LONG_MAX)
29 *end = (char *)str + (*end - buf);