summaryrefslogtreecommitdiff
path: root/src/stdlib/strtoul.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib/strtoul.c')
-rw-r--r--src/stdlib/strtoul.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/stdlib/strtoul.c b/src/stdlib/strtoul.c
index 9a00910b..414b5897 100644
--- a/src/stdlib/strtoul.c
+++ b/src/stdlib/strtoul.c
@@ -2,25 +2,17 @@
#include "errno.h"
#include "limits.h"
-#if defined __STDC_VERSION__ && 199912L <= __STDC_VERSION__
-#include "inttypes.h"
-#else
-typedef unsigned long uintmax_t;
-#define strtoumax(n, e, b) ((long)n & (long)e & (long)b ? 0 : 0)
-#endif
-
/** convert string to unsigned long integer **/
+
unsigned long int strtoul(const char * nptr, char ** endptr, int base)
{
- /* FIXME: forward dependency on 9899-1999 */
- uintmax_t ret = strtoumax(nptr, endptr, base);
+ unsigned long int ret = 0;
+ unsigned long int max = ULONG_MAX;
+ unsigned long int min = 0;
- if (ret > ULONG_MAX) {
- ret = ULONG_MAX;
- errno = ERANGE; /* converted value too large */
- }
+ #include "_strtoi.h"
- return (unsigned long int)ret;
+ return ret;
}
/***