projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
add and consolidate nasty stdio_ext junk
[oweals/musl.git]
/
src
/
stdlib
/
strtol.c
1
#include <stdlib.h>
2
#include <inttypes.h>
3
#include <errno.h>
4
#include <limits.h>
5
6
long strtol(const char *s, char **p, int base)
7
{
8
intmax_t x = strtoimax(s, p, base);
9
if (x > LONG_MAX) {
10
errno = ERANGE;
11
return LONG_MAX;
12
} else if (x < LONG_MIN) {
13
errno = ERANGE;
14
return LONG_MIN;
15
}
16
return x;
17
}