version 1.28, 2017/01/10 13:47:00 |
version 1.33, 2019/03/03 11:01:15 |
|
|
#include <string.h> |
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
|
|
|
#include "mandoc.h" |
#include "roff.h" |
#include "roff.h" |
#include "man.h" |
#include "man.h" |
#include "mdoc.h" |
#include "mdoc.h" |
#include "mandoc.h" |
#include "mandoc_parse.h" |
|
|
static void pline(int, int *, int *, int); |
static void pline(int, int *, int *, int); |
static void pman(const struct roff_node *, int *, int *, int); |
static void pman(const struct roff_node *, int *, int *, int); |
Line 78 main(int argc, char *argv[]) |
|
Line 79 main(int argc, char *argv[]) |
|
argv += optind; |
argv += optind; |
|
|
mchars_alloc(); |
mchars_alloc(); |
mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_BADARG, NULL, NULL); |
mp = mparse_alloc(MPARSE_SO | MPARSE_UTF8 | MPARSE_LATIN1 | |
|
MPARSE_VALIDATE, MANDOC_OS_OTHER, NULL); |
assert(mp); |
assert(mp); |
|
|
if (argc < 1) |
if (argc < 1) |
|
|
static void |
static void |
pmandoc(struct mparse *mp, int fd, const char *fn, int list) |
pmandoc(struct mparse *mp, int fd, const char *fn, int list) |
{ |
{ |
struct roff_man *man; |
struct roff_meta *meta; |
int line, col; |
int line, col; |
|
|
mparse_readfd(mp, fd, fn); |
mparse_readfd(mp, fd, fn); |
close(fd); |
close(fd); |
mparse_result(mp, &man, NULL); |
meta = mparse_result(mp); |
line = 1; |
line = 1; |
col = 0; |
col = 0; |
|
|
if (man == NULL) |
if (meta->macroset == MACROSET_MDOC) |
return; |
pmdoc(meta->first->child, &line, &col, list); |
if (man->macroset == MACROSET_MDOC) { |
else |
mdoc_validate(man); |
pman(meta->first->child, &line, &col, list); |
pmdoc(man->first->child, &line, &col, list); |
|
} else { |
|
man_validate(man); |
|
pman(man->first->child, &line, &col, list); |
|
} |
|
|
|
if ( ! list) |
if ( ! list) |
putchar('\n'); |
putchar('\n'); |