diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-05-23 22:45:02 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-05-23 22:45:02 +0000 |
commit | 5f11e83ec40e027d9941a83310ca46e5e32821c7 (patch) | |
tree | 443369858d56a918cd55fb337d34f528d8d4d96b /usr.bin/mandoc/mdoc_term.c | |
parent | 22bfa887a3d98fe67ad553bf37793e74ab6f8142 (diff) |
Unified error and warning message system for all of mandoc,
featuring three message levels, as agreed during the mandoc hackathon:
* FATAL parser failure, cannot produce any output from this input file:
eventually, we hope to convert most of these to ERRORs.
* ERROR, meaning mandoc cannot cope fully with the input syntax and will
probably lose information or produce structurally garbled output;
it will try to produce output anyway but exit non-zero at the end,
which is eventually intended to make the ports infrastructure happy.
* WARNING, meaning you should clean up the input file, but output
is probably mostly OK, so this will not cause error-exit at the end.
This commit is mostly just converting the old system to the new one; before
the classification will become really reliable, we must check all messages.
In particular,
* set up a new central message string table in main.c
* drop the old message string tables from man.c and mdoc.c
* get rid of the piece-meal merr enums in libman and libmdoc
* reduce number of error/warning functions from 16 to 6 (still a lot...)
While here, handle a few problems more gracefully:
* allow .Rv and .Ex to work without a prior .Nm
* allow .An to ignore extra arguments
* allow undeclared columns in .Bl -column
Written by kristaps@.
Diffstat (limited to 'usr.bin/mandoc/mdoc_term.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 8b06e3f54e2..b763898fad2 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.80 2010/05/15 21:09:53 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.81 2010/05/23 22:45:01 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -23,6 +23,7 @@ #include <stdlib.h> #include <string.h> +#include "mandoc.h" #include "out.h" #include "term.h" #include "mdoc.h" @@ -1082,6 +1083,8 @@ static int termp_nm_pre(DECL_ARGS) { + if (NULL == n->child && NULL == m->name) + if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) term_newln(p); @@ -1089,6 +1092,7 @@ termp_nm_pre(DECL_ARGS) if (NULL == n->child) term_word(p, m->name); + return(1); } @@ -1213,7 +1217,7 @@ termp_rv_pre(DECL_ARGS) term_word(p, "()"); } - if (n->child->next) + if (n->child && n->child->next) term_word(p, "functions return"); else term_word(p, "function returns"); @@ -1252,7 +1256,7 @@ termp_ex_pre(DECL_ARGS) p->flags &= ~TERMP_NOSPACE; } - if (n->child->next) + if (n->child && n->child->next) term_word(p, "utilities exit"); else term_word(p, "utility exits"); |