summaryrefslogtreecommitdiffstats
path: root/man_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-06-20 23:02:31 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-06-20 23:02:31 +0000
commit37fc9452eae26c51be7df689f984abae6d78ccea (patch)
tree0066a63ed50561d168fdd765aa6669cb3b72c8b9 /man_validate.c
parentf55f857f8f078275f8f6d914367c3075c9e25022 (diff)
downloadmandoc-37fc9452eae26c51be7df689f984abae6d78ccea.tar.gz
As suggested by jmc@, only include line and column numbers into messages
when they are meaningful, to avoid confusing stuff like this: $ mandoc /dev/null mandoc: /dev/null:0:1: FATAL: not a manual Instead, just say: mandoc: /dev/null: FATAL: not a manual Another example this applies to is documents having a prologue, but lacking a body. Do not throw a FATAL error for these; instead, issue a WARNING and show the empty document, in the man(7) case with the same amount of blank lines as groff does. Also downgrade mdoc(7) documents having content before the first .Sh from FATAL to WARNING.
Diffstat (limited to 'man_validate.c')
-rw-r--r--man_validate.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/man_validate.c b/man_validate.c
index 0088e6f8..6ebf6cea 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -198,10 +198,12 @@ check_root(CHKARGS)
man->flags &= ~MAN_BLINE;
man->flags &= ~MAN_ELINE;
- if (NULL == man->first->child) {
- man_nmsg(man, n, MANDOCERR_NODOCBODY);
- return(0);
- } else if (NULL == man->meta.title) {
+ if (NULL == man->first->child)
+ man_nmsg(man, n, MANDOCERR_DOC_EMPTY);
+ else
+ man->meta.hasbody = 1;
+
+ if (NULL == man->meta.title) {
man_nmsg(man, n, MANDOCERR_TH_MISSING);
/*