aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-06-08 12:54:58 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-06-08 12:54:58 +0000
commit789580a2a2366243d622766fdadd094931ca6596 (patch)
tree60a78614bcfb83b55ebd45464a5bc77e4c61c98c /mdoc_term.c
parent76a6887f123b221e7a8851c1b0d0008119492613 (diff)
downloadmandoc-789580a2a2366243d622766fdadd094931ca6596.tar.gz
mandoc-789580a2a2366243d622766fdadd094931ca6596.tar.zst
mandoc-789580a2a2366243d622766fdadd094931ca6596.zip
make the internal a2roffsu() interface more powerful by returning
a pointer to the end of the parsed data, making it easier to parse subsequent bytes
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 27d6d938..471c52ca 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.362 2017/06/07 17:38:26 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.363 2017/06/08 12:54:58 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -533,8 +533,10 @@ static int
a2width(const struct termp *p, const char *v)
{
struct roffsu su;
+ const char *end;
- if (a2roffsu(v, &su, SCALE_MAX) < 2) {
+ end = a2roffsu(v, &su, SCALE_MAX);
+ if (end == NULL || *end != '\0') {
SCALE_HS_INIT(&su, term_strlen(p, v));
su.scale /= term_strlen(p, "0");
}