summaryrefslogtreecommitdiffstats
path: root/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
commitad29d8dbe925e8f0d680007ebf3c95aec8351f84 (patch)
treee1d347a6e1580d73cf7fb7e978c1b9103e0acbac /term.c
parentd44fff44885ccb8313515cbafde42b061f7d4c45 (diff)
downloadmandoc-ad29d8dbe925e8f0d680007ebf3c95aec8351f84.tar.gz
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 'term.c')
-rw-r--r--term.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/term.c b/term.c
index ebc1e4ef..2e917c8f 100644
--- a/term.c
+++ b/term.c
@@ -479,7 +479,7 @@ term_word(struct termp *p, const char *word)
p->flags |= (TERMP_NOSPACE | TERMP_NONEWLINE);
continue;
case ESCAPE_HORIZ:
- if (a2roffsu(seq, &su, SCALE_EM) == 0)
+ if (a2roffsu(seq, &su, SCALE_EM) == NULL)
continue;
uc = term_hspan(p, &su) / 24;
if (uc > 0)
@@ -500,7 +500,7 @@ term_word(struct termp *p, const char *word)
}
continue;
case ESCAPE_HLINE:
- if (a2roffsu(seq, &su, SCALE_EM) == 0)
+ if ((seq = a2roffsu(seq, &su, SCALE_EM)) == NULL)
continue;
uc = term_hspan(p, &su) / 24;
if (uc <= 0) {
@@ -509,16 +509,7 @@ term_word(struct termp *p, const char *word)
lsz = p->tcol->rmargin - p->tcol->offset;
} else
lsz = uc;
- while (sz &&
- strchr(" %&()*+-./0123456789:<=>", *seq)) {
- seq++;
- sz--;
- }
- if (sz && strchr("cifMmnPpuv", *seq)) {
- seq++;
- sz--;
- }
- if (sz == 0)
+ if (*seq == '\0')
uc = -1;
else if (*seq == '\\') {
seq++;
@@ -739,7 +730,7 @@ term_setwidth(struct termp *p, const char *wstr)
default:
break;
}
- if (a2roffsu(wstr, &su, SCALE_MAX))
+ if (a2roffsu(wstr, &su, SCALE_MAX) != NULL)
width = term_hspan(p, &su);
else
iop = 0;