=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/roff.c,v retrieving revision 1.221 retrieving revision 1.222 diff -c -r1.221 -r1.222 *** src/usr.bin/mandoc/roff.c 2018/12/13 11:55:14 1.221 --- src/usr.bin/mandoc/roff.c 2018/12/14 05:17:45 1.222 *************** *** 1,4 **** ! /* $OpenBSD: roff.c,v 1.221 2018/12/13 11:55:14 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze --- 1,4 ---- ! /* $OpenBSD: roff.c,v 1.222 2018/12/14 05:17:45 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze *************** *** 1202,1209 **** isalnum((unsigned char)*cp) == 0 && strchr(cp, '$') != NULL) { if (r->man->meta.rcsids & rcsid) ! mandoc_msg(MANDOCERR_RCS_REP, r->parse, ! ln, stesc + 1 - buf->buf, stesc + 1); r->man->meta.rcsids |= rcsid; } --- 1202,1210 ---- isalnum((unsigned char)*cp) == 0 && strchr(cp, '$') != NULL) { if (r->man->meta.rcsids & rcsid) ! mandoc_msg(MANDOCERR_RCS_REP, ln, ! (int)(stesc - buf->buf) + 1, ! "%s", stesc + 1); r->man->meta.rcsids |= rcsid; } *************** *** 1215,1222 **** ep--; } if (*ep == ' ' || *ep == '\t') ! mandoc_msg(MANDOCERR_SPACE_EOL, r->parse, ! ln, ep - buf->buf, NULL); /* * Save comments preceding the title macro --- 1216,1223 ---- ep--; } if (*ep == ' ' || *ep == '\t') ! mandoc_msg(MANDOCERR_SPACE_EOL, ! ln, (int)(ep - buf->buf), NULL); /* * Save comments preceding the title macro *************** *** 1325,1339 **** if (esc == ESCAPE_ERROR || (esc == ESCAPE_SPECIAL && mchars_spec2cp(stnam, inaml) < 0)) ! mandoc_vmsg(MANDOCERR_ESC_BAD, ! r->parse, ln, (int)(stesc - buf->buf), "%.*s", (int)(cp - stesc), stesc); stesc--; continue; } if (EXPAND_LIMIT < ++expand_count) { ! mandoc_msg(MANDOCERR_ROFFLOOP, r->parse, ln, (int)(stesc - buf->buf), NULL); return ROFF_IGN; } --- 1326,1340 ---- if (esc == ESCAPE_ERROR || (esc == ESCAPE_SPECIAL && mchars_spec2cp(stnam, inaml) < 0)) ! mandoc_msg(MANDOCERR_ESC_BAD, ! ln, (int)(stesc - buf->buf), "%.*s", (int)(cp - stesc), stesc); stesc--; continue; } if (EXPAND_LIMIT < ++expand_count) { ! mandoc_msg(MANDOCERR_ROFFLOOP, ln, (int)(stesc - buf->buf), NULL); return ROFF_IGN; } *************** *** 1374,1381 **** arg_complete = 1; while (maxl == 0 || naml < maxl) { if (*cp == '\0') { ! mandoc_msg(MANDOCERR_ESC_BAD, r->parse, ! ln, (int)(stesc - buf->buf), stesc); arg_complete = 0; break; } --- 1375,1382 ---- arg_complete = 1; while (maxl == 0 || naml < maxl) { if (*cp == '\0') { ! mandoc_msg(MANDOCERR_ESC_BAD, ln, ! (int)(stesc - buf->buf), "%s", stesc); arg_complete = 0; break; } *************** *** 1426,1434 **** break; case '$': if (r->mstackpos < 0) { ! mandoc_vmsg(MANDOCERR_ARG_UNDEF, ! r->parse, ln, (int)(stesc - buf->buf), ! "%.3s", stesc); break; } ctx = r->mstack + r->mstackpos; --- 1427,1434 ---- break; case '$': if (r->mstackpos < 0) { ! mandoc_msg(MANDOCERR_ARG_UNDEF, ln, ! (int)(stesc - buf->buf), "%.3s", stesc); break; } ctx = r->mstack + r->mstackpos; *************** *** 1443,1451 **** else if (stesc[2] == '@') quote_args = 1; else { ! mandoc_vmsg(MANDOCERR_ARG_NONUM, ! r->parse, ln, (int)(stesc - buf->buf), ! "%.3s", stesc); break; } asz = 0; --- 1443,1450 ---- else if (stesc[2] == '@') quote_args = 1; else { ! mandoc_msg(MANDOCERR_ARG_NONUM, ln, ! (int)(stesc - buf->buf), "%.3s", stesc); break; } asz = 0; *************** *** 1504,1515 **** if (res == NULL) { if (stesc[1] == '*') ! mandoc_vmsg(MANDOCERR_STR_UNDEF, ! r->parse, ln, (int)(stesc - buf->buf), "%.*s", (int)naml, stnam); res = ""; } else if (buf->sz + strlen(res) > SHRT_MAX) { ! mandoc_msg(MANDOCERR_ROFFLOOP, r->parse, ln, (int)(stesc - buf->buf), NULL); return ROFF_IGN; } --- 1503,1514 ---- if (res == NULL) { if (stesc[1] == '*') ! mandoc_msg(MANDOCERR_STR_UNDEF, ! ln, (int)(stesc - buf->buf), "%.*s", (int)naml, stnam); res = ""; } else if (buf->sz + strlen(res) > SHRT_MAX) { ! mandoc_msg(MANDOCERR_ROFFLOOP, ln, (int)(stesc - buf->buf), NULL); return ROFF_IGN; } *************** *** 1662,1669 **** /* Skip empty request lines. */ if (buf->buf[pos] == '"') { ! mandoc_msg(MANDOCERR_COMMENT_BAD, r->parse, ! ln, pos, NULL); return ROFF_IGN; } else if (buf->buf[pos] == '\0') return ROFF_IGN; --- 1661,1667 ---- /* Skip empty request lines. */ if (buf->buf[pos] == '"') { ! mandoc_msg(MANDOCERR_COMMENT_BAD, ln, pos, NULL); return ROFF_IGN; } else if (buf->buf[pos] == '\0') return ROFF_IGN; *************** *** 1688,1695 **** if (r->tbl != NULL && (t == TOKEN_NONE || t == ROFF_TS || t == ROFF_br || t == ROFF_ce || t == ROFF_rj || t == ROFF_sp)) { ! mandoc_msg(MANDOCERR_TBLMACRO, r->parse, ! ln, pos, buf->buf + spos); if (t != TOKEN_NONE) return ROFF_IGN; while (buf->buf[pos] != '\0' && buf->buf[pos] != ' ') --- 1686,1693 ---- if (r->tbl != NULL && (t == TOKEN_NONE || t == ROFF_TS || t == ROFF_br || t == ROFF_ce || t == ROFF_rj || t == ROFF_sp)) { ! mandoc_msg(MANDOCERR_TBLMACRO, ! ln, pos, "%s", buf->buf + spos); if (t != TOKEN_NONE) return ROFF_IGN; while (buf->buf[pos] != '\0' && buf->buf[pos] != ' ') *************** *** 1748,1759 **** roff_endparse(struct roff *r) { if (r->last != NULL) ! mandoc_msg(MANDOCERR_BLK_NOEND, r->parse, ! r->last->line, r->last->col, ! roff_name[r->last->tok]); if (r->eqn != NULL) { ! mandoc_msg(MANDOCERR_BLK_NOEND, r->parse, r->eqn->node->line, r->eqn->node->pos, "EQ"); eqn_parse(r->eqn); r->eqn = NULL; --- 1746,1756 ---- roff_endparse(struct roff *r) { if (r->last != NULL) ! mandoc_msg(MANDOCERR_BLK_NOEND, r->last->line, ! r->last->col, "%s", roff_name[r->last->tok]); if (r->eqn != NULL) { ! mandoc_msg(MANDOCERR_BLK_NOEND, r->eqn->node->line, r->eqn->node->pos, "EQ"); eqn_parse(r->eqn); r->eqn = NULL; *************** *** 1821,1828 **** */ if (r->last == NULL) { ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ! ln, ppos, ".."); return ROFF_IGN; } --- 1818,1824 ---- */ if (r->last == NULL) { ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, ".."); return ROFF_IGN; } *************** *** 1836,1848 **** case ROFF_ig: break; default: ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ! ln, ppos, ".."); return ROFF_IGN; } if (buf->buf[pos] != '\0') ! mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos, ".. %s", buf->buf + pos); roffnode_pop(r); --- 1832,1843 ---- case ROFF_ig: break; default: ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, ".."); return ROFF_IGN; } if (buf->buf[pos] != '\0') ! mandoc_msg(MANDOCERR_ARG_SKIP, ln, pos, ".. %s", buf->buf + pos); roffnode_pop(r); *************** *** 1869,1876 **** roff_ccond(struct roff *r, int ln, int ppos) { if (NULL == r->last) { ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ! ln, ppos, "\\}"); return 0; } --- 1864,1870 ---- roff_ccond(struct roff *r, int ln, int ppos) { if (NULL == r->last) { ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "\\}"); return 0; } *************** *** 1881,1894 **** case ROFF_while: break; default: ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ! ln, ppos, "\\}"); return 0; } if (r->last->endspan > -1) { ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ! ln, ppos, "\\}"); return 0; } --- 1875,1886 ---- case ROFF_while: break; default: ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "\\}"); return 0; } if (r->last->endspan > -1) { ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "\\}"); return 0; } *************** *** 1932,1939 **** deftype = ROFFDEF_USER; name = roff_getstrn(r, iname, namesz, &deftype); if (name == NULL) { ! mandoc_vmsg(MANDOCERR_STR_UNDEF, ! r->parse, ln, (int)(iname - buf->buf), "%.*s", (int)namesz, iname); namesz = 0; } else --- 1924,1931 ---- deftype = ROFFDEF_USER; name = roff_getstrn(r, iname, namesz, &deftype); if (name == NULL) { ! mandoc_msg(MANDOCERR_STR_UNDEF, ! ln, (int)(iname - buf->buf), "%.*s", (int)namesz, iname); namesz = 0; } else *************** *** 1942,1949 **** name = iname; if (namesz == 0 && tok != ROFF_ig) { ! mandoc_msg(MANDOCERR_REQ_EMPTY, r->parse, ! ln, ppos, roff_name[tok]); return ROFF_IGN; } --- 1934,1941 ---- name = iname; if (namesz == 0 && tok != ROFF_ig) { ! mandoc_msg(MANDOCERR_REQ_EMPTY, ! ln, ppos, "%s", roff_name[tok]); return ROFF_IGN; } *************** *** 2001,2008 **** deftype = ROFFDEF_USER; name = roff_getstrn(r, iname, namesz, &deftype); if (name == NULL) { ! mandoc_vmsg(MANDOCERR_STR_UNDEF, ! r->parse, ln, (int)(iname - buf->buf), "%.*s", (int)namesz, iname); namesz = 0; } else --- 1993,2000 ---- deftype = ROFFDEF_USER; name = roff_getstrn(r, iname, namesz, &deftype); if (name == NULL) { ! mandoc_msg(MANDOCERR_STR_UNDEF, ! ln, (int)(iname - buf->buf), "%.*s", (int)namesz, iname); namesz = 0; } else *************** *** 2014,2020 **** r->last->end = mandoc_strndup(name, namesz); if (*cp != '\0') ! mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse, ln, pos, ".%s ... %s", roff_name[tok], cp); return ROFF_IGN; --- 2006,2012 ---- r->last->end = mandoc_strndup(name, namesz); if (*cp != '\0') ! mandoc_msg(MANDOCERR_ARG_EXCESS, ln, pos, ".%s ... %s", roff_name[tok], cp); return ROFF_IGN; *************** *** 2415,2422 **** roff_insec(ROFF_ARGS) { ! mandoc_msg(MANDOCERR_REQ_INSEC, r->parse, ! ln, ppos, roff_name[tok]); return ROFF_IGN; } --- 2407,2413 ---- roff_insec(ROFF_ARGS) { ! mandoc_msg(MANDOCERR_REQ_INSEC, ln, ppos, "%s", roff_name[tok]); return ROFF_IGN; } *************** *** 2424,2431 **** roff_unsupp(ROFF_ARGS) { ! mandoc_msg(MANDOCERR_REQ_UNSUPP, r->parse, ! ln, ppos, roff_name[tok]); return ROFF_IGN; } --- 2415,2421 ---- roff_unsupp(ROFF_ARGS) { ! mandoc_msg(MANDOCERR_REQ_UNSUPP, ln, ppos, "%s", roff_name[tok]); return ROFF_IGN; } *************** *** 2499,2506 **** */ if (buf->buf[pos] == '\0') ! mandoc_msg(MANDOCERR_COND_EMPTY, r->parse, ! ln, ppos, roff_name[tok]); r->last->endspan = 1; --- 2489,2496 ---- */ if (buf->buf[pos] == '\0') ! mandoc_msg(MANDOCERR_COND_EMPTY, ! ln, ppos, "%s", roff_name[tok]); r->last->endspan = 1; *************** *** 2703,2709 **** case '/': if (operand2 == 0) { mandoc_msg(MANDOCERR_DIVZERO, ! r->parse, ln, *pos, v); *res = 0; break; } --- 2693,2699 ---- case '/': if (operand2 == 0) { mandoc_msg(MANDOCERR_DIVZERO, ! ln, *pos, "%s", v); *res = 0; break; } *************** *** 2712,2718 **** case '%': if (operand2 == 0) { mandoc_msg(MANDOCERR_DIVZERO, ! r->parse, ln, *pos, v); *res = 0; break; } --- 2702,2708 ---- case '%': if (operand2 == 0) { mandoc_msg(MANDOCERR_DIVZERO, ! ln, *pos, "%s", v); *res = 0; break; } *************** *** 2992,2999 **** /* Parse the number of lines. */ if ( ! roff_evalnum(r, ln, buf->buf, &pos, &iv, 0)) { ! mandoc_msg(MANDOCERR_IT_NONUM, r->parse, ! ln, ppos, buf->buf + 1); return ROFF_IGN; } --- 2982,2989 ---- /* Parse the number of lines. */ if ( ! roff_evalnum(r, ln, buf->buf, &pos, &iv, 0)) { ! mandoc_msg(MANDOCERR_IT_NONUM, ! ln, ppos, "%s", buf->buf + 1); return ROFF_IGN; } *************** *** 3047,3054 **** roff_TE(ROFF_ARGS) { if (r->tbl == NULL) { ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ! ln, ppos, "TE"); return ROFF_IGN; } if (tbl_end(r->tbl, 0) == 0) { --- 3037,3043 ---- roff_TE(ROFF_ARGS) { if (r->tbl == NULL) { ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "TE"); return ROFF_IGN; } if (tbl_end(r->tbl, 0) == 0) { *************** *** 3068,3075 **** { if (NULL == r->tbl) ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ! ln, ppos, "T&"); else tbl_restart(ln, ppos, r->tbl); --- 3057,3063 ---- { if (NULL == r->tbl) ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "T&"); else tbl_restart(ln, ppos, r->tbl); *************** *** 3165,3171 **** r->eqn->node = n; if (buf->buf[pos] != '\0') ! mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos, ".EQ %s", buf->buf + pos); return ROFF_IGN; --- 3153,3159 ---- r->eqn->node = n; if (buf->buf[pos] != '\0') ! mandoc_msg(MANDOCERR_ARG_SKIP, ln, pos, ".EQ %s", buf->buf + pos); return ROFF_IGN; *************** *** 3178,3186 **** eqn_parse(r->eqn); r->eqn = NULL; } else ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ln, ppos, "EN"); if (buf->buf[pos] != '\0') ! mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos, "EN %s", buf->buf + pos); return ROFF_IGN; } --- 3166,3174 ---- eqn_parse(r->eqn); r->eqn = NULL; } else ! mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "EN"); if (buf->buf[pos] != '\0') ! mandoc_msg(MANDOCERR_ARG_SKIP, ln, pos, "EN %s", buf->buf + pos); return ROFF_IGN; } *************** *** 3189,3196 **** roff_TS(ROFF_ARGS) { if (r->tbl != NULL) { ! mandoc_msg(MANDOCERR_BLK_BROKEN, r->parse, ! ln, ppos, "TS breaks TS"); tbl_end(r->tbl, 0); } r->tbl = tbl_alloc(ppos, ln, r->parse, r->last_tbl); --- 3177,3183 ---- roff_TS(ROFF_ARGS) { if (r->tbl != NULL) { ! mandoc_msg(MANDOCERR_BLK_BROKEN, ln, ppos, "TS breaks TS"); tbl_end(r->tbl, 0); } r->tbl = tbl_alloc(ppos, ln, r->parse, r->last_tbl); *************** *** 3227,3234 **** while (*cp == ' ') *cp++ = '\0'; if (*cp != '\0') ! mandoc_vmsg(MANDOCERR_ARG_EXCESS, ! r->parse, ln, cp - buf->buf, "%s ... %s", roff_name[tok], cp); roff_word_alloc(r->man, ln, pos, buf->buf + pos); } --- 3214,3221 ---- while (*cp == ' ') *cp++ = '\0'; if (*cp != '\0') ! mandoc_msg(MANDOCERR_ARG_EXCESS, ! ln, (int)(cp - buf->buf), "%s ... %s", roff_name[tok], cp); roff_word_alloc(r->man, ln, pos, buf->buf + pos); } *************** *** 3241,3248 **** npos = 0; if (roff_evalnum(r, ln, r->man->last->string, &npos, &roffce_lines, 0) == 0) { ! mandoc_vmsg(MANDOCERR_CE_NONUM, ! r->parse, ln, pos, "ce %s", buf->buf + pos); roffce_lines = 1; } if (roffce_lines < 1) { --- 3228,3235 ---- npos = 0; if (roff_evalnum(r, ln, r->man->last->string, &npos, &roffce_lines, 0) == 0) { ! mandoc_msg(MANDOCERR_CE_NONUM, ! ln, pos, "ce %s", buf->buf + pos); roffce_lines = 1; } if (roffce_lines < 1) { *************** *** 3317,3323 **** man_breakscope(r->man, ROFF_br); roff_elem_alloc(r->man, ln, ppos, ROFF_br); if (buf->buf[pos] != '\0') ! mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos, "%s %s", roff_name[tok], buf->buf + pos); r->man->last->flags |= NODE_LINE | NODE_VALID | NODE_ENDED; r->man->next = ROFF_NEXT_SIBLING; --- 3304,3310 ---- man_breakscope(r->man, ROFF_br); roff_elem_alloc(r->man, ln, ppos, ROFF_br); if (buf->buf[pos] != '\0') ! mandoc_msg(MANDOCERR_ARG_SKIP, ln, pos, "%s %s", roff_name[tok], buf->buf + pos); r->man->last->flags |= NODE_LINE | NODE_VALID | NODE_ENDED; r->man->next = ROFF_NEXT_SIBLING; *************** *** 3335,3341 **** r->control = '\0'; if (*p != '\0') ! mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse, ln, p - buf->buf, "cc ... %s", p); return ROFF_IGN; --- 3322,3328 ---- r->control = '\0'; if (*p != '\0') ! mandoc_msg(MANDOCERR_ARG_EXCESS, ln, p - buf->buf, "cc ... %s", p); return ROFF_IGN; *************** *** 3355,3362 **** if (*kp == '\0' || (*kp == '\\' && mandoc_escape(&p, NULL, NULL) != ESCAPE_SPECIAL) || (*p != ' ' && *p != '\0')) { ! mandoc_vmsg(MANDOCERR_CHAR_ARG, r->parse, ! ln, pos, "char %s", kp); return ROFF_IGN; } ksz = p - kp; --- 3342,3348 ---- if (*kp == '\0' || (*kp == '\\' && mandoc_escape(&p, NULL, NULL) != ESCAPE_SPECIAL) || (*p != ' ' && *p != '\0')) { ! mandoc_msg(MANDOCERR_CHAR_ARG, ln, pos, "char %s", kp); return ROFF_IGN; } ksz = p - kp; *************** *** 3389,3396 **** } } if (font > 1) ! mandoc_msg(MANDOCERR_CHAR_FONT, r->parse, ! ln, vp - buf->buf, vp); /* * Approximate the effect of .char using the .tr tables. --- 3375,3382 ---- } } if (font > 1) ! mandoc_msg(MANDOCERR_CHAR_FONT, ! ln, (int)(vp - buf->buf), "%s", vp); /* * Approximate the effect of .char using the .tr tables. *************** *** 3423,3430 **** else { r->escape = *p; if (*++p != '\0') ! mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse, ! ln, p - buf->buf, "ec ... %s", p); } return ROFF_IGN; } --- 3409,3416 ---- else { r->escape = *p; if (*++p != '\0') ! mandoc_msg(MANDOCERR_ARG_EXCESS, ln, ! (int)(p - buf->buf), "ec ... %s", p); } return ROFF_IGN; } *************** *** 3434,3440 **** { r->escape = '\0'; if (buf->buf[pos] != '\0') ! mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos, "eo %s", buf->buf + pos); return ROFF_IGN; } --- 3420,3426 ---- { r->escape = '\0'; if (buf->buf[pos] != '\0') ! mandoc_msg(MANDOCERR_ARG_SKIP, ln, pos, "eo %s", buf->buf + pos); return ROFF_IGN; } *************** *** 3458,3464 **** p = buf->buf + pos; if (*p == '\0') { ! mandoc_msg(MANDOCERR_REQ_EMPTY, r->parse, ln, ppos, "tr"); return ROFF_IGN; } --- 3444,3450 ---- p = buf->buf + pos; if (*p == '\0') { ! mandoc_msg(MANDOCERR_REQ_EMPTY, ln, ppos, "tr"); return ROFF_IGN; } *************** *** 3469,3476 **** if (*first == '\\') { esc = mandoc_escape(&p, NULL, NULL); if (esc == ESCAPE_ERROR) { ! mandoc_msg(MANDOCERR_ESC_BAD, r->parse, ! ln, (int)(p - buf->buf), first); return ROFF_IGN; } fsz = (size_t)(p - first); --- 3455,3462 ---- if (*first == '\\') { esc = mandoc_escape(&p, NULL, NULL); if (esc == ESCAPE_ERROR) { ! mandoc_msg(MANDOCERR_ESC_BAD, ln, ! (int)(p - buf->buf), "%s", first); return ROFF_IGN; } fsz = (size_t)(p - first); *************** *** 3480,3493 **** if (*second == '\\') { esc = mandoc_escape(&p, NULL, NULL); if (esc == ESCAPE_ERROR) { ! mandoc_msg(MANDOCERR_ESC_BAD, r->parse, ! ln, (int)(p - buf->buf), second); return ROFF_IGN; } ssz = (size_t)(p - second); } else if (*second == '\0') { ! mandoc_vmsg(MANDOCERR_TR_ODD, r->parse, ! ln, first - buf->buf, "tr %s", first); second = " "; p--; } --- 3466,3479 ---- if (*second == '\\') { esc = mandoc_escape(&p, NULL, NULL); if (esc == ESCAPE_ERROR) { ! mandoc_msg(MANDOCERR_ESC_BAD, ln, ! (int)(p - buf->buf), "%s", second); return ROFF_IGN; } ssz = (size_t)(p - second); } else if (*second == '\0') { ! mandoc_msg(MANDOCERR_TR_ODD, ln, ! (int)(first - buf->buf), "tr %s", first); second = " "; p--; } *************** *** 3522,3528 **** if (r->mstackpos >= 0) return ROFF_IGN | ROFF_USERRET; ! mandoc_msg(MANDOCERR_REQ_NOMAC, r->parse, ln, ppos, "return"); return ROFF_IGN; } --- 3508,3514 ---- if (r->mstackpos >= 0) return ROFF_IGN | ROFF_USERRET; ! mandoc_msg(MANDOCERR_REQ_NOMAC, ln, ppos, "return"); return ROFF_IGN; } *************** *** 3585,3601 **** levels = 1; if (buf->buf[pos] != '\0' && roff_evalnum(r, ln, buf->buf, &pos, &levels, 0) == 0) { ! mandoc_vmsg(MANDOCERR_CE_NONUM, r->parse, ln, pos, "shift %s", buf->buf + pos); levels = 1; } if (r->mstackpos < 0) { ! mandoc_msg(MANDOCERR_REQ_NOMAC, r->parse, ln, ppos, "shift"); return ROFF_IGN; } ctx = r->mstack + r->mstackpos; if (levels > ctx->argc) { ! mandoc_vmsg(MANDOCERR_SHIFT, r->parse, ln, pos, "%d, but max is %d", levels, ctx->argc); levels = ctx->argc; } --- 3571,3587 ---- levels = 1; if (buf->buf[pos] != '\0' && roff_evalnum(r, ln, buf->buf, &pos, &levels, 0) == 0) { ! mandoc_msg(MANDOCERR_CE_NONUM, ln, pos, "shift %s", buf->buf + pos); levels = 1; } if (r->mstackpos < 0) { ! mandoc_msg(MANDOCERR_REQ_NOMAC, ln, ppos, "shift"); return ROFF_IGN; } ctx = r->mstack + r->mstackpos; if (levels > ctx->argc) { ! mandoc_msg(MANDOCERR_SHIFT, ln, pos, "%d, but max is %d", levels, ctx->argc); levels = ctx->argc; } *************** *** 3615,3621 **** char *name, *cp; name = buf->buf + pos; ! mandoc_vmsg(MANDOCERR_SO, r->parse, ln, ppos, "so %s", name); /* * Handle `so'. Be EXTREMELY careful, as we shouldn't be --- 3601,3607 ---- char *name, *cp; name = buf->buf + pos; ! mandoc_msg(MANDOCERR_SO, ln, ppos, "so %s", name); /* * Handle `so'. Be EXTREMELY careful, as we shouldn't be *************** *** 3625,3632 **** */ if (*name == '/' || strstr(name, "../") || strstr(name, "/..")) { ! mandoc_vmsg(MANDOCERR_SO_PATH, r->parse, ln, ppos, ! ".so %s", name); buf->sz = mandoc_asprintf(&cp, ".sp\nSee the file %s.\n.sp", name) + 1; free(buf->buf); --- 3611,3617 ---- */ if (*name == '/' || strstr(name, "../") || strstr(name, "/..")) { ! mandoc_msg(MANDOCERR_SO_PATH, ln, ppos, ".so %s", name); buf->sz = mandoc_asprintf(&cp, ".sp\nSee the file %s.\n.sp", name) + 1; free(buf->buf); *************** *** 3739,3745 **** cp++; if ('\\' == *cp) continue; ! mandoc_vmsg(MANDOCERR_NAMESC, r->parse, ln, pos, "%.*s", (int)(cp - name + 1), name); mandoc_escape((const char **)&cp, NULL, NULL); break; --- 3724,3730 ---- cp++; if ('\\' == *cp) continue; ! mandoc_msg(MANDOCERR_NAMESC, ln, pos, "%.*s", (int)(cp - name + 1), name); mandoc_escape((const char **)&cp, NULL, NULL); break;