diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-07-21 15:21:13 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-07-21 15:21:13 +0000 |
commit | ff6ddfd72fee08b3063dffb618af31325e51beea (patch) | |
tree | 13490df552db9fb8c134636ddefc554d2ded3c46 /mandoc.c | |
parent | faba8b69bbb1a57a9980aa454612ab8cca95e93a (diff) | |
download | mandoc-ff6ddfd72fee08b3063dffb618af31325e51beea.tar.gz |
Support `size' constructs in eqn.7. Generalise mandoc_strontou to this
effect.
Diffstat (limited to 'mandoc.c')
-rw-r--r-- | mandoc.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -698,7 +698,7 @@ mandoc_getcontrol(const char *cp, int *ppos) * If the string is invalid, or is less than 0, return -1. */ 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 *ep; @@ -716,11 +716,10 @@ mandoc_strntou(const char *p, size_t sz, int base) if (buf[0] == '\0' || *ep != '\0') return(-1); - if ((errno == ERANGE && - (v == LONG_MAX || v == LONG_MIN)) || - (v > INT_MAX || v < 0)) - return(-1); + if (v > INT_MAX) + v = INT_MAX; + if (v < INT_MIN) + v = INT_MIN; return((int)v); } - |