-/* $Id: man.c,v 1.22 2009/06/18 10:32:00 kristaps Exp $ */
+/* $Id: man.c,v 1.27 2009/07/07 09:35:40 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
#include "libman.h"
+const char *const __man_merrnames[WERRMAX] = {
+ "invalid character", /* WNPRINT */
+ "system: malloc error", /* WNMEM */
+ "invalid manual section", /* WMSEC */
+ "invalid date format", /* WDATE */
+ "scope of prior line violated", /* WLNSCOPE */
+ "trailing whitespace", /* WTSPACE */
+ "unterminated quoted parameter", /* WTQUOTE */
+ "document has no body", /* WNODATA */
+ "document has no title/section", /* WNOTITLE */
+ "invalid escape sequence", /* WESCAPE */
+};
+
const char *const __man_macronames[MAN_MAX] = {
"br", "TH", "SH", "SS",
"TP", "LP", "PP", "P",
if (p->string)
free(p->string);
+ if (p->parent)
+ p->parent->nchild--;
free(p);
}
if (p->next)
man_node_freelist(p->next);
+ assert(0 == p->nchild);
man_node_free(p);
}
}
+int
+man_err(struct man *m, int line, int pos, int iserr, enum merr type)
+{
+ const char *p;
+
+ p = __man_merrnames[(int)type];
+ assert(p);
+
+ if (iserr)
+ return(man_verr(m, line, pos, p));
+
+ return(man_vwarn(m, line, pos, p));
+}