summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile9
-rw-r--r--apropos.132
-rw-r--r--apropos.c19
-rw-r--r--index.sgml34
-rw-r--r--mandocdb.c2
-rw-r--r--mandocdb.h61
-rw-r--r--manpage.c15
-rw-r--r--mansearch.c40
-rw-r--r--mansearch.h56
-rw-r--r--whatis.1186
10 files changed, 127 insertions, 327 deletions
diff --git a/Makefile b/Makefile
index 83b9544e..70ab0c64 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ CFLAGS += -DUSE_WCHAR
# If your system has manpath(1), uncomment this. This is most any
# system that's not OpenBSD or NetBSD. If uncommented, manpage(1) and
# mandocdb(8) will use manpath(1) to get the MANPATH variable.
-CFLAGS += -DUSE_MANPATH
+#CFLAGS += -DUSE_MANPATH
# If your system supports static binaries only, uncomment this. This
# appears only to be BSD UNIX systems (Mac OS X has no support and Linux
@@ -107,7 +107,6 @@ SRCS = Makefile \
mandoc_char.7 \
mandocdb.8 \
mandocdb.c \
- mandocdb.h \
manpath.c \
manpath.h \
mdoc.7 \
@@ -234,16 +233,16 @@ MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
$(MANDOC_OBJS): main.h mandoc.h mdoc.h man.h config.h out.h
MANDOCDB_OBJS = mandocdb.o manpath.o
-$(MANDOCDB_OBJS): mandocdb.h mandoc.h mdoc.h man.h config.h manpath.h
+$(MANDOCDB_OBJS): mansearch.h mandoc.h mdoc.h man.h config.h manpath.h
PRECONV_OBJS = preconv.o
$(PRECONV_OBJS): config.h
APROPOS_OBJS = apropos.o mansearch.o manpath.o
-$(APROPOS_OBJS): config.h manpath.h mandocdb.h mansearch.h
+$(APROPOS_OBJS): config.h manpath.h mansearch.h
MANPAGE_OBJS = manpage.o mansearch.o manpath.o
-$(MANPAGE_OBJS): config.h manpath.h mandocdb.h mansearch.h
+$(MANPAGE_OBJS): config.h manpath.h mansearch.h
DEMANDOC_OBJS = demandoc.o
$(DEMANDOC_OBJS): config.h
diff --git a/apropos.1 b/apropos.1
index 15b8b065..a347cc5c 100644
--- a/apropos.1
+++ b/apropos.1
@@ -18,7 +18,8 @@
.Dt APROPOS 1
.Os
.Sh NAME
-.Nm apropos
+.Nm apropos ,
+.Nm whatis
.Nd search manual page databases
.Sh SYNOPSIS
.Nm
@@ -30,8 +31,10 @@
.Ar expression ...
.Sh DESCRIPTION
The
-.Nm
-utility queries manual page databases generated by
+.Nm apropos
+and
+.Nm whatis
+utilities query manual page databases generated by
.Xr mandocdb 8 ,
evaluating on
.Ar expression
@@ -44,9 +47,10 @@ searches for
databases in the default paths stipulated by
.Xr man 1
and
-parses terms as case-sensitive words
-over manual names and descriptions.
+maps terms to case-sensitive manual names and descriptions.
Multiple terms are OR'd.
+.Nm whatis
+maps terms only to case-sensitive manual names.
.Pp
Its arguments are as follows:
.Bl -tag -width Ds
@@ -77,9 +81,14 @@ See
for a listing of manual sections.
.El
.Pp
-An
+.Nm whatis
+considers an
.Ar expression
-consists of type and keyword pairs.
+to consist of an opaque keyword.
+.Nm apropos
+parses a
+.Ar expression
+into type and keyword pairs.
This pair syntax
.Li [key[,key]*(=~)]?val ,
where operand
@@ -113,7 +122,8 @@ is the manual's short description.
If an architecture is specified for the manual, it is displayed as
.Qq title(cat/arch) \- description .
.Ss Macro Keys
-Queries evaluate over a subset of
+.Nm apropos
+queries evaluate over a subset of
.Xr mdoc 7
macros indexed by
.Xr mandocdb 8 .
@@ -209,14 +219,10 @@ If none of these conditions are met, it overrides the default list.
.El
.Sh FILES
.Bl -tag -width "/etc/man.conf" -compact
-.It Pa whatis.db
+.It Pa mandocdb.db
name of the
.Xr mandocdb 8
keyword database
-.It Pa whatis.index
-name of the
-.Xr mandocdb 8
-filename database
.It Pa /etc/man.conf
default
.Xr man 1
diff --git a/apropos.c b/apropos.c
index 1fd3a528..5c953c7d 100644
--- a/apropos.c
+++ b/apropos.c
@@ -32,11 +32,11 @@
int
main(int argc, char *argv[])
{
- int ch;
+ int ch, whatis;
+ struct mansearch search;
size_t i, sz;
struct manpage *res;
- char *conf_file, *defpaths, *auxpaths,
- *arch, *sec;
+ char *conf_file, *defpaths, *auxpaths;
struct manpaths paths;
char *progname;
extern char *optarg;
@@ -48,8 +48,10 @@ main(int argc, char *argv[])
else
++progname;
- auxpaths = defpaths = conf_file = arch = sec = NULL;
+ auxpaths = defpaths = conf_file = NULL;
memset(&paths, 0, sizeof(struct manpaths));
+ memset(&search, 0, sizeof(struct mansearch));
+ whatis = (0 == strcmp(progname, "whatis"));
while (-1 != (ch = getopt(argc, argv, "C:M:m:S:s:")))
switch (ch) {
@@ -63,10 +65,10 @@ main(int argc, char *argv[])
auxpaths = optarg;
break;
case ('S'):
- arch = optarg;
+ search.arch = optarg;
break;
case ('s'):
- sec = optarg;
+ search.sec = optarg;
break;
default:
goto usage;
@@ -78,8 +80,11 @@ main(int argc, char *argv[])
if (0 == argc)
goto usage;
+ search.deftype = whatis ? TYPE_Nm : TYPE_Nm | TYPE_Nd;
+ search.flags = whatis ? MANSEARCH_WHATIS : 0;
+
manpath_parse(&paths, conf_file, defpaths, auxpaths);
- ch = mansearch(&paths, arch, sec, argc, argv, &res, &sz);
+ ch = mansearch(&search, &paths, argc, argv, &res, &sz);
manpath_free(&paths);
if (0 == ch)
diff --git a/index.sgml b/index.sgml
index 92ef18da..365146ed 100644
--- a/index.sgml
+++ b/index.sgml
@@ -157,16 +157,6 @@
</TD>
</TR>
<TR>
- <TD VALIGN="top"><A HREF="whatis.1.html">whatis(1)</A></TD>
- <TD VALIGN="top">
- search the manual page database
- (<A HREF="whatis.1.txt">text</A> |
- <A HREF="whatis.1.xhtml">xhtml</A> |
- <A HREF="whatis.1.pdf">pdf</A> |
- <A HREF="whatis.1.ps">ps</A>)
- </TD>
- </TR>
- <TR>
<TD VALIGN="top"><A HREF="mandoc.3.html">mandoc(3)</A></TD>
<TD VALIGN="top">
mandoc macro compiler library
@@ -305,28 +295,16 @@
<A NAME="news">News</A>
</H1>
<P CLASS="news">
- 23-03-2011: version 1.12.1
- </P>
- <P>
- Significant work on <A HREF="apropos.1.html">apropos</A> and <A HREF="mandocdb.8.html">mandocdb</A>. These tools are
- now much more robust.
- A <A HREF="whatis.1.html">whatis</A> implementation is now handled as an <A HREF="apropos.1.html">apropos</A> mode.
- These tools are also able to minimally handle pre-formatted pages, that is, those already formatted by another utility
- such as GNU troff.
- </P>
- <P>
- The <A HREF="man.cgi.7.html">man.cgi</A> script is also now available for wider testing. It interfaces with <A
- HREF="mandocdb.8.html">mandocdb</A> manuals cached by <DEL><A HREF="catman.8.html">catman</A></DEL>. HTML output is generated
- on-the-fly by <A HREF="mandoc.3.html">libmandoc</A> or internal methods to convert pre-formatted pages.
+ xx-xx-2012: version 1.12.4
</P>
<P>
- The mailing list archive for the discuss and tech lists are being hosted by <A CLASS="external"
- HREF="http://www.gmane.org">Gmane</A> at <A HREF="http://dir.gmane.org/gmane.comp.tools.mdocml.user"
- CLASS="external">gmane.comp.tools.mdocml.user</A> and <A HREF="http://dir.gmane.org/gmane.comp.tools.mdocml.devel"
- CLASS="external">gmane.comp.tools.mdocml.devel</A>, respectively.
+ <I>Ingo, can you summarise your changes here?</I>
</P>
<P>
- Lastly, I'm no longer providing binaries, as nobody has asked for them.
+ The <A HREF="mandocdb.8.html">mandocdb</A> tools (<A HREF="mandocdb.8.html">mandocdb</A>,
+ <A HREF="apropos.1.html">apropos</A> (absorbing whatis), and
+ <A HREF="man.cgi.7.html">man.cgi</A> have been re-written to use
+ <A CLASS="external" HREF="http://www.sqlite.org">sqlite3</A> as a database.
</P>
<P>
See <A HREF="http://mdocml.bsd.lv/cgi-bin/cvsweb/index.sgml?cvsroot=mdocml">cvsweb</A> for
diff --git a/mandocdb.c b/mandocdb.c
index cc3f4940..b1c59ada 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -44,8 +44,8 @@
#include "mdoc.h"
#include "man.h"
#include "mandoc.h"
-#include "mandocdb.h"
#include "manpath.h"
+#include "mansearch.h"
/* Post a warning to stderr. */
#define WARNING(_f, _b, _fmt, _args...) \
diff --git a/mandocdb.h b/mandocdb.h
deleted file mode 100644
index c0e56361..00000000
--- a/mandocdb.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $Id$ */
-/*
- * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#ifndef MANDOCDB_H
-#define MANDOCDB_H
-
-#define MANDOC_DB "mandocdb.db"
-
-#define TYPE_An 0x0000000000000001ULL
-#define TYPE_Ar 0x0000000000000002ULL
-#define TYPE_At 0x0000000000000004ULL
-#define TYPE_Bsx 0x0000000000000008ULL
-#define TYPE_Bx 0x0000000000000010ULL
-#define TYPE_Cd 0x0000000000000020ULL
-#define TYPE_Cm 0x0000000000000040ULL
-#define TYPE_Dv 0x0000000000000080ULL
-#define TYPE_Dx 0x0000000000000100ULL
-#define TYPE_Em 0x0000000000000200ULL
-#define TYPE_Er 0x0000000000000400ULL
-#define TYPE_Ev 0x0000000000000800ULL
-#define TYPE_Fa 0x0000000000001000ULL
-#define TYPE_Fl 0x0000000000002000ULL
-#define TYPE_Fn 0x0000000000004000ULL
-#define TYPE_Ft 0x0000000000008000ULL
-#define TYPE_Fx 0x0000000000010000ULL
-#define TYPE_Ic 0x0000000000020000ULL
-#define TYPE_In 0x0000000000040000ULL
-#define TYPE_Lb 0x0000000000080000ULL
-#define TYPE_Li 0x0000000000100000ULL
-#define TYPE_Lk 0x0000000000200000ULL
-#define TYPE_Ms 0x0000000000400000ULL
-#define TYPE_Mt 0x0000000000800000ULL
-#define TYPE_Nd 0x0000000001000000ULL
-#define TYPE_Nm 0x0000000002000000ULL
-#define TYPE_Nx 0x0000000004000000ULL
-#define TYPE_Ox 0x0000000008000000ULL
-#define TYPE_Pa 0x0000000010000000ULL
-#define TYPE_Rs 0x0000000020000000ULL
-#define TYPE_Sh 0x0000000040000000ULL
-#define TYPE_Ss 0x0000000080000000ULL
-#define TYPE_St 0x0000000100000000ULL
-#define TYPE_Sy 0x0000000200000000ULL
-#define TYPE_Tn 0x0000000400000000ULL
-#define TYPE_Va 0x0000000800000000ULL
-#define TYPE_Vt 0x0000001000000000ULL
-#define TYPE_Xr 0x0000002000000000ULL
-
-#endif /*!MANDOCDB_H */
diff --git a/manpage.c b/manpage.c
index 93f3d264..1a19c908 100644
--- a/manpage.c
+++ b/manpage.c
@@ -36,9 +36,9 @@ main(int argc, char *argv[])
{
int ch, term;
size_t i, sz, len;
+ struct mansearch search;
struct manpage *res;
- char *conf_file, *defpaths, *auxpaths, *cp,
- *arch, *sec;
+ char *conf_file, *defpaths, *auxpaths, *cp;
char buf[MAXPATHLEN];
const char *cmd;
struct manpaths paths;
@@ -54,8 +54,9 @@ main(int argc, char *argv[])
else
++progname;
- auxpaths = defpaths = conf_file = arch = sec = NULL;
+ auxpaths = defpaths = conf_file = NULL;
memset(&paths, 0, sizeof(struct manpaths));
+ memset(&search, 0, sizeof(struct mansearch));
while (-1 != (ch = getopt(argc, argv, "C:M:m:S:s:")))
switch (ch) {
@@ -69,10 +70,10 @@ main(int argc, char *argv[])
auxpaths = optarg;
break;
case ('S'):
- arch = optarg;
+ search.arch = optarg;
break;
case ('s'):
- sec = optarg;
+ search.sec = optarg;
break;
default:
goto usage;
@@ -84,8 +85,10 @@ main(int argc, char *argv[])
if (0 == argc)
goto usage;
+ search.deftype = TYPE_Nm | TYPE_Nd;
+
manpath_parse(&paths, conf_file, defpaths, auxpaths);
- ch = mansearch(&paths, arch, sec, argc, argv, &res, &sz);
+ ch = mansearch(&search, &paths, argc, argv, &res, &sz);
manpath_free(&paths);
if (0 == ch)
diff --git a/mansearch.c b/mansearch.c
index 5aa30623..c82dbf97 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -39,7 +39,6 @@
#include "mandoc.h"
#include "manpath.h"
-#include "mandocdb.h"
#include "mansearch.h"
#define SQL_BIND_TEXT(_db, _s, _i, _v) \
@@ -117,15 +116,16 @@ static const struct type types[] = {
static void *hash_alloc(size_t, void *);
static void hash_free(void *, size_t, void *);
static void *hash_halloc(size_t, void *);
-static struct expr *exprcomp(int, char *[]);
+static struct expr *exprcomp(const struct mansearch *,
+ int, char *[]);
static void exprfree(struct expr *);
-static struct expr *exprterm(char *);
+static struct expr *exprterm(const struct mansearch *, char *);
static char *sql_statement(const struct expr *,
const char *, const char *);
int
-mansearch(const struct manpaths *paths,
- const char *arch, const char *sec,
+mansearch(const struct mansearch *search,
+ const struct manpaths *paths,
int argc, char *argv[],
struct manpage **res, size_t *sz)
{
@@ -158,7 +158,7 @@ mansearch(const struct manpaths *paths,
if (0 == argc)
goto out;
- if (NULL == (e = exprcomp(argc, argv)))
+ if (NULL == (e = exprcomp(search, argc, argv)))
goto out;
/*
@@ -176,7 +176,7 @@ mansearch(const struct manpaths *paths,
goto out;
}
- sql = sql_statement(e, arch, sec);
+ sql = sql_statement(e, search->arch, search->sec);
/*
* Loop over the directories (containing databases) for us to
@@ -211,10 +211,10 @@ mansearch(const struct manpaths *paths,
if (SQLITE_OK != c)
fprintf(stderr, "%s\n", sqlite3_errmsg(db));
- if (NULL != arch)
- SQL_BIND_TEXT(db, s, j, arch);
- if (NULL != sec)
- SQL_BIND_TEXT(db, s, j, arch);
+ if (NULL != search->arch)
+ SQL_BIND_TEXT(db, s, j, search->arch);
+ if (NULL != search->sec)
+ SQL_BIND_TEXT(db, s, j, search->sec);
for (ep = e; NULL != ep; ep = ep->next) {
SQL_BIND_TEXT(db, s, j, ep->v);
@@ -346,7 +346,7 @@ sql_statement(const struct expr *e, const char *arch, const char *sec)
* "(", "foo=bar", etc.).
*/
static struct expr *
-exprcomp(int argc, char *argv[])
+exprcomp(const struct mansearch *search, int argc, char *argv[])
{
int i;
struct expr *first, *next, *cur;
@@ -354,7 +354,7 @@ exprcomp(int argc, char *argv[])
first = cur = NULL;
for (i = 0; i < argc; i++) {
- next = exprterm(argv[i]);
+ next = exprterm(search, argv[i]);
if (NULL == next) {
exprfree(first);
return(NULL);
@@ -370,7 +370,7 @@ exprcomp(int argc, char *argv[])
}
static struct expr *
-exprterm(char *buf)
+exprterm(const struct mansearch *search, char *buf)
{
struct expr *e;
char *key, *v;
@@ -381,6 +381,14 @@ exprterm(char *buf)
e = mandoc_calloc(1, sizeof(struct expr));
+ /*"whatis" mode uses an opaque string and default fields. */
+
+ if (MANSEARCH_WHATIS & search->flags) {
+ e->v = buf;
+ e->bits = search->deftype;
+ return(e);
+ }
+
/*
* If no =~ is specified, search with equality over names and
* descriptions.
@@ -389,10 +397,10 @@ exprterm(char *buf)
if (NULL == (v = strpbrk(buf, "=~"))) {
e->v = buf;
- e->bits = TYPE_Nm | TYPE_Nd;
+ e->bits = search->deftype;
return(e);
} else if (v == buf)
- e->bits = TYPE_Nm | TYPE_Nd;
+ e->bits = search->deftype;
e->glob = '~' == *v;
*v++ = '\0';
diff --git a/mansearch.h b/mansearch.h
index b9caf4ae..10584c63 100644
--- a/mansearch.h
+++ b/mansearch.h
@@ -17,17 +17,65 @@
#ifndef MANSEARCH_H
#define MANSEARCH_H
+#define MANDOC_DB "mandocdb.db"
+
+#define TYPE_An 0x0000000000000001ULL
+#define TYPE_Ar 0x0000000000000002ULL
+#define TYPE_At 0x0000000000000004ULL
+#define TYPE_Bsx 0x0000000000000008ULL
+#define TYPE_Bx 0x0000000000000010ULL
+#define TYPE_Cd 0x0000000000000020ULL
+#define TYPE_Cm 0x0000000000000040ULL
+#define TYPE_Dv 0x0000000000000080ULL
+#define TYPE_Dx 0x0000000000000100ULL
+#define TYPE_Em 0x0000000000000200ULL
+#define TYPE_Er 0x0000000000000400ULL
+#define TYPE_Ev 0x0000000000000800ULL
+#define TYPE_Fa 0x0000000000001000ULL
+#define TYPE_Fl 0x0000000000002000ULL
+#define TYPE_Fn 0x0000000000004000ULL
+#define TYPE_Ft 0x0000000000008000ULL
+#define TYPE_Fx 0x0000000000010000ULL
+#define TYPE_Ic 0x0000000000020000ULL
+#define TYPE_In 0x0000000000040000ULL
+#define TYPE_Lb 0x0000000000080000ULL
+#define TYPE_Li 0x0000000000100000ULL
+#define TYPE_Lk 0x0000000000200000ULL
+#define TYPE_Ms 0x0000000000400000ULL
+#define TYPE_Mt 0x0000000000800000ULL
+#define TYPE_Nd 0x0000000001000000ULL
+#define TYPE_Nm 0x0000000002000000ULL
+#define TYPE_Nx 0x0000000004000000ULL
+#define TYPE_Ox 0x0000000008000000ULL
+#define TYPE_Pa 0x0000000010000000ULL
+#define TYPE_Rs 0x0000000020000000ULL
+#define TYPE_Sh 0x0000000040000000ULL
+#define TYPE_Ss 0x0000000080000000ULL
+#define TYPE_St 0x0000000100000000ULL
+#define TYPE_Sy 0x0000000200000000ULL
+#define TYPE_Tn 0x0000000400000000ULL
+#define TYPE_Va 0x0000000800000000ULL
+#define TYPE_Vt 0x0000001000000000ULL
+#define TYPE_Xr 0x0000002000000000ULL
+
+__BEGIN_DECLS
+
struct manpage {
char file[MAXPATHLEN]; /* prefixed by manpath */
char *desc; /* description of manpage */
int form; /* 0 == catpage */
};
-__BEGIN_DECLS
+struct mansearch {
+ const char *arch; /* architecture/NULL */
+ const char *sec; /* mansection/NULL */
+ uint64_t deftype; /* type if no key */
+ int flags;
+#define MANSEARCH_WHATIS 0x01 /* whatis mode: equality, no key */
+};
-int mansearch(const struct manpaths *paths, /* manpaths */
- const char *arch, /* architecture */
- const char *sec, /* manual section */
+int mansearch(const struct mansearch *cfg, /* options */
+ const struct manpaths *paths, /* manpaths */
int argc, /* size of argv */
char *argv[], /* search terms */
struct manpage **res, /* results */
diff --git a/whatis.1 b/whatis.1
deleted file mode 100644
index ad5e3376..00000000
--- a/whatis.1
+++ /dev/null
@@ -1,186 +0,0 @@
-.\" $Id$
-.\"
-.\" Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
-.\"
-.\" Permission to use, copy, modify, and distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.\"
-.Dd $Mdocdate$
-.Dt WHATIS 1
-.Os
-.Sh NAME
-.Nm whatis
-.Nd search for manual pages by page names
-.Sh SYNOPSIS
-.Nm
-.Op Fl C Ar file
-.Op Fl M Ar manpath
-.Op Fl m Ar manpath
-.Op Fl S Ar arch
-.Op Fl s Ar section
-.Ar name ...
-.Sh DESCRIPTION
-The
-.Nm
-utility searches databases generated by
-.Xr mandocdb 8
-for manuals containing the word
-.Ar name
-in their page name, ignoring case.
-.Pp
-By default,
-.Nm
-searches for
-.Xr mandocdb 8
-databases in the default paths stipulated by
-.Xr man 1 .
-If standard output is a TTY, a result may be selected from a list and
-its manual displayed with the pager.
-.Pp
-The options are as follows:
-.Bl -tag -width Ds
-.It Fl C Ar file
-Specify an alternative configuration
-.Ar file
-in
-.Xr man.conf 5
-format.
-.It Fl M Ar manpath
-Use the colon-separated
-.Ar manpath
-instead of the default list of paths searched for
-.Xr mandocdb 8
-databases.
-Invalid paths, or paths without manual databases, are ignored.
-.It Fl m Ar manpath
-Prepend the colon-separated
-.Ar manpath
-to the list of paths searched for
-.Xr mandocdb 8
-databases.
-Invalid paths, or paths without manual databases, are ignored.
-.It Fl S Ar arch
-Search only for a particular architecture.
-.It Fl s Ar cat
-Search only for a manual section.
-See
-.Xr man 1
-for a listing of manual sections.
-.El
-.Pp
-Results are sorted by manual title, with output formatted as
-.Pp
-.D1 title(sec) \- description
-.Pp
-Where
-.Qq title
-is the manual's title (note multiple manual names may exist for one
-title),
-.Qq sec
-is the manual section, and
-.Qq description
-is the manual's short description.
-If an architecture is specified for the manual, it is displayed as
-.Pp
-.D1 title(cat/arch) \- description
-.Pp
-If on a TTY, results are prefixed with a numeric identifier.
-.Pp
-.D1 [index] title(cat) \- description
-.Pp
-One may choose a manual be entering the index at the prompt.
-Valid choices are displayed using
-.Ev MANPAGER ,
-or failing that ,
-.Ev PAGER
-or just
-.Xr more 1 .
-Source pages are formatted with
-.Xr mandoc 1 ;
-preformatted pages with
-.Xr cat 1 .
-.Pp
-.Nm
-is identical to running
-.Xr apropos 1
-as follows:
-.Pp
-.Dl $ apropos -- -i 'Nm~[[:<:]]term[[:>:]]'
-.Sh ENVIRONMENT
-.Bl -tag -width Ds
-.It Ev MANPAGER
-Default pager for manuals.
-If this is unset, falls back to
-.Ev Pager .
-.It Ev PAGER
-The second choice for a manual pager.
-If this is unset, use
-.Xr more 1 .
-.It Ev MANPATH
-Colon-separated paths modifying the default list of paths searched for
-manual databases.
-Invalid paths, or paths without manual databases, are ignored.
-Overridden by
-.Fl M .
-If
-.Ev MANPATH
-begins with a
-.Sq \&: ,
-it is appended to the default list;
-else if it ends with
-.Sq \&: ,
-it is prepended to the default list; else if it contains
-.Sq \&:: ,
-the default list is inserted between the colons.
-If none of these conditions are met, it overrides the default list.
-.El
-.Sh FILES
-.Bl -tag -width "/etc/man.conf" -compact
-.It Pa whatis.db
-name of the
-.Xr mandocdb 8
-keyword database
-.It Pa whatis.index
-name of the
-.Xr mandocdb 8
-filename database
-.It Pa /etc/man.conf
-default
-.Xr man 1
-configuration file
-.El
-.Sh EXIT STATUS
-.Ex -std
-.Sh SEE ALSO
-.Xr apropos 1 ,
-.Xr man 1 ,
-.Xr man.conf 5 ,
-.Xr mandocdb 8
-.Sh HISTORY
-The
-.Nm
-utility first appeared in
-.Bx 2 .
-It was rewritten from scratch as part of the
-.Xr mandocdb 8
-project for
-.Ox 5.1 .
-.Sh AUTHORS
-.An -nosplit
-.An Bill Joy
-wrote the original
-.Bx
-.Nm
-in 1979.
-The current version was written by
-.An Kristaps Dzonsons ,
-.Mt kristaps@bsd.lv .