summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-07-07 16:12:07 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-07-07 16:12:07 +0000
commitf35d4d1a46fee7686edf8d4d08f125069d4dc857 (patch)
treec3d2f2b50c245fe2b8fe34fe01fa284d69592eff /usr.bin
parente9c98b01dbf4aab839369afcc72089954c853f1f (diff)
no need to delete any content from .Rs blocks,
and downgrade the related message from ERROR to WARNING
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/mandoc.h4
-rw-r--r--usr.bin/mandoc/mdoc_validate.c47
-rw-r--r--usr.bin/mandoc/read.c4
3 files changed, 16 insertions, 39 deletions
diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h
index dcc9b56ff12..0ef18391a11 100644
--- a/usr.bin/mandoc/mandoc.h
+++ b/usr.bin/mandoc/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.83 2014/07/07 15:03:24 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.84 2014/07/07 16:12:06 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -105,6 +105,7 @@ enum mandocerr {
MANDOCERR_BD_REP, /* skipping duplicate display type: type */
MANDOCERR_BL_REP, /* skipping duplicate list type: type */
MANDOCERR_AT_BAD, /* unknown AT&T UNIX version: 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 */
@@ -141,7 +142,6 @@ enum mandocerr {
MANDOCERR_NONAME, /* manual name not yet set */
MANDOCERR_MACRO, /* skipping unknown macro */
MANDOCERR_ARGCOUNT, /* argument count wrong */
- MANDOCERR_RS_SKIP, /* skipping invalid content in .Rs block: macro */
MANDOCERR_ST_BAD, /* unknown standard specifier: standard */
MANDOCERR_STRAYTA, /* skipping column outside column list */
MANDOCERR_NOSCOPE, /* skipping end of block that is not open */
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index afdc1638126..1b200521324 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.147 2014/07/06 19:08:56 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.148 2014/07/07 16:12:06 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -1764,42 +1764,9 @@ post_rs(POST_ARGS)
}
/*
- * Make sure only certain types of nodes are allowed within the
- * the `Rs' body. Delete offending nodes and raise a warning.
- * Do this before re-ordering for the sake of clarity.
- */
-
- next = NULL;
- for (nn = mdoc->last->child; nn; nn = next) {
- for (i = 0; i < RSORD_MAX; i++)
- if (nn->tok == rsord[i])
- break;
-
- if (i < RSORD_MAX) {
- if (MDOC__J == rsord[i] || MDOC__B == rsord[i])
- mdoc->last->norm->Rs.quote_T++;
- next = nn->next;
- continue;
- }
-
- next = nn->next;
- mandoc_msg(MANDOCERR_RS_SKIP, mdoc->parse,
- nn->line, nn->pos, mdoc_macronames[nn->tok]);
- mdoc_node_delete(mdoc, nn);
- }
-
- /*
- * Nothing to sort if only invalid nodes were found
- * inside the `Rs' body.
- */
-
- if (NULL == mdoc->last->child)
- return(1);
-
- /*
* The full `Rs' block needs special handling to order the
* sub-elements according to `rsord'. Pick through each element
- * and correctly order it. This is a insertion sort.
+ * and correctly order it. This is an insertion sort.
*/
next = NULL;
@@ -1809,6 +1776,14 @@ post_rs(POST_ARGS)
if (rsord[i] == nn->tok)
break;
+ if (i == RSORD_MAX) {
+ mandoc_msg(MANDOCERR_RS_BAD,
+ mdoc->parse, nn->line, nn->pos,
+ mdoc_macronames[nn->tok]);
+ i = -1;
+ } else if (MDOC__J == nn->tok || MDOC__B == nn->tok)
+ mdoc->last->norm->Rs.quote_T++;
+
/*
* Remove `nn' from the chain. This somewhat
* repeats mdoc_node_unlink(), but since we're
@@ -1834,6 +1809,8 @@ post_rs(POST_ARGS)
for (j = 0; j < RSORD_MAX; j++)
if (rsord[j] == prev->tok)
break;
+ if (j == RSORD_MAX)
+ j = -1;
if (j <= i)
break;
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c
index 66624759f75..0613e25576c 100644
--- a/usr.bin/mandoc/read.c
+++ b/usr.bin/mandoc/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.44 2014/07/07 15:03:24 schwarze Exp $ */
+/* $Id: read.c,v 1.45 2014/07/07 16:12:06 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -141,6 +141,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"skipping duplicate display type",
"skipping duplicate list type",
"unknown AT&T UNIX version",
+ "invalid content in Rs block",
"invalid Boolean argument",
"unknown font, skipping request",
@@ -177,7 +178,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"manual name not yet set",
"skipping unknown macro",
"argument count wrong",
- "skipping invalid content in .Rs block",
"unknown standard specifier",
"skipping column outside column list",
"skipping end of block that is not open",