summaryrefslogtreecommitdiffstats
path: root/manpath.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-11-22 11:30:23 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-11-22 11:30:23 +0000
commit22da865402a78266a769c6c501dbecec806fc0d3 (patch)
treebce636bf50fd51354f227706a2d28e974948df56 /manpath.c
parent556fbe5dbb473b7fd0ad6ba9a1ad36a105cffd66 (diff)
downloadmandoc-22da865402a78266a769c6c501dbecec806fc0d3.tar.gz
In -T locale (the default), -T ascii, and -T utf8 mode, provide a new
output option -O tag[=term] to move right to the definition of "term" when opening the manual page in a pager, effectively porting the -T html fragment name feature - https://man.openbsd.org/ksh#ulimit - to the terminal. Try: $ man -O tag uvm_sysctl $ man -O tag=ulimit ksh $ man -O tag 3 compress Feature development triggered by a question from kn@. Klemens also tested, provided feedback that resulted in improvements, and provided an OK.
Diffstat (limited to 'manpath.c')
-rw-r--r--manpath.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/manpath.c b/manpath.c
index 24f57598..6d67151b 100644
--- a/manpath.c
+++ b/manpath.c
@@ -232,8 +232,8 @@ int
manconf_output(struct manoutput *conf, const char *cp, int fromfile)
{
const char *const toks[] = {
- "includes", "man", "paper", "style",
- "indent", "width", "fragment", "mdoc", "noval", "toc"
+ "includes", "man", "paper", "style", "indent", "width",
+ "tag", "fragment", "mdoc", "noval", "toc"
};
const char *errstr;
@@ -257,7 +257,7 @@ manconf_output(struct manoutput *conf, const char *cp, int fromfile)
warnx("-O %s=?: Missing argument value", toks[tok]);
return -1;
}
- if ((tok == 6 || tok == 7) && *cp != '\0') {
+ if (tok > 6 && *cp != '\0') {
warnx("-O %s: Does not take a value: %s", toks[tok], cp);
return -1;
}
@@ -312,15 +312,22 @@ manconf_output(struct manoutput *conf, const char *cp, int fromfile)
warnx("-O width=%s is %s", cp, errstr);
return -1;
case 6:
- conf->fragment = 1;
+ if (conf->tag != NULL) {
+ oldval = mandoc_strdup(conf->tag);
+ break;
+ }
+ conf->tag = mandoc_strdup(cp);
return 0;
case 7:
- conf->mdoc = 1;
+ conf->fragment = 1;
return 0;
case 8:
- conf->noval = 1;
+ conf->mdoc = 1;
return 0;
case 9:
+ conf->noval = 1;
+ return 0;
+ case 10:
conf->toc = 1;
return 0;
default: