version 1.107, 2015/01/14 17:49:15 |
version 1.108, 2015/01/14 22:02:50 |
Line 191 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
Line 191 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
"ignoring macro in table", |
"ignoring macro in table", |
|
|
/* related to document structure and macros */ |
/* related to document structure and macros */ |
|
NULL, |
"input stack limit exceeded, infinite loop?", |
"input stack limit exceeded, infinite loop?", |
"skipping bad character", |
"skipping bad character", |
"skipping unknown macro", |
"skipping unknown macro", |
Line 218 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
Line 219 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
"input too large", |
"input too large", |
"NOT IMPLEMENTED: .so with absolute path or \"..\"", |
"NOT IMPLEMENTED: .so with absolute path or \"..\"", |
".so request failed", |
".so request failed", |
|
|
/* system errors */ |
|
"gunzip failed with code", |
|
NULL, |
|
"gunzip died from signal", |
|
}; |
}; |
|
|
static const char * const mandoclevels[MANDOCLEVEL_MAX] = { |
static const char * const mandoclevels[MANDOCLEVEL_MAX] = { |
Line 773 mparse_readfd(struct mparse *curp, int fd, const char |
|
Line 769 mparse_readfd(struct mparse *curp, int fd, const char |
|
save_child = curp->child; |
save_child = curp->child; |
if (fd != -1) |
if (fd != -1) |
curp->child = 0; |
curp->child = 0; |
else if (mparse_open(curp, &fd, file) >= MANDOCLEVEL_SYSERR) |
else if (mparse_open(curp, &fd, file) != MANDOCLEVEL_OK) |
goto out; |
goto out; |
|
|
if (read_whole_file(curp, file, fd, &blk, &with_mmap)) { |
if (read_whole_file(curp, file, fd, &blk, &with_mmap)) { |
Line 805 mparse_open(struct mparse *curp, int *fd, const char * |
|
Line 801 mparse_open(struct mparse *curp, int *fd, const char * |
|
int pfd[2]; |
int pfd[2]; |
int save_errno; |
int save_errno; |
char *cp; |
char *cp; |
enum mandocerr err; |
|
|
|
pfd[1] = -1; |
|
curp->file = file; |
curp->file = file; |
|
|
/* Unless zipped, try to just open the file. */ |
/* Unless zipped, try to just open the file. */ |
Line 831 mparse_open(struct mparse *curp, int *fd, const char * |
|
Line 825 mparse_open(struct mparse *curp, int *fd, const char * |
|
if (access(file, R_OK) == -1) { |
if (access(file, R_OK) == -1) { |
if (cp != NULL) |
if (cp != NULL) |
errno = save_errno; |
errno = save_errno; |
err = MANDOCERR_SYSOPEN; |
free(cp); |
goto out; |
*fd = -1; |
|
curp->child = 0; |
|
mandoc_msg(MANDOCERR_FILE, curp, 0, 0, strerror(errno)); |
|
return(MANDOCLEVEL_ERROR); |
} |
} |
|
|
/* Run gunzip(1). */ |
/* Run gunzip(1). */ |
Line 860 mparse_open(struct mparse *curp, int *fd, const char * |
|
Line 857 mparse_open(struct mparse *curp, int *fd, const char * |
|
*fd = pfd[0]; |
*fd = pfd[0]; |
return(MANDOCLEVEL_OK); |
return(MANDOCLEVEL_OK); |
} |
} |
|
|
out: |
|
free(cp); |
|
*fd = -1; |
|
curp->child = 0; |
|
curp->file_status = MANDOCLEVEL_SYSERR; |
|
if (curp->mmsg) |
|
(*curp->mmsg)(err, curp->file_status, curp->file, |
|
0, 0, strerror(errno)); |
|
if (pfd[1] != -1) |
|
exit(1); |
|
return(curp->file_status); |
|
} |
} |
|
|
enum mandoclevel |
enum mandoclevel |
Line 887 mparse_wait(struct mparse *curp) |
|
Line 872 mparse_wait(struct mparse *curp) |
|
exit((int)MANDOCLEVEL_SYSERR); |
exit((int)MANDOCLEVEL_SYSERR); |
} |
} |
if (WIFSIGNALED(status)) { |
if (WIFSIGNALED(status)) { |
mandoc_vmsg(MANDOCERR_SYSSIG, curp, 0, 0, |
mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, |
"%d", WTERMSIG(status)); |
"gunzip died from signal %d", WTERMSIG(status)); |
curp->file_status = MANDOCLEVEL_SYSERR; |
return(MANDOCLEVEL_ERROR); |
return(curp->file_status); |
|
} |
} |
if (WEXITSTATUS(status)) { |
if (WEXITSTATUS(status)) { |
mandoc_vmsg(MANDOCERR_SYSEXIT, curp, 0, 0, |
mandoc_vmsg(MANDOCERR_FILE, curp, 0, 0, |
"%d", WEXITSTATUS(status)); |
"gunzip failed with code %d", WEXITSTATUS(status)); |
curp->file_status = MANDOCLEVEL_SYSERR; |
return(MANDOCLEVEL_ERROR); |
return(curp->file_status); |
|
} |
} |
return(MANDOCLEVEL_OK); |
return(MANDOCLEVEL_OK); |
} |
} |
Line 1009 mandoc_msg(enum mandocerr er, struct mparse *m, |
|
Line 992 mandoc_msg(enum mandocerr er, struct mparse *m, |
|
while (er < mandoclimits[level]) |
while (er < mandoclimits[level]) |
level--; |
level--; |
|
|
if (level < m->wlevel) |
if (level < m->wlevel && er != MANDOCERR_FILE) |
return; |
return; |
|
|
if (m->mmsg) |
if (m->mmsg) |