=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.273.2.9 retrieving revision 1.283 diff -u -p -r1.273.2.9 -r1.283 --- mandoc/main.c 2017/02/21 17:04:04 1.273.2.9 +++ mandoc/main.c 2017/02/17 14:31:52 1.283 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.273.2.9 2017/02/21 17:04:04 schwarze Exp $ */ +/* $Id: main.c,v 1.283 2017/02/17 14:31:52 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze @@ -81,7 +81,9 @@ struct curparse { struct manoutput *outopts; /* output options */ }; + int mandocdb(int, char *[]); + static int fs_lookup(const struct manpaths *, size_t ipath, const char *, const char *, const char *, @@ -355,9 +357,6 @@ main(int argc, char *argv[]) /* man(1), whatis(1), apropos(1) */ if (search.argmode != ARG_FILE) { - if (argc == 0) - usage(search.argmode); - if (search.argmode == ARG_NAME && outmode == OUTMODE_ONE) search.firstmatch = 1; @@ -365,10 +364,10 @@ main(int argc, char *argv[]) /* Access the mandoc database. */ manconf_parse(&conf, conf_file, defpaths, auxpaths); - mansearch_setup(1); if ( ! mansearch(&search, &conf.manpath, argc, argv, &res, &sz)) usage(search.argmode); + if (sz == 0) { if (search.argmode == ARG_NAME) fs_search(&search, &conf.manpath, @@ -470,7 +469,7 @@ main(int argc, char *argv[]) if (resp == NULL) parse(&curp, fd, *argv); - else if (resp->form & FORM_SRC) { + else if (resp->form == FORM_SRC) { /* For .so only; ignore failure. */ chdir(conf.manpath.paths[resp->ipath]); parse(&curp, fd, resp->file); @@ -522,7 +521,6 @@ out: if (search.argmode != ARG_FILE) { manconf_free(&conf); mansearch_free(res, sz); - mansearch_setup(0); } free(defos); @@ -626,7 +624,8 @@ fs_lookup(const struct manpaths *paths, size_t ipath, glob_t globinfo; struct manpage *page; char *file; - int form, globres; + int globres; + enum form form; form = FORM_SRC; mandoc_asprintf(&file, "%s/man%s/%s.%s",