-extern char *__progname;
-
-extern void *ascii_alloc(void);
-extern void *latin1_alloc(void);
-extern void *utf8_alloc(void);
-extern int terminal_run(void *, const struct mdoc *);
-extern int tree_run(void *, const struct mdoc *);
-extern void terminal_free(void *);
-
-__dead static void version(void);
-__dead static void usage(void);
-static int foptions(int *, char *);
-static int toptions(enum outt *, char *);
-static int woptions(int *, char *);
-static int merr(void *, int, int, const char *);
-static int mwarn(void *, int, int,
- enum mdoc_warn, const char *);
-static int file(struct buf *, struct buf *,
- const char *, struct mdoc *);
-static int fdesc(struct buf *, struct buf *,
- const char *, int, struct mdoc *);
+static const char * const mandocerrs[MANDOCERR_MAX] = {
+ "ok",
+
+ "generic warning",
+
+ /* related to the prologue */
+ "no title in document",
+ "document title should be all caps",
+ "unknown manual section",
+ "cannot parse date argument",
+ "prologue macros out of order",
+ "duplicate prologue macro",
+ "macro not allowed in prologue",
+ "macro not allowed in body",
+
+ /* related to document structure */
+ ".so is fragile, better use ln(1)",
+ "NAME section must come first",
+ "bad NAME section contents",
+ "manual name not yet set",
+ "sections out of conventional order",
+ "duplicate section name",
+ "section not in conventional manual section",
+
+ /* related to macros and nesting */
+ "skipping obsolete macro",
+ "skipping paragraph macro",
+ "blocks badly nested",
+ "child violates parent syntax",
+ "nested displays are not portable",
+ "already in literal mode",
+
+ /* related to missing macro arguments */
+ "skipping empty macro",
+ "missing display type",
+ "list type must come first",
+ "tag lists require a width argument",
+ "missing font type",
+
+ /* related to bad macro arguments */
+ "skipping argument",
+ "duplicate argument",
+ "duplicate display type",
+ "duplicate list type",
+ "unknown AT&T UNIX version",
+ "bad Boolean value",
+ "unknown font",
+ "unknown standard specifier",
+ "bad width argument",
+
+ /* related to plain text */
+ "blank line in non-literal context",
+ "tab in non-literal context",
+ "end of line whitespace",
+ "bad comment style",
+ "unknown escape sequence",
+ "unterminated quoted string",
+
+ "generic error",
+
+ "bad table syntax",
+ "bad table option",
+ "bad table layout",
+ "no table layout cells specified",
+ "input stack limit exceeded, infinite loop?",
+ "skipping bad character",
+ "skipping text before the first section header",
+ "skipping unknown macro",
+ "NOT IMPLEMENTED: skipping request",
+ "line scope broken",
+ "argument count wrong",
+ "skipping end of block that is not open",
+ "missing end of block",
+ "scope open on exit",
+ "uname(3) system call failed",
+ "macro requires line argument(s)",
+ "macro requires body argument(s)",
+ "macro requires argument(s)",
+ "missing list type",
+ "line argument(s) will be lost",
+ "body argument(s) will be lost",
+
+ "generic fatal error",
+
+ "column syntax is inconsistent",
+ "NOT IMPLEMENTED: .Bd -file",
+ "line scope broken, syntax violated",
+ "argument count wrong, violates syntax",
+ "child violates parent syntax",
+ "argument count wrong, violates syntax",
+ "NOT IMPLEMENTED: .so with absolute path or \"..\"",
+ "no document body",
+ "no document prologue",
+ "static buffer exhausted",
+};