=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.273 retrieving revision 1.274 diff -u -p -r1.273 -r1.274 --- mandoc/main.c 2016/07/19 13:36:13 1.273 +++ mandoc/main.c 2016/07/19 21:31:55 1.274 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.273 2016/07/19 13:36:13 schwarze Exp $ */ +/* $Id: main.c,v 1.274 2016/07/19 21:31:55 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014-2016 Ingo Schwarze @@ -82,9 +82,7 @@ struct curparse { }; -#if HAVE_SQLITE3 int mandocdb(int, char *[]); -#endif static int fs_lookup(const struct manpaths *, size_t ipath, const char *, @@ -147,11 +145,9 @@ main(int argc, char *argv[]) setprogname(progname); #endif -#if HAVE_SQLITE3 if (strncmp(progname, "mandocdb", 8) == 0 || strcmp(progname, BINM_MAKEWHATIS) == 0) return mandocdb(argc, argv); -#endif #if HAVE_PLEDGE if (pledge("stdio rpath tmppath tty proc exec flock", NULL) == -1) @@ -349,9 +345,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; @@ -359,19 +352,9 @@ main(int argc, char *argv[]) /* Access the mandoc database. */ manconf_parse(&conf, conf_file, defpaths, auxpaths); -#if HAVE_SQLITE3 - mansearch_setup(1); if ( ! mansearch(&search, &conf.manpath, argc, argv, &res, &sz)) usage(search.argmode); -#else - if (search.argmode != ARG_NAME) { - fputs("mandoc: database support not compiled in\n", - stderr); - return (int)MANDOCLEVEL_BADARG; - } - sz = 0; -#endif if (sz == 0) { if (search.argmode == ARG_NAME) @@ -474,7 +457,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,10 +505,7 @@ main(int argc, char *argv[]) out: if (search.argmode != ARG_FILE) { manconf_free(&conf); -#if HAVE_SQLITE3 mansearch_free(res, sz); - mansearch_setup(0); -#endif } free(defos); @@ -629,7 +609,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", @@ -667,10 +648,8 @@ fs_lookup(const struct manpaths *paths, size_t ipath, return 0; found: -#if HAVE_SQLITE3 warnx("outdated mandoc.db lacks %s(%s) entry, run %s %s", name, sec, BINM_MAKEWHATIS, paths->paths[ipath]); -#endif *res = mandoc_reallocarray(*res, ++*ressz, sizeof(struct manpage)); page = *res + (*ressz - 1); page->file = file;