=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.230 retrieving revision 1.236 diff -u -p -r1.230 -r1.236 --- mandoc/main.c 2015/03/27 21:33:20 1.230 +++ mandoc/main.c 2015/04/19 15:10:46 1.236 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.230 2015/03/27 21:33:20 schwarze Exp $ */ +/* $Id: main.c,v 1.236 2015/04/19 15:10:46 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze @@ -34,11 +34,12 @@ #include #include -#include "mandoc.h" #include "mandoc_aux.h" -#include "main.h" +#include "mandoc.h" +#include "roff.h" #include "mdoc.h" #include "man.h" +#include "main.h" #include "manconf.h" #include "mansearch.h" @@ -57,8 +58,8 @@ enum outmode { OUTMODE_ONE }; -typedef void (*out_mdoc)(void *, const struct mdoc *); -typedef void (*out_man)(void *, const struct man *); +typedef void (*out_mdoc)(void *, const struct roff_man *); +typedef void (*out_man)(void *, const struct roff_man *); typedef void (*out_free)(void *); enum outt { @@ -356,6 +357,8 @@ main(int argc, char *argv[]) argc, argv, &res, &sz); if (sz == 0) { + fprintf(stderr, "%s: nothing appropriate\n", + progname); rc = MANDOCLEVEL_BADARG; goto out; } @@ -575,11 +578,9 @@ fs_lookup(const struct manpaths *paths, size_t ipath, found: #if HAVE_SQLITE3 - fprintf(stderr, "%s: outdated mandoc.db lacks %s(%s) entry,\n" - " consider running # makewhatis %s\n", - progname, name, sec, paths->paths[ipath]); + fprintf(stderr, "%s: outdated mandoc.db lacks %s(%s) entry, run " + "makewhatis %s\n", progname, name, sec, paths->paths[ipath]); #endif - *res = mandoc_reallocarray(*res, ++*ressz, sizeof(struct manpage)); page = *res + (*ressz - 1); page->file = file; @@ -633,8 +634,7 @@ static void parse(struct curparse *curp, int fd, const char *file) { enum mandoclevel rctmp; - struct mdoc *mdoc; - struct man *man; + struct roff_man *man; /* Begin by parsing the file itself. */ @@ -721,14 +721,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 @@ -996,7 +998,7 @@ spawn_pager(void) if (pager == NULL || *pager == '\0') pager = getenv("PAGER"); if (pager == NULL || *pager == '\0') - pager = "/usr/bin/more -s"; + pager = "more -s"; cp = mandoc_strdup(pager); /*