version 1.226, 2015/03/17 07:33:07 |
version 1.227, 2015/03/17 13:35:52 |
Line 101 int mandocdb(int, char**); |
|
Line 101 int mandocdb(int, char**); |
|
static int moptions(int *, char *); |
static int moptions(int *, char *); |
static void mmsg(enum mandocerr, enum mandoclevel, |
static void mmsg(enum mandocerr, enum mandoclevel, |
const char *, int, int, const char *); |
const char *, int, int, const char *); |
static void parse(struct curparse *, int, |
static void parse(struct curparse *, int, const char *); |
const char *, enum mandoclevel *); |
static void passthrough(const char *, int, int); |
static enum mandoclevel passthrough(const char *, int, int); |
|
static pid_t spawn_pager(void); |
static pid_t spawn_pager(void); |
static int toptions(struct curparse *, char *); |
static int toptions(struct curparse *, char *); |
static void usage(enum argmode) __attribute__((noreturn)); |
static void usage(enum argmode) __attribute__((noreturn)); |
Line 423 main(int argc, char *argv[]) |
|
Line 422 main(int argc, char *argv[]) |
|
if (argc < 1) { |
if (argc < 1) { |
if (pager_pid == 1 && isatty(STDOUT_FILENO)) |
if (pager_pid == 1 && isatty(STDOUT_FILENO)) |
pager_pid = spawn_pager(); |
pager_pid = spawn_pager(); |
parse(&curp, STDIN_FILENO, "<stdin>", &rc); |
parse(&curp, STDIN_FILENO, "<stdin>"); |
} |
} |
|
|
while (argc > 0) { |
while (argc > 0) { |
Line 437 main(int argc, char *argv[]) |
|
Line 436 main(int argc, char *argv[]) |
|
pager_pid = spawn_pager(); |
pager_pid = spawn_pager(); |
|
|
if (resp == NULL) |
if (resp == NULL) |
parse(&curp, fd, *argv, &rc); |
parse(&curp, fd, *argv); |
else if (resp->form & FORM_SRC) { |
else if (resp->form & FORM_SRC) { |
/* For .so only; ignore failure. */ |
/* For .so only; ignore failure. */ |
chdir(paths.paths[resp->ipath]); |
chdir(paths.paths[resp->ipath]); |
parse(&curp, fd, resp->file, &rc); |
parse(&curp, fd, resp->file); |
} else { |
} else |
rctmp = passthrough(resp->file, fd, |
passthrough(resp->file, fd, synopsis_only); |
synopsis_only); |
|
if (rc < rctmp) |
|
rc = rctmp; |
|
} |
|
|
|
rctmp = mparse_wait(curp.mp); |
rctmp = mparse_wait(curp.mp); |
if (rc < rctmp) |
if (rc < rctmp) |
Line 632 fs_search(const struct mansearch *cfg, const struct ma |
|
Line 627 fs_search(const struct mansearch *cfg, const struct ma |
|
} |
} |
|
|
static void |
static void |
parse(struct curparse *curp, int fd, const char *file, |
parse(struct curparse *curp, int fd, const char *file) |
enum mandoclevel *level) |
|
{ |
{ |
enum mandoclevel rc; |
enum mandoclevel rctmp; |
struct mdoc *mdoc; |
struct mdoc *mdoc; |
struct man *man; |
struct man *man; |
|
|
Line 644 parse(struct curparse *curp, int fd, const char *file, |
|
Line 638 parse(struct curparse *curp, int fd, const char *file, |
|
assert(file); |
assert(file); |
assert(fd >= -1); |
assert(fd >= -1); |
|
|
rc = mparse_readfd(curp->mp, fd, file); |
rctmp = mparse_readfd(curp->mp, fd, file); |
|
if (rc < rctmp) |
|
rc = rctmp; |
|
|
/* |
/* |
* With -Wstop and warnings or errors of at least the requested |
* With -Wstop and warnings or errors of at least the requested |
* level, do not produce output. |
* level, do not produce output. |
*/ |
*/ |
|
|
if (MANDOCLEVEL_OK != rc && curp->wstop) |
if (rctmp != MANDOCLEVEL_OK && curp->wstop) |
goto cleanup; |
return; |
|
|
/* If unset, allocate output dev now (if applicable). */ |
/* If unset, allocate output dev now (if applicable). */ |
|
|
Line 730 parse(struct curparse *curp, int fd, const char *file, |
|
Line 726 parse(struct curparse *curp, int fd, const char *file, |
|
(*curp->outman)(curp->outdata, man); |
(*curp->outman)(curp->outdata, man); |
if (mdoc && curp->outmdoc) |
if (mdoc && curp->outmdoc) |
(*curp->outmdoc)(curp->outdata, mdoc); |
(*curp->outmdoc)(curp->outdata, mdoc); |
|
|
cleanup: |
|
if (*level < rc) |
|
*level = rc; |
|
} |
} |
|
|
static enum mandoclevel |
static void |
passthrough(const char *file, int fd, int synopsis_only) |
passthrough(const char *file, int fd, int synopsis_only) |
{ |
{ |
const char synb[] = "S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS"; |
const char synb[] = "S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS"; |
Line 794 passthrough(const char *file, int fd, int synopsis_onl |
|
Line 786 passthrough(const char *file, int fd, int synopsis_onl |
|
|
|
done: |
done: |
fclose(stream); |
fclose(stream); |
return(MANDOCLEVEL_OK); |
return; |
|
|
fail: |
fail: |
fprintf(stderr, "%s: %s: SYSERR: %s: %s", |
fprintf(stderr, "%s: %s: SYSERR: %s: %s", |
progname, file, syscall, strerror(errno)); |
progname, file, syscall, strerror(errno)); |
return(MANDOCLEVEL_SYSERR); |
if (rc < MANDOCLEVEL_SYSERR) |
|
rc = MANDOCLEVEL_SYSERR; |
} |
} |
|
|
static int |
static int |
|
|
handle_sigpipe(int signum) |
handle_sigpipe(int signum) |
{ |
{ |
|
|
exit(rc); |
exit((int)rc); |
} |
} |
|
|
static pid_t |
static pid_t |