diff options
-rw-r--r-- | main.c | 8 | ||||
-rw-r--r-- | read.c | 6 |
2 files changed, 8 insertions, 6 deletions
@@ -510,7 +510,6 @@ main(int argc, char *argv[]) } else thisarg = *argv; - mandoc_msg_setinfilename(thisarg); fd = mparse_open(curp.mp, thisarg); if (fd != -1) { if (use_pager) { @@ -523,11 +522,13 @@ main(int argc, char *argv[]) conf.output.tag : *argv; } + mandoc_msg_setinfilename(thisarg); if (resp == NULL || resp->form == FORM_SRC) parse(&curp, fd, thisarg); else passthrough(resp->file, fd, conf.output.synopsisonly); + mandoc_msg_setinfilename(NULL); if (ferror(stdout)) { if (tag_files != NULL) { @@ -545,8 +546,9 @@ main(int argc, char *argv[]) outdata_alloc(&curp); terminal_sepline(curp.outdata); } - } - mandoc_msg_setinfilename(NULL); + } else + mandoc_msg(MANDOCERR_FILE, 0, 0, + "%s", strerror(errno)); if (curp.wstop && mandoc_msg_getrc() != MANDOCLEVEL_OK) break; @@ -372,8 +372,9 @@ rerun: mparse_readfd(curp, fd, ln.buf + of); close(fd); } else { - mandoc_msg(MANDOCERR_SO_FAIL, curp->line, - pos, ".so %s", ln.buf + of); + mandoc_msg(MANDOCERR_SO_FAIL, + curp->line, of, ".so %s: %s", + ln.buf + of, strerror(errno)); ln.sz = mandoc_asprintf(&cp, ".sp\nSee the file %s.\n.sp", ln.buf + of); @@ -633,7 +634,6 @@ mparse_open(struct mparse *curp, const char *file) /* Neither worked, give up. */ - mandoc_msg(MANDOCERR_FILE, 0, 0, "%s", strerror(errno)); return -1; } |