summaryrefslogtreecommitdiffstats
path: root/mandoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-07-21 15:21:13 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-07-21 15:21:13 +0000
commitff6ddfd72fee08b3063dffb618af31325e51beea (patch)
tree13490df552db9fb8c134636ddefc554d2ded3c46 /mandoc.c
parentfaba8b69bbb1a57a9980aa454612ab8cca95e93a (diff)
downloadmandoc-ff6ddfd72fee08b3063dffb618af31325e51beea.tar.gz
Support `size' constructs in eqn.7. Generalise mandoc_strontou to this
effect.
Diffstat (limited to 'mandoc.c')
-rw-r--r--mandoc.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/mandoc.c b/mandoc.c
index 554c3048..6d11e9b7 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -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);
}
-