aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit0376f290310249f2701221cdaaf7138fae3c6989 (patch)
treeaf23aca22eb3b9d3fa8f3fe749fb6ea4ce2e9a72 /main.c
parent0094b52bf5ae4780a23fccaab7adc5bf71c2c161 (diff)
downloadmandoc-0376f290310249f2701221cdaaf7138fae3c6989.tar.gz
mandoc-0376f290310249f2701221cdaaf7138fae3c6989.tar.zst
mandoc-0376f290310249f2701221cdaaf7138fae3c6989.zip
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.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/main.c b/main.c
index 96d34887..d5d61e81 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.228 2015/03/27 16:36:31 schwarze Exp $ */
+/* $Id: main.c,v 1.229 2015/03/27 17:37:25 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);