blob: 990673a6327733c89d6a16317529b3e439d4e1e2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST
signed short int
libsimple_strtoh(const char *restrict nptr, char **restrict end, int base) /* TODO test, man */
{
signed long int r = strtol(nptr, end, base);
if(r < SHRT_MIN) {
r = SHRT_MIN;
errno = ERANGE;
} else if(r > SHRT_MAX) {
r = SHRT_MAX;
errno = ERANGE;
}
return (signed short int)r;
}
#else
#include "test.h"
int
main(void)
{
return 0;
}
#endif
|