summaryrefslogtreecommitdiffstatshomepage
path: root/man.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-06-18 10:53:58 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-06-18 10:53:58 +0000
commit52078b04137667fec0f8506ad5417fffefd8f82d (patch)
tree206c99ff4874368c5c3874ffe02f5bee49456266 /man.c
parente100896ec287b69a49978cc7502276f0759544b0 (diff)
downloadmandoc-52078b04137667fec0f8506ad5417fffefd8f82d.tar.gz
mandoc-52078b04137667fec0f8506ad5417fffefd8f82d.tar.zst
mandoc-52078b04137667fec0f8506ad5417fffefd8f82d.zip
Moved all formatted libman warn/error into man.c/libman.h.
Converted all formatted warn/errors into regular syntax.
Diffstat (limited to 'man.c')
-rw-r--r--man.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/man.c b/man.c
index 7d197ff4..350498fd 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.22 2009/06/18 10:32:00 kristaps Exp $ */
+/* $Id: man.c,v 1.23 2009/06/18 10:53:58 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -434,3 +434,40 @@ 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;
+ }
+ assert(p);
+
+ if (iserr)
+ return(man_verr(m, line, pos, p));
+
+ return(man_vwarn(m, line, pos, p));
+}