From bd594191829d2a31f9e18568ec26c7036feea666 Mon Sep 17 00:00:00 2001 From: schwarze Date: Fri, 8 Aug 2014 15:54:10 +0000 Subject: [PATCH] mention requests and macros in more messages --- usr.bin/mandoc/man.c | 6 +-- usr.bin/mandoc/man_validate.c | 16 ++++--- usr.bin/mandoc/mandoc.h | 60 +++++++++++++------------- usr.bin/mandoc/mdoc.c | 6 +-- usr.bin/mandoc/mdoc_macro.c | 4 +- usr.bin/mandoc/mdoc_validate.c | 78 ++++++++++++++++++++-------------- usr.bin/mandoc/read.c | 18 ++++---- usr.bin/mandoc/roff.c | 7 +-- 8 files changed, 106 insertions(+), 89 deletions(-) diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c index 133202c7aa8..87b5449eaf8 100644 --- a/usr.bin/mandoc/man.c +++ b/usr.bin/mandoc/man.c @@ -1,4 +1,4 @@ -/* $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 * Copyright (c) 2013, 2014 Ingo Schwarze @@ -492,8 +492,8 @@ man_pmacro(struct man *man, int ln, char *buf, int offs) 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); } diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c index 3e5d4d18a90..e4a418e9677 100644 --- a/usr.bin/mandoc/man_validate.c +++ b/usr.bin/mandoc/man_validate.c @@ -1,4 +1,4 @@ -/* $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 * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze @@ -400,10 +400,10 @@ post_TH(CHKARGS) /* 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; } } @@ -431,7 +431,9 @@ post_TH(CHKARGS) 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 */ @@ -461,7 +463,8 @@ post_nf(CHKARGS) { 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); @@ -472,7 +475,8 @@ post_fi(CHKARGS) { 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); diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index 27ed15fc0fd..b4098b153d7 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,4 +1,4 @@ -/* $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 * Copyright (c) 2010-2014 Ingo Schwarze @@ -51,8 +51,8 @@ enum mandocerr { /* 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 */ @@ -61,14 +61,14 @@ enum mandocerr { 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 */ @@ -79,8 +79,8 @@ enum mandocerr { 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 */ @@ -89,27 +89,27 @@ enum mandocerr { 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 */ @@ -140,21 +140,21 @@ enum mandocerr { /* 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 */ @@ -162,7 +162,7 @@ enum mandocerr { 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 */ diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 3d189d047ed..be74a3e3180 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $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 * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze @@ -834,8 +834,8 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs) 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); } diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index 5767a50029a..91448ad820f 100644 --- a/usr.bin/mandoc/mdoc_macro.c +++ b/usr.bin/mandoc/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $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 * Copyright (c) 2010, 2012, 2013 Ingo Schwarze @@ -1781,7 +1781,7 @@ phrase_ta(MACRO_PROT_ARGS) 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); } diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index e394b70225d..85492ed8d22 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $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 * Copyright (c) 2010-2014 Ingo Schwarze @@ -676,9 +676,9 @@ pre_bl(PRE_ARGS) /* 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; } @@ -687,8 +687,8 @@ pre_bl(PRE_ARGS) 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; @@ -701,7 +701,8 @@ pre_bl(PRE_ARGS) /* 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; } @@ -715,7 +716,8 @@ pre_bl(PRE_ARGS) 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 */ @@ -792,7 +794,8 @@ pre_bd(PRE_ARGS) 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) { @@ -825,13 +828,14 @@ pre_bd(PRE_ARGS) 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; } @@ -968,7 +972,8 @@ post_bf(POST_ARGS) 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; @@ -1081,7 +1086,8 @@ post_nm(POST_ARGS) 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); } @@ -1169,8 +1175,8 @@ post_at(POST_ARGS) 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); @@ -1237,8 +1243,9 @@ post_it(POST_ARGS) /* 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: @@ -1249,8 +1256,9 @@ post_it(POST_ARGS) /* 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: @@ -1681,8 +1689,8 @@ post_st(POST_ARGS) 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); @@ -1909,8 +1917,9 @@ post_sh_head(POST_ARGS) /* 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. */ @@ -1953,12 +1962,14 @@ post_sh_head(POST_ARGS) */ 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. */ @@ -1992,7 +2003,7 @@ post_sh_head(POST_ARGS) 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; @@ -2174,10 +2185,10 @@ post_dt(POST_ARGS) 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; } @@ -2221,8 +2232,8 @@ post_dt(POST_ARGS) 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); } @@ -2244,8 +2255,8 @@ post_dt(POST_ARGS) } 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 @@ -2355,7 +2366,8 @@ post_ex(POST_ARGS) 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); } diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index c6926126f59..bfe2b526958 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $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 * Copyright (c) 2010-2014 Ingo Schwarze @@ -115,8 +115,8 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "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 */ @@ -128,7 +128,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "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", @@ -198,7 +198,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "generic fatal error", "input too large", - "NOT IMPLEMENTED: .Bd -file", + "NOT IMPLEMENTED: Bd -file", "NOT IMPLEMENTED: .so with absolute path or \"..\"", ".so request failed", @@ -345,8 +345,8 @@ mparse_buf_r(struct mparse *curp, struct buf blk, int start) 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; @@ -402,8 +402,8 @@ mparse_buf_r(struct mparse *curp, struct buf blk, int start) 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; diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c index 4ead0ac8a47..776e4c0e081 100644 --- a/usr.bin/mandoc/roff.c +++ b/usr.bin/mandoc/roff.c @@ -1,4 +1,4 @@ -/* $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 * Copyright (c) 2010-2014 Ingo Schwarze @@ -1971,7 +1971,7 @@ roff_so(ROFF_ARGS) 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 @@ -2063,7 +2063,8 @@ roff_getname(struct roff *r, char **cpp, int ln, int pos) 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; } -- 2.20.1