From 6c828de3fdf8afbdff78fdd1b3783dc5477f2816 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sun, 29 Dec 2013 23:55:25 +0100 Subject: [PATCH] mandoc(1): Allow ERRORS section headers in section 4 manual pages. They are useful for various purposes and used currently. --- contrib/mdocml/README.DRAGONFLY | 3 +++ contrib/mdocml/mandoc.h | 2 +- contrib/mdocml/mdoc_validate.c | 6 ++++-- contrib/mdocml/read.c | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/contrib/mdocml/README.DRAGONFLY b/contrib/mdocml/README.DRAGONFLY index a6130f83a4..1ec0f95b0e 100644 --- a/contrib/mdocml/README.DRAGONFLY +++ b/contrib/mdocml/README.DRAGONFLY @@ -13,7 +13,10 @@ Local modifications applied to the following files: config.h lib.in Makefile + mandoc.h + mdoc_validate.c msec.in + read.c The source code is currently kept in sync with the stable branch of the upstream CVS for collaboration purposes. diff --git a/contrib/mdocml/mandoc.h b/contrib/mdocml/mandoc.h index 5170b419b9..c2a17ebf15 100644 --- a/contrib/mdocml/mandoc.h +++ b/contrib/mdocml/mandoc.h @@ -65,7 +65,7 @@ enum mandocerr { MANDOCERR_BADNAMESEC, /* bad NAME section contents */ MANDOCERR_SECOOO, /* sections out of conventional order */ MANDOCERR_SECREP, /* duplicate section name */ - MANDOCERR_SECMSEC, /* section header suited to sections ... */ + MANDOCERR_SECMSEC, /* section header not suited to manual section */ /* related to macros and nesting */ MANDOCERR_MACROOBS, /* skipping obsolete macro */ diff --git a/contrib/mdocml/mdoc_validate.c b/contrib/mdocml/mdoc_validate.c index 4cfd620448..e08f86499a 100644 --- a/contrib/mdocml/mdoc_validate.c +++ b/contrib/mdocml/mdoc_validate.c @@ -2041,9 +2041,11 @@ post_sh_head(POST_ARGS) assert(mdoc->meta.msec); switch (sec) { - case (SEC_RETURN_VALUES): - /* FALLTHROUGH */ case (SEC_ERRORS): + if (*mdoc->meta.msec == '4') + break; + /* FALLTHROUGH */ + case (SEC_RETURN_VALUES): /* FALLTHROUGH */ case (SEC_LIBRARY): if (*mdoc->meta.msec == '2') diff --git a/contrib/mdocml/read.c b/contrib/mdocml/read.c index 511ba7dc46..e8b101a635 100644 --- a/contrib/mdocml/read.c +++ b/contrib/mdocml/read.c @@ -106,7 +106,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "bad NAME section contents", "sections out of conventional order", "duplicate section name", - "section header suited to sections 2, 3, and 9 only", + "section header not suited to manual section", /* related to macros and nesting */ "skipping obsolete macro", -- 2.41.0