summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-03-27 17:37:25 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-03-27 17:37:25 +0000
commitaeaacb622a48de841df3d2733d63ed99db74ffbc (patch)
tree26003bbc829278be3b4b17ea680abf1917792058 /main.c
parent2fba111e1348dcdc89a477c59777c7ad13b08029 (diff)
downloadmandoc-aeaacb622a48de841df3d2733d63ed99db74ffbc.tar.gz
Parse the new man.conf(5) "output" directive.
The next step will be to actually use the parsed data.
Diffstat (limited to 'main.c')
-rw-r--r--main.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/main.c b/main.c
index ecb22477..83358dda 100644
--- a/main.c
+++ b/main.c
@@ -8,9 +8,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -39,7 +39,7 @@
#include "main.h"
#include "mdoc.h"
#include "man.h"
-#include "manpath.h"
+#include "manconf.h"
#include "mansearch.h"
#if !defined(__GNUC__) || (__GNUC__ < 2)
@@ -118,9 +118,9 @@ static enum mandoclevel rc;
int
main(int argc, char *argv[])
{
+ struct manconf conf;
struct curparse curp;
struct mansearch search;
- struct manpaths paths;
char *auxpaths;
char *defos;
unsigned char *uc;
@@ -151,7 +151,7 @@ main(int argc, char *argv[])
/* Search options. */
- memset(&paths, 0, sizeof(struct manpaths));
+ memset(&conf, 0, sizeof(conf));
conf_file = defpaths = NULL;
auxpaths = NULL;
@@ -336,10 +336,11 @@ main(int argc, char *argv[])
/* Access the mandoc database. */
- manpath_parse(&paths, conf_file, defpaths, auxpaths);
+ manconf_parse(&conf, conf_file, defpaths, auxpaths);
#if HAVE_SQLITE3
mansearch_setup(1);
- if( ! mansearch(&search, &paths, argc, argv, &res, &sz))
+ if ( ! mansearch(&search, &conf.manpath,
+ argc, argv, &res, &sz))
usage(search.argmode);
#else
if (search.argmode != ARG_NAME) {
@@ -351,7 +352,8 @@ main(int argc, char *argv[])
#endif
if (sz == 0 && search.argmode == ARG_NAME)
- fs_search(&search, &paths, argc, argv, &res, &sz);
+ fs_search(&search, &conf.manpath,
+ argc, argv, &res, &sz);
if (sz == 0) {
rc = MANDOCLEVEL_BADARG;
@@ -439,7 +441,7 @@ main(int argc, char *argv[])
parse(&curp, fd, *argv);
else if (resp->form & FORM_SRC) {
/* For .so only; ignore failure. */
- chdir(paths.paths[resp->ipath]);
+ chdir(conf.manpath.paths[resp->ipath]);
parse(&curp, fd, resp->file);
} else
passthrough(resp->file, fd, synopsis_only);
@@ -470,7 +472,7 @@ main(int argc, char *argv[])
out:
if (search.argmode != ARG_FILE) {
- manpath_free(&paths);
+ manconf_free(&conf);
#if HAVE_SQLITE3
mansearch_free(res, sz);
mansearch_setup(0);