diff options
author | 2017-06-08 12:54:58 +0000 | |
---|---|---|
committer | 2017-06-08 12:54:58 +0000 | |
commit | 789580a2a2366243d622766fdadd094931ca6596 (patch) | |
tree | 60a78614bcfb83b55ebd45464a5bc77e4c61c98c /term.c | |
parent | 76a6887f123b221e7a8851c1b0d0008119492613 (diff) | |
download | mandoc-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 'term.c')
-rw-r--r-- | term.c | 19 |
1 files changed, 5 insertions, 14 deletions
@@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.267 2017/06/07 20:01:19 schwarze Exp $ */ +/* $Id: term.c,v 1.268 2017/06/08 12:54:58 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -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; |