=================================================================== RCS file: /cvs/mandoc/roff.c,v retrieving revision 1.375 retrieving revision 1.379 diff -u -p -r1.375 -r1.379 --- mandoc/roff.c 2020/08/03 11:02:57 1.375 +++ mandoc/roff.c 2021/10/04 10:12:27 1.379 @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.375 2020/08/03 11:02:57 schwarze Exp $ */ +/* $Id: roff.c,v 1.379 2021/10/04 10:12:27 schwarze Exp $ */ /* * Copyright (c) 2010-2015, 2017-2020 Ingo Schwarze * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons @@ -1823,7 +1823,7 @@ roff_parsetext(struct roff *r, struct buf *buf, int po } int -roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs) +roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs, size_t len) { enum roff_tok t; int e; @@ -1834,6 +1834,14 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, ppos = pos = *offs; + if (len > 80 && r->tbl == NULL && r->eqn == NULL && + (r->man->flags & ROFF_NOFILL) == 0 && + strchr(" .\\", buf->buf[pos]) == NULL && + buf->buf[pos] != r->control && + strcspn(buf->buf, " ") < 80) + mandoc_msg(MANDOCERR_TEXT_LONG, ln, (int)len - 1, + "%.20s...", buf->buf + pos); + /* Handle in-line equation delimiters. */ if (r->tbl == NULL && @@ -2362,7 +2370,9 @@ roff_cond_checkend(ROFF_ARGS) while ((ep = strchr(ep, '\\')) != NULL) { switch (ep[1]) { case '}': - if (rr) + if (ep[2] == '\0') + ep[0] = '\0'; + else if (rr) ep[1] = '&'; else memmove(ep, ep + 2, strlen(ep + 2) + 1); @@ -3657,7 +3667,9 @@ roff_char(ROFF_ARGS) case ESCAPE_FONTITALIC: case ESCAPE_FONTBOLD: case ESCAPE_FONTBI: - case ESCAPE_FONTCW: + case ESCAPE_FONTCR: + case ESCAPE_FONTCB: + case ESCAPE_FONTCI: case ESCAPE_FONTPREV: font++; break; @@ -3937,9 +3949,7 @@ roff_userdef(ROFF_ARGS) r->mstacksz += 8; } ctx = r->mstack + r->mstackpos; - ctx->argsz = 0; ctx->argc = 0; - ctx->argv = NULL; /* * Collect pointers to macro argument strings,