usr.bin/man: Update
Change-Id: I0c5d2115ba384687032f7b2af50d99dedc323b7a
This commit is contained in:
parent
92395e9c3f
commit
b9a6a72b65
5 changed files with 161 additions and 30 deletions
81
etc/man.conf
81
etc/man.conf
|
@ -1,16 +1,69 @@
|
||||||
|
# $NetBSD: man.conf,v 1.31 2012/10/06 15:33:59 wiz Exp $
|
||||||
|
|
||||||
|
# Sheer, raging paranoia...
|
||||||
_version BSD.2
|
_version BSD.2
|
||||||
_subdir man{[1-9],1x}
|
|
||||||
|
# The whatis/apropos database.
|
||||||
|
_mandb /var/db/man.db
|
||||||
|
|
||||||
|
# Subdirectories for paths ending in '/', IN SEARCH ORDER.
|
||||||
|
_subdir cat1 man1 cat8 man8 cat6 man6 cat2 man2 cat3 man3 cat4 man4 cat5 man5 cat7 man7 man3f cat9 man9 catn mann catl manl
|
||||||
|
|
||||||
|
# Files typed by suffix and their commands.
|
||||||
|
# Note the order, .Z must come after .[1-9].Z, or it will match first.
|
||||||
_suffix .0
|
_suffix .0
|
||||||
_build .[1-9] mandoc %s
|
_build .0.Z /usr/bin/zcat %s
|
||||||
_build .tbl tbl %s | mandoc
|
_build .0.bz2 /usr/bin/bzcat %s
|
||||||
_default /usr/{,pkg/{,gcc*/}}man
|
_build .0.gz /usr/bin/zcat %s
|
||||||
_whatdb /usr/{,pkg/{,gcc*/}}man/whatis.db
|
_build .0.xz /usr/bin/xzcat %s
|
||||||
1 man1
|
_build .[1-9ln] /usr/bin/mandoc %s
|
||||||
2 man2
|
_build .[1-9ln].Z /usr/bin/zcat %s | /usr/bin/mandoc
|
||||||
3 man3
|
_build .[1-9ln].bz2 /usr/bin/bzcat %s | /usr/bin/mandoc
|
||||||
4 man4
|
_build .[1-9ln].gz /usr/bin/zcat %s | /usr/bin/mandoc
|
||||||
5 man5
|
_build .[1-9ln].xz /usr/bin/xzcat %s | /usr/bin/mandoc
|
||||||
6 man6
|
_build .tbl /usr/bin/mandoc %s
|
||||||
7 man7
|
_build .tbl.Z /usr/bin/zcat %s | /usr/bin/mandoc
|
||||||
8 man8
|
_build .tbl.bz2 /usr/bin/bzcat %s | /usr/bin/mandoc
|
||||||
9 man9
|
_build .tbl.gz /usr/bin/zcat %s | /usr/bin/mandoc
|
||||||
|
_build .tbl.xz /usr/bin/xzcat %s | /usr/bin/mandoc
|
||||||
|
|
||||||
|
_build .me /usr/bin/nroff -msafer -me %s 2>/dev/null | cat -s
|
||||||
|
|
||||||
|
_crunch .Z /usr/bin/zcat > %s
|
||||||
|
_crunch .bz /usr/bin/bzcat > %s
|
||||||
|
_crunch .gz /usr/bin/zcat > %s
|
||||||
|
_crunch .xz /usr/bin/xzcat > %s
|
||||||
|
|
||||||
|
# Sections and their directories.
|
||||||
|
# All paths ending in '/' are the equivalent of entries specifying that
|
||||||
|
# directory with all of the subdirectories listed for the keyword _subdir.
|
||||||
|
|
||||||
|
# default
|
||||||
|
# MINIX: Add /usr/man ...
|
||||||
|
_default /usr/{,share,X11R7,X11R6,pkg,local}/man/
|
||||||
|
|
||||||
|
# Other sections that represent complete man subdirectories.
|
||||||
|
X11R7 /usr/X11R7/man/
|
||||||
|
X11R6 /usr/X11R6/man/
|
||||||
|
packages /usr/pkg/man/
|
||||||
|
local /usr/local/man/
|
||||||
|
|
||||||
|
# Specific section/directory combinations.
|
||||||
|
1 {cat,man}1
|
||||||
|
2 {cat,man}2
|
||||||
|
3 {cat,man}3
|
||||||
|
3F {cat,man}3f
|
||||||
|
3f {cat,man}3f
|
||||||
|
4 {cat,man}4
|
||||||
|
5 {cat,man}5
|
||||||
|
6 {cat,man}6
|
||||||
|
7 {cat,man}7
|
||||||
|
8 {cat,man}8
|
||||||
|
9 {cat,man}9
|
||||||
|
l {cat,man}l
|
||||||
|
n {cat,man}n
|
||||||
|
|
||||||
|
# machine classes per machine
|
||||||
|
_i386 x86
|
||||||
|
_amd64 x86
|
||||||
|
_sparc64 sparc
|
||||||
|
|
|
@ -199,7 +199,7 @@
|
||||||
2012/10/17 12:00:00,usr.bin/make
|
2012/10/17 12:00:00,usr.bin/make
|
||||||
2012/10/17 12:00:00,usr.bin/Makefile
|
2012/10/17 12:00:00,usr.bin/Makefile
|
||||||
2012/10/17 12:00:00,usr.bin/Makefile.inc
|
2012/10/17 12:00:00,usr.bin/Makefile.inc
|
||||||
2010/07/07 21:24:34,usr.bin/man
|
2012/10/17 12:00:00,usr.bin/man
|
||||||
2012/10/17 12:00:00,usr.bin/menuc
|
2012/10/17 12:00:00,usr.bin/menuc
|
||||||
2013/10/25 12:00:00,usr.bin/mesg
|
2013/10/25 12:00:00,usr.bin/mesg
|
||||||
2010/10/15 05:46:48,usr.bin/mkdep
|
2010/10/15 05:46:48,usr.bin/mkdep
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: man.1,v 1.21 2009/10/07 08:30:31 cegger Exp $
|
.\" $NetBSD: man.1,v 1.24 2011/10/07 10:52:31 mbalmer Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1989, 1990, 1993
|
.\" Copyright (c) 1989, 1990, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
.\"
|
.\"
|
||||||
.\" @(#)man.1 8.2 (Berkeley) 1/2/94
|
.\" @(#)man.1 8.2 (Berkeley) 1/2/94
|
||||||
.\"
|
.\"
|
||||||
.Dd October 6, 2009
|
.Dd October 7, 2011
|
||||||
.Dt MAN 1
|
.Dt MAN 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -49,11 +49,13 @@
|
||||||
.Oc
|
.Oc
|
||||||
.Ar name Ar ...
|
.Ar name Ar ...
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl k
|
.Fl k
|
||||||
.Op Fl C Ar file
|
.Op Fl C Ar file
|
||||||
.Op Fl M Ar path
|
.Op Fl M Ar path
|
||||||
.Op Fl m Ar path
|
.Op Fl m Ar path
|
||||||
.Ar keyword Ar ...
|
.Ar keyword Ar ...
|
||||||
|
.Nm
|
||||||
|
.Fl p
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
.Nm
|
.Nm
|
||||||
|
@ -130,6 +132,8 @@ is specified by the
|
||||||
line in the
|
line in the
|
||||||
.Nm
|
.Nm
|
||||||
configuration file.
|
configuration file.
|
||||||
|
.It Fl p
|
||||||
|
Print the search path for the manual pages.
|
||||||
.It Fl s
|
.It Fl s
|
||||||
Restrict the directories that
|
Restrict the directories that
|
||||||
.Nm
|
.Nm
|
||||||
|
@ -220,7 +224,7 @@ will be used.
|
||||||
.Bl -hang -width /etc/man.conf -compact
|
.Bl -hang -width /etc/man.conf -compact
|
||||||
.It Pa /etc/man.conf
|
.It Pa /etc/man.conf
|
||||||
default man configuration file.
|
default man configuration file.
|
||||||
.It Pa /usr/{share,X11R6,pkg,local}/man/whatis.db
|
.It Pa /usr/{share,X11R7,pkg,local}/man/whatis.db
|
||||||
standard whatis/apropos database search path,
|
standard whatis/apropos database search path,
|
||||||
set in
|
set in
|
||||||
.Pa /etc/man.conf .
|
.Pa /etc/man.conf .
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: man.c,v 1.41 2010/07/07 21:24:34 christos Exp $ */
|
/* $NetBSD: man.c,v 1.44 2012/01/03 17:49:57 joerg Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1987, 1993, 1994, 1995
|
* Copyright (c) 1987, 1993, 1994, 1995
|
||||||
|
@ -40,12 +40,13 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994, 1995\
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
|
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: man.c,v 1.41 2010/07/07 21:24:34 christos Exp $");
|
__RCSID("$NetBSD: man.c,v 1.44 2012/01/03 17:49:57 joerg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -84,6 +85,7 @@ struct manstate {
|
||||||
char *pathsearch; /* -S: path of man must contain this string */
|
char *pathsearch; /* -S: path of man must contain this string */
|
||||||
char *sectionname; /* -s: limit search to a given man section */
|
char *sectionname; /* -s: limit search to a given man section */
|
||||||
int where; /* -w: just show paths of all matching files */
|
int where; /* -w: just show paths of all matching files */
|
||||||
|
int getpath; /* -p: print the path of directories containing man pages */
|
||||||
|
|
||||||
/* important tags from the config file */
|
/* important tags from the config file */
|
||||||
TAG *defaultpath; /* _default: default MANPATH */
|
TAG *defaultpath; /* _default: default MANPATH */
|
||||||
|
@ -118,6 +120,7 @@ static void onsig(int);
|
||||||
static void usage(void) __attribute__((__noreturn__));
|
static void usage(void) __attribute__((__noreturn__));
|
||||||
static void addpath(struct manstate *, const char *, size_t, const char *);
|
static void addpath(struct manstate *, const char *, size_t, const char *);
|
||||||
static const char *getclass(const char *);
|
static const char *getclass(const char *);
|
||||||
|
static void printmanpath(struct manstate *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main function
|
* main function
|
||||||
|
@ -137,7 +140,7 @@ main(int argc, char **argv)
|
||||||
/*
|
/*
|
||||||
* parse command line...
|
* parse command line...
|
||||||
*/
|
*/
|
||||||
while ((ch = getopt(argc, argv, "-aC:cfhkM:m:P:s:S:w")) != -1)
|
while ((ch = getopt(argc, argv, "-aC:cfhkM:m:P:ps:S:w")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'a':
|
case 'a':
|
||||||
m.all = 1;
|
m.all = 1;
|
||||||
|
@ -159,6 +162,9 @@ main(int argc, char **argv)
|
||||||
case 'P': /* -P for backward compatibility */
|
case 'P': /* -P for backward compatibility */
|
||||||
m.manpath = strdup(optarg);
|
m.manpath = strdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'p':
|
||||||
|
m.getpath = 1;
|
||||||
|
break;
|
||||||
/*
|
/*
|
||||||
* The -f and -k options are backward compatible,
|
* The -f and -k options are backward compatible,
|
||||||
* undocumented ways of calling whatis(1) and apropos(1).
|
* undocumented ways of calling whatis(1) and apropos(1).
|
||||||
|
@ -187,7 +193,7 @@ main(int argc, char **argv)
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
if (!argc)
|
if (!m.getpath && !argc)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -358,6 +364,9 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m.getpath)
|
||||||
|
printmanpath(&m);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* now m.mymanpath is complete!
|
* now m.mymanpath is complete!
|
||||||
*/
|
*/
|
||||||
|
@ -984,5 +993,55 @@ usage(void)
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"Usage: %s -k [-C cfg] [-M path] [-m path] keyword ...\n",
|
"Usage: %s -k [-C cfg] [-M path] [-m path] keyword ...\n",
|
||||||
getprogname());
|
getprogname());
|
||||||
|
(void)fprintf(stderr, "Usage: %s -p\n", getprogname());
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* printmanpath --
|
||||||
|
* Prints a list of directories containing man pages.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
printmanpath(struct manstate *m)
|
||||||
|
{
|
||||||
|
ENTRY *esubd;
|
||||||
|
char *defaultpath = NULL; /* _default tag value from man.conf. */
|
||||||
|
char *buf; /* for storing temporary values */
|
||||||
|
char **ap;
|
||||||
|
glob_t pg;
|
||||||
|
struct stat sb;
|
||||||
|
TAG *path = m->defaultpath;
|
||||||
|
TAG *subdirs = m->subdirs;
|
||||||
|
|
||||||
|
/* the tail queue is empty if no _default tag is defined in * man.conf */
|
||||||
|
if (TAILQ_EMPTY(&path->entrylist))
|
||||||
|
errx(EXIT_FAILURE, "Empty manpath");
|
||||||
|
|
||||||
|
defaultpath = TAILQ_LAST(&path->entrylist, tqh)->s;
|
||||||
|
|
||||||
|
if (glob(defaultpath, GLOB_BRACE | GLOB_NOSORT, NULL, &pg) != 0)
|
||||||
|
err(EXIT_FAILURE, "glob failed");
|
||||||
|
|
||||||
|
if (pg.gl_matchc == 0) {
|
||||||
|
warnx("Default path in %s doesn't exist", _PATH_MANCONF);
|
||||||
|
globfree(&pg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TAILQ_FOREACH(esubd, &subdirs->entrylist, q) {
|
||||||
|
/* Drop cat page directory, only sources are relevant. */
|
||||||
|
if (strncmp(esubd->s, "man", 3))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
|
||||||
|
if (asprintf(&buf, "%s%s", *ap, esubd->s) == -1)
|
||||||
|
err(EXIT_FAILURE, "memory allocation error");
|
||||||
|
/* Skip non-directories. */
|
||||||
|
if (stat(buf, &sb) == 0 && S_ISDIR(sb.st_mode))
|
||||||
|
printf("%s\n", buf);
|
||||||
|
|
||||||
|
free(buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
globfree(&pg);
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: man.conf.5,v 1.20 2007/02/10 19:27:39 reed Exp $
|
.\" $NetBSD: man.conf.5,v 1.22 2012/04/29 03:46:43 christos Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1989, 1991, 1993
|
.\" Copyright (c) 1989, 1991, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
.\"
|
.\"
|
||||||
.\" @(#)man.conf.5 8.5 (Berkeley) 1/2/94
|
.\" @(#)man.conf.5 8.5 (Berkeley) 1/2/94
|
||||||
.\"
|
.\"
|
||||||
.Dd April 10, 2006
|
.Dd April 28, 2012
|
||||||
.Dt MAN.CONF 5
|
.Dt MAN.CONF 5
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -98,9 +98,9 @@ The suffix specification may contain the normal shell globbing characters
|
||||||
The rest of the _build line is a shell command line whose standard
|
The rest of the _build line is a shell command line whose standard
|
||||||
output is a formatted manual page that can be directly displayed to
|
output is a formatted manual page that can be directly displayed to
|
||||||
the user.
|
the user.
|
||||||
Any occurrences of the string
|
There should be exactly one occurrence of the string
|
||||||
.Dq %s
|
.Dq %s
|
||||||
in the shell command line will
|
in the shell command line, and it will
|
||||||
be replaced by the name of the file which is being formatted.
|
be replaced by the name of the file which is being formatted.
|
||||||
.It _crunch
|
.It _crunch
|
||||||
used by
|
used by
|
||||||
|
@ -110,6 +110,10 @@ which originally were compressed man pages: The first field lists a suffix
|
||||||
which indicates what kind of compression were used to compress the man page.
|
which indicates what kind of compression were used to compress the man page.
|
||||||
The rest of the line must be a shell command line, used to compress the
|
The rest of the line must be a shell command line, used to compress the
|
||||||
formatted pages.
|
formatted pages.
|
||||||
|
There should be exactly one occurrence of the string
|
||||||
|
.Dq %s
|
||||||
|
in the shell command line, and it will
|
||||||
|
be replaced by the name of the output file.
|
||||||
.It _default
|
.It _default
|
||||||
contains the system-wide default man path used to search for man pages.
|
contains the system-wide default man path used to search for man pages.
|
||||||
.It _subdir
|
.It _subdir
|
||||||
|
@ -152,6 +156,16 @@ including curly braces
|
||||||
to escape a shell globbing character,
|
to escape a shell globbing character,
|
||||||
precede it with a backslash
|
precede it with a backslash
|
||||||
.Pq Dq \e .
|
.Pq Dq \e .
|
||||||
|
.It _\*[Lt]machine\*[Gt]
|
||||||
|
The defines additional paths to be searched for the particular
|
||||||
|
.Dv machine
|
||||||
|
whose literal value is taken from
|
||||||
|
.Xr uname 1
|
||||||
|
.Fl m .
|
||||||
|
For example on an
|
||||||
|
.Dv amd64 ,
|
||||||
|
.Dv _amd64
|
||||||
|
is used.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
Section configuration lines in
|
Section configuration lines in
|
||||||
|
@ -219,6 +233,7 @@ _subdir cat[123]
|
||||||
_suffix .0
|
_suffix .0
|
||||||
_build .[1-9] nroff -man %s
|
_build .[1-9] nroff -man %s
|
||||||
_build .tbl tbl %s | nroff -man
|
_build .tbl tbl %s | nroff -man
|
||||||
|
_i386 x86
|
||||||
_default /usr/share/man/
|
_default /usr/share/man/
|
||||||
sect3 /usr/share/man/{old/,}cat3
|
sect3 /usr/share/man/{old/,}cat3
|
||||||
.Ed
|
.Ed
|
||||||
|
|
Loading…
Reference in a new issue