aboutsummaryrefslogtreecommitdiffstatshomepage
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
commitb4c01f5c60dab8debad192bef6f9db1c465255b9 (patch)
treee78d628565794d197118e581bb2357acd6ba5f4f /man_validate.c
parentb3b89a43d7165af5fd4fe84f88cdeef6cb5ee1aa (diff)
downloadmandoc-b4c01f5c60dab8debad192bef6f9db1c465255b9.tar.gz
mandoc-b4c01f5c60dab8debad192bef6f9db1c465255b9.tar.zst
mandoc-b4c01f5c60dab8debad192bef6f9db1c465255b9.zip
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.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/man_validate.c b/man_validate.c
index 15c34e08..8e786842 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -1,4 +1,4 @@
-/* $Id: man_validate.c,v 1.92 2014/06/20 17:24:00 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.93 2014/06/20 23:02:31 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);
/*