projects
/
musl
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
9cbec1a86ec2c261bf463a89d846b4c5e6b654f8
[musl]
/
src
/
stdlib
/
wcstoul.c
1
#include <wchar.h>
2
#include <stdlib.h>
3
#include <inttypes.h>
4
#include <errno.h>
5
#include <limits.h>
6
7
unsigned long wcstoul(const wchar_t *s, wchar_t **p, int base)
8
{
9
intmax_t x;
10
if (sizeof(intmax_t) == sizeof(long))
11
return wcstoumax(s, p, base);
12
x = wcstoimax(s, p, base);
13
if (-x > ULONG_MAX || x > ULONG_MAX) {
14
errno = ERANGE;
15
return ULONG_MAX;
16
}
17
return x;
18
}