version 1.213, 2015/01/13 23:17:52 |
version 1.216, 2015/01/16 21:15:05 |
|
|
#include "config.h" |
#include "config.h" |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
#include <sys/param.h> /* MACHINE */ |
|
|
#include <assert.h> |
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
Line 131 main(int argc, char *argv[]) |
|
Line 132 main(int argc, char *argv[]) |
|
int prio, best_prio, synopsis_only; |
int prio, best_prio, synopsis_only; |
char sec; |
char sec; |
#endif |
#endif |
enum mandoclevel rc; |
enum mandoclevel rc, rctmp; |
enum outmode outmode; |
enum outmode outmode; |
int fd; |
int fd; |
int show_usage; |
int show_usage; |
Line 176 main(int argc, char *argv[]) |
|
Line 177 main(int argc, char *argv[]) |
|
|
|
memset(&curp, 0, sizeof(struct curparse)); |
memset(&curp, 0, sizeof(struct curparse)); |
curp.outtype = OUTT_LOCALE; |
curp.outtype = OUTT_LOCALE; |
curp.wlevel = MANDOCLEVEL_FATAL; |
curp.wlevel = MANDOCLEVEL_BADARG; |
options = MPARSE_SO | MPARSE_UTF8 | MPARSE_LATIN1; |
options = MPARSE_SO | MPARSE_UTF8 | MPARSE_LATIN1; |
defos = NULL; |
defos = NULL; |
|
|
Line 328 main(int argc, char *argv[]) |
|
Line 329 main(int argc, char *argv[]) |
|
argv++; |
argv++; |
argc--; |
argc--; |
} |
} |
|
if (search.arch == NULL) |
|
search.arch = getenv("MACHINE"); |
|
if (search.arch == NULL) |
|
search.arch = MACHINE; |
} |
} |
|
|
rc = MANDOCLEVEL_OK; |
rc = MANDOCLEVEL_OK; |
Line 431 main(int argc, char *argv[]) |
|
Line 436 main(int argc, char *argv[]) |
|
} |
} |
|
|
while (argc) { |
while (argc) { |
rc = mparse_open(curp.mp, &fd, |
rctmp = mparse_open(curp.mp, &fd, |
#if HAVE_SQLITE3 |
#if HAVE_SQLITE3 |
resp != NULL ? resp->file : |
resp != NULL ? resp->file : |
#endif |
#endif |
*argv); |
*argv); |
|
if (rc < rctmp) |
|
rc = rctmp; |
|
|
if (fd != -1) { |
if (fd != -1) { |
if (use_pager && isatty(STDOUT_FILENO)) |
if (use_pager && isatty(STDOUT_FILENO)) |
Line 451 main(int argc, char *argv[]) |
|
Line 458 main(int argc, char *argv[]) |
|
/* 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, &rc); |
} else |
} else { |
rc = passthrough(resp->file, fd, |
rctmp = passthrough(resp->file, fd, |
synopsis_only); |
synopsis_only); |
|
if (rc < rctmp) |
|
rc = rctmp; |
|
} |
#endif |
#endif |
|
|
if (mparse_wait(curp.mp) != MANDOCLEVEL_OK) |
rctmp = mparse_wait(curp.mp); |
rc = MANDOCLEVEL_SYSERR; |
if (rc < rctmp) |
|
rc = rctmp; |
|
|
if (argc > 1 && curp.outtype <= OUTT_UTF8) |
if (argc > 1 && curp.outtype <= OUTT_UTF8) |
ascii_sepline(curp.outdata); |
ascii_sepline(curp.outdata); |
Line 641 parse(struct curparse *curp, int fd, const char *file, |
|
Line 652 parse(struct curparse *curp, int fd, const char *file, |
|
|
|
rc = mparse_readfd(curp->mp, fd, file); |
rc = mparse_readfd(curp->mp, fd, file); |
|
|
/* Stop immediately if the parse has failed. */ |
|
|
|
if (MANDOCLEVEL_FATAL <= rc) |
|
goto cleanup; |
|
|
|
/* |
/* |
* 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. |
Line 907 woptions(struct curparse *curp, char *arg) |
|
Line 913 woptions(struct curparse *curp, char *arg) |
|
curp->wlevel = MANDOCLEVEL_ERROR; |
curp->wlevel = MANDOCLEVEL_ERROR; |
break; |
break; |
case 4: |
case 4: |
curp->wlevel = MANDOCLEVEL_FATAL; |
curp->wlevel = MANDOCLEVEL_BADARG; |
break; |
break; |
default: |
default: |
fprintf(stderr, "%s: -W %s: Bad argument\n", |
fprintf(stderr, "%s: -W %s: Bad argument\n", |