]> git.cameronkatri.com Git - mandoc.git/blobdiff - man.c
Fixed undocumented `-diag' where NULL list item bodies aren't followed by a vspace.
[mandoc.git] / man.c
diff --git a/man.c b/man.c
index c20f1a43bbe9a677c0695993ac4888376a267621..c27ddaf8002c4e527f5984907d2f21be24a31858 100644 (file)
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/*     $Id: man.c,v 1.26 2009/07/04 09:01:55 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",
@@ -438,44 +451,11 @@ 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)
+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;
-       case (WESCAPE):
-               p = "invalid escape sequence";
-               break;
-       }
+       p = __man_merrnames[(int)type];
        assert(p);
 
        if (iserr)