From 789580a2a2366243d622766fdadd094931ca6596 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 8 Jun 2017 12:54:58 +0000 Subject: 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 --- mdoc_term.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mdoc_term.c') 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 * Copyright (c) 2010, 2012-2017 Ingo Schwarze @@ -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"); } -- cgit v1.2.3-56-ge451