version 1.53, 2011/05/24 21:31:23 |
version 1.54, 2011/07/21 15:21:13 |
Line 698 mandoc_getcontrol(const char *cp, int *ppos) |
|
Line 698 mandoc_getcontrol(const char *cp, int *ppos) |
|
* If the string is invalid, or is less than 0, return -1. |
* If the string is invalid, or is less than 0, return -1. |
*/ |
*/ |
int |
int |
mandoc_strntou(const char *p, size_t sz, int base) |
mandoc_strntoi(const char *p, size_t sz, int base) |
{ |
{ |
char buf[32]; |
char buf[32]; |
char *ep; |
char *ep; |
Line 716 mandoc_strntou(const char *p, size_t sz, int base) |
|
Line 716 mandoc_strntou(const char *p, size_t sz, int base) |
|
if (buf[0] == '\0' || *ep != '\0') |
if (buf[0] == '\0' || *ep != '\0') |
return(-1); |
return(-1); |
|
|
if ((errno == ERANGE && |
if (v > INT_MAX) |
(v == LONG_MAX || v == LONG_MIN)) || |
v = INT_MAX; |
(v > INT_MAX || v < 0)) |
if (v < INT_MIN) |
return(-1); |
v = INT_MIN; |
|
|
return((int)v); |
return((int)v); |
} |
} |
|
|