aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-07-19 21:31:55 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-07-19 21:31:55 +0000
commit490252b369661e1862919f425cdaf44accbeb1ae (patch)
tree8a0b59b3e70291eee1659e8a3fa736fd5f16f6a4 /main.c
parente5f4a3c1625e925c77bedecad81068d453990bc5 (diff)
downloadmandoc-490252b369661e1862919f425cdaf44accbeb1ae.tar.gz
mandoc-490252b369661e1862919f425cdaf44accbeb1ae.tar.zst
mandoc-490252b369661e1862919f425cdaf44accbeb1ae.zip
Remove the dependency on SQLite without loss of functionality.
Stop supporting systems that don't have mmap(3). Drop the obsolete names_check() now that we deleted MLINKS.
Diffstat (limited to 'main.c')
-rw-r--r--main.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/main.c b/main.c
index 16f55a09..56bfd635 100644
--- a/main.c
+++ b/main.c
@@ -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 <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;