aboutsummaryrefslogtreecommitdiffstatshomepage
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
commitb4c01f5c60dab8debad192bef6f9db1c465255b9 (patch)
treee78d628565794d197118e581bb2357acd6ba5f4f /read.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 'read.c')
-rw-r--r--read.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/read.c b/read.c
index 3c68b42d..b47c5e10 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.49 2014/06/20 17:24:00 schwarze Exp $ */
+/* $Id: read.c,v 1.50 2014/06/20 23:02:31 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;
}