version 1.143, 2015/10/11 21:12:55 |
version 1.147, 2016/01/08 02:13:39 |
|
|
|
|
#include <assert.h> |
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
|
#if HAVE_ERR |
#include <err.h> |
#include <err.h> |
|
#endif |
#include <errno.h> |
#include <errno.h> |
#include <fcntl.h> |
#include <fcntl.h> |
#include <stdarg.h> |
#include <stdarg.h> |
|
|
struct mparse { |
struct mparse { |
struct roff_man *man; /* man parser */ |
struct roff_man *man; /* man parser */ |
struct roff *roff; /* roff parser (!NULL) */ |
struct roff *roff; /* roff parser (!NULL) */ |
const struct mchars *mchars; /* character table */ |
|
char *sodest; /* filename pointed to by .so */ |
char *sodest; /* filename pointed to by .so */ |
const char *file; /* filename of current input file */ |
const char *file; /* filename of current input file */ |
struct buf *primary; /* buffer currently being parsed */ |
struct buf *primary; /* buffer currently being parsed */ |
Line 216 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
Line 217 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
/* related to request and macro arguments */ |
/* related to request and macro arguments */ |
"escaped character not allowed in a name", |
"escaped character not allowed in a name", |
"NOT IMPLEMENTED: Bd -file", |
"NOT IMPLEMENTED: Bd -file", |
|
"skipping display without arguments", |
"missing list type, using -item", |
"missing list type, using -item", |
"missing manual name, using \"\"", |
"missing manual name, using \"\"", |
"uname(3) system call failed, using UNKNOWN", |
"uname(3) system call failed, using UNKNOWN", |
|
|
if (mparse_open(curp, &fd, ln.buf + of) == |
if (mparse_open(curp, &fd, ln.buf + of) == |
MANDOCLEVEL_OK) { |
MANDOCLEVEL_OK) { |
mparse_readfd(curp, fd, ln.buf + of); |
mparse_readfd(curp, fd, ln.buf + of); |
|
close(fd); |
curp->file = save_file; |
curp->file = save_file; |
} else { |
} else { |
curp->file = save_file; |
curp->file = save_file; |
Line 771 mparse_readfd(struct mparse *curp, int fd, const char |
|
Line 774 mparse_readfd(struct mparse *curp, int fd, const char |
|
#endif |
#endif |
free(blk.buf); |
free(blk.buf); |
} |
} |
|
|
if (fd != STDIN_FILENO && close(fd) == -1) |
|
perror(file); |
|
|
|
return curp->file_status; |
return curp->file_status; |
} |
} |
|
|
Line 815 mparse_open(struct mparse *curp, int *fd, const char * |
|
Line 814 mparse_open(struct mparse *curp, int *fd, const char * |
|
|
|
struct mparse * |
struct mparse * |
mparse_alloc(int options, enum mandoclevel wlevel, mandocmsg mmsg, |
mparse_alloc(int options, enum mandoclevel wlevel, mandocmsg mmsg, |
const struct mchars *mchars, const char *defos) |
const char *defos) |
{ |
{ |
struct mparse *curp; |
struct mparse *curp; |
|
|
Line 826 mparse_alloc(int options, enum mandoclevel wlevel, man |
|
Line 825 mparse_alloc(int options, enum mandoclevel wlevel, man |
|
curp->mmsg = mmsg; |
curp->mmsg = mmsg; |
curp->defos = defos; |
curp->defos = defos; |
|
|
curp->mchars = mchars; |
curp->roff = roff_alloc(curp, options); |
curp->roff = roff_alloc(curp, curp->mchars, options); |
|
curp->man = roff_man_alloc( curp->roff, curp, curp->defos, |
curp->man = roff_man_alloc( curp->roff, curp, curp->defos, |
curp->options & MPARSE_QUICK ? 1 : 0); |
curp->options & MPARSE_QUICK ? 1 : 0); |
if (curp->options & MPARSE_MDOC) { |
if (curp->options & MPARSE_MDOC) { |