=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.234 retrieving revision 1.238 diff -u -p -r1.234 -r1.238 --- mandoc/main.c 2015/04/18 16:06:40 1.234 +++ mandoc/main.c 2015/04/29 11:04:17 1.238 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.234 2015/04/18 16:06:40 schwarze Exp $ */ +/* $Id: main.c,v 1.238 2015/04/29 11:04:17 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze @@ -352,9 +352,15 @@ main(int argc, char *argv[]) sz = 0; #endif - if (sz == 0 && search.argmode == ARG_NAME) - fs_search(&search, &conf.manpath, - argc, argv, &res, &sz); + if (sz == 0) { + if (search.argmode == ARG_NAME) + fs_search(&search, &conf.manpath, + argc, argv, &res, &sz); + else + fprintf(stderr, + "%s: nothing appropriate\n", + progname); + } if (sz == 0) { rc = MANDOCLEVEL_BADARG; @@ -632,7 +638,6 @@ static void parse(struct curparse *curp, int fd, const char *file) { enum mandoclevel rctmp; - struct roff_man *mdoc; struct roff_man *man; /* Begin by parsing the file itself. */ @@ -720,14 +725,16 @@ parse(struct curparse *curp, int fd, const char *file) } } - mparse_result(curp->mp, &mdoc, &man, NULL); + mparse_result(curp->mp, &man, NULL); /* Execute the out device, if it exists. */ - if (man && curp->outman) + if (man == NULL) + return; + if (curp->outmdoc != NULL && man->macroset == MACROSET_MDOC) + (*curp->outmdoc)(curp->outdata, man); + if (curp->outman != NULL && man->macroset == MACROSET_MAN) (*curp->outman)(curp->outdata, man); - if (mdoc && curp->outmdoc) - (*curp->outmdoc)(curp->outdata, mdoc); } static void @@ -1020,7 +1027,7 @@ spawn_pager(void) /* Hand over to the pager. */ execvp(argv[0], argv); - fprintf(stderr, "%s: exec: %s\n", - progname, strerror(errno)); + fprintf(stderr, "%s: exec %s: %s\n", + progname, argv[0], strerror(errno)); exit((int)MANDOCLEVEL_SYSERR); }