Gitiles
Code Review
Sign In
gerrit-public.fairphone.software
/
platform
/
external
/
musl
/
82171d6ac0d84876cdc6dd6319b0790b42cdb47e
/
.
/
src
/
stdlib
/
strtoul.c
blob: 951d5e8c7a29a12a3adfb7450142985f0eff6755 [
file
] [
log
] [
blame
]
#include
<stdlib.h>
#include
<inttypes.h>
#include
<errno.h>
#include
<limits.h>
unsigned
long
strtoul
(
const
char
*
s
,
char
**
p
,
int
base
)
{
uintmax_t
x
=
strtoumax
(
s
,
p
,
base
);
if
(
x
>
ULONG_MAX
)
{
errno
=
ERANGE
;
return
ULONG_MAX
;
}
return
x
;
}