summaryrefslogtreecommitdiffstats
path: root/tag.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 /tag.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 'tag.c')
-rw-r--r--tag.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tag.c b/tag.c
index 5d0119c5..bef94939 100644
--- a/tag.c
+++ b/tag.c
@@ -18,6 +18,9 @@
#include <sys/types.h>
+#if HAVE_ERR
+#include <err.h>
+#endif
#include <limits.h>
#include <signal.h>
#include <stddef.h>
@@ -216,6 +219,11 @@ tag_write(void)
if (tag_files.tfd <= 0)
return;
+ if (tag_files.tagname != NULL && ohash_find(&tag_data,
+ ohash_qlookup(&tag_data, tag_files.tagname)) == NULL) {
+ warnx("%s: no such tag", tag_files.tagname);
+ tag_files.tagname = NULL;
+ }
stream = fdopen(tag_files.tfd, "w");
entry = ohash_first(&tag_data, &slot);
while (entry != NULL) {