From 8653551cb202b50a668483cb155c4c8272808ae8 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 22 Nov 2018 11:30:23 +0000 Subject: 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. --- tag.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tag.c') diff --git a/tag.c b/tag.c index 823f2045..473ea7b6 100644 --- a/tag.c +++ b/tag.c @@ -1,4 +1,4 @@ -/* $Id: tag.c,v 1.20 2018/10/23 20:42:37 schwarze Exp $ */ +/* $Id: tag.c,v 1.21 2018/11/22 11:30:23 schwarze Exp $ */ /* * Copyright (c) 2015, 2016, 2018 Ingo Schwarze * @@ -18,6 +18,9 @@ #include +#if HAVE_ERR +#include +#endif #include #include #include @@ -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) { -- cgit v1.2.3-56-ge451