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 | 3ee412a268eff0c9e52bb141dc3289eda00a6d53 (patch) | |
tree | c7806e338a7f518f1e0d02ab42c28e4ce822a405 /mandoc.c | |
parent | 610da288ad1c36332f5bc333692f49e2326fa30d (diff) | |
download | mandoc-3ee412a268eff0c9e52bb141dc3289eda00a6d53.tar.gz mandoc-3ee412a268eff0c9e52bb141dc3289eda00a6d53.tar.zst mandoc-3ee412a268eff0c9e52bb141dc3289eda00a6d53.zip |
Support `size' constructs in eqn.7. Generalise mandoc_strontou to this
effect.
Diffstat (limited to 'mandoc.c')
-rw-r--r-- | mandoc.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -1,4 +1,4 @@ -/* $Id: mandoc.c,v 1.53 2011/05/24 21:31:23 kristaps Exp $ */ +/* $Id: mandoc.c,v 1.54 2011/07/21 15:21:13 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -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); } - |