=================================================================== RCS file: /cvs/mandoc/read.c,v retrieving revision 1.189 retrieving revision 1.192 diff -u -p -r1.189 -r1.192 --- mandoc/read.c 2017/07/06 22:59:48 1.189 +++ mandoc/read.c 2017/07/20 14:36:36 1.192 @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.189 2017/07/06 22:59:48 schwarze Exp $ */ +/* $Id: read.c,v 1.192 2017/07/20 14:36:36 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2017 Ingo Schwarze @@ -24,9 +24,6 @@ #include #include -#if HAVE_ERR -#include -#endif #include #include #include @@ -42,7 +39,6 @@ #include "mdoc.h" #include "man.h" #include "libmandoc.h" -#include "roff_int.h" #define REPARSE_LIMIT 1000 @@ -343,7 +339,6 @@ choose_parser(struct mparse *curp) static int mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start) { - const struct tbl_span *span; struct buf ln; const char *save_file; char *cp; @@ -534,21 +529,7 @@ rerun: if (curp->man->macroset == MACROSET_NONE) choose_parser(curp); - /* - * Lastly, push down into the parsers themselves. - * If libroff returns ROFF_TBL, then add it to the - * currently open parse. Since we only get here if - * there does exist data (see tbl_data.c), we're - * guaranteed that something's been allocated. - * Do the same for ROFF_EQN. - */ - - if (rr == ROFF_TBL) - while ((span = roff_span(curp->roff)) != NULL) - roff_addtbl(curp->man, span); - else if (rr == ROFF_EQN) - roff_addeqn(curp->man, roff_eqn(curp->roff)); - else if ((curp->man->macroset == MACROSET_MDOC ? + if ((curp->man->macroset == MACROSET_MDOC ? mdoc_parseln(curp->man, curp->line, ln.buf, of) : man_parseln(curp->man, curp->line, ln.buf, of)) == 2) break; @@ -576,8 +557,11 @@ read_whole_file(struct mparse *curp, const char *file, size_t off; ssize_t ssz; - if (fstat(fd, &st) == -1) - err((int)MANDOCLEVEL_SYSERR, "%s", file); + if (fstat(fd, &st) == -1) { + mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, + "fstat: %s", strerror(errno)); + return 0; + } /* * If we're a regular file, try just reading in the whole entry @@ -599,8 +583,11 @@ read_whole_file(struct mparse *curp, const char *file, } if (curp->gzip) { - if ((gz = gzdopen(fd, "rb")) == NULL) - err((int)MANDOCLEVEL_SYSERR, "%s", file); + if ((gz = gzdopen(fd, "rb")) == NULL) { + mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, + "gzdopen: %s", strerror(errno)); + return 0; + } } else gz = NULL; @@ -629,8 +616,11 @@ read_whole_file(struct mparse *curp, const char *file, fb->sz = off; return 1; } - if (ssz == -1) - err((int)MANDOCLEVEL_SYSERR, "%s", file); + if (ssz == -1) { + mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, + "read: %s", strerror(errno)); + break; + } off += (size_t)ssz; }