#include <stdlib.h>
#include <limits.h>
+#include "strntol.h"
+
long strntol(const char *str, size_t sz, char **end, int base)
{
/* Expect that digit representation of LONG_MAX/MIN
if (ret == LONG_MIN || ret == LONG_MAX)
return ret;
if (end)
- *end = (char *)str + (*end - buf);
+ *end = (char *)beg + (*end - buf);
return ret;
}