summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eqn.c58
-rw-r--r--main.c9
-rw-r--r--man.c28
-rw-r--r--man_macro.c30
-rw-r--r--man_validate.c60
-rw-r--r--mandoc.c19
-rw-r--r--mandoc.h6
-rw-r--r--mandoc_msg.c12
-rw-r--r--mdoc.c15
-rw-r--r--mdoc_argv.c10
-rw-r--r--mdoc_macro.c73
-rw-r--r--mdoc_validate.c383
-rw-r--r--read.c40
-rw-r--r--roff.c167
-rw-r--r--roff_validate.c15
-rw-r--r--tbl.c12
-rw-r--r--tbl_data.c10
-rw-r--r--tbl_layout.c26
-rw-r--r--tbl_opts.c17
19 files changed, 424 insertions, 566 deletions
diff --git a/eqn.c b/eqn.c
index 318517d4..b07250ac 100644
--- a/eqn.c
+++ b/eqn.c
@@ -407,7 +407,7 @@ eqn_next(struct eqn_node *ep, enum parse_mode mode)
ep->end = strchr(ep->start + 1, *ep->start);
ep->start++; /* Skip opening quote. */
if (ep->end == NULL) {
- mandoc_msg(MANDOCERR_ARG_QUOTE, ep->parse,
+ mandoc_msg(MANDOCERR_ARG_QUOTE,
ep->node->line, ep->node->pos, NULL);
ep->end = strchr(ep->start, '\0');
}
@@ -428,7 +428,7 @@ eqn_next(struct eqn_node *ep, enum parse_mode mode)
if ((def = eqn_def_find(ep)) == NULL)
break;
if (++lim > EQN_NEST_MAX) {
- mandoc_msg(MANDOCERR_ROFFLOOP, ep->parse,
+ mandoc_msg(MANDOCERR_ROFFLOOP,
ep->node->line, ep->node->pos, NULL);
return EQN_TOK_EOF;
}
@@ -561,7 +561,7 @@ static void
eqn_delim(struct eqn_node *ep)
{
if (ep->end[0] == '\0' || ep->end[1] == '\0') {
- mandoc_msg(MANDOCERR_REQ_EMPTY, ep->parse,
+ mandoc_msg(MANDOCERR_REQ_EMPTY,
ep->node->line, ep->node->pos, "delim");
if (ep->end[0] != '\0')
ep->end++;
@@ -588,7 +588,7 @@ eqn_undef(struct eqn_node *ep)
struct eqn_def *def;
if (eqn_next(ep, MODE_NOSUB) == EQN_TOK_EOF) {
- mandoc_msg(MANDOCERR_REQ_EMPTY, ep->parse,
+ mandoc_msg(MANDOCERR_REQ_EMPTY,
ep->node->line, ep->node->pos, "undef");
return;
}
@@ -607,7 +607,7 @@ eqn_def(struct eqn_node *ep)
int i;
if (eqn_next(ep, MODE_NOSUB) == EQN_TOK_EOF) {
- mandoc_msg(MANDOCERR_REQ_EMPTY, ep->parse,
+ mandoc_msg(MANDOCERR_REQ_EMPTY,
ep->node->line, ep->node->pos, "define");
return;
}
@@ -636,7 +636,7 @@ eqn_def(struct eqn_node *ep)
}
if (eqn_next(ep, MODE_QUOTED) == EQN_TOK_EOF) {
- mandoc_vmsg(MANDOCERR_REQ_EMPTY, ep->parse,
+ mandoc_msg(MANDOCERR_REQ_EMPTY,
ep->node->line, ep->node->pos, "define %s", def->key);
free(def->key);
free(def->val);
@@ -685,7 +685,7 @@ next_tok:
case EQN_TOK_TDEFINE:
if (eqn_next(ep, MODE_NOSUB) == EQN_TOK_EOF ||
eqn_next(ep, MODE_QUOTED) == EQN_TOK_EOF)
- mandoc_msg(MANDOCERR_REQ_EMPTY, ep->parse,
+ mandoc_msg(MANDOCERR_REQ_EMPTY,
ep->node->line, ep->node->pos, "tdefine");
break;
case EQN_TOK_DELIM:
@@ -693,8 +693,8 @@ next_tok:
break;
case EQN_TOK_GFONT:
if (eqn_next(ep, MODE_SUB) == EQN_TOK_EOF)
- mandoc_msg(MANDOCERR_REQ_EMPTY, ep->parse,
- ep->node->line, ep->node->pos, eqn_toks[tok]);
+ mandoc_msg(MANDOCERR_REQ_EMPTY, ep->node->line,
+ ep->node->pos, "%s", eqn_toks[tok]);
break;
case EQN_TOK_MARK:
case EQN_TOK_LINEUP:
@@ -709,8 +709,8 @@ next_tok:
case EQN_TOK_DOT:
case EQN_TOK_DOTDOT:
if (parent->last == NULL) {
- mandoc_msg(MANDOCERR_EQN_NOBOX, ep->parse,
- ep->node->line, ep->node->pos, eqn_toks[tok]);
+ mandoc_msg(MANDOCERR_EQN_NOBOX, ep->node->line,
+ ep->node->pos, "%s", eqn_toks[tok]);
cur = eqn_box_alloc(ep, parent);
cur->type = EQN_TEXT;
cur->text = mandoc_strdup("");
@@ -754,8 +754,8 @@ next_tok:
case EQN_TOK_DOWN:
case EQN_TOK_UP:
if (eqn_next(ep, MODE_SUB) == EQN_TOK_EOF)
- mandoc_msg(MANDOCERR_REQ_EMPTY, ep->parse,
- ep->node->line, ep->node->pos, eqn_toks[tok]);
+ mandoc_msg(MANDOCERR_REQ_EMPTY, ep->node->line,
+ ep->node->pos, "%s", eqn_toks[tok]);
break;
case EQN_TOK_FAT:
case EQN_TOK_ROMAN:
@@ -792,14 +792,14 @@ next_tok:
case EQN_TOK_GSIZE:
/* Accept two values: integral size and a single. */
if (eqn_next(ep, MODE_SUB) == EQN_TOK_EOF) {
- mandoc_msg(MANDOCERR_REQ_EMPTY, ep->parse,
- ep->node->line, ep->node->pos, eqn_toks[tok]);
+ mandoc_msg(MANDOCERR_REQ_EMPTY, ep->node->line,
+ ep->node->pos, "%s", eqn_toks[tok]);
break;
}
size = mandoc_strntoi(ep->start, ep->toksz, 10);
if (-1 == size) {
- mandoc_msg(MANDOCERR_IT_NONUM, ep->parse,
- ep->node->line, ep->node->pos, eqn_toks[tok]);
+ mandoc_msg(MANDOCERR_IT_NONUM, ep->node->line,
+ ep->node->pos, "%s", eqn_toks[tok]);
break;
}
if (EQN_TOK_GSIZE == tok) {
@@ -823,8 +823,8 @@ next_tok:
* and keep on reading.
*/
if (parent->last == NULL) {
- mandoc_msg(MANDOCERR_EQN_NOBOX, ep->parse,
- ep->node->line, ep->node->pos, eqn_toks[tok]);
+ mandoc_msg(MANDOCERR_EQN_NOBOX, ep->node->line,
+ ep->node->pos, "%s", eqn_toks[tok]);
cur = eqn_box_alloc(ep, parent);
cur->type = EQN_TEXT;
cur->text = mandoc_strdup("");
@@ -890,8 +890,8 @@ next_tok:
* rebalance and continue reading.
*/
if (parent->last == NULL) {
- mandoc_msg(MANDOCERR_EQN_NOBOX, ep->parse,
- ep->node->line, ep->node->pos, eqn_toks[tok]);
+ mandoc_msg(MANDOCERR_EQN_NOBOX, ep->node->line,
+ ep->node->pos, "%s", eqn_toks[tok]);
cur = eqn_box_alloc(ep, parent);
cur->type = EQN_TEXT;
cur->text = mandoc_strdup("");
@@ -917,16 +917,16 @@ next_tok:
cur->left != NULL))
break;
if (cur == NULL) {
- mandoc_msg(MANDOCERR_BLK_NOTOPEN, ep->parse,
- ep->node->line, ep->node->pos, eqn_toks[tok]);
+ mandoc_msg(MANDOCERR_BLK_NOTOPEN, ep->node->line,
+ ep->node->pos, "%s", eqn_toks[tok]);
break;
}
parent = cur;
if (EQN_TOK_RIGHT == tok) {
if (eqn_next(ep, MODE_SUB) == EQN_TOK_EOF) {
mandoc_msg(MANDOCERR_REQ_EMPTY,
- ep->parse, ep->node->line,
- ep->node->pos, eqn_toks[tok]);
+ ep->node->line, ep->node->pos,
+ "%s", eqn_toks[tok]);
break;
}
/* Handling depends on right/left. */
@@ -960,8 +960,8 @@ next_tok:
parent = parent->parent;
if (EQN_TOK_LEFT == tok &&
eqn_next(ep, MODE_SUB) == EQN_TOK_EOF) {
- mandoc_msg(MANDOCERR_REQ_EMPTY, ep->parse,
- ep->node->line, ep->node->pos, eqn_toks[tok]);
+ mandoc_msg(MANDOCERR_REQ_EMPTY, ep->node->line,
+ ep->node->pos, "%s", eqn_toks[tok]);
break;
}
parent = eqn_box_alloc(ep, parent);
@@ -994,8 +994,8 @@ next_tok:
if (cur->type == EQN_PILE)
break;
if (cur == NULL) {
- mandoc_msg(MANDOCERR_IT_STRAY, ep->parse,
- ep->node->line, ep->node->pos, eqn_toks[tok]);
+ mandoc_msg(MANDOCERR_IT_STRAY, ep->node->line,
+ ep->node->pos, "%s", eqn_toks[tok]);
break;
}
parent = eqn_box_alloc(ep, cur);
diff --git a/main.c b/main.c
index f74b84be..f4230bba 100644
--- a/main.c
+++ b/main.c
@@ -889,7 +889,6 @@ check_xr(void)
static struct manpaths paths;
struct mansearch search;
struct mandoc_xr *xr;
- char *cp;
size_t sz;
if (paths.sz == 0)
@@ -908,12 +907,12 @@ check_xr(void)
if (fs_search(&search, &paths, 1, &xr->name, NULL, &sz))
continue;
if (xr->count == 1)
- mandoc_asprintf(&cp, "Xr %s %s", xr->name, xr->sec);
+ mandoc_msg(MANDOCERR_XR_BAD, xr->line,
+ xr->pos + 1, "Xr %s %s", xr->name, xr->sec);
else
- mandoc_asprintf(&cp, "Xr %s %s (%d times)",
+ mandoc_msg(MANDOCERR_XR_BAD, xr->line,
+ xr->pos + 1, "Xr %s %s (%d times)",
xr->name, xr->sec, xr->count);
- mandoc_msg(MANDOCERR_XR_BAD, NULL, xr->line, xr->pos + 1, cp);
- free(cp);
}
}
diff --git a/man.c b/man.c
index acd3da20..34a479c2 100644
--- a/man.c
+++ b/man.c
@@ -122,8 +122,7 @@ man_ptext(struct roff_man *man, int line, char *buf, int offs)
if (buf[i] == '\0') {
if (man->flags & (MAN_ELINE | MAN_BLINE)) {
- mandoc_msg(MANDOCERR_BLK_BLANK, man->parse,
- line, 0, NULL);
+ mandoc_msg(MANDOCERR_BLK_BLANK, line, 0, NULL);
return 1;
}
if (man->last->tok == MAN_SH || man->last->tok == MAN_SS)
@@ -148,8 +147,7 @@ man_ptext(struct roff_man *man, int line, char *buf, int offs)
if (' ' == buf[i - 1] || '\t' == buf[i - 1]) {
if (i > 1 && '\\' != buf[i - 2])
- mandoc_msg(MANDOCERR_SPACE_EOL, man->parse,
- line, i - 1, NULL);
+ mandoc_msg(MANDOCERR_SPACE_EOL, line, i - 1, NULL);
for (--i; i && ' ' == buf[i]; i--)
/* Spin back to non-space. */ ;
@@ -194,8 +192,7 @@ man_pmacro(struct roff_man *man, int ln, char *buf, int offs)
if (sz > 0 && sz < 4)
tok = roffhash_find(man->manmac, buf + ppos, sz);
if (tok == TOKEN_NONE) {
- mandoc_msg(MANDOCERR_MACRO, man->parse,
- ln, ppos, buf + ppos - 1);
+ mandoc_msg(MANDOCERR_MACRO, ln, ppos, "%s", buf + ppos - 1);
return 1;
}
@@ -225,8 +222,7 @@ man_pmacro(struct roff_man *man, int ln, char *buf, int offs)
*/
if (buf[offs] == '\0' && buf[offs - 1] == ' ')
- mandoc_msg(MANDOCERR_SPACE_EOL, man->parse,
- ln, offs - 1, NULL);
+ mandoc_msg(MANDOCERR_SPACE_EOL, ln, offs - 1, NULL);
/*
* Some macros break next-line scopes; otherwise, remember
@@ -299,9 +295,8 @@ man_breakscope(struct roff_man *man, int tok)
== MAN_NSCOPED)
n = n->parent;
- mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse,
- n->line, n->pos, "%s breaks %s",
- roff_name[tok], roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_BLK_LINE, n->line, n->pos,
+ "%s breaks %s", roff_name[tok], roff_name[n->tok]);
roff_node_delete(man, n);
man->flags &= ~MAN_ELINE;
@@ -341,9 +336,8 @@ man_breakscope(struct roff_man *man, int tok)
assert(n->type == ROFFT_BLOCK);
assert(man_macro(n->tok)->flags & MAN_BSCOPED);
- mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse,
- n->line, n->pos, "%s breaks %s",
- roff_name[tok], roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_BLK_LINE, n->line, n->pos,
+ "%s breaks %s", roff_name[tok], roff_name[n->tok]);
roff_node_delete(man, n);
man->flags &= ~MAN_BLINE;
@@ -358,16 +352,14 @@ man_state(struct roff_man *man, struct roff_node *n)
case MAN_nf:
case MAN_EX:
if (man->flags & MAN_LITERAL && ! (n->flags & NODE_VALID))
- mandoc_msg(MANDOCERR_NF_SKIP, man->parse,
- n->line, n->pos, "nf");
+ mandoc_msg(MANDOCERR_NF_SKIP, n->line, n->pos, "nf");
man->flags |= MAN_LITERAL;
break;
case MAN_fi:
case MAN_EE:
if ( ! (man->flags & MAN_LITERAL) &&
! (n->flags & NODE_VALID))
- mandoc_msg(MANDOCERR_FI_SKIP, man->parse,
- n->line, n->pos, "fi");
+ mandoc_msg(MANDOCERR_FI_SKIP, n->line, n->pos, "fi");
man->flags &= ~MAN_LITERAL;
break;
default:
diff --git a/man_macro.c b/man_macro.c
index ca481663..3055197d 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -106,8 +106,8 @@ man_unscope(struct roff_man *man, const struct roff_node *to)
if (man->flags & (MAN_BLINE | MAN_ELINE) &&
man_macro(n->tok)->flags &
(MAN_BSCOPED | MAN_NSCOPED)) {
- mandoc_vmsg(MANDOCERR_BLK_LINE,
- man->parse, n->line, n->pos,
+ mandoc_msg(MANDOCERR_BLK_LINE,
+ n->line, n->pos,
"EOF breaks %s", roff_name[n->tok]);
if (man->flags & MAN_ELINE)
man->flags &= ~MAN_ELINE;
@@ -124,7 +124,7 @@ man_unscope(struct roff_man *man, const struct roff_node *to)
if (n->type == ROFFT_BLOCK &&
man_macro(n->tok)->fp == blk_exp)
mandoc_msg(MANDOCERR_BLK_NOEND,
- man->parse, n->line, n->pos,
+ n->line, n->pos, "%s",
roff_name[n->tok]);
}
@@ -216,13 +216,13 @@ blk_close(MACRO_PROT_ARGS)
nrew++;
target = strtol(p, &p, 10);
if (*p != '\0')
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse,
- line, p - buf, "RE ... %s", p);
+ mandoc_msg(MANDOCERR_ARG_EXCESS, line,
+ (int)(p - buf), "RE ... %s", p);
if (target == 0)
target = 1;
nrew -= target;
if (nrew < 1) {
- mandoc_vmsg(MANDOCERR_RE_NOTOPEN, man->parse,
+ mandoc_msg(MANDOCERR_RE_NOTOPEN,
line, ppos, "RE %d", target);
return;
}
@@ -245,8 +245,8 @@ blk_close(MACRO_PROT_ARGS)
break;
if (nn == NULL) {
- mandoc_msg(MANDOCERR_BLK_NOTOPEN, man->parse,
- line, ppos, roff_name[tok]);
+ mandoc_msg(MANDOCERR_BLK_NOTOPEN,
+ line, ppos, "%s", roff_name[tok]);
rew_scope(man, MAN_PP);
if (tok == MAN_RE) {
roff_elem_alloc(man, line, ppos, ROFF_br);
@@ -315,8 +315,8 @@ blk_exp(MACRO_PROT_ARGS)
}
if (buf[*pos] != '\0')
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse, line,
- *pos, "%s ... %s", roff_name[tok], buf + *pos);
+ mandoc_msg(MANDOCERR_ARG_EXCESS, line, *pos,
+ "%s ... %s", roff_name[tok], buf + *pos);
man_unscope(man, head);
roff_body_alloc(man, line, ppos, tok);
@@ -380,15 +380,13 @@ in_line_eoln(MACRO_PROT_ARGS)
for (;;) {
if (buf[*pos] != '\0' && (tok == MAN_fi || tok == MAN_nf)) {
- mandoc_vmsg(MANDOCERR_ARG_SKIP,
- man->parse, line, *pos, "%s %s",
- roff_name[tok], buf + *pos);
+ mandoc_msg(MANDOCERR_ARG_SKIP, line, *pos,
+ "%s %s", roff_name[tok], buf + *pos);
break;
}
if (buf[*pos] != '\0' && man->last != n && tok == MAN_PD) {
- mandoc_vmsg(MANDOCERR_ARG_EXCESS,
- man->parse, line, *pos, "%s ... %s",
- roff_name[tok], buf + *pos);
+ mandoc_msg(MANDOCERR_ARG_EXCESS, line, *pos,
+ "%s ... %s", roff_name[tok], buf + *pos);
break;
}
la = *pos;
diff --git a/man_validate.c b/man_validate.c
index 4070506d..87d0dc05 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -171,14 +171,12 @@ check_root(CHKARGS)
assert((man->flags & (MAN_BLINE | MAN_ELINE)) == 0);
if (n->last == NULL || n->last->type == ROFFT_COMMENT)
- mandoc_msg(MANDOCERR_DOC_EMPTY, man->parse,
- n->line, n->pos, NULL);
+ mandoc_msg(MANDOCERR_DOC_EMPTY, n->line, n->pos, NULL);
else
man->meta.hasbody = 1;
if (NULL == man->meta.title) {
- mandoc_msg(MANDOCERR_TH_NOTITLE, man->parse,
- n->line, n->pos, NULL);
+ mandoc_msg(MANDOCERR_TH_NOTITLE, n->line, n->pos, NULL);
/*
* If a title hasn't been set, do so now (by
@@ -193,7 +191,7 @@ check_root(CHKARGS)
if (man->meta.os_e &&
(man->meta.rcsids & (1 << man->meta.os_e)) == 0)
- mandoc_msg(MANDOCERR_RCS_MISSING, man->parse, 0, 0,
+ mandoc_msg(MANDOCERR_RCS_MISSING, 0, 0,
man->meta.os_e == MANDOC_OS_OPENBSD ?
"(OpenBSD)" : "(NetBSD)");
}
@@ -214,8 +212,8 @@ check_text(CHKARGS)
cp = n->string;
for (p = cp; NULL != (p = strchr(p, '\t')); p++)
- mandoc_msg(MANDOCERR_FI_TAB, man->parse,
- n->line, n->pos + (p - cp), NULL);
+ mandoc_msg(MANDOCERR_FI_TAB,
+ n->line, n->pos + (int)(p - cp), NULL);
}
static void
@@ -223,11 +221,10 @@ post_OP(CHKARGS)
{
if (n->child == NULL)
- mandoc_msg(MANDOCERR_OP_EMPTY, man->parse,
- n->line, n->pos, "OP");
+ mandoc_msg(MANDOCERR_OP_EMPTY, n->line, n->pos, "OP");
else if (n->child->next != NULL && n->child->next->next != NULL) {
n = n->child->next->next;
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse,
+ mandoc_msg(MANDOCERR_ARG_EXCESS,
n->line, n->pos, "OP ... %s", n->string);
}
}
@@ -249,9 +246,8 @@ post_SH(CHKARGS)
}
if (nc->tok == MAN_PP || nc->tok == ROFF_sp || nc->tok == ROFF_br) {
- mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse,
- nc->line, nc->pos, "%s after %s",
- roff_name[nc->tok], roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_PAR_SKIP, nc->line, nc->pos,
+ "%s after %s", roff_name[nc->tok], roff_name[n->tok]);
roff_node_delete(man, nc);
}
@@ -261,7 +257,7 @@ post_SH(CHKARGS)
*/
if ((nc = n->last) != NULL && nc->tok == ROFF_br) {
- mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse,
+ mandoc_msg(MANDOCERR_PAR_SKIP,
nc->line, nc->pos, "%s at the end of %s",
roff_name[nc->tok], roff_name[n->tok]);
roff_node_delete(man, nc);
@@ -272,8 +268,8 @@ static void
post_UR(CHKARGS)
{
if (n->type == ROFFT_HEAD && n->child == NULL)
- mandoc_msg(MANDOCERR_UR_NOHEAD, man->parse,
- n->line, n->pos, roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_UR_NOHEAD, n->line, n->pos,
+ "%s", roff_name[n->tok]);
check_part(man, n);
}
@@ -282,8 +278,8 @@ check_part(CHKARGS)
{
if (n->type == ROFFT_BODY && n->child == NULL)
- mandoc_msg(MANDOCERR_BLK_EMPTY, man->parse,
- n->line, n->pos, roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_BLK_EMPTY, n->line, n->pos,
+ "%s", roff_name[n->tok]);
}
static void
@@ -298,21 +294,20 @@ check_par(CHKARGS)
case ROFFT_BODY:
if (n->child != NULL &&
(n->child->tok == ROFF_sp || n->child->tok == ROFF_br)) {
- mandoc_vmsg(MANDOCERR_PAR_SKIP,
- man->parse, n->child->line, n->child->pos,
+ mandoc_msg(MANDOCERR_PAR_SKIP,
+ n->child->line, n->child->pos,
"%s after %s", roff_name[n->child->tok],
roff_name[n->tok]);
roff_node_delete(man, n->child);
}
if (n->child == NULL)
- mandoc_vmsg(MANDOCERR_PAR_SKIP,
- man->parse, n->line, n->pos,
+ mandoc_msg(MANDOCERR_PAR_SKIP, n->line, n->pos,
"%s empty", roff_name[n->tok]);
break;
case ROFFT_HEAD:
if (n->child != NULL)
- mandoc_vmsg(MANDOCERR_ARG_SKIP,
- man->parse, n->line, n->pos, "%s %s%s",
+ mandoc_msg(MANDOCERR_ARG_SKIP,
+ n->line, n->pos, "%s %s%s",
roff_name[n->tok], n->child->string,
n->child->next != NULL ? " ..." : "");
break;
@@ -332,8 +327,7 @@ post_IP(CHKARGS)
break;
case ROFFT_BODY:
if (n->parent->head->child == NULL && n->child == NULL)
- mandoc_vmsg(MANDOCERR_PAR_SKIP,
- man->parse, n->line, n->pos,
+ mandoc_msg(MANDOCERR_PAR_SKIP, n->line, n->pos,
"%s empty", roff_name[n->tok]);
break;
default:
@@ -366,9 +360,8 @@ post_TH(CHKARGS)
/* Only warn about this once... */
if (isalpha((unsigned char)*p) &&
! isupper((unsigned char)*p)) {
- mandoc_vmsg(MANDOCERR_TITLE_CASE,
- man->parse, n->line,
- n->pos + (p - n->string),
+ mandoc_msg(MANDOCERR_TITLE_CASE, n->line,
+ n->pos + (int)(p - n->string),
"TH %s", n->string);
break;
}
@@ -376,8 +369,7 @@ post_TH(CHKARGS)
man->meta.title = mandoc_strdup(n->string);
} else {
man->meta.title = mandoc_strdup("");
- mandoc_msg(MANDOCERR_TH_NOTITLE, man->parse,
- nb->line, nb->pos, "TH");
+ mandoc_msg(MANDOCERR_TH_NOTITLE, nb->line, nb->pos, "TH");
}
/* TITLE ->MSEC<- DATE OS VOL */
@@ -388,7 +380,7 @@ post_TH(CHKARGS)
man->meta.msec = mandoc_strdup(n->string);
else {
man->meta.msec = mandoc_strdup("");
- mandoc_vmsg(MANDOCERR_MSEC_MISSING, man->parse,
+ mandoc_msg(MANDOCERR_MSEC_MISSING,
nb->line, nb->pos, "TH %s", man->meta.title);
}
@@ -402,7 +394,7 @@ post_TH(CHKARGS)
mandoc_normdate(man, n->string, n->line, n->pos);
} else {
man->meta.date = mandoc_strdup("");
- mandoc_msg(MANDOCERR_DATE_MISSING, man->parse,
+ mandoc_msg(MANDOCERR_DATE_MISSING,
n ? n->line : nb->line,
n ? n->pos : nb->pos, "TH");
}
@@ -430,7 +422,7 @@ post_TH(CHKARGS)
man->meta.vol = mandoc_strdup(p);
if (n != NULL && (n = n->next) != NULL)
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse,
+ mandoc_msg(MANDOCERR_ARG_EXCESS,
n->line, n->pos, "TH ... %s", n->string);
/*
diff --git a/mandoc.c b/mandoc.c
index d2396c2a..bac795ab 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -467,7 +467,7 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos)
/* Quoted argument without a closing quote. */
if (1 == quoted)
- mandoc_msg(MANDOCERR_ARG_QUOTE, parse, ln, *pos, NULL);
+ mandoc_msg(MANDOCERR_ARG_QUOTE, ln, *pos, NULL);
/* NUL-terminate this argument and move to the next one. */
if (pairs)
@@ -481,7 +481,7 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos)
*cpp = cp;
if ('\0' == *cp && (white || ' ' == cp[-1]))
- mandoc_msg(MANDOCERR_SPACE_EOL, parse, ln, *pos, NULL);
+ mandoc_msg(MANDOCERR_SPACE_EOL, ln, *pos, NULL);
return start;
}
@@ -562,7 +562,7 @@ mandoc_normdate(struct roff_man *man, char *in, int ln, int pos)
/* No date specified: use today's date. */
if (in == NULL || *in == '\0' || strcmp(in, "$" "Mdocdate$") == 0) {
- mandoc_msg(MANDOCERR_DATE_MISSING, man->parse, ln, pos, NULL);
+ mandoc_msg(MANDOCERR_DATE_MISSING, ln, pos, NULL);
return time2a(time(NULL));
}
@@ -572,23 +572,20 @@ mandoc_normdate(struct roff_man *man, char *in, int ln, int pos)
a2time(&t, "%b %d, %Y", in)) {
cp = time2a(t);
if (t > time(NULL) + 86400)
- mandoc_msg(MANDOCERR_DATE_FUTURE, man->parse,
- ln, pos, cp);
+ mandoc_msg(MANDOCERR_DATE_FUTURE, ln, pos, "%s", cp);
else if (*in != '$' && strcmp(in, cp) != 0)
- mandoc_msg(MANDOCERR_DATE_NORM, man->parse,
- ln, pos, cp);
+ mandoc_msg(MANDOCERR_DATE_NORM, ln, pos, "%s", cp);
return cp;
}
/* In man(7), do not warn about the legacy format. */
if (a2time(&t, "%Y-%m-%d", in) == 0)
- mandoc_msg(MANDOCERR_DATE_BAD, man->parse, ln, pos, in);
+ mandoc_msg(MANDOCERR_DATE_BAD, ln, pos, "%s", in);
else if (t > time(NULL) + 86400)
- mandoc_msg(MANDOCERR_DATE_FUTURE, man->parse, ln, pos, in);
+ mandoc_msg(MANDOCERR_DATE_FUTURE, ln, pos, "%s", in);
else if (man->macroset == MACROSET_MDOC)
- mandoc_vmsg(MANDOCERR_DATE_LEGACY, man->parse,
- ln, pos, "Dd %s", in);
+ mandoc_msg(MANDOCERR_DATE_LEGACY, ln, pos, "Dd %s", in);
/* Use any non-mdoc(7) date verbatim. */
diff --git a/mandoc.h b/mandoc.h
index 60a16e97..2a601b0c 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -274,10 +274,8 @@ enum mandocerr mandoc_msg_getmin(void);
void mandoc_msg_setmin(enum mandocerr);
enum mandoclevel mandoc_msg_getrc(void);
void mandoc_msg_setrc(enum mandoclevel);
-void mandoc_msg(enum mandocerr, void *, int, int, const char *);
-void mandoc_vmsg(enum mandocerr, void *, int, int,
- const char *, ...)
- __attribute__((__format__ (__printf__, 5, 6)));
+void mandoc_msg(enum mandocerr, int, int, const char *, ...)
+ __attribute__((__format__ (__printf__, 4, 5)));
void mchars_alloc(void);
void mchars_free(void);
int mchars_num2char(const char *, size_t);
diff --git a/mandoc_msg.c b/mandoc_msg.c
index aa0cce5a..d2ccb91f 100644
--- a/mandoc_msg.c
+++ b/mandoc_msg.c
@@ -288,8 +288,7 @@ mandoc_msg_setrc(enum mandoclevel level)
}
void
-mandoc_vmsg(enum mandocerr t, void *dummy, int line, int col,
- const char *fmt, ...)
+mandoc_msg(enum mandocerr t, int line, int col, const char *fmt, ...)
{
va_list ap;
enum mandoclevel level;
@@ -324,12 +323,3 @@ mandoc_vmsg(enum mandocerr t, void *dummy, int line, int col,
}
fputc('\n', fileptr);
}
-
-void
-mandoc_msg(enum mandocerr t, void *dummy, int line, int col, const char *msg)
-{
- if (msg == NULL)
- mandoc_vmsg(t, dummy, line, col, NULL);
- else
- mandoc_vmsg(t, dummy, line, col, "%s", msg);
-}
diff --git a/mdoc.c b/mdoc.c
index 1c852cc8..58c1afd5 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -227,8 +227,7 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs)
*end = '\0';
if (ws)
- mandoc_msg(MANDOCERR_SPACE_EOL, mdoc->parse,
- line, (int)(ws-buf), NULL);
+ mandoc_msg(MANDOCERR_SPACE_EOL, line, (int)(ws - buf), NULL);
/*
* Blank lines are allowed in no-fill mode
@@ -252,8 +251,7 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs)
default:
break;
}
- mandoc_msg(MANDOCERR_FI_BLANK, mdoc->parse,
- line, (int)(c - buf), NULL);
+ mandoc_msg(MANDOCERR_FI_BLANK, line, (int)(c - buf), NULL);
roff_elem_alloc(mdoc, line, offs, ROFF_sp);
mdoc->last->flags |= NODE_VALID | NODE_ENDED;
mdoc->next = ROFF_NEXT_SIBLING;
@@ -293,8 +291,7 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs)
if (*c == ' ')
c++;
if (isupper((unsigned char)(*c)))
- mandoc_msg(MANDOCERR_EOS, mdoc->parse,
- line, (int)(c - buf), NULL);
+ mandoc_msg(MANDOCERR_EOS, line, (int)(c - buf), NULL);
}
return 1;
@@ -322,8 +319,7 @@ mdoc_pmacro(struct roff_man *mdoc, int ln, char *buf, int offs)
if (sz == 2 || sz == 3)
tok = roffhash_find(mdoc->mdocmac, buf + sv, sz);
if (tok == TOKEN_NONE) {
- mandoc_msg(MANDOCERR_MACRO, mdoc->parse,
- ln, sv, buf + sv - 1);
+ mandoc_msg(MANDOCERR_MACRO, ln, sv, "%s", buf + sv - 1);
return 1;
}
@@ -353,8 +349,7 @@ mdoc_pmacro(struct roff_man *mdoc, int ln, char *buf, int offs)
*/
if ('\0' == buf[offs] && ' ' == buf[offs - 1])
- mandoc_msg(MANDOCERR_SPACE_EOL, mdoc->parse,
- ln, offs - 1, NULL);
+ mandoc_msg(MANDOCERR_SPACE_EOL, ln, offs - 1, NULL);
/*
* If an initial macro or a list invocation, divert directly
diff --git a/mdoc_argv.c b/mdoc_argv.c
index 9a43db9c..6cd5efa2 100644
--- a/mdoc_argv.c
+++ b/mdoc_argv.c
@@ -453,8 +453,7 @@ args(struct roff_man *mdoc, int line, int *pos,
if (buf[*pos] == '\0') {
if (mdoc->flags & MDOC_PHRASELIT &&
! (mdoc->flags & MDOC_PHRASE)) {
- mandoc_msg(MANDOCERR_ARG_QUOTE,
- mdoc->parse, line, *pos, NULL);
+ mandoc_msg(MANDOCERR_ARG_QUOTE, line, *pos, NULL);
mdoc->flags &= ~MDOC_PHRASELIT;
}
return ARGS_EOLN;
@@ -505,7 +504,7 @@ args(struct roff_man *mdoc, int line, int *pos,
p = strchr(*v, '\0');
if (p[-1] == ' ')
mandoc_msg(MANDOCERR_SPACE_EOL,
- mdoc->parse, line, *pos, NULL);
+ line, *pos, NULL);
*pos += (int)(p - *v);
}
@@ -553,7 +552,7 @@ args(struct roff_man *mdoc, int line, int *pos,
if (buf[*pos] == '\0') {
if ( ! (mdoc->flags & MDOC_PHRASE))
mandoc_msg(MANDOCERR_ARG_QUOTE,
- mdoc->parse, line, *pos, NULL);
+ line, *pos, NULL);
return ARGS_WORD;
}
@@ -567,8 +566,7 @@ args(struct roff_man *mdoc, int line, int *pos,
(*pos)++;
if ('\0' == buf[*pos])
- mandoc_msg(MANDOCERR_SPACE_EOL, mdoc->parse,
- line, *pos, NULL);
+ mandoc_msg(MANDOCERR_SPACE_EOL, line, *pos, NULL);
return ARGS_WORD;
}
diff --git a/mdoc_macro.c b/mdoc_macro.c
index c141003e..f858f42e 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -228,8 +228,8 @@ mdoc_endparse(struct roff_man *mdoc)
for ( ; n; n = n->parent)
if (n->type == ROFFT_BLOCK &&
mdoc_macro(n->tok)->flags & MDOC_EXPLICIT)
- mandoc_msg(MANDOCERR_BLK_NOEND, mdoc->parse,
- n->line, n->pos, roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_BLK_NOEND,
+ n->line, n->pos, "%s", roff_name[n->tok]);
/* Rewind to the first. */
@@ -255,8 +255,7 @@ lookup(struct roff_man *mdoc, int from, int line, int ppos, const char *p)
if (res != TOKEN_NONE) {
if (mdoc_macro(res)->flags & MDOC_CALLABLE)
return res;
- mandoc_msg(MANDOCERR_MACRO_CALL,
- mdoc->parse, line, ppos, p);
+ mandoc_msg(MANDOCERR_MACRO_CALL, line, ppos, "%s", p);
}
}
return TOKEN_NONE;
@@ -421,10 +420,9 @@ find_pending(struct roff_man *mdoc, enum roff_tok tok, int line, int ppos,
if (target->type == ROFFT_HEAD)
target->flags |= NODE_ENDED;
else if ( ! (target->flags & NODE_ENDED)) {
- mandoc_vmsg(MANDOCERR_BLK_NEST,
- mdoc->parse, line, ppos,
- "%s breaks %s", roff_name[tok],
- roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_BLK_NEST,
+ line, ppos, "%s breaks %s",
+ roff_name[tok], roff_name[n->tok]);
mdoc_endbody_alloc(mdoc, line, ppos,
tok, target);
}
@@ -635,7 +633,7 @@ blk_exp_close(MACRO_PROT_ARGS)
* the scope - of the current block ends.
*/
- mandoc_vmsg(MANDOCERR_BLK_NEST, mdoc->parse,
+ mandoc_msg(MANDOCERR_BLK_NEST,
line, ppos, "%s breaks %s",
roff_name[atok], roff_name[later->tok]);
@@ -678,8 +676,8 @@ blk_exp_close(MACRO_PROT_ARGS)
}
if (body == NULL) {
- mandoc_msg(MANDOCERR_BLK_NOTOPEN, mdoc->parse,
- line, ppos, roff_name[tok]);
+ mandoc_msg(MANDOCERR_BLK_NOTOPEN, line, ppos,
+ "%s", roff_name[tok]);
if (maxargs && endbody == NULL) {
/*
* Stray .Ec without previous .Eo:
@@ -696,10 +694,8 @@ blk_exp_close(MACRO_PROT_ARGS)
if ((mdoc_macro(tok)->flags & MDOC_PARSED) == 0) {
if (buf[*pos] != '\0')
- mandoc_vmsg(MANDOCERR_ARG_SKIP,
- mdoc->parse, line, ppos,
- "%s %s", roff_name[tok],
- buf + *pos);
+ mandoc_msg(MANDOCERR_ARG_SKIP, line, ppos,
+ "%s %s", roff_name[tok], buf + *pos);
if (endbody == NULL && n != NULL)
rew_pending(mdoc, n);
return;
@@ -834,8 +830,7 @@ in_line(MACRO_PROT_ARGS)
} else if ( ! nc && ! cnt) {
mdoc_argv_free(arg);
mandoc_msg(MANDOCERR_MACRO_EMPTY,
- mdoc->parse, line, ppos,
- roff_name[tok]);
+ line, ppos, "%s", roff_name[tok]);
}
(*mdoc_macro(ntok)->fp)(mdoc, ntok,
line, la, pos, buf);
@@ -921,8 +916,8 @@ in_line(MACRO_PROT_ARGS)
rew_last(mdoc, mdoc->last);
} else {
mdoc_argv_free(arg);
- mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
- line, ppos, roff_name[tok]);
+ mandoc_msg(MANDOCERR_MACRO_EMPTY,
+ line, ppos, "%s", roff_name[tok]);
}
}
if (nl)
@@ -946,8 +941,8 @@ blk_full(MACRO_PROT_ARGS)
nl = MDOC_NEWLINE & mdoc->flags;
if (buf[*pos] == '\0' && (tok == MDOC_Sh || tok == MDOC_Ss)) {
- mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
- line, ppos, roff_name[tok]);
+ mandoc_msg(MANDOCERR_MACRO_EMPTY,
+ line, ppos, "%s", roff_name[tok]);
return;
}
@@ -967,9 +962,8 @@ blk_full(MACRO_PROT_ARGS)
if (tok == MDOC_It && n->tok == MDOC_Bl) {
if (blk != NULL) {
- mandoc_vmsg(MANDOCERR_BLK_BROKEN,
- mdoc->parse, line, ppos,
- "It breaks %s",
+ mandoc_msg(MANDOCERR_BLK_BROKEN,
+ line, ppos, "It breaks %s",
roff_name[blk->tok]);
rew_pending(mdoc, blk);
}
@@ -980,8 +974,8 @@ blk_full(MACRO_PROT_ARGS)
switch (tok) {
case MDOC_Sh:
case MDOC_Ss:
- mandoc_vmsg(MANDOCERR_BLK_BROKEN,
- mdoc->parse, line, ppos,
+ mandoc_msg(MANDOCERR_BLK_BROKEN,
+ line, ppos,
"%s breaks %s", roff_name[tok],
roff_name[n->tok]);
rew_pending(mdoc, n);
@@ -1007,8 +1001,7 @@ blk_full(MACRO_PROT_ARGS)
/* Item breaking an explicit block. */
if (blk != NULL) {
- mandoc_vmsg(MANDOCERR_BLK_BROKEN,
- mdoc->parse, line, ppos,
+ mandoc_msg(MANDOCERR_BLK_BROKEN, line, ppos,
"It breaks %s", roff_name[blk->tok]);
rew_pending(mdoc, blk);
blk = NULL;
@@ -1022,7 +1015,7 @@ blk_full(MACRO_PROT_ARGS)
/* Skip items outside lists. */
if (tok == MDOC_It && (n == NULL || n->tok != MDOC_Bl)) {
- mandoc_vmsg(MANDOCERR_IT_STRAY, mdoc->parse,
+ mandoc_msg(MANDOCERR_IT_STRAY,
line, ppos, "It %s", buf + *pos);
roff_elem_alloc(mdoc, line, ppos, ROFF_br);
rew_elem(mdoc, ROFF_br);
@@ -1100,13 +1093,12 @@ blk_full(MACRO_PROT_ARGS)
}
if (tok == MDOC_Bd || tok == MDOC_Bk) {
- mandoc_vmsg(MANDOCERR_ARG_EXCESS,
- mdoc->parse, line, la, "%s ... %s",
- roff_name[tok], buf + la);
+ mandoc_msg(MANDOCERR_ARG_EXCESS, line, la,
+ "%s ... %s", roff_name[tok], buf + la);
break;
}
if (tok == MDOC_Rs) {
- mandoc_vmsg(MANDOCERR_ARG_SKIP, mdoc->parse,
+ mandoc_msg(MANDOCERR_ARG_SKIP,
line, la, "Rs %s", buf + la);
break;
}
@@ -1360,8 +1352,8 @@ in_line_argn(MACRO_PROT_ARGS)
if (ac == ARGS_PUNCT || ac == ARGS_EOLN) {
if (abs(state) < 2 && tok == MDOC_Pf)
- mandoc_vmsg(MANDOCERR_PF_SKIP,
- mdoc->parse, line, ppos, "Pf %s",
+ mandoc_msg(MANDOCERR_PF_SKIP,
+ line, ppos, "Pf %s",
p == NULL ? "at eol" : p);
break;
}
@@ -1401,8 +1393,8 @@ in_line_argn(MACRO_PROT_ARGS)
}
if (state == -1) {
- mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
- line, ppos, roff_name[tok]);
+ mandoc_msg(MANDOCERR_MACRO_EMPTY,
+ line, ppos, "%s", roff_name[tok]);
return;
}
@@ -1431,8 +1423,8 @@ in_line_eoln(MACRO_PROT_ARGS)
if (buf[*pos] == '\0' &&
(tok == MDOC_Fd || *roff_name[tok] == '%')) {
- mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
- line, ppos, roff_name[tok]);
+ mandoc_msg(MANDOCERR_MACRO_EMPTY,
+ line, ppos, "%s", roff_name[tok]);
return;
}
@@ -1500,8 +1492,7 @@ phrase_ta(MACRO_PROT_ARGS)
}
if (n == NULL || n->norm->Bl.type != LIST_column) {
- mandoc_msg(MANDOCERR_TA_STRAY, mdoc->parse,
- line, ppos, "Ta");
+ mandoc_msg(MANDOCERR_TA_STRAY, line, ppos, "Ta");
return;
}
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 444f0710..535996eb 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -415,8 +415,7 @@ check_text(struct roff_man *mdoc, int ln, int pos, char *p)
return;
for (cp = p; NULL != (p = strchr(p, '\t')); p++)
- mandoc_msg(MANDOCERR_FI_TAB, mdoc->parse,
- ln, pos + (int)(p - cp), NULL);
+ mandoc_msg(MANDOCERR_FI_TAB, ln, pos + (int)(p - cp), NULL);
}
static void
@@ -463,7 +462,7 @@ check_text_em(struct roff_man *mdoc, int ln, int pos, char *p)
nn != NULL &&
nn->type == ROFFT_TEXT &&
isalpha((unsigned char)*nn->string))) {
- mandoc_msg(MANDOCERR_DASHDASH, mdoc->parse,
+ mandoc_msg(MANDOCERR_DASHDASH,
ln, pos + (int)(cp - p) - 1, NULL);
break;
}
@@ -479,17 +478,13 @@ check_toptext(struct roff_man *mdoc, int ln, int pos, const char *p)
return;
if ((cp = strstr(p, "OpenBSD")) != NULL)
- mandoc_msg(MANDOCERR_BX, mdoc->parse,
- ln, pos + (cp - p), "Ox");
+ mandoc_msg(MANDOCERR_BX, ln, pos + (int)(cp - p), "Ox");
if ((cp = strstr(p, "NetBSD")) != NULL)
- mandoc_msg(MANDOCERR_BX, mdoc->parse,
- ln, pos + (cp - p), "Nx");
+ mandoc_msg(MANDOCERR_BX, ln, pos + (int)(cp - p), "Nx");
if ((cp = strstr(p, "FreeBSD")) != NULL)
- mandoc_msg(MANDOCERR_BX, mdoc->parse,
- ln, pos + (cp - p), "Fx");
+ mandoc_msg(MANDOCERR_BX, ln, pos + (int)(cp - p), "Fx");
if ((cp = strstr(p, "DragonFly")) != NULL)
- mandoc_msg(MANDOCERR_BX, mdoc->parse,
- ln, pos + (cp - p), "Dx");
+ mandoc_msg(MANDOCERR_BX, ln, pos + (int)(cp - p), "Dx");
cp = p;
while ((cp = strstr(cp + 1, "()")) != NULL) {
@@ -498,8 +493,7 @@ check_toptext(struct roff_man *mdoc, int ln, int pos, const char *p)
break;
if ((cpr < p || *cpr == ' ') && cpr + 1 < cp) {
cpr++;
- mandoc_vmsg(MANDOCERR_FUNC, mdoc->parse,
- ln, pos + (cpr - p),
+ mandoc_msg(MANDOCERR_FUNC, ln, pos + (int)(cpr - p),
"%.*s()", (int)(cp - cpr), cpr);
}
}
@@ -533,9 +527,8 @@ post_delim(POST_ARGS)
tok == MDOC_Ss || tok == MDOC_Fo))
return;
- mandoc_vmsg(MANDOCERR_DELIM, mdoc->parse,
- nch->line, nch->pos + (lc - nch->string),
- "%s%s %s", roff_name[tok],
+ mandoc_msg(MANDOCERR_DELIM, nch->line,
+ nch->pos + (int)(lc - nch->string), "%s%s %s", roff_name[tok],
nch == mdoc->last->child ? "" : " ...", nch->string);
}
@@ -627,9 +620,8 @@ post_delim_nb(POST_ARGS)
}
}
- mandoc_vmsg(MANDOCERR_DELIM_NB, mdoc->parse,
- nch->line, nch->pos + (lc - nch->string),
- "%s%s %s", roff_name[tok],
+ mandoc_msg(MANDOCERR_DELIM_NB, nch->line,
+ nch->pos + (int)(lc - nch->string), "%s%s %s", roff_name[tok],
nch == mdoc->last->child ? "" : " ...", nch->string);
}
@@ -695,39 +687,34 @@ post_bl_norm(POST_ARGS)
case MDOC_Compact:
if (n->norm->Bl.comp)
mandoc_msg(MANDOCERR_ARG_REP,
- mdoc->parse, argv->line,
- argv->pos, "Bl -compact");
+ argv->line, argv->pos, "Bl -compact");
n->norm->Bl.comp = 1;
break;
case MDOC_Width:
wa = argv;
if (0 == argv->sz) {
mandoc_msg(MANDOCERR_ARG_EMPTY,
- mdoc->parse, argv->line,
- argv->pos, "Bl -width");
+ argv->line, argv->pos, "Bl -width");
n->norm->Bl.width = "0n";
break;
}
if (NULL != n->norm->Bl.width)
- mandoc_vmsg(MANDOCERR_ARG_REP,
- mdoc->parse, argv->line,
- argv->pos, "Bl -width %s",
- argv->value[0]);
+ mandoc_msg(MANDOCERR_ARG_REP,
+ argv->line, argv->pos,
+ "Bl -width %s", argv->value[0]);
rewrite_macro2len(mdoc, argv->value);
n->norm->Bl.width = argv->value[0];
break;
case MDOC_Offset:
if (0 == argv->sz) {
mandoc_msg(MANDOCERR_ARG_EMPTY,
- mdoc->parse, argv->line,
- argv->pos, "Bl -offset");
+ argv->line, argv->pos, "Bl -offset");
break;
}
if (NULL != n->norm->Bl.offs)
- mandoc_vmsg(MANDOCERR_ARG_REP,
- mdoc->parse, argv->line,
- argv->pos, "Bl -offset %s",
- argv->value[0]);
+ mandoc_msg(MANDOCERR_ARG_REP,
+ argv->line, argv->pos,
+ "Bl -offset %s", argv->value[0]);
rewrite_macro2len(mdoc, argv->value);
n->norm->Bl.offs = argv->value[0];
break;
@@ -741,8 +728,7 @@ post_bl_norm(POST_ARGS)
/* Check: multiple list types. */
if (LIST__NONE != n->norm->Bl.type) {
- mandoc_vmsg(MANDOCERR_BL_REP,
- mdoc->parse, n->line, n->pos,
+ mandoc_msg(MANDOCERR_BL_REP, n->line, n->pos,
"Bl -%s", mdoc_argnames[argv->arg]);
continue;
}
@@ -752,8 +738,8 @@ post_bl_norm(POST_ARGS)
if (n->norm->Bl.width ||
n->norm->Bl.offs ||
n->norm->Bl.comp)
- mandoc_vmsg(MANDOCERR_BL_LATETYPE,
- mdoc->parse, n->line, n->pos, "Bl -%s",
+ mandoc_msg(MANDOCERR_BL_LATETYPE,
+ n->line, n->pos, "Bl -%s",
mdoc_argnames[n->args->argv[0].arg]);
n->norm->Bl.type = lt;
@@ -766,8 +752,7 @@ post_bl_norm(POST_ARGS)
/* Allow lists to default to LIST_item. */
if (LIST__NONE == n->norm->Bl.type) {
- mandoc_msg(MANDOCERR_BL_NOTYPE, mdoc->parse,
- n->line, n->pos, "Bl");
+ mandoc_msg(MANDOCERR_BL_NOTYPE, n->line, n->pos, "Bl");
n->norm->Bl.type = LIST_item;
mdoclt = MDOC_Item;
}
@@ -782,7 +767,7 @@ post_bl_norm(POST_ARGS)
switch (n->norm->Bl.type) {
case LIST_tag:
if (n->norm->Bl.width == NULL)
- mandoc_msg(MANDOCERR_BL_NOWIDTH, mdoc->parse,
+ mandoc_msg(MANDOCERR_BL_NOWIDTH,
n->line, n->pos, "Bl -tag");
break;
case LIST_column:
@@ -791,9 +776,8 @@ post_bl_norm(POST_ARGS)
case LIST_inset:
case LIST_item:
if (n->norm->Bl.width != NULL)
- mandoc_vmsg(MANDOCERR_BL_SKIPW, mdoc->parse,
- wa->line, wa->pos, "Bl -%s",
- mdoc_argnames[mdoclt]);
+ mandoc_msg(MANDOCERR_BL_SKIPW, wa->line, wa->pos,
+ "Bl -%s", mdoc_argnames[mdoclt]);
n->norm->Bl.width = NULL;
break;
case LIST_bullet:
@@ -841,29 +825,25 @@ post_bd(POST_ARGS)
dt = DISP_literal;
break;
case MDOC_File:
- mandoc_msg(MANDOCERR_BD_FILE, mdoc->parse,
- n->line, n->pos, NULL);
+ mandoc_msg(MANDOCERR_BD_FILE, n->line, n->pos, NULL);
break;
case MDOC_Offset:
if (0 == argv->sz) {
mandoc_msg(MANDOCERR_ARG_EMPTY,
- mdoc->parse, argv->line,
- argv->pos, "Bd -offset");
+ argv->line, argv->pos, "Bd -offset");
break;
}
if (NULL != n->norm->Bd.offs)
- mandoc_vmsg(MANDOCERR_ARG_REP,
- mdoc->parse, argv->line,
- argv->pos, "Bd -offset %s",
- argv->value[0]);
+ mandoc_msg(MANDOCERR_ARG_REP,
+ argv->line, argv->pos,
+ "Bd -offset %s", argv->value[0]);
rewrite_macro2len(mdoc, argv->value);
n->norm->Bd.offs = argv->value[0];
break;
case MDOC_Compact:
if (n->norm->Bd.comp)
mandoc_msg(MANDOCERR_ARG_REP,
- mdoc->parse, argv->line,
- argv->pos, "Bd -compact");
+ argv->line, argv->pos, "Bd -compact");
n->norm->Bd.comp = 1;
break;
default:
@@ -875,14 +855,12 @@ post_bd(POST_ARGS)
if (DISP__NONE == n->norm->Bd.type)
n->norm->Bd.type = dt;
else
- mandoc_vmsg(MANDOCERR_BD_REP,
- mdoc->parse, n->line, n->pos,
+ mandoc_msg(MANDOCERR_BD_REP, n->line, n->pos,
"Bd -%s", mdoc_argnames[argv->arg]);
}
if (DISP__NONE == n->norm->Bd.type) {
- mandoc_msg(MANDOCERR_BD_NOTYPE, mdoc->parse,
- n->line, n->pos, "Bd");
+ mandoc_msg(MANDOCERR_BD_NOTYPE, n->line, n->pos, "Bd");
n->norm->Bd.type = DISP_ragged;
}
}
@@ -904,8 +882,7 @@ post_an_norm(POST_ARGS)
for (i = 1; i < n->args->argc; i++) {
argv = n->args->argv + i;
- mandoc_vmsg(MANDOCERR_AN_REP,
- mdoc->parse, argv->line, argv->pos,
+ mandoc_msg(MANDOCERR_AN_REP, argv->line, argv->pos,
"An -%s", mdoc_argnames[argv->arg]);
}
@@ -926,7 +903,7 @@ post_eoln(POST_ARGS)
post_useless(mdoc);
n = mdoc->last;
if (n->child != NULL)
- mandoc_vmsg(MANDOCERR_ARG_SKIP, mdoc->parse, n->line,
+ mandoc_msg(MANDOCERR_ARG_SKIP, n->line,
n->pos, "%s %s", roff_name[n->tok], n->child->string);
while (n->child != NULL)
@@ -989,8 +966,7 @@ post_ex(POST_ARGS)
mdoc->next = ROFF_NEXT_SIBLING;
ic = 1;
} else {
- mandoc_msg(MANDOCERR_EX_NONAME, mdoc->parse,
- n->line, n->pos, "Ex");
+ mandoc_msg(MANDOCERR_EX_NONAME, n->line, n->pos, "Ex");
ic = 0;
}
@@ -1023,7 +999,7 @@ post_lb(POST_ARGS)
return;
}
- mandoc_vmsg(MANDOCERR_LB_BAD, mdoc->parse, n->child->line,
+ mandoc_msg(MANDOCERR_LB_BAD, n->child->line,
n->child->pos, "Lb %s", n->child->string);
roff_word_alloc(mdoc, n->line, n->pos, "library");
@@ -1087,8 +1063,8 @@ post_std(POST_ARGS)
if (n->args->argv[0].arg == MDOC_Std)
return;
- mandoc_msg(MANDOCERR_ARG_STD, mdoc->parse,
- n->line, n->pos, roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_ARG_STD, n->line, n->pos,
+ "%s", roff_name[n->tok]);
}
static void
@@ -1102,7 +1078,7 @@ post_st(POST_ARGS)
assert(nch->type == ROFFT_TEXT);
if ((p = mdoc_a2st(nch->string)) == NULL) {
- mandoc_vmsg(MANDOCERR_ST_BAD, mdoc->parse,
+ mandoc_msg(MANDOCERR_ST_BAD,
nch->line, nch->pos, "St %s", nch->string);
roff_node_delete(mdoc, n);
return;
@@ -1122,8 +1098,8 @@ post_obsolete(POST_ARGS)
n = mdoc->last;
if (n->type == ROFFT_ELEM || n->type == ROFFT_BLOCK)
- mandoc_msg(MANDOCERR_MACRO_OBS, mdoc->parse,
- n->line, n->pos, roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_MACRO_OBS, n->line, n->pos,
+ "%s", roff_name[n->tok]);
}
static void
@@ -1132,8 +1108,8 @@ post_useless(POST_ARGS)
struct roff_node *n;
n = mdoc->last;
- mandoc_msg(MANDOCERR_MACRO_USELESS, mdoc->parse,
- n->line, n->pos, roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_MACRO_USELESS, n->line, n->pos,
+ "%s", roff_name[n->tok]);
}
/*
@@ -1162,14 +1138,14 @@ post_bf(POST_ARGS)
nch = np->child;
if (np->parent->args == NULL) {
if (nch == NULL) {
- mandoc_msg(MANDOCERR_BF_NOFONT, mdoc->parse,
+ mandoc_msg(MANDOCERR_BF_NOFONT,
np->line, np->pos, "Bf");
return;
}
nch = nch->next;
}
if (nch != NULL)
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
+ mandoc_msg(MANDOCERR_ARG_EXCESS,
nch->line, nch->pos, "Bf ... %s", nch->string);
/* Extract argument into data. */
@@ -1200,9 +1176,8 @@ post_bf(POST_ARGS)
else if ( ! strcmp(np->child->string, "Sy"))
np->norm->Bf.font = FONT_Sy;
else
- mandoc_vmsg(MANDOCERR_BF_BADFONT, mdoc->parse,
- np->child->line, np->child->pos,
- "Bf %s", np->child->string);
+ mandoc_msg(MANDOCERR_BF_BADFONT, np->child->line,
+ np->child->pos, "Bf %s", np->child->string);
}
static void
@@ -1216,8 +1191,8 @@ post_fname(POST_ARGS)
pos = strcspn(n->string, "()");
cp = n->string + pos;
if ( ! (cp[0] == '\0' || (cp[0] == '(' && cp[1] == '*')))
- mandoc_msg(MANDOCERR_FN_PAREN, mdoc->parse,
- n->line, n->pos + pos, n->string);
+ mandoc_msg(MANDOCERR_FN_PAREN, n->line, n->pos + pos,
+ "%s", n->string);
}
static void
@@ -1239,12 +1214,11 @@ post_fo(POST_ARGS)
return;
if (n->child == NULL) {
- mandoc_msg(MANDOCERR_FO_NOHEAD, mdoc->parse,
- n->line, n->pos, "Fo");
+ mandoc_msg(MANDOCERR_FO_NOHEAD, n->line, n->pos, "Fo");
return;
}
if (n->child != n->last) {
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
+ mandoc_msg(MANDOCERR_ARG_EXCESS,
n->child->next->line, n->child->next->pos,
"Fo ... %s", n->child->next->string);
while (n->child != n->last)
@@ -1268,9 +1242,8 @@ post_fa(POST_ARGS)
break;
if (*cp != ',')
continue;
- mandoc_msg(MANDOCERR_FA_COMMA, mdoc->parse,
- n->line, n->pos + (cp - n->string),
- n->string);
+ mandoc_msg(MANDOCERR_FA_COMMA, n->line,
+ n->pos + (int)(cp - n->string), "%s", n->string);
break;
}
}
@@ -1296,8 +1269,7 @@ post_nm(POST_ARGS)
if (mdoc->meta.name == NULL ||
(mdoc->lastsec == SEC_NAME && n->child == NULL))
- mandoc_msg(MANDOCERR_NM_NONAME, mdoc->parse,
- n->line, n->pos, "Nm");
+ mandoc_msg(MANDOCERR_NM_NONAME, n->line, n->pos, "Nm");
switch (n->type) {
case ROFFT_ELEM:
@@ -1331,12 +1303,10 @@ post_nd(POST_ARGS)
return;
if (n->sec != SEC_NAME)
- mandoc_msg(MANDOCERR_ND_LATE, mdoc->parse,
- n->line, n->pos, "Nd");
+ mandoc_msg(MANDOCERR_ND_LATE, n->line, n->pos, "Nd");
if (n->child == NULL)
- mandoc_msg(MANDOCERR_ND_EMPTY, mdoc->parse,
- n->line, n->pos, "Nd");
+ mandoc_msg(MANDOCERR_ND_EMPTY, n->line, n->pos, "Nd");
else
post_delim(mdoc);
@@ -1356,8 +1326,8 @@ post_display(POST_ARGS)
n->body->parent->args == NULL)
roff_node_delete(mdoc, n);
} else if (n->child == NULL)
- mandoc_msg(MANDOCERR_BLK_EMPTY, mdoc->parse,
- n->line, n->pos, roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_BLK_EMPTY, n->line, n->pos,
+ "%s", roff_name[n->tok]);
else if (n->tok == MDOC_D1)
post_hyph(mdoc);
break;
@@ -1365,7 +1335,7 @@ post_display(POST_ARGS)
if (n->tok == MDOC_Bd) {
if (n->args == NULL) {
mandoc_msg(MANDOCERR_BD_NOARG,
- mdoc->parse, n->line, n->pos, "Bd");
+ n->line, n->pos, "Bd");
mdoc->next = ROFF_NEXT_SIBLING;
while (n->body->child != NULL)
roff_node_relink(mdoc,
@@ -1378,9 +1348,8 @@ post_display(POST_ARGS)
}
for (np = n->parent; np != NULL; np = np->parent) {
if (np->type == ROFFT_BLOCK && np->tok == MDOC_Bd) {
- mandoc_vmsg(MANDOCERR_BD_NEST,
- mdoc->parse, n->line, n->pos,
- "%s in Bd", roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_BD_NEST, n->line,
+ n->pos, "%s in Bd", roff_name[n->tok]);
break;
}
}
@@ -1444,7 +1413,7 @@ post_at(POST_ARGS)
att = NULL;
if (nch != NULL && ((att = mdoc_a2att(nch->string)) == NULL))
- mandoc_vmsg(MANDOCERR_AT_BAD, mdoc->parse,
+ mandoc_msg(MANDOCERR_AT_BAD,
nch->line, nch->pos, "At %s", nch->string);
mdoc->next = ROFF_NEXT_CHILD;
@@ -1468,12 +1437,12 @@ post_an(POST_ARGS)
nch = np->child;
if (np->norm->An.auth == AUTH__NONE) {
if (nch == NULL)
- mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
+ mandoc_msg(MANDOCERR_MACRO_EMPTY,
np->line, np->pos, "An");
else
post_delim_nb(mdoc);
} else if (nch != NULL)
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
+ mandoc_msg(MANDOCERR_ARG_EXCESS,
nch->line, nch->pos, "An ... %s", nch->string);
}
@@ -1569,9 +1538,8 @@ post_it(POST_ARGS)
case LIST_inset:
case LIST_diag:
if (nit->head->child == NULL)
- mandoc_vmsg(MANDOCERR_IT_NOHEAD,
- mdoc->parse, nit->line, nit->pos,
- "Bl -%s It",
+ mandoc_msg(MANDOCERR_IT_NOHEAD,
+ nit->line, nit->pos, "Bl -%s It",
mdoc_argnames[nbl->args->argv[0].arg]);
break;
case LIST_bullet:
@@ -1579,14 +1547,13 @@ post_it(POST_ARGS)
case LIST_enum:
case LIST_hyphen:
if (nit->body == NULL || nit->body->child == NULL)
- mandoc_vmsg(MANDOCERR_IT_NOBODY,
- mdoc->parse, nit->line, nit->pos,
- "Bl -%s It",
+ mandoc_msg(MANDOCERR_IT_NOBODY,
+ nit->line, nit->pos, "Bl -%s It",
mdoc_argnames[nbl->args->argv[0].arg]);
/* FALLTHROUGH */
case LIST_item:
if ((nch = nit->head->child) != NULL)
- mandoc_vmsg(MANDOCERR_ARG_SKIP, mdoc->parse,
+ mandoc_msg(MANDOCERR_ARG_SKIP,
nit->line, nit->pos, "It %s",
nch->string == NULL ? roff_name[nch->tok] :
nch->string);
@@ -1598,7 +1565,7 @@ post_it(POST_ARGS)
if (nit->head->next->child == NULL &&
nit->head->next->next == NULL) {
- mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
+ mandoc_msg(MANDOCERR_MACRO_EMPTY,
nit->line, nit->pos, "It");
roff_node_delete(mdoc, nit);
break;
@@ -1609,16 +1576,15 @@ post_it(POST_ARGS)
if (nch->type != ROFFT_BODY)
continue;
if (i++ && nch->flags & NODE_LINE)
- mandoc_msg(MANDOCERR_TA_LINE, mdoc->parse,
+ mandoc_msg(MANDOCERR_TA_LINE,
nch->line, nch->pos, "Ta");
}
if (i < cols || i > cols + 1)
- mandoc_vmsg(MANDOCERR_BL_COL,
- mdoc->parse, nit->line, nit->pos,
+ mandoc_msg(MANDOCERR_BL_COL, nit->line, nit->pos,
"%d columns, %d cells", cols, i);
else if (nit->head->next->child != NULL &&
nit->head->next->child->line > nit->line)
- mandoc_msg(MANDOCERR_IT_NOARG, mdoc->parse,
+ mandoc_msg(MANDOCERR_IT_NOARG,
nit->line, nit->pos, "Bl -column It");
break;
default:
@@ -1648,14 +1614,13 @@ post_bl_block(POST_ARGS)
continue;
}
if (ni->next == NULL) {
- mandoc_msg(MANDOCERR_PAR_MOVE,
- mdoc->parse, nc->line, nc->pos,
- roff_name[nc->tok]);
+ mandoc_msg(MANDOCERR_PAR_MOVE, nc->line,
+ nc->pos, "%s", roff_name[nc->tok]);
roff_node_relink(mdoc, nc);
} else if (n->norm->Bl.comp == 0 &&
n->norm->Bl.type != LIST_column) {
- mandoc_vmsg(MANDOCERR_PAR_SKIP,
- mdoc->parse, nc->line, nc->pos,
+ mandoc_msg(MANDOCERR_PAR_SKIP,
+ nc->line, nc->pos,
"%s before It", roff_name[nc->tok]);
roff_node_delete(mdoc, nc);
} else
@@ -1701,7 +1666,7 @@ post_bl_head(POST_ARGS)
if (nh->norm->Bl.type != LIST_column) {
if ((nch = nh->child) == NULL)
return;
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
+ mandoc_msg(MANDOCERR_ARG_EXCESS,
nch->line, nch->pos, "Bl ... %s", nch->string);
while (nch != NULL) {
roff_node_delete(mdoc, nch);
@@ -1778,7 +1743,7 @@ post_bl(POST_ARGS)
nchild = nbody->child;
if (nchild == NULL) {
- mandoc_msg(MANDOCERR_BLK_EMPTY, mdoc->parse,
+ mandoc_msg(MANDOCERR_BLK_EMPTY,
nbody->line, nbody->pos, "Bl");
return;
}
@@ -1821,8 +1786,8 @@ post_bl(POST_ARGS)
continue;
}
- mandoc_msg(MANDOCERR_BL_MOVE, mdoc->parse,
- nchild->line, nchild->pos, roff_name[nchild->tok]);
+ mandoc_msg(MANDOCERR_BL_MOVE, nchild->line, nchild->pos,
+ "%s", roff_name[nchild->tok]);
/*
* Move the node out of the Bl block.
@@ -1877,13 +1842,13 @@ post_bl(POST_ARGS)
if (prev_Er != NULL) {
order = strcmp(prev_Er, nnext->string);
if (order > 0)
- mandoc_vmsg(MANDOCERR_ER_ORDER,
- mdoc->parse, nnext->line, nnext->pos,
+ mandoc_msg(MANDOCERR_ER_ORDER,
+ nnext->line, nnext->pos,
"Er %s %s (NetBSD)",
prev_Er, nnext->string);
else if (order == 0)
- mandoc_vmsg(MANDOCERR_ER_REP,
- mdoc->parse, nnext->line, nnext->pos,
+ mandoc_msg(MANDOCERR_ER_REP,
+ nnext->line, nnext->pos,
"Er %s (NetBSD)", prev_Er);
}
prev_Er = nnext->string;
@@ -1898,8 +1863,7 @@ post_bk(POST_ARGS)
n = mdoc->last;
if (n->type == ROFFT_BLOCK && n->body->child == NULL) {
- mandoc_msg(MANDOCERR_BLK_EMPTY,
- mdoc->parse, n->line, n->pos, "Bk");
+ mandoc_msg(MANDOCERR_BLK_EMPTY, n->line, n->pos, "Bk");
roff_node_delete(mdoc, n);
}
}
@@ -1927,8 +1891,7 @@ post_sm(POST_ARGS)
return;
}
- mandoc_vmsg(MANDOCERR_SM_BAD,
- mdoc->parse, nch->line, nch->pos,
+ mandoc_msg(MANDOCERR_SM_BAD, nch->line, nch->pos,
"%s %s", roff_name[mdoc->last->tok], nch->string);
roff_node_relink(mdoc, nch);
return;
@@ -1968,8 +1931,7 @@ post_root(POST_ARGS)
mandoc_normdate(mdoc, NULL, 0, 0);
if (mdoc->meta.title == NULL) {
- mandoc_msg(MANDOCERR_DT_NOTITLE,
- mdoc->parse, 0, 0, "EOF");
+ mandoc_msg(MANDOCERR_DT_NOTITLE, 0, 0, "EOF");
mdoc->meta.title = mandoc_strdup("UNTITLED");
}
@@ -1977,12 +1939,11 @@ post_root(POST_ARGS)
mdoc->meta.vol = mandoc_strdup("LOCAL");
if (mdoc->meta.os == NULL) {
- mandoc_msg(MANDOCERR_OS_MISSING,
- mdoc->parse, 0, 0, NULL);
+ mandoc_msg(MANDOCERR_OS_MISSING, 0, 0, NULL);
mdoc->meta.os = mandoc_strdup("");
} else if (mdoc->meta.os_e &&
(mdoc->meta.rcsids & (1 << mdoc->meta.os_e)) == 0)
- mandoc_msg(MANDOCERR_RCS_MISSING, mdoc->parse, 0, 0,
+ mandoc_msg(MANDOCERR_RCS_MISSING, 0, 0,
mdoc->meta.os_e == MANDOC_OS_OPENBSD ?
"(OpenBSD)" : "(NetBSD)");
@@ -1998,8 +1959,7 @@ post_root(POST_ARGS)
n->child->next->next == NULL)
n = n->next;
n = n->child->next->next;
- mandoc_vmsg(MANDOCERR_ARCH_BAD,
- mdoc->parse, n->line, n->pos,
+ mandoc_msg(MANDOCERR_ARCH_BAD, n->line, n->pos,
"Dt ... %s %s", mdoc->meta.arch,
mdoc->meta.os_e == MANDOC_OS_OPENBSD ?
"(OpenBSD)" : "(NetBSD)");
@@ -2016,10 +1976,10 @@ post_root(POST_ARGS)
n = n->next;
if (n == NULL)
- mandoc_msg(MANDOCERR_DOC_EMPTY, mdoc->parse, 0, 0, NULL);
+ mandoc_msg(MANDOCERR_DOC_EMPTY, 0, 0, NULL);
else if (n->tok != MDOC_Sh)
- mandoc_msg(MANDOCERR_SEC_BEFORE, mdoc->parse,
- n->line, n->pos, roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_SEC_BEFORE, n->line, n->pos,
+ "%s", roff_name[n->tok]);
}
static void
@@ -2034,8 +1994,7 @@ post_rs(POST_ARGS)
return;
if (np->child == NULL) {
- mandoc_msg(MANDOCERR_RS_EMPTY, mdoc->parse,
- np->line, np->pos, "Rs");
+ mandoc_msg(MANDOCERR_RS_EMPTY, np->line, np->pos, "Rs");
return;
}
@@ -2053,8 +2012,8 @@ post_rs(POST_ARGS)
break;
if (i == RSORD_MAX) {
- mandoc_msg(MANDOCERR_RS_BAD, mdoc->parse,
- nch->line, nch->pos, roff_name[nch->tok]);
+ mandoc_msg(MANDOCERR_RS_BAD, nch->line, nch->pos,
+ "%s", roff_name[nch->tok]);
i = -1;
} else if (nch->tok == MDOC__J || nch->tok == MDOC__B)
np->norm->Rs.quote_T++;
@@ -2143,8 +2102,7 @@ post_ns(POST_ARGS)
n = mdoc->last;
if (n->flags & NODE_LINE ||
(n->next != NULL && n->next->flags & NODE_DELIMC))
- mandoc_msg(MANDOCERR_NS_SKIP, mdoc->parse,
- n->line, n->pos, NULL);
+ mandoc_msg(MANDOCERR_NS_SKIP, n->line, n->pos, NULL);
}
static void
@@ -2196,8 +2154,8 @@ post_sh_name(POST_ARGS)
switch (n->tok) {
case MDOC_Nm:
if (hasnm && n->child != NULL)
- mandoc_vmsg(MANDOCERR_NAMESEC_PUNCT,
- mdoc->parse, n->line, n->pos,
+ mandoc_msg(MANDOCERR_NAMESEC_PUNCT,
+ n->line, n->pos,
"Nm %s", n->child->string);
hasnm = 1;
continue;
@@ -2205,7 +2163,7 @@ post_sh_name(POST_ARGS)
hasnd = 1;
if (n->next != NULL)
mandoc_msg(MANDOCERR_NAMESEC_ND,
- mdoc->parse, n->line, n->pos, NULL);
+ n->line, n->pos, NULL);
break;
case TOKEN_NONE:
if (n->type == ROFFT_TEXT &&
@@ -2216,18 +2174,18 @@ post_sh_name(POST_ARGS)
}
/* FALLTHROUGH */
default:
- mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse,
- n->line, n->pos, roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_NAMESEC_BAD,
+ n->line, n->pos, "%s", roff_name[n->tok]);
continue;
}
break;
}
if ( ! hasnm)
- mandoc_msg(MANDOCERR_NAMESEC_NONM, mdoc->parse,
+ mandoc_msg(MANDOCERR_NAMESEC_NONM,
mdoc->last->line, mdoc->last->pos, NULL);
if ( ! hasnd)
- mandoc_msg(MANDOCERR_NAMESEC_NOND, mdoc->parse,
+ mandoc_msg(MANDOCERR_NAMESEC_NOND,
mdoc->last->line, mdoc->last->pos, NULL);
}
@@ -2253,21 +2211,18 @@ post_sh_see_also(POST_ARGS)
sec = n->child->next->string;
if (lastsec != NULL) {
if (lastpunct[0] != ',' || lastpunct[1] != '\0')
- mandoc_vmsg(MANDOCERR_XR_PUNCT,
- mdoc->parse, n->line, n->pos,
- "%s before %s(%s)", lastpunct,
- name, sec);
+ mandoc_msg(MANDOCERR_XR_PUNCT, n->line,
+ n->pos, "%s before %s(%s)",
+ lastpunct, name, sec);
cmp = strcmp(lastsec, sec);
if (cmp > 0)
- mandoc_vmsg(MANDOCERR_XR_ORDER,
- mdoc->parse, n->line, n->pos,
- "%s(%s) after %s(%s)", name,
- sec, lastname, lastsec);
+ mandoc_msg(MANDOCERR_XR_ORDER, n->line,
+ n->pos, "%s(%s) after %s(%s)",
+ name, sec, lastname, lastsec);
else if (cmp == 0 &&
strcasecmp(lastname, name) > 0)
- mandoc_vmsg(MANDOCERR_XR_ORDER,
- mdoc->parse, n->line, n->pos,
- "%s after %s", name, lastname);
+ mandoc_msg(MANDOCERR_XR_ORDER, n->line,
+ n->pos, "%s after %s", name, lastname);
}
lastname = name;
lastsec = sec;
@@ -2288,8 +2243,8 @@ post_sh_see_also(POST_ARGS)
return;
lastpunct = n->string;
if (n->next == NULL || n->next->tok == MDOC_Rs)
- mandoc_vmsg(MANDOCERR_XR_PUNCT, mdoc->parse,
- n->line, n->pos, "%s after %s(%s)",
+ mandoc_msg(MANDOCERR_XR_PUNCT, n->line,
+ n->pos, "%s after %s(%s)",
lastpunct, lastname, lastsec);
n = n->next;
}
@@ -2310,7 +2265,7 @@ post_sh_authors(POST_ARGS)
{
if ( ! child_an(mdoc->last))
- mandoc_msg(MANDOCERR_AN_MISSING, mdoc->parse,
+ mandoc_msg(MANDOCERR_AN_MISSING,
mdoc->last->line, mdoc->last->pos, NULL);
}
@@ -2376,7 +2331,7 @@ post_sh_head(POST_ARGS)
/* The NAME should be first. */
if (sec != SEC_NAME && mdoc->lastnamed == SEC_NONE)
- mandoc_vmsg(MANDOCERR_NAMESEC_FIRST, mdoc->parse,
+ mandoc_msg(MANDOCERR_NAMESEC_FIRST,
mdoc->last->line, mdoc->last->pos, "Sh %s",
sec != SEC_CUSTOM ? secnames[sec] :
(nch = mdoc->last->child) == NULL ? "" :
@@ -2413,9 +2368,8 @@ post_sh_head(POST_ARGS)
}
}
if (goodsec != NULL)
- mandoc_vmsg(MANDOCERR_SEC_TYPO, mdoc->parse,
- nch->line, nch->pos, "Sh %s instead of %s",
- nch->string, goodsec);
+ mandoc_msg(MANDOCERR_SEC_TYPO, nch->line, nch->pos,
+ "Sh %s instead of %s", nch->string, goodsec);
return;
}
@@ -2425,14 +2379,12 @@ post_sh_head(POST_ARGS)
*/
if (sec == mdoc->lastnamed)
- mandoc_vmsg(MANDOCERR_SEC_REP, mdoc->parse,
- mdoc->last->line, mdoc->last->pos,
- "Sh %s", secnames[sec]);
+ mandoc_msg(MANDOCERR_SEC_REP, mdoc->last->line,
+ mdoc->last->pos, "Sh %s", secnames[sec]);
if (sec < mdoc->lastnamed)
- mandoc_vmsg(MANDOCERR_SEC_ORDER, mdoc->parse,
- mdoc->last->line, mdoc->last->pos,
- "Sh %s", secnames[sec]);
+ mandoc_msg(MANDOCERR_SEC_ORDER, mdoc->last->line,
+ mdoc->last->pos, "Sh %s", secnames[sec]);
/* Mark the last named section. */
@@ -2464,7 +2416,7 @@ post_sh_head(POST_ARGS)
break;
if (NULL == goodsec)
goodsec = "9";
- mandoc_vmsg(MANDOCERR_SEC_MSEC, mdoc->parse,
+ mandoc_msg(MANDOCERR_SEC_MSEC,
mdoc->last->line, mdoc->last->pos,
"Sh %s for %s only", secnames[sec], goodsec);
break;
@@ -2481,13 +2433,13 @@ post_xr(POST_ARGS)
n = mdoc->last;
nch = n->child;
if (nch->next == NULL) {
- mandoc_vmsg(MANDOCERR_XR_NOSEC, mdoc->parse,
+ mandoc_msg(MANDOCERR_XR_NOSEC,
n->line, n->pos, "Xr %s", nch->string);
} else {
assert(nch->next == n->last);
if(mandoc_xr_add(nch->next->string, nch->string,
nch->line, nch->pos))
- mandoc_vmsg(MANDOCERR_XR_SELF, mdoc->parse,
+ mandoc_msg(MANDOCERR_XR_SELF,
nch->line, nch->pos, "Xr %s %s",
nch->string, nch->next->string);
}
@@ -2516,8 +2468,7 @@ post_ignpar(POST_ARGS)
if ((np = mdoc->last->child) != NULL)
if (np->tok == MDOC_Pp ||
np->tok == ROFF_br || np->tok == ROFF_sp) {
- mandoc_vmsg(MANDOCERR_PAR_SKIP,
- mdoc->parse, np->line, np->pos,
+ mandoc_msg(MANDOCERR_PAR_SKIP, np->line, np->pos,
"%s after %s", roff_name[np->tok],
roff_name[mdoc->last->tok]);
roff_node_delete(mdoc, np);
@@ -2525,9 +2476,8 @@ post_ignpar(POST_ARGS)
if ((np = mdoc->last->last) != NULL)
if (np->tok == MDOC_Pp || np->tok == ROFF_br) {
- mandoc_vmsg(MANDOCERR_PAR_SKIP, mdoc->parse,
- np->line, np->pos, "%s at the end of %s",
- roff_name[np->tok],
+ mandoc_msg(MANDOCERR_PAR_SKIP, np->line, np->pos,
+ "%s at the end of %s", roff_name[np->tok],
roff_name[mdoc->last->tok]);
roff_node_delete(mdoc, np);
}
@@ -2558,9 +2508,8 @@ post_prevpar(POST_ARGS)
if (n->tok == MDOC_It && n->parent->norm->Bl.comp)
return;
- mandoc_vmsg(MANDOCERR_PAR_SKIP, mdoc->parse,
- n->prev->line, n->prev->pos, "%s before %s",
- roff_name[n->prev->tok], roff_name[n->tok]);
+ mandoc_msg(MANDOCERR_PAR_SKIP, n->prev->line, n->prev->pos,
+ "%s before %s", roff_name[n->prev->tok], roff_name[n->tok]);
roff_node_delete(mdoc, n->prev);
}
@@ -2573,9 +2522,8 @@ post_par(POST_ARGS)
np = mdoc->last;
if (np->child != NULL)
- mandoc_vmsg(MANDOCERR_ARG_SKIP,
- mdoc->parse, np->line, np->pos, "%s %s",
- roff_name[np->tok], np->child->string);
+ mandoc_msg(MANDOCERR_ARG_SKIP, np->line, np->pos,
+ "%s %s", roff_name[np->tok], np->child->string);
}
static void
@@ -2588,17 +2536,15 @@ post_dd(POST_ARGS)
n->flags |= NODE_NOPRT;
if (mdoc->meta.date != NULL) {
- mandoc_msg(MANDOCERR_PROLOG_REP, mdoc->parse,
- n->line, n->pos, "Dd");
+ mandoc_msg(MANDOCERR_PROLOG_REP, n->line, n->pos, "Dd");
free(mdoc->meta.date);
} else if (mdoc->flags & MDOC_PBODY)
- mandoc_msg(MANDOCERR_PROLOG_LATE, mdoc->parse,
- n->line, n->pos, "Dd");
+ mandoc_msg(MANDOCERR_PROLOG_LATE, n->line, n->pos, "Dd");
else if (mdoc->meta.title != NULL)
- mandoc_msg(MANDOCERR_PROLOG_ORDER, mdoc->parse,
+ mandoc_msg(MANDOCERR_PROLOG_ORDER,
n->line, n->pos, "Dd after Dt");
else if (mdoc->meta.os != NULL)
- mandoc_msg(MANDOCERR_PROLOG_ORDER, mdoc->parse,
+ mandoc_msg(MANDOCERR_PROLOG_ORDER,
n->line, n->pos, "Dd after Os");
if (n->child == NULL || n->child->string[0] == '\0') {
@@ -2629,16 +2575,14 @@ post_dt(POST_ARGS)
n->flags |= NODE_NOPRT;
if (mdoc->flags & MDOC_PBODY) {
- mandoc_msg(MANDOCERR_DT_LATE, mdoc->parse,
- n->line, n->pos, "Dt");
+ mandoc_msg(MANDOCERR_DT_LATE, n->line, n->pos, "Dt");
return;
}
if (mdoc->meta.title != NULL)
- mandoc_msg(MANDOCERR_PROLOG_REP, mdoc->parse,
- n->line, n->pos, "Dt");
+ mandoc_msg(MANDOCERR_PROLOG_REP, n->line, n->pos, "Dt");
else if (mdoc->meta.os != NULL)
- mandoc_msg(MANDOCERR_PROLOG_ORDER, mdoc->parse,
+ mandoc_msg(MANDOCERR_PROLOG_ORDER,
n->line, n->pos, "Dt after Os");
free(mdoc->meta.title);
@@ -2655,8 +2599,7 @@ post_dt(POST_ARGS)
nn = n->child;
if (nn == NULL || *nn->string == '\0') {
- mandoc_msg(MANDOCERR_DT_NOTITLE,
- mdoc->parse, n->line, n->pos, "Dt");
+ mandoc_msg(MANDOCERR_DT_NOTITLE, n->line, n->pos, "Dt");
mdoc->meta.title = mandoc_strdup("UNTITLED");
} else {
mdoc->meta.title = mandoc_strdup(nn->string);
@@ -2665,9 +2608,8 @@ post_dt(POST_ARGS)
for (p = nn->string; *p != '\0'; p++)
if (islower((unsigned char)*p)) {
- mandoc_vmsg(MANDOCERR_TITLE_CASE,
- mdoc->parse, nn->line,
- nn->pos + (p - nn->string),
+ mandoc_msg(MANDOCERR_TITLE_CASE, nn->line,
+ nn->pos + (int)(p - nn->string),
"Dt %s", nn->string);
break;
}
@@ -2679,8 +2621,7 @@ post_dt(POST_ARGS)
nn = nn->next;
if (nn == NULL) {
- mandoc_vmsg(MANDOCERR_MSEC_MISSING,
- mdoc->parse, n->line, n->pos,
+ mandoc_msg(MANDOCERR_MSEC_MISSING, n->line, n->pos,
"Dt %s", mdoc->meta.title);
mdoc->meta.vol = mandoc_strdup("LOCAL");
return; /* msec and arch remain NULL. */
@@ -2692,7 +2633,7 @@ post_dt(POST_ARGS)
cp = mandoc_a2msec(nn->string);
if (cp == NULL) {
- mandoc_vmsg(MANDOCERR_MSEC_BAD, mdoc->parse,
+ mandoc_msg(MANDOCERR_MSEC_BAD,
nn->line, nn->pos, "Dt ... %s", nn->string);
mdoc->meta.vol = mandoc_strdup(nn->string);
} else
@@ -2710,7 +2651,7 @@ post_dt(POST_ARGS)
/* Ignore fourth and later arguments. */
if ((nn = nn->next) != NULL)
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
+ mandoc_msg(MANDOCERR_ARG_EXCESS,
nn->line, nn->pos, "Dt ... %s", nn->string);
}
@@ -2731,8 +2672,8 @@ post_bx(POST_ARGS)
!strcmp(nch->string, "Free") ? "Fx" :
!strcmp(nch->string, "DragonFly") ? "Dx" : NULL;
if (macro != NULL)
- mandoc_msg(MANDOCERR_BX, mdoc->parse,
- n->line, n->pos, macro);
+ mandoc_msg(MANDOCERR_BX,
+ n->line, n->pos, "%s", macro);
mdoc->last = nch;
nch = nch->next;
mdoc->next = ROFF_NEXT_SIBLING;
@@ -2780,11 +2721,9 @@ post_os(POST_ARGS)
n->flags |= NODE_NOPRT;
if (mdoc->meta.os != NULL)
- mandoc_msg(MANDOCERR_PROLOG_REP, mdoc->parse,
- n->line, n->pos, "Os");
+ mandoc_msg(MANDOCERR_PROLOG_REP, n->line, n->pos, "Os");
else if (mdoc->flags & MDOC_PBODY)
- mandoc_msg(MANDOCERR_PROLOG_LATE, mdoc->parse,
- n->line, n->pos, "Os");
+ mandoc_msg(MANDOCERR_PROLOG_LATE, n->line, n->pos, "Os");
post_delim(mdoc);
@@ -2813,8 +2752,7 @@ post_os(POST_ARGS)
#else /*!OSNAME */
if (defbuf == NULL) {
if (uname(&utsname) == -1) {
- mandoc_msg(MANDOCERR_OS_UNAME, mdoc->parse,
- n->line, n->pos, "Os");
+ mandoc_msg(MANDOCERR_OS_UNAME, n->line, n->pos, "Os");
defbuf = mandoc_strdup("UNKNOWN");
} else
mandoc_asprintf(&defbuf, "%s %s",
@@ -2838,8 +2776,7 @@ out:
*/
if (n->child != NULL)
- mandoc_vmsg(MANDOCERR_OS_ARG, mdoc->parse,
- n->child->line, n->child->pos,
+ mandoc_msg(MANDOCERR_OS_ARG, n->child->line, n->child->pos,
"Os %s (%s)", n->child->string,
mdoc->meta.os_e == MANDOC_OS_OPENBSD ?
"OpenBSD" : "NetBSD");
@@ -2851,14 +2788,12 @@ out:
return;
if (strncmp(n->string, "$" "Mdocdate", 9)) {
if (mdoc->meta.os_e == MANDOC_OS_OPENBSD)
- mandoc_vmsg(MANDOCERR_MDOCDATE_MISSING,
- mdoc->parse, n->line, n->pos,
- "Dd %s (OpenBSD)", n->string);
+ mandoc_msg(MANDOCERR_MDOCDATE_MISSING, n->line,
+ n->pos, "Dd %s (OpenBSD)", n->string);
} else {
if (mdoc->meta.os_e == MANDOC_OS_NETBSD)
- mandoc_vmsg(MANDOCERR_MDOCDATE,
- mdoc->parse, n->line, n->pos,
- "Dd %s (NetBSD)", n->string);
+ mandoc_msg(MANDOCERR_MDOCDATE, n->line,
+ n->pos, "Dd %s (NetBSD)", n->string);
}
}
diff --git a/read.c b/read.c
index 95439fee..62267b03 100644
--- a/read.c
+++ b/read.c
@@ -208,7 +208,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
if (c & 0x80) {
if ( ! (curp->filenc && preconv_encode(
&blk, &i, &ln, &pos, &curp->filenc))) {
- mandoc_vmsg(MANDOCERR_CHAR_BAD, curp,
+ mandoc_msg(MANDOCERR_CHAR_BAD,
curp->line, pos, "0x%x", c);
ln.buf[pos++] = '?';
i++;
@@ -221,10 +221,10 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
*/
if (c == 0x7f || (c < 0x20 && c != 0x09)) {
- mandoc_vmsg(c == 0x00 || c == 0x04 ||
+ mandoc_msg(c == 0x00 || c == 0x04 ||
c > 0x0a ? MANDOCERR_CHAR_BAD :
MANDOCERR_CHAR_UNSUPP,
- curp, curp->line, pos, "0x%x", c);
+ curp->line, pos, "0x%x", c);
i++;
if (c != '\r')
ln.buf[pos++] = '?';
@@ -298,7 +298,7 @@ rerun:
if (loop == curp->loop)
break;
mandoc_msg(MANDOCERR_WHILE_NEST,
- curp, curp->line, pos, NULL);
+ curp->line, pos, NULL);
}
curp->loop = thisln;
loop = NULL;
@@ -308,12 +308,12 @@ rerun:
case ROFF_LOOPEXIT:
if (curp->loop == NULL) {
mandoc_msg(MANDOCERR_WHILE_FAIL,
- curp, curp->line, pos, NULL);
+ curp->line, pos, NULL);
break;
}
if (inloop == 0) {
mandoc_msg(MANDOCERR_WHILE_INTO,
- curp, curp->line, pos, NULL);
+ curp->line, pos, NULL);
curp->loop = loop = NULL;
break;
}
@@ -348,7 +348,7 @@ rerun:
if (++curp->reparse_count > REPARSE_LIMIT) {
/* Abort and return to the top level. */
result = ROFF_IGN;
- mandoc_msg(MANDOCERR_ROFFLOOP, curp,
+ mandoc_msg(MANDOCERR_ROFFLOOP,
curp->line, pos, NULL);
goto out;
}
@@ -372,9 +372,8 @@ rerun:
mparse_readfd(curp, fd, ln.buf + of);
close(fd);
} else {
- mandoc_vmsg(MANDOCERR_SO_FAIL,
- curp, curp->line, pos,
- ".so %s", ln.buf + of);
+ mandoc_msg(MANDOCERR_SO_FAIL, curp->line,
+ pos, ".so %s", ln.buf + of);
ln.sz = mandoc_asprintf(&cp,
".sp\nSee the file %s.\n.sp",
ln.buf + of);
@@ -409,7 +408,7 @@ rerun:
out:
if (inloop) {
if (result != ROFF_USERRET)
- mandoc_msg(MANDOCERR_WHILE_OUTOF, curp,
+ mandoc_msg(MANDOCERR_WHILE_OUTOF,
curp->line, pos, NULL);
curp->loop = NULL;
}
@@ -429,7 +428,7 @@ read_whole_file(struct mparse *curp, int fd, struct buf *fb, int *with_mmap)
int gzerrnum, retval;
if (fstat(fd, &st) == -1) {
- mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0,
+ mandoc_msg(MANDOCERR_FILE, 0, 0,
"fstat: %s", strerror(errno));
return 0;
}
@@ -443,7 +442,7 @@ read_whole_file(struct mparse *curp, int fd, struct buf *fb, int *with_mmap)
if (curp->gzip == 0 && S_ISREG(st.st_mode)) {
if (st.st_size > 0x7fffffff) {
- mandoc_msg(MANDOCERR_TOOLARGE, curp, 0, 0, NULL);
+ mandoc_msg(MANDOCERR_TOOLARGE, 0, 0, NULL);
return 0;
}
*with_mmap = 1;
@@ -462,12 +461,12 @@ read_whole_file(struct mparse *curp, int fd, struct buf *fb, int *with_mmap)
* which this function must not do.
*/
if ((fd = dup(fd)) == -1) {
- mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0,
+ mandoc_msg(MANDOCERR_FILE, 0, 0,
"dup: %s", strerror(errno));
return 0;
}
if ((gz = gzdopen(fd, "rb")) == NULL) {
- mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0,
+ mandoc_msg(MANDOCERR_FILE, 0, 0,
"gzdopen: %s", strerror(errno));
close(fd);
return 0;
@@ -488,8 +487,7 @@ read_whole_file(struct mparse *curp, int fd, struct buf *fb, int *with_mmap)
for (;;) {
if (off == fb->sz) {
if (fb->sz == (1U << 31)) {
- mandoc_msg(MANDOCERR_TOOLARGE, curp,
- 0, 0, NULL);
+ mandoc_msg(MANDOCERR_TOOLARGE, 0, 0, NULL);
break;
}
resize_buf(fb, 65536);
@@ -505,7 +503,7 @@ read_whole_file(struct mparse *curp, int fd, struct buf *fb, int *with_mmap)
if (ssz == -1) {
if (curp->gzip)
(void)gzerror(gz, &gzerrnum);
- mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, "read: %s",
+ mandoc_msg(MANDOCERR_FILE, 0, 0, "read: %s",
curp->gzip && gzerrnum != Z_ERRNO ?
zError(gzerrnum) : strerror(errno));
break;
@@ -514,7 +512,7 @@ read_whole_file(struct mparse *curp, int fd, struct buf *fb, int *with_mmap)
}
if (curp->gzip && (gzerrnum = gzclose(gz)) != Z_OK)
- mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, "gzclose: %s",
+ mandoc_msg(MANDOCERR_FILE, 0, 0, "gzclose: %s",
gzerrnum == Z_ERRNO ? strerror(errno) :
zError(gzerrnum));
if (retval == 0) {
@@ -553,7 +551,7 @@ mparse_readfd(struct mparse *curp, int fd, const char *filename)
int with_mmap;
if (recursion_depth > 64) {
- mandoc_msg(MANDOCERR_ROFFLOOP, curp, curp->line, 0, NULL);
+ mandoc_msg(MANDOCERR_ROFFLOOP, curp->line, 0, NULL);
return;
}
if (read_whole_file(curp, fd, &blk, &with_mmap) == 0)
@@ -635,7 +633,7 @@ mparse_open(struct mparse *curp, const char *file)
/* Neither worked, give up. */
- mandoc_msg(MANDOCERR_FILE, curp, 0, 0, strerror(errno));
+ mandoc_msg(MANDOCERR_FILE, 0, 0, "%s", strerror(errno));
return -1;
}
diff --git a/roff.c b/roff.c
index 3b3a1996..c8bbde1a 100644
--- a/roff.c
+++ b/roff.c
@@ -1204,8 +1204,9 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
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);
+ mandoc_msg(MANDOCERR_RCS_REP, ln,
+ (int)(stesc - buf->buf) + 1,
+ "%s", stesc + 1);
r->man->meta.rcsids |= rcsid;
}
@@ -1217,8 +1218,8 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
ep--;
}
if (*ep == ' ' || *ep == '\t')
- mandoc_msg(MANDOCERR_SPACE_EOL, r->parse,
- ln, ep - buf->buf, NULL);
+ mandoc_msg(MANDOCERR_SPACE_EOL,
+ ln, (int)(ep - buf->buf), NULL);
/*
* Save comments preceding the title macro
@@ -1327,15 +1328,15 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
if (esc == ESCAPE_ERROR ||
(esc == ESCAPE_SPECIAL &&
mchars_spec2cp(stnam, inaml) < 0))
- mandoc_vmsg(MANDOCERR_ESC_BAD,
- r->parse, ln, (int)(stesc - buf->buf),
+ 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, r->parse,
+ mandoc_msg(MANDOCERR_ROFFLOOP,
ln, (int)(stesc - buf->buf), NULL);
return ROFF_IGN;
}
@@ -1376,8 +1377,8 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
arg_complete = 1;
while (maxl == 0 || naml < maxl) {
if (*cp == '\0') {
- mandoc_msg(MANDOCERR_ESC_BAD, r->parse,
- ln, (int)(stesc - buf->buf), stesc);
+ mandoc_msg(MANDOCERR_ESC_BAD, ln,
+ (int)(stesc - buf->buf), "%s", stesc);
arg_complete = 0;
break;
}
@@ -1428,9 +1429,8 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
break;
case '$':
if (r->mstackpos < 0) {
- mandoc_vmsg(MANDOCERR_ARG_UNDEF,
- r->parse, ln, (int)(stesc - buf->buf),
- "%.3s", stesc);
+ mandoc_msg(MANDOCERR_ARG_UNDEF, ln,
+ (int)(stesc - buf->buf), "%.3s", stesc);
break;
}
ctx = r->mstack + r->mstackpos;
@@ -1445,9 +1445,8 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
else if (stesc[2] == '@')
quote_args = 1;
else {
- mandoc_vmsg(MANDOCERR_ARG_NONUM,
- r->parse, ln, (int)(stesc - buf->buf),
- "%.3s", stesc);
+ mandoc_msg(MANDOCERR_ARG_NONUM, ln,
+ (int)(stesc - buf->buf), "%.3s", stesc);
break;
}
asz = 0;
@@ -1506,12 +1505,12 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
if (res == NULL) {
if (stesc[1] == '*')
- mandoc_vmsg(MANDOCERR_STR_UNDEF,
- r->parse, ln, (int)(stesc - buf->buf),
+ 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, r->parse,
+ mandoc_msg(MANDOCERR_ROFFLOOP,
ln, (int)(stesc - buf->buf), NULL);
return ROFF_IGN;
}
@@ -1664,8 +1663,7 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs)
/* Skip empty request lines. */
if (buf->buf[pos] == '"') {
- mandoc_msg(MANDOCERR_COMMENT_BAD, r->parse,
- ln, pos, NULL);
+ mandoc_msg(MANDOCERR_COMMENT_BAD, ln, pos, NULL);
return ROFF_IGN;
} else if (buf->buf[pos] == '\0')
return ROFF_IGN;
@@ -1690,8 +1688,8 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs)
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);
+ 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] != ' ')
@@ -1750,12 +1748,11 @@ void
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]);
+ 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->parse,
+ mandoc_msg(MANDOCERR_BLK_NOEND,
r->eqn->node->line, r->eqn->node->pos, "EQ");
eqn_parse(r->eqn);
r->eqn = NULL;
@@ -1823,8 +1820,7 @@ roff_cblock(ROFF_ARGS)
*/
if (r->last == NULL) {
- mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse,
- ln, ppos, "..");
+ mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "..");
return ROFF_IGN;
}
@@ -1838,13 +1834,12 @@ roff_cblock(ROFF_ARGS)
case ROFF_ig:
break;
default:
- mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse,
- ln, ppos, "..");
+ mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "..");
return ROFF_IGN;
}
if (buf->buf[pos] != '\0')
- mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos,
+ mandoc_msg(MANDOCERR_ARG_SKIP, ln, pos,
".. %s", buf->buf + pos);
roffnode_pop(r);
@@ -1871,8 +1866,7 @@ static int
roff_ccond(struct roff *r, int ln, int ppos)
{
if (NULL == r->last) {
- mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse,
- ln, ppos, "\\}");
+ mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "\\}");
return 0;
}
@@ -1883,14 +1877,12 @@ roff_ccond(struct roff *r, int ln, int ppos)
case ROFF_while:
break;
default:
- mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse,
- ln, ppos, "\\}");
+ mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "\\}");
return 0;
}
if (r->last->endspan > -1) {
- mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse,
- ln, ppos, "\\}");
+ mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "\\}");
return 0;
}
@@ -1934,8 +1926,8 @@ roff_block(ROFF_ARGS)
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),
+ mandoc_msg(MANDOCERR_STR_UNDEF,
+ ln, (int)(iname - buf->buf),
"%.*s", (int)namesz, iname);
namesz = 0;
} else
@@ -1944,8 +1936,8 @@ roff_block(ROFF_ARGS)
name = iname;
if (namesz == 0 && tok != ROFF_ig) {
- mandoc_msg(MANDOCERR_REQ_EMPTY, r->parse,
- ln, ppos, roff_name[tok]);
+ mandoc_msg(MANDOCERR_REQ_EMPTY,
+ ln, ppos, "%s", roff_name[tok]);
return ROFF_IGN;
}
@@ -2003,8 +1995,8 @@ roff_block(ROFF_ARGS)
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),
+ mandoc_msg(MANDOCERR_STR_UNDEF,
+ ln, (int)(iname - buf->buf),
"%.*s", (int)namesz, iname);
namesz = 0;
} else
@@ -2016,7 +2008,7 @@ roff_block(ROFF_ARGS)
r->last->end = mandoc_strndup(name, namesz);
if (*cp != '\0')
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse,
+ mandoc_msg(MANDOCERR_ARG_EXCESS,
ln, pos, ".%s ... %s", roff_name[tok], cp);
return ROFF_IGN;
@@ -2417,8 +2409,7 @@ static int
roff_insec(ROFF_ARGS)
{
- mandoc_msg(MANDOCERR_REQ_INSEC, r->parse,
- ln, ppos, roff_name[tok]);
+ mandoc_msg(MANDOCERR_REQ_INSEC, ln, ppos, "%s", roff_name[tok]);
return ROFF_IGN;
}
@@ -2426,8 +2417,7 @@ static int
roff_unsupp(ROFF_ARGS)
{
- mandoc_msg(MANDOCERR_REQ_UNSUPP, r->parse,
- ln, ppos, roff_name[tok]);
+ mandoc_msg(MANDOCERR_REQ_UNSUPP, ln, ppos, "%s", roff_name[tok]);
return ROFF_IGN;
}
@@ -2501,8 +2491,8 @@ roff_cond(ROFF_ARGS)
*/
if (buf->buf[pos] == '\0')
- mandoc_msg(MANDOCERR_COND_EMPTY, r->parse,
- ln, ppos, roff_name[tok]);
+ mandoc_msg(MANDOCERR_COND_EMPTY,
+ ln, ppos, "%s", roff_name[tok]);
r->last->endspan = 1;
@@ -2705,7 +2695,7 @@ roff_evalnum(struct roff *r, int ln, const char *v,
case '/':
if (operand2 == 0) {
mandoc_msg(MANDOCERR_DIVZERO,
- r->parse, ln, *pos, v);
+ ln, *pos, "%s", v);
*res = 0;
break;
}
@@ -2714,7 +2704,7 @@ roff_evalnum(struct roff *r, int ln, const char *v,
case '%':
if (operand2 == 0) {
mandoc_msg(MANDOCERR_DIVZERO,
- r->parse, ln, *pos, v);
+ ln, *pos, "%s", v);
*res = 0;
break;
}
@@ -2994,8 +2984,8 @@ roff_it(ROFF_ARGS)
/* 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);
+ mandoc_msg(MANDOCERR_IT_NONUM,
+ ln, ppos, "%s", buf->buf + 1);
return ROFF_IGN;
}
@@ -3049,8 +3039,7 @@ static int
roff_TE(ROFF_ARGS)
{
if (r->tbl == NULL) {
- mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse,
- ln, ppos, "TE");
+ mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "TE");
return ROFF_IGN;
}
if (tbl_end(r->tbl, 0) == 0) {
@@ -3070,8 +3059,7 @@ roff_T_(ROFF_ARGS)
{
if (NULL == r->tbl)
- mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse,
- ln, ppos, "T&");
+ mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "T&");
else
tbl_restart(ln, ppos, r->tbl);
@@ -3167,7 +3155,7 @@ roff_EQ(ROFF_ARGS)
r->eqn->node = n;
if (buf->buf[pos] != '\0')
- mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos,
+ mandoc_msg(MANDOCERR_ARG_SKIP, ln, pos,
".EQ %s", buf->buf + pos);
return ROFF_IGN;
@@ -3180,9 +3168,9 @@ roff_EN(ROFF_ARGS)
eqn_parse(r->eqn);
r->eqn = NULL;
} else
- mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ln, ppos, "EN");
+ mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "EN");
if (buf->buf[pos] != '\0')
- mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos,
+ mandoc_msg(MANDOCERR_ARG_SKIP, ln, pos,
"EN %s", buf->buf + pos);
return ROFF_IGN;
}
@@ -3191,8 +3179,7 @@ static int
roff_TS(ROFF_ARGS)
{
if (r->tbl != NULL) {
- mandoc_msg(MANDOCERR_BLK_BROKEN, r->parse,
- ln, ppos, "TS breaks TS");
+ 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);
@@ -3229,8 +3216,8 @@ roff_onearg(ROFF_ARGS)
while (*cp == ' ')
*cp++ = '\0';
if (*cp != '\0')
- mandoc_vmsg(MANDOCERR_ARG_EXCESS,
- r->parse, ln, cp - buf->buf,
+ 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);
}
@@ -3243,8 +3230,8 @@ roff_onearg(ROFF_ARGS)
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);
+ mandoc_msg(MANDOCERR_CE_NONUM,
+ ln, pos, "ce %s", buf->buf + pos);
roffce_lines = 1;
}
if (roffce_lines < 1) {
@@ -3319,7 +3306,7 @@ roff_br(ROFF_ARGS)
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,
+ 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;
@@ -3337,7 +3324,7 @@ roff_cc(ROFF_ARGS)
r->control = '\0';
if (*p != '\0')
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse,
+ mandoc_msg(MANDOCERR_ARG_EXCESS,
ln, p - buf->buf, "cc ... %s", p);
return ROFF_IGN;
@@ -3357,8 +3344,7 @@ roff_char(ROFF_ARGS)
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);
+ mandoc_msg(MANDOCERR_CHAR_ARG, ln, pos, "char %s", kp);
return ROFF_IGN;
}
ksz = p - kp;
@@ -3391,8 +3377,8 @@ roff_char(ROFF_ARGS)
}
}
if (font > 1)
- mandoc_msg(MANDOCERR_CHAR_FONT, r->parse,
- ln, vp - buf->buf, vp);
+ mandoc_msg(MANDOCERR_CHAR_FONT,
+ ln, (int)(vp - buf->buf), "%s", vp);
/*
* Approximate the effect of .char using the .tr tables.
@@ -3425,8 +3411,8 @@ roff_ec(ROFF_ARGS)
else {
r->escape = *p;
if (*++p != '\0')
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse,
- ln, p - buf->buf, "ec ... %s", p);
+ mandoc_msg(MANDOCERR_ARG_EXCESS, ln,
+ (int)(p - buf->buf), "ec ... %s", p);
}
return ROFF_IGN;
}
@@ -3436,7 +3422,7 @@ roff_eo(ROFF_ARGS)
{
r->escape = '\0';
if (buf->buf[pos] != '\0')
- mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse,
+ mandoc_msg(MANDOCERR_ARG_SKIP,
ln, pos, "eo %s", buf->buf + pos);
return ROFF_IGN;
}
@@ -3460,7 +3446,7 @@ roff_tr(ROFF_ARGS)
p = buf->buf + pos;
if (*p == '\0') {
- mandoc_msg(MANDOCERR_REQ_EMPTY, r->parse, ln, ppos, "tr");
+ mandoc_msg(MANDOCERR_REQ_EMPTY, ln, ppos, "tr");
return ROFF_IGN;
}
@@ -3471,8 +3457,8 @@ roff_tr(ROFF_ARGS)
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);
+ mandoc_msg(MANDOCERR_ESC_BAD, ln,
+ (int)(p - buf->buf), "%s", first);
return ROFF_IGN;
}
fsz = (size_t)(p - first);
@@ -3482,14 +3468,14 @@ roff_tr(ROFF_ARGS)
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);
+ 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_vmsg(MANDOCERR_TR_ODD, r->parse,
- ln, first - buf->buf, "tr %s", first);
+ mandoc_msg(MANDOCERR_TR_ODD, ln,
+ (int)(first - buf->buf), "tr %s", first);
second = " ";
p--;
}
@@ -3524,7 +3510,7 @@ roff_return(ROFF_ARGS)
if (r->mstackpos >= 0)
return ROFF_IGN | ROFF_USERRET;
- mandoc_msg(MANDOCERR_REQ_NOMAC, r->parse, ln, ppos, "return");
+ mandoc_msg(MANDOCERR_REQ_NOMAC, ln, ppos, "return");
return ROFF_IGN;
}
@@ -3587,17 +3573,17 @@ roff_shift(ROFF_ARGS)
levels = 1;
if (buf->buf[pos] != '\0' &&
roff_evalnum(r, ln, buf->buf, &pos, &levels, 0) == 0) {
- mandoc_vmsg(MANDOCERR_CE_NONUM, r->parse,
+ mandoc_msg(MANDOCERR_CE_NONUM,
ln, pos, "shift %s", buf->buf + pos);
levels = 1;
}
if (r->mstackpos < 0) {
- mandoc_msg(MANDOCERR_REQ_NOMAC, r->parse, ln, ppos, "shift");
+ mandoc_msg(MANDOCERR_REQ_NOMAC, ln, ppos, "shift");
return ROFF_IGN;
}
ctx = r->mstack + r->mstackpos;
if (levels > ctx->argc) {
- mandoc_vmsg(MANDOCERR_SHIFT, r->parse,
+ mandoc_msg(MANDOCERR_SHIFT,
ln, pos, "%d, but max is %d", levels, ctx->argc);
levels = ctx->argc;
}
@@ -3617,7 +3603,7 @@ roff_so(ROFF_ARGS)
char *name, *cp;
name = buf->buf + pos;
- mandoc_vmsg(MANDOCERR_SO, r->parse, ln, ppos, "so %s", name);
+ mandoc_msg(MANDOCERR_SO, ln, ppos, "so %s", name);
/*
* Handle `so'. Be EXTREMELY careful, as we shouldn't be
@@ -3627,8 +3613,7 @@ roff_so(ROFF_ARGS)
*/
if (*name == '/' || strstr(name, "../") || strstr(name, "/..")) {
- mandoc_vmsg(MANDOCERR_SO_PATH, r->parse, ln, ppos,
- ".so %s", 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);
@@ -3741,7 +3726,7 @@ roff_getname(struct roff *r, char **cpp, int ln, int pos)
cp++;
if ('\\' == *cp)
continue;
- mandoc_vmsg(MANDOCERR_NAMESC, r->parse, ln, pos,
+ mandoc_msg(MANDOCERR_NAMESC, ln, pos,
"%.*s", (int)(cp - name + 1), name);
mandoc_escape((const char **)&cp, NULL, NULL);
break;
diff --git a/roff_validate.c b/roff_validate.c
index 54172391..ee14188b 100644
--- a/roff_validate.c
+++ b/roff_validate.c
@@ -64,12 +64,12 @@ roff_valid_br(ROFF_VALID_ARGS)
struct roff_node *np;
if (n->child != NULL)
- mandoc_vmsg(MANDOCERR_ARG_SKIP, man->parse,
+ mandoc_msg(MANDOCERR_ARG_SKIP,
n->line, n->pos, "br %s", n->child->string);
if (n->next != NULL && n->next->type == ROFFT_TEXT &&
*n->next->string == ' ') {
- mandoc_msg(MANDOCERR_PAR_SKIP, man->parse, n->line, n->pos,
+ mandoc_msg(MANDOCERR_PAR_SKIP, n->line, n->pos,
"br before text line with leading blank");
roff_node_delete(man, n);
return;
@@ -82,7 +82,7 @@ roff_valid_br(ROFF_VALID_ARGS)
case ROFF_br:
case ROFF_sp:
case MDOC_Pp:
- mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse,
+ mandoc_msg(MANDOCERR_PAR_SKIP,
n->line, n->pos, "br after %s", roff_name[np->tok]);
roff_node_delete(man, n);
break;
@@ -128,8 +128,7 @@ roff_valid_ft(ROFF_VALID_ARGS)
break;
}
- mandoc_vmsg(MANDOCERR_FT_BAD, man->parse,
- n->line, n->pos, "ft %s", cp);
+ mandoc_msg(MANDOCERR_FT_BAD, n->line, n->pos, "ft %s", cp);
roff_node_delete(man, n);
}
@@ -139,7 +138,7 @@ roff_valid_sp(ROFF_VALID_ARGS)
struct roff_node *np;
if (n->child != NULL && n->child->next != NULL)
- mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse,
+ mandoc_msg(MANDOCERR_ARG_EXCESS,
n->child->next->line, n->child->next->pos,
"sp ... %s", n->child->next->string);
@@ -148,12 +147,12 @@ roff_valid_sp(ROFF_VALID_ARGS)
switch (np->tok) {
case ROFF_br:
- mandoc_msg(MANDOCERR_PAR_SKIP, man->parse,
+ mandoc_msg(MANDOCERR_PAR_SKIP,
np->line, np->pos, "br before sp");
roff_node_delete(man, np);
break;
case MDOC_Pp:
- mandoc_msg(MANDOCERR_PAR_SKIP, man->parse,
+ mandoc_msg(MANDOCERR_PAR_SKIP,
n->line, n->pos, "sp after Pp");
roff_node_delete(man, n);
break;
diff --git a/tbl.c b/tbl.c
index 0767c539..bf6bd399 100644
--- a/tbl.c
+++ b/tbl.c
@@ -144,8 +144,7 @@ void
tbl_restart(int line, int pos, struct tbl_node *tbl)
{
if (tbl->part == TBL_PART_CDATA)
- mandoc_msg(MANDOCERR_TBLDATA_BLK, tbl->parse,
- line, pos, "T&");
+ mandoc_msg(MANDOCERR_TBLDATA_BLK, line, pos, "T&");
tbl->part = TBL_PART_LAYOUT;
tbl->line = line;
@@ -170,18 +169,15 @@ tbl_end(struct tbl_node *tbl, int still_open)
struct tbl_span *sp;
if (still_open)
- mandoc_msg(MANDOCERR_BLK_NOEND, tbl->parse,
- tbl->line, tbl->pos, "TS");
+ mandoc_msg(MANDOCERR_BLK_NOEND, tbl->line, tbl->pos, "TS");
else if (tbl->part == TBL_PART_CDATA)
- mandoc_msg(MANDOCERR_TBLDATA_BLK, tbl->parse,
- tbl->line, tbl->pos, "TE");
+ mandoc_msg(MANDOCERR_TBLDATA_BLK, tbl->line, tbl->pos, "TE");
sp = tbl->first_span;
while (sp != NULL && sp->first == NULL)
sp = sp->next;
if (sp == NULL) {
- mandoc_msg(MANDOCERR_TBLDATA_NONE, tbl->parse,
- tbl->line, tbl->pos, NULL);
+ mandoc_msg(MANDOCERR_TBLDATA_NONE, tbl->line, tbl->pos, NULL);
return 0;
}
return 1;
diff --git a/tbl_data.c b/tbl_data.c
index b2d0edef..e289464b 100644
--- a/tbl_data.c
+++ b/tbl_data.c
@@ -77,8 +77,8 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp,
cp->col = dp->layout->last->col + 1;
dp->layout->last = cp;
} else {
- mandoc_msg(MANDOCERR_TBLDATA_EXTRA, tbl->parse,
- ln, sv, p + sv);
+ mandoc_msg(MANDOCERR_TBLDATA_EXTRA,
+ ln, sv, "%s", p + sv);
while (p[*pos] != '\0')
(*pos)++;
return;
@@ -171,7 +171,7 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp,
dat->layout->pos == TBL_CELL_DOWN) &&
dat->pos == TBL_DATA_DATA && *dat->string != '\0')
mandoc_msg(MANDOCERR_TBLDATA_SPAN,
- tbl->parse, ln, sv, dat->string);
+ ln, sv, "%s", dat->string);
}
void
@@ -210,8 +210,8 @@ tbl_cdata(struct tbl_node *tbl, int ln, const char *p, int pos)
dat->string = mandoc_strdup(p + pos);
if (dat->layout->pos == TBL_CELL_DOWN)
- mandoc_msg(MANDOCERR_TBLDATA_SPAN, tbl->parse,
- ln, pos, dat->string);
+ mandoc_msg(MANDOCERR_TBLDATA_SPAN,
+ ln, pos, "%s", dat->string);
}
static struct tbl_span *
diff --git a/tbl_layout.c b/tbl_layout.c
index 11914a9f..cd57cf95 100644
--- a/tbl_layout.c
+++ b/tbl_layout.c
@@ -86,8 +86,7 @@ mod:
(*pos)++;
goto mod;
}
- mandoc_msg(MANDOCERR_TBLLAYOUT_PAR, tbl->parse,
- ln, *pos, NULL);
+ mandoc_msg(MANDOCERR_TBLLAYOUT_PAR, ln, *pos, NULL);
return;
}
@@ -115,8 +114,7 @@ mod:
cp->flags |= TBL_CELL_ITALIC;
goto mod;
case 'm':
- mandoc_msg(MANDOCERR_TBLLAYOUT_MOD, tbl->parse,
- ln, *pos, "m");
+ mandoc_msg(MANDOCERR_TBLLAYOUT_MOD, ln, *pos, "m");
goto mod;
case 'p':
case 'v':
@@ -159,10 +157,10 @@ mod:
cp->vert++;
else
mandoc_msg(MANDOCERR_TBLLAYOUT_VERT,
- tbl->parse, ln, *pos - 1, NULL);
+ ln, *pos - 1, NULL);
goto mod;
default:
- mandoc_vmsg(MANDOCERR_TBLLAYOUT_CHAR, tbl->parse,
+ mandoc_msg(MANDOCERR_TBLLAYOUT_CHAR,
ln, *pos - 1, "%c", p[*pos - 1]);
goto mod;
}
@@ -175,7 +173,7 @@ mod:
/* Support only one-character font-names for now. */
if (p[*pos] == '\0' || (p[*pos + 1] != ' ' && p[*pos + 1] != '.')) {
- mandoc_vmsg(MANDOCERR_FT_BAD, tbl->parse,
+ mandoc_msg(MANDOCERR_FT_BAD,
ln, *pos, "TS %s", p + *pos - 1);
if (p[*pos] != '\0')
(*pos)++;
@@ -197,7 +195,7 @@ mod:
case 'R':
goto mod;
default:
- mandoc_vmsg(MANDOCERR_FT_BAD, tbl->parse,
+ mandoc_msg(MANDOCERR_FT_BAD,
ln, *pos - 1, "TS f%c", p[*pos - 1]);
goto mod;
}
@@ -218,7 +216,7 @@ cell(struct tbl_node *tbl, struct tbl_row *rp,
rp->vert++;
else
mandoc_msg(MANDOCERR_TBLLAYOUT_VERT,
- tbl->parse, ln, *pos, NULL);
+ ln, *pos, NULL);
}
(*pos)++;
}
@@ -237,7 +235,7 @@ again:
break;
if (i == KEYS_MAX) {
- mandoc_vmsg(MANDOCERR_TBLLAYOUT_CHAR, tbl->parse,
+ mandoc_msg(MANDOCERR_TBLLAYOUT_CHAR,
ln, *pos, "%c", p[*pos]);
(*pos)++;
goto again;
@@ -248,14 +246,12 @@ again:
if (c == TBL_CELL_SPAN) {
if (rp->last == NULL)
- mandoc_msg(MANDOCERR_TBLLAYOUT_SPAN,
- tbl->parse, ln, *pos, NULL);
+ mandoc_msg(MANDOCERR_TBLLAYOUT_SPAN, ln, *pos, NULL);
else if (rp->last->pos == TBL_CELL_HORIZ ||
rp->last->pos == TBL_CELL_DHORIZ)
c = rp->last->pos;
} else if (c == TBL_CELL_DOWN && rp == tbl->first_row)
- mandoc_msg(MANDOCERR_TBLLAYOUT_DOWN,
- tbl->parse, ln, *pos, NULL);
+ mandoc_msg(MANDOCERR_TBLLAYOUT_DOWN, ln, *pos, NULL);
(*pos)++;
@@ -298,7 +294,7 @@ tbl_layout(struct tbl_node *tbl, int ln, const char *p, int pos)
}
if (tbl->first_row->first == NULL) {
mandoc_msg(MANDOCERR_TBLLAYOUT_NONE,
- tbl->parse, ln, pos, NULL);
+ ln, pos, NULL);
cell_alloc(tbl, tbl->first_row,
TBL_CELL_LEFT);
if (tbl->opts.lvert < tbl->first_row->vert)
diff --git a/tbl_opts.c b/tbl_opts.c
index 3e0f11d5..6c552aad 100644
--- a/tbl_opts.c
+++ b/tbl_opts.c
@@ -81,7 +81,7 @@ arg(struct tbl_node *tbl, int ln, const char *p, int *pos, int key)
switch (key) {
case KEY_DELIM:
- mandoc_vmsg(MANDOCERR_TBLOPT_EQN, tbl->parse,
+ mandoc_msg(MANDOCERR_TBLOPT_EQN,
ln, *pos, "%.*s", len, p + *pos);
want = 2;
break;
@@ -103,12 +103,11 @@ arg(struct tbl_node *tbl, int ln, const char *p, int *pos, int key)
}
if (len == 0)
- mandoc_msg(MANDOCERR_TBLOPT_NOARG,
- tbl->parse, ln, *pos, keys[key].name);
+ mandoc_msg(MANDOCERR_TBLOPT_NOARG, ln, *pos,
+ "%s", keys[key].name);
else if (want && len != want)
- mandoc_vmsg(MANDOCERR_TBLOPT_ARGSZ,
- tbl->parse, ln, *pos, "%s want %d have %d",
- keys[key].name, want, len);
+ mandoc_msg(MANDOCERR_TBLOPT_ARGSZ, ln, *pos,
+ "%s want %d have %d", keys[key].name, want, len);
*pos += len;
if (p[*pos] == ')')
@@ -142,8 +141,8 @@ tbl_option(struct tbl_node *tbl, int ln, const char *p, int *offs)
len++;
if (len == 0) {
- mandoc_vmsg(MANDOCERR_TBLOPT_ALPHA,
- tbl->parse, ln, pos, "%c", p[pos]);
+ mandoc_msg(MANDOCERR_TBLOPT_ALPHA,
+ ln, pos, "%c", p[pos]);
pos++;
continue;
}
@@ -157,7 +156,7 @@ tbl_option(struct tbl_node *tbl, int ln, const char *p, int *offs)
i++;
if (i == KEY_MAXKEYS) {
- mandoc_vmsg(MANDOCERR_TBLOPT_BAD, tbl->parse,
+ mandoc_msg(MANDOCERR_TBLOPT_BAD,
ln, pos, "%.*s", len, p + pos);
pos += len;
continue;