aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--main.c10
-rw-r--r--mansearch.c3
-rw-r--r--mansearch.h3
3 files changed, 10 insertions, 6 deletions
diff --git a/main.c b/main.c
index 9b1f982e..a6d5013b 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.188 2014/08/30 18:08:10 schwarze Exp $ */
+/* $Id: main.c,v 1.189 2014/09/01 22:45:53 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -284,7 +284,6 @@ main(int argc, char *argv[])
mansearch_setup(1);
if( ! mansearch(&search, &paths, argc, argv, &res, &sz))
usage(search.argmode);
- manpath_free(&paths);
resp = res;
if (sz == 0) {
@@ -367,9 +366,11 @@ main(int argc, char *argv[])
while (argc) {
#if HAVE_SQLITE3
if (resp != NULL) {
- if (resp->form)
+ if (resp->form) {
+ /* For .so only; ignore failure. */
+ chdir(paths.paths[resp->ipath]);
parse(&curp, -1, resp->file, &rc);
- else
+ } else
rc = passthrough(resp->file);
resp++;
} else
@@ -388,6 +389,7 @@ main(int argc, char *argv[])
#if HAVE_SQLITE3
out:
if (search.argmode != ARG_FILE) {
+ manpath_free(&paths);
mansearch_free(res, sz);
mansearch_setup(0);
}
diff --git a/mansearch.c b/mansearch.c
index 0ede3e66..a8a37a96 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.46 2014/08/21 20:29:07 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.47 2014/09/01 22:45:53 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -335,6 +335,7 @@ mansearch(const struct mansearch *search,
maxres, sizeof(struct manpage));
}
mpage = *res + cur;
+ mpage->ipath = i;
mpage->sec = 10;
mpage->form = mp->form;
buildnames(mpage, db, s, mp->pageid,
diff --git a/mansearch.h b/mansearch.h
index 3644310b..6cc6f410 100644
--- a/mansearch.h
+++ b/mansearch.h
@@ -1,4 +1,4 @@
-/* $Id: mansearch.h,v 1.16 2014/08/17 03:24:47 schwarze Exp $ */
+/* $Id: mansearch.h,v 1.17 2014/09/01 22:45:53 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -79,6 +79,7 @@ struct manpage {
char *file; /* to be prefixed by manpath */
char *names; /* a list of names with sections */
char *output; /* user-defined additional output */
+ size_t ipath; /* number of the manpath */
int sec; /* section number, 10 means invalid */
int form; /* 0 == catpage */
};