aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--apropos.128
-rw-r--r--apropos.c14
-rw-r--r--catman.c4
-rw-r--r--cgi.c6
-rw-r--r--mandocdb.828
-rw-r--r--mandocdb.c18
-rw-r--r--manpath.c13
-rw-r--r--manpath.h8
-rw-r--r--whatis.175
9 files changed, 144 insertions, 50 deletions
diff --git a/apropos.1 b/apropos.1
index 2d84d6ea..f958f4f2 100644
--- a/apropos.1
+++ b/apropos.1
@@ -1,4 +1,4 @@
-.\" $Id: apropos.1,v 1.12 2011/11/29 10:59:19 kristaps Exp $
+.\" $Id: apropos.1,v 1.13 2011/12/12 02:00:49 schwarze Exp $
.\"
.\" Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 29 2011 $
+.Dd $Mdocdate: December 12 2011 $
.Dt APROPOS 1
.Os
.Sh NAME
@@ -22,11 +22,12 @@
.Nd search manual page databases
.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 expression...
+.Ar expression ...
.Sh DESCRIPTION
The
.Nm
@@ -37,6 +38,12 @@ evaluating on
for each file in each database.
Its arguments 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 path instead of the default list of paths
searched for
@@ -238,6 +245,21 @@ Invalid paths, or paths without manual databases, are ignored.
Overridden by
.Fl M .
.El
+.Sh FILES
+.Bl -tag -width "/etc/man.conf" -compact
+.It Pa mandoc.db
+name of the
+.Xr mandocdb 8
+keyword database
+.It Pa mandoc.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 EXAMPLES
diff --git a/apropos.c b/apropos.c
index b33855e1..15faf977 100644
--- a/apropos.c
+++ b/apropos.c
@@ -1,4 +1,4 @@
-/* $Id: apropos.c,v 1.23 2011/12/07 16:08:55 kristaps Exp $ */
+/* $Id: apropos.c,v 1.24 2011/12/12 02:00:49 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -44,6 +44,7 @@ main(int argc, char *argv[])
struct opts opts;
struct expr *e;
char *defpaths, *auxpaths;
+ char *conf_file;
extern int optind;
extern char *optarg;
@@ -59,10 +60,14 @@ main(int argc, char *argv[])
memset(&opts, 0, sizeof(struct opts));
auxpaths = defpaths = NULL;
+ conf_file = NULL;
e = NULL;
- while (-1 != (ch = getopt(argc, argv, "M:m:S:s:")))
+ while (-1 != (ch = getopt(argc, argv, "C:M:m:S:s:")))
switch (ch) {
+ case ('C'):
+ conf_file = optarg;
+ break;
case ('M'):
defpaths = optarg;
break;
@@ -88,7 +93,7 @@ main(int argc, char *argv[])
rc = 0;
- manpath_parse(&paths, defpaths, auxpaths);
+ manpath_parse(&paths, conf_file, defpaths, auxpaths);
e = whatis ? termcomp(argc, argv, &terms) :
exprcomp(argc, argv, &terms);
@@ -142,10 +147,11 @@ usage(void)
{
fprintf(stderr, "usage: %s "
+ "[-C file] "
"[-M manpath] "
"[-m manpath] "
"[-S arch] "
"[-s section] "
- "expression...\n",
+ "expression ...\n",
progname);
}
diff --git a/catman.c b/catman.c
index 5b38f214..031beb84 100644
--- a/catman.c
+++ b/catman.c
@@ -1,4 +1,4 @@
-/* $Id: catman.c,v 1.4 2011/12/08 00:20:52 kristaps Exp $ */
+/* $Id: catman.c,v 1.5 2011/12/12 02:00:49 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -112,7 +112,7 @@ main(int argc, char *argv[])
}
memset(&dirs, 0, sizeof(struct manpaths));
- manpath_parse(&dirs, base, aux);
+ manpath_parse(&dirs, NULL, base, aux);
ch = manup(&dirs, buf);
manpath_free(&dirs);
return(ch ? EXIT_SUCCESS : EXIT_FAILURE);
diff --git a/cgi.c b/cgi.c
index 52bf2720..30075489 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.29 2011/12/11 00:22:47 kristaps Exp $ */
+/* $Id: cgi.c,v 1.30 2011/12/12 02:00:49 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -792,7 +792,7 @@ pg_show(const struct req *req, char *path)
}
memset(&ps, 0, sizeof(struct manpaths));
- manpath_manconf("etc/catman.conf", &ps);
+ manpath_manconf(&ps, "etc/catman.conf");
if (vol >= (unsigned int)ps.sz) {
resp_error400();
@@ -878,7 +878,7 @@ pg_search(const struct req *req, char *path)
}
memset(&ps, 0, sizeof(struct manpaths));
- manpath_manconf("etc/catman.conf", &ps);
+ manpath_manconf(&ps, "etc/catman.conf");
/*
* Poor man's tokenisation: just break apart by spaces.
diff --git a/mandocdb.8 b/mandocdb.8
index e8e84ec8..0469c13b 100644
--- a/mandocdb.8
+++ b/mandocdb.8
@@ -1,4 +1,4 @@
-.\" $Id: mandocdb.8,v 1.11 2011/12/02 00:21:56 kristaps Exp $
+.\" $Id: mandocdb.8,v 1.12 2011/12/12 02:00:49 schwarze Exp $
.\"
.\" Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: December 2 2011 $
+.Dd $Mdocdate: December 12 2011 $
.Dt MANDOCDB 8
.Os
.Sh NAME
@@ -23,7 +23,10 @@
.Sh SYNOPSIS
.Nm
.Op Fl av
-.Op Ar dir ...
+.Op Fl C Ar file
+.Nm
+.Op Fl av
+.Ar dir ...
.Nm
.Op Fl v
.Fl d Ar dir
@@ -69,10 +72,16 @@ uses the default paths stipulated by
.Xr man 1 .
.Pp
The arguments are as follows:
-.Bl -tag -width Ds
+.Bl -tag -width "-C file"
.It Fl a
Use all directories and files found below
.Ar dir ... .
+.It Fl C Ar file
+Specify an alternative configuration
+.Ar file
+in
+.Xr man.conf 5
+format.
.It Fl d Ar dir
Merge (remove and re-add)
.Ar
@@ -141,7 +150,7 @@ length plus one) mapping to a 12-byte binary field consisting of the
64-bit keyword type and 32-bit source
.Sx Index Database
record number, both in network-byte order.
-The typet bit-mask consists of the following
+The type bit-mask consists of the following
values mapping into
.Xr mdoc 7
macro identifiers:
@@ -208,6 +217,10 @@ keyword database mapping keywords to a type and file reference in
A
.Xr recno 3
database of indexed file-names.
+.It Pa /etc/man.conf
+The default
+.Xr man 1
+configuration file.
.El
.Sh EXIT STATUS
The
@@ -249,9 +262,12 @@ This usually indicates database corruption or invalid command-line
arguments.
.El
.Sh SEE ALSO
+.Xr apropos 1 ,
.Xr man 1 ,
+.Xr whatis 1 ,
.Xr btree 3 ,
-.Xr recno 3
+.Xr recno 3 ,
+.Xr man.conf 5
.Sh AUTHORS
The
.Nm
diff --git a/mandocdb.c b/mandocdb.c
index b7c7e0b3..fe9c01a7 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.33 2011/12/10 22:01:06 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.34 2011/12/12 02:00:49 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -273,6 +273,7 @@ main(int argc, char *argv[])
struct manpaths dirs;
enum op op; /* current operation */
const char *dir;
+ char *conf_file;
char *cp;
char pbuf[PATH_MAX],
ibuf[MAXPATHLEN], /* index fname */
@@ -312,12 +313,16 @@ main(int argc, char *argv[])
maxrec = 0;
op = OP_NEW;
dir = NULL;
+ conf_file = NULL;
- while (-1 != (ch = getopt(argc, argv, "ad:u:v")))
+ while (-1 != (ch = getopt(argc, argv, "aC:d:u:v")))
switch (ch) {
case ('a'):
use_all = 1;
break;
+ case ('C'):
+ conf_file = optarg;
+ break;
case ('d'):
dir = optarg;
op = OP_UPDATE;
@@ -426,7 +431,7 @@ main(int argc, char *argv[])
dirs.paths[i] = mandoc_strdup(cp);
}
} else
- manpath_parse(&dirs, NULL, NULL);
+ manpath_parse(&dirs, conf_file, NULL, NULL);
for (i = 0; i < dirs.sz; i++) {
ibuf[0] = fbuf[0] = '\0';
@@ -1660,7 +1665,8 @@ usage(void)
{
fprintf(stderr, "usage: %s [-v] "
- "[-d dir [files...] |"
- " -u dir [files...] |"
- " dir...]\n", progname);
+ "[-C file] |"
+ " dir ... |"
+ " -d dir [file ...] |"
+ " -u dir [file ...]\n", progname);
}
diff --git a/manpath.c b/manpath.c
index 7ce672e2..1ed7f9c5 100644
--- a/manpath.c
+++ b/manpath.c
@@ -1,4 +1,4 @@
-/* $Id: manpath.c,v 1.4 2011/11/26 22:38:11 schwarze Exp $ */
+/* $Id: manpath.c,v 1.5 2011/12/12 02:00:49 schwarze Exp $ */
/*
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -36,7 +36,8 @@
static void manpath_add(struct manpaths *, const char *);
void
-manpath_parse(struct manpaths *dirs, char *defp, char *auxp)
+manpath_parse(struct manpaths *dirs, const char *file,
+ char *defp, char *auxp)
{
manpath_parseline(dirs, auxp);
@@ -45,7 +46,7 @@ manpath_parse(struct manpaths *dirs, char *defp, char *auxp)
defp = getenv("MANPATH");
if (NULL == defp)
- manpath_parseconf(dirs);
+ manpath_parseconf(dirs, file);
else
manpath_parseline(dirs, defp);
}
@@ -91,7 +92,7 @@ manpath_add(struct manpaths *dirs, const char *dir)
}
void
-manpath_parseconf(struct manpaths *dirs)
+manpath_parseconf(struct manpaths *dirs, const char *file)
{
#ifdef USE_MANPATH
FILE *stream;
@@ -124,7 +125,7 @@ manpath_parseconf(struct manpaths *dirs)
free(buf);
pclose(stream);
#else
- manpath_manconf(MAN_CONF_FILE, dirs);
+ manpath_manconf(dirs, file ? file : MAN_CONF_FILE);
#endif
}
@@ -140,7 +141,7 @@ manpath_free(struct manpaths *p)
}
void
-manpath_manconf(const char *file, struct manpaths *dirs)
+manpath_manconf(struct manpaths *dirs, const char *file)
{
FILE *stream;
char *p, *q;
diff --git a/manpath.h b/manpath.h
index e60558c5..d55a0452 100644
--- a/manpath.h
+++ b/manpath.h
@@ -1,4 +1,4 @@
-/* $Id: manpath.h,v 1.3 2011/11/24 10:44:56 kristaps Exp $ */
+/* $Id: manpath.h,v 1.4 2011/12/12 02:00:49 schwarze Exp $ */
/*
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -29,9 +29,9 @@ struct manpaths {
__BEGIN_DECLS
-void manpath_manconf(const char *, struct manpaths *);
-void manpath_parse(struct manpaths *, char *, char *);
-void manpath_parseconf(struct manpaths *);
+void manpath_manconf(struct manpaths *, const char *);
+void manpath_parse(struct manpaths *, const char *, char *, char *);
+void manpath_parseconf(struct manpaths *, const char *);
void manpath_parseline(struct manpaths *, char *);
void manpath_free(struct manpaths *);
diff --git a/whatis.1 b/whatis.1
index c927ef8c..8ade7f45 100644
--- a/whatis.1
+++ b/whatis.1
@@ -1,4 +1,4 @@
-.\" $Id: whatis.1,v 1.3 2011/11/29 10:59:19 kristaps Exp $
+.\" $Id: whatis.1,v 1.4 2011/12/12 02:00:49 schwarze Exp $
.\"
.\" Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
@@ -14,37 +14,52 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 29 2011 $
+.Dd $Mdocdate: December 12 2011 $
.Dt WHATIS 1
.Os
.Sh NAME
.Nm whatis
-.Nd search manual page databases
+.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 term...
+.Ar name ...
.Sh DESCRIPTION
The
.Nm
-utility searches for manuals named or described with
-.Ar term
-in manual page databases generated by
-.Xr mandocdb 8 .
-Its arguments are as follows:
+utility searches databases generated by
+.Xr mandocdb 8
+for manuals containing the word
+.Ar name
+in their page name, ignoring case.
+It returns the header lines from all matching pages.
+You can then use the
+.Xr man 1
+command to get more information.
+.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 path instead of the default list of paths
-searched for
+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 paths to the list of paths searched
-for
+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.
@@ -102,16 +117,44 @@ Invalid paths, or paths without manual databases, are ignored.
Overridden by
.Fl M .
.El
-.\" .Sh FILES
+.Sh FILES
+.Bl -tag -width "/etc/man.conf" -compact
+.It Pa mandoc.db
+name of the
+.Xr mandocdb 8
+keyword database
+.It Pa mandoc.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 AUTHORS
+.Sh HISTORY
The
.Nm
-utility was written by
+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 .