8 static inline int isspace(int c
)
10 return (c
<= ' '); /* Close enough */
13 static inline int digitval(int ch
)
15 if (ch
>= '0' && ch
<= '9') {
17 } else if (ch
>= 'A' && ch
<= 'Z') {
19 } else if (ch
>= 'a' && ch
<= 'z') {
26 unsigned long strtoul(const char *nptr
, char **endptr
, int base
)
32 while (isspace((unsigned char)*nptr
)) {
36 /* Single optional + or - */
39 if (c
== '-' || c
== '+') {
47 (nptr
[1] == 'x' || nptr
[1] == 'X')) {
50 } else if (nptr
[0] == '0') {
56 } else if (base
== 16) {
58 (nptr
[1] == 'x' || nptr
[1] == 'X')) {
63 while ((d
= digitval(*nptr
)) >= 0 && d
< base
) {
69 *endptr
= (char *)nptr
;
71 return minus
? -v
: v
;