]> git.cameronkatri.com Git - mandoc.git/blobdiff - read.c
fix RCS IDs
[mandoc.git] / read.c
diff --git a/read.c b/read.c
index 6ef75e51f003bd1f8483fa935bceb6ecea660b68..8d6cb1038bec1ec8735e2ef1601e9d7f6e3de4de 100644 (file)
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/*     $Id: read.c,v 1.98 2014/11/26 23:42:14 schwarze Exp $ */
+/*     $Id: read.c,v 1.104 2014/12/01 04:14:14 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -41,7 +41,6 @@
 #include "libmandoc.h"
 #include "mdoc.h"
 #include "man.h"
-#include "main.h"
 
 #define        REPARSE_LIMIT   1000
 
@@ -97,7 +96,6 @@ static        const char * const      mandocerrs[MANDOCERR_MAX] = {
        "lower case character in document title",
        "missing manual section, using \"\"",
        "unknown manual section",
-       "unknown manual volume or arch",
        "missing date, using today's date",
        "cannot parse date, using it verbatim",
        "missing Os macro, using \"\"",
@@ -121,6 +119,7 @@ static      const char * const      mandocerrs[MANDOCERR_MAX] = {
 
        /* related to macros and nesting */
        "obsolete macro",
+       "macro neither callable nor escaped",
        "skipping paragraph macro",
        "moving paragraph macro out of list",
        "skipping no-space macro",
@@ -146,6 +145,7 @@ static      const char * const      mandocerrs[MANDOCERR_MAX] = {
        "empty list item",
        "missing font type, using \\fR",
        "unknown font type, using \\fR",
+       "nothing follows prefix",
        "missing -std argument, adding it",
        "missing eqn box, using \"\"",
 
@@ -202,6 +202,7 @@ static      const char * const      mandocerrs[MANDOCERR_MAX] = {
        /* related to request and macro arguments */
        "escaped character not allowed in a name",
        "argument count wrong",
+       "NOT IMPLEMENTED: Bd -file",
        "missing list type, using -item",
        "missing manual name, using \"\"",
        "uname(3) system call failed, using UNKNOWN",
@@ -214,7 +215,6 @@ static      const char * const      mandocerrs[MANDOCERR_MAX] = {
        "generic fatal error",
 
        "input too large",
-       "NOT IMPLEMENTED: Bd -file",
        "NOT IMPLEMENTED: .so with absolute path or \"..\"",
        ".so request failed",
 
@@ -317,7 +317,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
        struct buf       ln;
        size_t           pos; /* byte number in the ln buffer */
        enum rofferr     rr;
-       int              of, rc;
+       int              of;
        int              lnn; /* line number in the real file */
        unsigned char    c;
 
@@ -570,34 +570,21 @@ rerun:
                 * Do the same for ROFF_EQN.
                 */
 
-               rc = -1;
-
-               if (ROFF_TBL == rr)
-                       while (NULL != (span = roff_span(curp->roff))) {
-                               rc = curp->man ?
-                                   man_addspan(curp->man, span) :
-                                   mdoc_addspan(curp->mdoc, span);
-                               if (0 == rc)
-                                       break;
-                       }
-               else if (ROFF_EQN == rr)
-                       rc = curp->mdoc ?
-                           mdoc_addeqn(curp->mdoc,
-                               roff_eqn(curp->roff)) :
-                           man_addeqn(curp->man,
-                               roff_eqn(curp->roff));
-               else if (curp->man || curp->mdoc)
-                       rc = curp->man ?
-                           man_parseln(curp->man,
-                               curp->line, ln.buf, of) :
-                           mdoc_parseln(curp->mdoc,
-                               curp->line, ln.buf, of);
-
-               if (0 == rc) {
-                       assert(MANDOCLEVEL_FATAL <= curp->file_status);
-                       break;
-               } else if (2 == rc)
-                       break;
+               if (rr == ROFF_TBL) {
+                       while ((span = roff_span(curp->roff)) != NULL)
+                               if (curp->man == NULL)
+                                       mdoc_addspan(curp->mdoc, span);
+                               else
+                                       man_addspan(curp->man, span);
+               } else if (rr == ROFF_EQN) {
+                       if (curp->man == NULL)
+                               mdoc_addeqn(curp->mdoc, roff_eqn(curp->roff));
+                       else
+                               man_addeqn(curp->man, roff_eqn(curp->roff));
+               } else if ((curp->man == NULL ?
+                   mdoc_parseln(curp->mdoc, curp->line, ln.buf, of) :
+                   man_parseln(curp->man, curp->line, ln.buf, of)) == 2)
+                               break;
 
                /* Temporary buffers typically are not full. */
 
@@ -768,12 +755,12 @@ mparse_parse_buffer(struct mparse *curp, struct buf blk, const char *file)
 }
 
 enum mandoclevel
-mparse_readmem(struct mparse *curp, const void *buf, size_t len,
+mparse_readmem(struct mparse *curp, void *buf, size_t len,
                const char *file)
 {
        struct buf blk;
 
-       blk.buf = UNCONST(buf);
+       blk.buf = buf;
        blk.sz = len;
 
        mparse_parse_buffer(curp, blk, file);