diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-06-20 22:58:42 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-06-20 22:58:42 +0000 |
commit | 9999ebc80ee1df63e3257e4fa41715be601a7bed (patch) | |
tree | d0bbb9f5fe20cf79ba166821559679d5dedecad7 /usr.bin/mandoc/read.c | |
parent | 1ba7e466112a238c682c6b8bc4a043f544ab4787 (diff) |
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 'usr.bin/mandoc/read.c')
-rw-r--r-- | usr.bin/mandoc/read.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index d0c83377abc..cbb94d663e2 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.27 2014/06/20 17:23:09 schwarze Exp $ */ +/* $Id: read.c,v 1.28 2014/06/20 22:58:41 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -98,6 +98,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", @@ -196,7 +198,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", @@ -674,7 +675,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; } |