aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-03-27 21:33:20 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-03-27 21:33:20 +0000
commit3a566c6001cb69c071c16b210bbb84009ab1b662 (patch)
tree1623a89f3236c216a580acbede0a3b507c822c9d /main.c
parent0376f290310249f2701221cdaaf7138fae3c6989 (diff)
downloadmandoc-3a566c6001cb69c071c16b210bbb84009ab1b662.tar.gz
mandoc-3a566c6001cb69c071c16b210bbb84009ab1b662.tar.zst
mandoc-3a566c6001cb69c071c16b210bbb84009ab1b662.zip
Actually use the new man.conf(5) "output" directive.
Additional functionality, yet minus 45 lines of code.
Diffstat (limited to 'main.c')
-rw-r--r--main.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/main.c b/main.c
index d5d61e81..2c365f71 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.229 2015/03/27 17:37:25 schwarze Exp $ */
+/* $Id: main.c,v 1.230 2015/03/27 21:33:20 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -83,7 +83,7 @@ struct curparse {
out_man outman; /* man output ptr */
out_free outfree; /* free output ptr */
void *outdata; /* data for output */
- char outopts[BUFSIZ]; /* buf of output opts */
+ struct manoutput *outopts; /* output options */
};
static int fs_lookup(const struct manpaths *,
@@ -127,7 +127,7 @@ main(int argc, char *argv[])
struct manpage *res, *resp;
char *conf_file, *defpaths;
size_t isec, i, sz;
- int prio, best_prio, synopsis_only;
+ int prio, best_prio;
char sec;
enum mandoclevel rctmp;
enum outmode outmode;
@@ -174,12 +174,12 @@ main(int argc, char *argv[])
memset(&curp, 0, sizeof(struct curparse));
curp.outtype = OUTT_LOCALE;
curp.wlevel = MANDOCLEVEL_BADARG;
+ curp.outopts = &conf.output;
options = MPARSE_SO | MPARSE_UTF8 | MPARSE_LATIN1;
defos = NULL;
pager_pid = 1;
show_usage = 0;
- synopsis_only = 0;
outmode = OUTMODE_DEF;
while (-1 != (c = getopt(argc, argv,
@@ -198,8 +198,7 @@ main(int argc, char *argv[])
search.argmode = ARG_WORD;
break;
case 'h':
- (void)strlcat(curp.outopts, "synopsis,", BUFSIZ);
- synopsis_only = 1;
+ conf.output.synopsisonly = 1;
pager_pid = 0;
outmode = OUTMODE_ALL;
break;
@@ -240,8 +239,9 @@ main(int argc, char *argv[])
break;
case 'O':
search.outkey = optarg;
- (void)strlcat(curp.outopts, optarg, BUFSIZ);
- (void)strlcat(curp.outopts, ",", BUFSIZ);
+ while (optarg != NULL)
+ manconf_output(&conf.output,
+ strsep(&optarg, ","));
break;
case 'S':
search.arch = optarg;
@@ -444,7 +444,8 @@ main(int argc, char *argv[])
chdir(conf.manpath.paths[resp->ipath]);
parse(&curp, fd, resp->file);
} else
- passthrough(resp->file, fd, synopsis_only);
+ passthrough(resp->file, fd,
+ conf.output.synopsisonly);
rctmp = mparse_wait(curp.mp);
if (rc < rctmp)