diff options
Diffstat (limited to 'usr.bin/mandoc/man.c')
-rw-r--r-- | usr.bin/mandoc/man.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c index a1e4578e7ac..6c00c53c852 100644 --- a/usr.bin/mandoc/man.c +++ b/usr.bin/mandoc/man.c @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.3 2009/06/18 23:34:53 schwarze Exp $ */ +/* $Id: man.c,v 1.4 2009/06/23 22:05:42 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -432,3 +432,46 @@ man_vwarn(struct man *man, int ln, int pos, const char *fmt, ...) } +int +man_err(struct man *m, int line, int pos, + int iserr, enum merr type) +{ + const char *p; + + p = NULL; + switch (type) { + case (WNPRINT): + p = "invalid character"; + break; + case (WNMEM): + p = "memory exhausted"; + break; + case (WMSEC): + p = "invalid manual section"; + break; + case (WDATE): + p = "invalid date format"; + break; + case (WLNSCOPE): + p = "scope of prior line violated"; + break; + case (WTSPACE): + p = "trailing whitespace at end of line"; + break; + case (WTQUOTE): + p = "unterminated quotation"; + break; + case (WNODATA): + p = "document has no data"; + break; + case (WNOTITLE): + p = "document has no title/section"; + break; + } + assert(p); + + if (iserr) + return(man_verr(m, line, pos, p)); + + return(man_vwarn(m, line, pos, p)); +} |