summaryrefslogtreecommitdiffstats
path: root/read.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 /read.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 'read.c')
-rw-r--r--read.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/read.c b/read.c
index 482af0db..965d354e 100644
--- a/read.c
+++ b/read.c
@@ -106,6 +106,8 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
/* related to document structure */
".so is fragile, better use ln(1)",
+ "no document body",
+ "content before the first section header",
"NAME section must come first",
"bad NAME section contents",
"sections out of conventional order",
@@ -204,7 +206,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"child violates parent syntax",
"argument count wrong, violates syntax",
"NOT IMPLEMENTED: .so with absolute path or \"..\"",
- "no document body",
"no document prologue",
"static buffer exhausted",
@@ -684,7 +685,7 @@ mparse_end(struct mparse *curp)
}
if ( ! (curp->mdoc || curp->man || curp->sodest)) {
- mandoc_msg(MANDOCERR_NOTMANUAL, curp, 1, 0, NULL);
+ mandoc_msg(MANDOCERR_NOTMANUAL, curp, 0, 0, NULL);
curp->file_status = MANDOCLEVEL_FATAL;
return;
}