aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-08-30 18:08:10 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-08-30 18:08:10 +0000
commitbaf73424c69a2aa19a4dbd317ca8b72d21c33c1b (patch)
treece7e1ebfb060ce4fdca55a63bc95a4cf96935f3b /main.c
parent13a468c1e025f5fbb958d0b9bb9e8f3ae1e680ed (diff)
downloadmandoc-baf73424c69a2aa19a4dbd317ca8b72d21c33c1b.tar.gz
mandoc-baf73424c69a2aa19a4dbd317ca8b72d21c33c1b.tar.zst
mandoc-baf73424c69a2aa19a4dbd317ca8b72d21c33c1b.zip
Introduce a man(1) -l option as an alias for mandoc -a.
Basically, this does the same as man -l in Linux man-db. The point is that now all functionality of the combined tool is reachable from the man(1) command name: apropos = man -k, whatis = man -f, mandoc = man -cl. Originally suggested by Carsten dot Kunze at arcor dot de, current maintainer of the Heirloom Documentation Tools. While here, add various missing information to the usage() and to the manuals.
Diffstat (limited to 'main.c')
-rw-r--r--main.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/main.c b/main.c
index e0380e94..9b1f982e 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.187 2014/08/23 22:26:06 schwarze Exp $ */
+/* $Id: main.c,v 1.188 2014/08/30 18:08:10 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -154,7 +154,7 @@ main(int argc, char *argv[])
show_usage = 0;
outmode = OUTMODE_DEF;
- while (-1 != (c = getopt(argc, argv, "aC:cfI:ikM:m:O:S:s:T:VW:w"))) {
+ while (-1 != (c = getopt(argc, argv, "aC:cfI:iklM:m:O:S:s:T:VW:w"))) {
switch (c) {
case 'a':
outmode = OUTMODE_ALL;
@@ -189,6 +189,10 @@ main(int argc, char *argv[])
case 'k':
search.argmode = ARG_EXPR;
break;
+ case 'l':
+ search.argmode = ARG_FILE;
+ outmode = OUTMODE_ALL;
+ break;
case 'M':
defpaths = optarg;
break;
@@ -408,22 +412,23 @@ usage(enum argmode argmode)
switch (argmode) {
case ARG_FILE:
- fputs("usage: mandoc [-V] [-Ios=name] [-mformat]"
- " [-Ooption] [-Toutput] [-Wlevel]\n"
+ fputs("usage: mandoc [-acfklV] [-Ios=name] "
+ "[-mformat] [-Ooption] [-Toutput] [-Wlevel]\n"
"\t [file ...]\n", stderr);
break;
case ARG_NAME:
- fputs("usage: man [-acfhkVw] [-C file] "
+ fputs("usage: man [-acfhklVw] [-C file] "
"[-M path] [-m path] [-S arch] [-s section]\n"
"\t [section] name ...\n", stderr);
break;
case ARG_WORD:
- fputs("usage: whatis [-V] [-C file] [-M path] [-m path] "
- "[-S arch] [-s section] name ...\n", stderr);
+ fputs("usage: whatis [-acfklVw] [-C file] "
+ "[-M path] [-m path] [-O outkey] [-S arch]\n"
+ "\t [-s section] name ...\n", stderr);
break;
case ARG_EXPR:
- fputs("usage: apropos [-V] [-C file] [-M path] [-m path] "
- "[-O outkey] [-S arch]\n"
+ fputs("usage: apropos [-acfklVw] [-C file] "
+ "[-M path] [-m path] [-O outkey] [-S arch]\n"
"\t [-s section] expression ...\n", stderr);
break;
}