-/* $Id: man.c,v 1.84 2014/08/08 15:32:17 schwarze Exp $ */
+/* $Id: man.c,v 1.85 2014/08/08 15:54:10 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
tok = (i > 0 && i < 4) ? man_hash_find(mac) : MAN_MAX;
if (MAN_MAX == tok) {
- mandoc_vmsg(MANDOCERR_MACRO, man->parse, ln, ppos,
- "%s", buf + ppos - 1);
+ mandoc_msg(MANDOCERR_MACRO, man->parse,
+ ln, ppos, buf + ppos - 1);
return(1);
}
-/* $Id: man_validate.c,v 1.73 2014/08/08 15:35:31 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.74 2014/08/08 15:54:10 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
/* Only warn about this once... */
if (isalpha((unsigned char)*p) &&
! isupper((unsigned char)*p)) {
- mandoc_msg(MANDOCERR_TITLE_CASE,
+ mandoc_vmsg(MANDOCERR_TITLE_CASE,
man->parse, n->line,
n->pos + (p - n->string),
- n->string);
+ "TH %s", n->string);
break;
}
}
n->line, n->pos);
} else {
man->meta.date = mandoc_strdup("");
- man_nmsg(man, n ? n : nb, MANDOCERR_DATE_MISSING);
+ mandoc_msg(MANDOCERR_DATE_MISSING, man->parse,
+ n ? n->line : nb->line,
+ n ? n->pos : nb->pos, "TH");
}
/* TITLE MSEC DATE ->SOURCE<- VOL */
{
if (MAN_LITERAL & man->flags)
- man_nmsg(man, n, MANDOCERR_NF_SKIP);
+ mandoc_msg(MANDOCERR_NF_SKIP, man->parse,
+ n->line, n->pos, "nf");
man->flags |= MAN_LITERAL;
return(1);
{
if ( ! (MAN_LITERAL & man->flags))
- man_nmsg(man, n, MANDOCERR_FI_SKIP);
+ mandoc_msg(MANDOCERR_FI_SKIP, man->parse,
+ n->line, n->pos, "fi");
man->flags &= ~MAN_LITERAL;
return(1);
-/* $Id: mandoc.h,v 1.94 2014/08/08 15:48:43 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.95 2014/08/08 15:54:10 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
/* related to the prologue */
MANDOCERR_TH_MISSING, /* missing .TH macro, using "unknown 1" */
MANDOCERR_TITLE_CASE, /* lower case character in document title */
- MANDOCERR_MSEC_BAD, /* unknown manual section: section */
- MANDOCERR_ARCH_BAD, /* unknown manual volume or arch: volume */
+ MANDOCERR_MSEC_BAD, /* unknown manual section: Dt ... section */
+ MANDOCERR_ARCH_BAD, /* unknown manual volume or arch: Dt ... volume */
MANDOCERR_DATE_MISSING, /* missing date, using today's date */
MANDOCERR_DATE_BAD, /* cannot parse date, using it verbatim: date */
MANDOCERR_PROLOG_ORDER, /* prologue macros out of order: macro */
MANDOCERR_PROLOG_ONLY, /* skipping prologue macro in body: macro */
/* related to document structure */
- MANDOCERR_SO, /* .so is fragile, better use ln(1): .so path */
+ MANDOCERR_SO, /* .so is fragile, better use ln(1): so path */
MANDOCERR_DOC_EMPTY, /* no document body */
MANDOCERR_SEC_BEFORE, /* content before first section header: macro */
- MANDOCERR_NAMESEC_FIRST, /* first section is not "NAME": title */
+ MANDOCERR_NAMESEC_FIRST, /* first section is not NAME: Sh title */
MANDOCERR_NAMESEC_BAD, /* bad NAME section contents: macro */
- MANDOCERR_SEC_ORDER, /* sections out of conventional order: title */
- MANDOCERR_SEC_REP, /* duplicate section title: title */
- MANDOCERR_SEC_MSEC, /* unexpected section: title for ... only */
+ MANDOCERR_SEC_ORDER, /* sections out of conventional order: Sh title */
+ MANDOCERR_SEC_REP, /* duplicate section title: Sh title */
+ MANDOCERR_SEC_MSEC, /* unexpected section: Sh title for ... only */
/* related to macros and nesting */
MANDOCERR_MACRO_OBS, /* obsolete macro: macro */
MANDOCERR_BD_NEST, /* nested displays are not portable: macro ... */
MANDOCERR_BL_MOVE, /* moving content out of list: macro */
MANDOCERR_VT_CHILD, /* .Vt block has child macro: macro */
- MANDOCERR_FI_SKIP, /* fill mode already enabled, skipping .fi */
- MANDOCERR_NF_SKIP, /* fill mode already disabled, skipping .nf */
+ MANDOCERR_FI_SKIP, /* fill mode already enabled, skipping: fi */
+ MANDOCERR_NF_SKIP, /* fill mode already disabled, skipping: nf */
MANDOCERR_BLK_LINE, /* line scope broken: macro breaks macro */
/* related to missing arguments */
MANDOCERR_MACRO_EMPTY, /* skipping empty macro: macro */
MANDOCERR_ARG_EMPTY, /* empty argument, using 0n: macro arg */
MANDOCERR_ARGCWARN, /* argument count wrong */
- MANDOCERR_BD_NOTYPE, /* missing display type, using -ragged */
- MANDOCERR_BL_LATETYPE, /* list type is not the first argument: arg */
+ MANDOCERR_BD_NOTYPE, /* missing display type, using -ragged: Bd */
+ MANDOCERR_BL_LATETYPE, /* list type is not the first argument: Bl arg */
MANDOCERR_BL_NOWIDTH, /* missing -width in -tag list, using 8n */
- MANDOCERR_EX_NONAME, /* missing name for .Ex, using "" */
- MANDOCERR_IT_NOHEAD, /* empty head in list item: type */
- MANDOCERR_IT_NOBODY, /* empty list item: type */
- MANDOCERR_BF_NOFONT, /* missing font type, using \fR */
- MANDOCERR_BF_BADFONT, /* unknown font type, using \fR: macro font */
+ MANDOCERR_EX_NONAME, /* missing utility name, using "": Ex */
+ MANDOCERR_IT_NOHEAD, /* empty head in list item: Bl -type It */
+ MANDOCERR_IT_NOBODY, /* empty list item: Bl -type It */
+ MANDOCERR_BF_NOFONT, /* missing font type, using \fR: Bf */
+ MANDOCERR_BF_BADFONT, /* unknown font type, using \fR: Bf font */
MANDOCERR_ARG_STD, /* missing -std argument, adding it: macro */
/* related to bad arguments */
MANDOCERR_ARG_QUOTE, /* unterminated quoted argument */
MANDOCERR_ARG_REP, /* duplicate argument: macro arg */
MANDOCERR_AN_REP, /* skipping duplicate argument: An -arg */
- MANDOCERR_BD_REP, /* skipping duplicate display type: type */
- MANDOCERR_BL_REP, /* skipping duplicate list type: type */
+ MANDOCERR_BD_REP, /* skipping duplicate display type: Bd -type */
+ MANDOCERR_BL_REP, /* skipping duplicate list type: Bl -type */
MANDOCERR_BL_SKIPW, /* skipping -width argument: Bl -type */
- MANDOCERR_AT_BAD, /* unknown AT&T UNIX version: version */
+ MANDOCERR_AT_BAD, /* unknown AT&T UNIX version: At version */
MANDOCERR_RS_BAD, /* invalid content in Rs block: macro */
MANDOCERR_SM_BAD, /* invalid Boolean argument: macro arg */
- MANDOCERR_FT_BAD, /* unknown font, skipping request: request font */
+ MANDOCERR_FT_BAD, /* unknown font, skipping request: ft font */
/* related to plain text */
MANDOCERR_FI_BLANK, /* blank line in fill mode, using .sp */
/* related to document structure and macros */
MANDOCERR_ROFFLOOP, /* input stack limit exceeded, infinite loop? */
- MANDOCERR_BADCHAR, /* skipping bad character */
- MANDOCERR_MACRO, /* skipping unknown macro */
- MANDOCERR_IT_STRAY, /* skipping item outside list */
- MANDOCERR_TA_STRAY, /* skipping column outside column list */
+ MANDOCERR_BADCHAR, /* skipping bad character: number */
+ MANDOCERR_MACRO, /* skipping unknown macro: macro */
+ MANDOCERR_IT_STRAY, /* skipping item outside list: It ... */
+ MANDOCERR_TA_STRAY, /* skipping column outside column list: Ta */
MANDOCERR_BLK_NOTOPEN, /* skipping end of block that is not open */
MANDOCERR_BLK_BROKEN, /* inserting missing end of block: macro ... */
MANDOCERR_BLK_NOEND, /* appending missing end of block: macro */
/* related to request and macro arguments */
- MANDOCERR_NAMESC, /* escaped character not allowed in a name */
+ MANDOCERR_NAMESC, /* escaped character not allowed in a name: name */
MANDOCERR_ARGCOUNT, /* argument count wrong */
- MANDOCERR_BL_NOTYPE, /* missing list type, using -item */
- MANDOCERR_NM_NONAME, /* missing manual name, using "" */
+ MANDOCERR_BL_NOTYPE, /* missing list type, using -item: Bl */
+ MANDOCERR_NM_NONAME, /* missing manual name, using "": Nm */
MANDOCERR_OS_UNAME, /* uname(3) system call failed, using UNKNOWN */
- MANDOCERR_ST_BAD, /* unknown standard specifier: standard */
+ MANDOCERR_ST_BAD, /* unknown standard specifier: St standard */
MANDOCERR_IT_NONUM, /* skipping request without numeric argument */
MANDOCERR_ARG_SKIP, /* skipping all arguments: macro args */
MANDOCERR_ARG_EXCESS, /* skipping excess arguments: macro ... args */
MANDOCERR_FATAL, /* ===== start of fatal errors ===== */
MANDOCERR_TOOLARGE, /* input too large */
- MANDOCERR_BADDISP, /* NOT IMPLEMENTED: .Bd -file */
+ MANDOCERR_BD_FILE, /* NOT IMPLEMENTED: Bd -file */
MANDOCERR_SO_PATH, /* NOT IMPLEMENTED: .so with absolute path or ".." */
MANDOCERR_SO_FAIL, /* .so request failed */
-/* $Id: mdoc.c,v 1.111 2014/08/08 15:32:17 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.112 2014/08/08 15:54:10 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
tok = (i > 1 && i < 4) ? mdoc_hash_find(mac) : MDOC_MAX;
if (MDOC_MAX == tok) {
- mandoc_vmsg(MANDOCERR_MACRO, mdoc->parse,
- ln, sv, "%s", buf + sv - 1);
+ mandoc_msg(MANDOCERR_MACRO, mdoc->parse,
+ ln, sv, buf + sv - 1);
return(1);
}
-/* $Id: mdoc_macro.c,v 1.95 2014/08/08 15:26:28 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.96 2014/08/08 15:54:10 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
n = n->parent;
if (NULL == n || LIST_column != n->norm->Bl.type) {
mandoc_msg(MANDOCERR_TA_STRAY, mdoc->parse,
- line, ppos, NULL);
+ line, ppos, "Ta");
return(1);
}
-/* $Id: mdoc_validate.c,v 1.156 2014/08/08 15:45:58 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.157 2014/08/08 15:54:10 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
/* Check: multiple list types. */
if (LIST__NONE != n->norm->Bl.type) {
- mandoc_msg(MANDOCERR_BL_REP,
+ mandoc_vmsg(MANDOCERR_BL_REP,
mdoc->parse, n->line, n->pos,
- mdoc_argnames[argv->arg]);
+ "Bl -%s", mdoc_argnames[argv->arg]);
continue;
}
if (n->norm->Bl.width ||
n->norm->Bl.offs ||
n->norm->Bl.comp)
- mandoc_msg(MANDOCERR_BL_LATETYPE,
- mdoc->parse, n->line, n->pos,
+ mandoc_vmsg(MANDOCERR_BL_LATETYPE,
+ mdoc->parse, n->line, n->pos, "Bl -%s",
mdoc_argnames[n->args->argv[0].arg]);
n->norm->Bl.type = lt;
/* Allow lists to default to LIST_item. */
if (LIST__NONE == n->norm->Bl.type) {
- mdoc_nmsg(mdoc, n, MANDOCERR_BL_NOTYPE);
+ mandoc_msg(MANDOCERR_BL_NOTYPE, mdoc->parse,
+ n->line, n->pos, "Bl");
n->norm->Bl.type = LIST_item;
}
switch (n->norm->Bl.type) {
case LIST_tag:
if (NULL == n->norm->Bl.width)
- mdoc_nmsg(mdoc, n, MANDOCERR_BL_NOWIDTH);
+ mandoc_msg(MANDOCERR_BL_NOWIDTH, mdoc->parse,
+ n->line, n->pos, "Bl -tag");
break;
case LIST_column:
/* FALLTHROUGH */
dt = DISP_literal;
break;
case MDOC_File:
- mdoc_nmsg(mdoc, n, MANDOCERR_BADDISP);
+ mandoc_msg(MANDOCERR_BD_FILE, mdoc->parse,
+ n->line, n->pos, NULL);
return(0);
case MDOC_Offset:
if (0 == argv->sz) {
if (DISP__NONE == n->norm->Bd.type)
n->norm->Bd.type = dt;
else
- mandoc_msg(MANDOCERR_BD_REP,
+ mandoc_vmsg(MANDOCERR_BD_REP,
mdoc->parse, n->line, n->pos,
- mdoc_argnames[argv->arg]);
+ "Bd -%s", mdoc_argnames[argv->arg]);
}
if (DISP__NONE == n->norm->Bd.type) {
- mdoc_nmsg(mdoc, n, MANDOCERR_BD_NOTYPE);
+ mandoc_msg(MANDOCERR_BD_NOTYPE, mdoc->parse,
+ n->line, n->pos, "Bd");
n->norm->Bd.type = DISP_ragged;
}
nch = np->child;
if (NULL == np->parent->args) {
if (NULL == nch) {
- mdoc_nmsg(mdoc, np, MANDOCERR_BF_NOFONT);
+ mandoc_msg(MANDOCERR_BF_NOFONT, mdoc->parse,
+ np->line, np->pos, "Bf");
return(1);
}
nch = nch->next;
mdoc_deroff(&mdoc->meta.name, mdoc->last);
if (NULL == mdoc->meta.name)
- mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NM_NONAME);
+ mandoc_msg(MANDOCERR_NM_NONAME, mdoc->parse,
+ mdoc->last->line, mdoc->last->pos, "Nm");
return(1);
}
assert(MDOC_TEXT == n->type);
if (NULL == (std_att = mdoc_a2att(n->string))) {
- mandoc_msg(MANDOCERR_AT_BAD, mdoc->parse,
- n->line, n->pos, n->string);
+ mandoc_vmsg(MANDOCERR_AT_BAD, mdoc->parse,
+ n->line, n->pos, "At %s", n->string);
mandoc_asprintf(&att, "AT&T UNIX %s", n->string);
} else
att = mandoc_strdup(std_att);
/* FALLTHROUGH */
case LIST_diag:
if (NULL == nit->head->child)
- mandoc_msg(MANDOCERR_IT_NOHEAD,
+ mandoc_vmsg(MANDOCERR_IT_NOHEAD,
mdoc->parse, nit->line, nit->pos,
+ "Bl -%s It",
mdoc_argnames[nbl->args->argv[0].arg]);
break;
case LIST_bullet:
/* FALLTHROUGH */
case LIST_hyphen:
if (NULL == nit->body->child)
- mandoc_msg(MANDOCERR_IT_NOBODY,
+ mandoc_vmsg(MANDOCERR_IT_NOBODY,
mdoc->parse, nit->line, nit->pos,
+ "Bl -%s It",
mdoc_argnames[nbl->args->argv[0].arg]);
/* FALLTHROUGH */
case LIST_item:
assert(MDOC_TEXT == nch->type);
if (NULL == (p = mdoc_a2st(nch->string))) {
- mandoc_msg(MANDOCERR_ST_BAD, mdoc->parse,
- nch->line, nch->pos, nch->string);
+ mandoc_vmsg(MANDOCERR_ST_BAD, mdoc->parse,
+ nch->line, nch->pos, "St %s", nch->string);
mdoc_node_delete(mdoc, n);
} else {
free(nch->string);
/* The NAME should be first. */
if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed)
- mandoc_msg(MANDOCERR_NAMESEC_FIRST, mdoc->parse,
- mdoc->last->line, mdoc->last->pos, secname);
+ mandoc_vmsg(MANDOCERR_NAMESEC_FIRST, mdoc->parse,
+ mdoc->last->line, mdoc->last->pos,
+ "Sh %s", secname);
/* The SYNOPSIS gets special attention in other areas. */
*/
if (sec == mdoc->lastnamed)
- mandoc_msg(MANDOCERR_SEC_REP, mdoc->parse,
- mdoc->last->line, mdoc->last->pos, secname);
+ mandoc_vmsg(MANDOCERR_SEC_REP, mdoc->parse,
+ mdoc->last->line, mdoc->last->pos,
+ "Sh %s", secname);
if (sec < mdoc->lastnamed)
- mandoc_msg(MANDOCERR_SEC_ORDER, mdoc->parse,
- mdoc->last->line, mdoc->last->pos, secname);
+ mandoc_vmsg(MANDOCERR_SEC_ORDER, mdoc->parse,
+ mdoc->last->line, mdoc->last->pos,
+ "Sh %s", secname);
/* Mark the last named section. */
goodsec = "9";
mandoc_vmsg(MANDOCERR_SEC_MSEC, mdoc->parse,
mdoc->last->line, mdoc->last->pos,
- "%s for %s only", secname, goodsec);
+ "Sh %s for %s only", secname, goodsec);
break;
default:
break;
for (p = nn->string; *p; p++) {
if (toupper((unsigned char)*p) == *p)
continue;
- mandoc_msg(MANDOCERR_TITLE_CASE,
+ mandoc_vmsg(MANDOCERR_TITLE_CASE,
mdoc->parse, nn->line,
nn->pos + (p - nn->string),
- nn->string);
+ "Dt %s", nn->string);
break;
}
mdoc->meta.vol = mandoc_strdup(cp);
mdoc->meta.msec = mandoc_strdup(nn->string);
} else {
- mandoc_msg(MANDOCERR_MSEC_BAD, mdoc->parse,
- nn->line, nn->pos, nn->string);
+ mandoc_vmsg(MANDOCERR_MSEC_BAD, mdoc->parse,
+ nn->line, nn->pos, "Dt ... %s", nn->string);
mdoc->meta.vol = mandoc_strdup(nn->string);
mdoc->meta.msec = mandoc_strdup(nn->string);
}
} else {
cp = mdoc_a2arch(nn->string);
if (NULL == cp) {
- mandoc_msg(MANDOCERR_ARCH_BAD, mdoc->parse,
- nn->line, nn->pos, nn->string);
+ mandoc_vmsg(MANDOCERR_ARCH_BAD, mdoc->parse,
+ nn->line, nn->pos, "Dt ... %s", nn->string);
free(mdoc->meta.vol);
mdoc->meta.vol = mandoc_strdup(nn->string);
} else
return(1);
if (mdoc->meta.name == NULL) {
- mdoc_nmsg(mdoc, n, MANDOCERR_EX_NONAME);
+ mandoc_msg(MANDOCERR_EX_NONAME, mdoc->parse,
+ n->line, n->pos, "Ex");
return(1);
}
-/* $Id: read.c,v 1.55 2014/08/08 15:48:43 schwarze Exp $ */
+/* $Id: read.c,v 1.56 2014/08/08 15:54:10 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
"nested displays are not portable",
"moving content out of list",
".Vt block has child macro",
- "fill mode already enabled, skipping .fi",
- "fill mode already disabled, skipping .nf",
+ "fill mode already enabled, skipping",
+ "fill mode already disabled, skipping",
"line scope broken",
/* related to missing macro arguments */
"missing display type, using -ragged",
"list type is not the first argument",
"missing -width in -tag list, using 8n",
- "missing name for .Ex, using \"\"",
+ "missing utility name, using \"\"",
"empty head in list item",
"empty list item",
"missing font type, using \\fR",
"generic fatal error",
"input too large",
- "NOT IMPLEMENTED: .Bd -file",
+ "NOT IMPLEMENTED: Bd -file",
"NOT IMPLEMENTED: .so with absolute path or \"..\"",
".so request failed",
if ( ! (isascii(c) &&
(isgraph(c) || isblank(c)))) {
- mandoc_msg(MANDOCERR_BADCHAR, curp,
- curp->line, pos, NULL);
+ mandoc_vmsg(MANDOCERR_BADCHAR, curp,
+ curp->line, pos, "0x%x", c);
i++;
ln.buf[pos++] = '?';
continue;
if ( ! (isascii(c) &&
(isgraph(c) || isblank(c)))) {
- mandoc_msg(MANDOCERR_BADCHAR, curp,
- curp->line, pos, NULL);
+ mandoc_vmsg(MANDOCERR_BADCHAR, curp,
+ curp->line, pos, "0x%x", c);
i += 2;
ln.buf[pos++] = '?';
continue;
-/* $Id: roff.c,v 1.96 2014/08/08 15:48:43 schwarze Exp $ */
+/* $Id: roff.c,v 1.97 2014/08/08 15:54:10 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
char *name;
name = *bufp + pos;
- mandoc_vmsg(MANDOCERR_SO, r->parse, ln, ppos, ".so %s", name);
+ mandoc_vmsg(MANDOCERR_SO, r->parse, ln, ppos, "so %s", name);
/*
* Handle `so'. Be EXTREMELY careful, as we shouldn't be
cp++;
if ('\\' == *cp)
continue;
- mandoc_msg(MANDOCERR_NAMESC, r->parse, ln, pos, NULL);
+ mandoc_vmsg(MANDOCERR_NAMESC, r->parse, ln, pos,
+ "%.*s", (int)(cp - name + 1), name);
mandoc_escape((const char **)&cp, NULL, NULL);
break;
}