summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/man/man.116
-rw-r--r--usr.bin/man/man.c29
2 files changed, 33 insertions, 12 deletions
diff --git a/usr.bin/man/man.1 b/usr.bin/man/man.1
index 632229bfa3b..8c814903fc2 100644
--- a/usr.bin/man/man.1
+++ b/usr.bin/man/man.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: man.1,v 1.3 1996/06/26 05:37:00 deraadt Exp $
+.\" $OpenBSD: man.1,v 1.4 1998/03/09 23:20:12 millert Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,9 +33,9 @@
.\"
.\" @(#)man.1 8.2 (Berkeley) 1/2/94
.\"
-.Dd January 2, 1994
+.Dd March 9, 1998
.Dt MAN 1
-.Os BSD 4
+.Os
.Sh NAME
.Nm man
.Nd display the on-line manual pages
@@ -45,6 +45,8 @@
.Op Fl C Ar file
.Op Fl M Ar path
.Op Fl m Ar path
+.Op Fl s Ar section
+.Op Fl S Ar subsection
.Op Ar section
.Ar name Ar ...
.Sh DESCRIPTION
@@ -112,6 +114,14 @@ The subdirectories to be searched, and their search order,
is specified by the ``_subdir'' line in the
.Nm man
configuration file.
+.It Fl s
+Another way of specifying the section, for compatibility with
+.Nm man
+on other operating systems.
+.It Fl S
+Specifies the machine-dependent subsection. This overrides the
+.Ev MACHINE
+environment variable. See the ``ENVIRONMENT'' section below.
.It Fl w
List the pathnames of the manual pages which
.Nm man
diff --git a/usr.bin/man/man.c b/usr.bin/man/man.c
index 0a5f2152393..10d71092095 100644
--- a/usr.bin/man/man.c
+++ b/usr.bin/man/man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man.c,v 1.6 1997/09/10 04:16:30 deraadt Exp $ */
+/* $OpenBSD: man.c,v 1.7 1998/03/09 23:20:13 millert Exp $ */
/* $NetBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
#else
-static char rcsid[] = "$OpenBSD: man.c,v 1.6 1997/09/10 04:16:30 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: man.c,v 1.7 1998/03/09 23:20:13 millert Exp $";
#endif
#endif /* not lint */
@@ -90,12 +90,13 @@ main(argc, argv)
glob_t pg;
size_t len;
int ch, f_cat, f_how, found;
- char **ap, *cmd, *machine, *p, *p_add, *p_path, *pager, *slashp;
+ char **ap, *cmd, *machine, *p, *p_add, *p_path, *pager, *sflag, *slashp;
char *conffile, buf[MAXPATHLEN * 2];
+ machine = sflag = NULL;
f_cat = f_how = 0;
conffile = p_add = p_path = NULL;
- while ((ch = getopt(argc, argv, "-aC:cfhkM:m:P:w")) != -1)
+ while ((ch = getopt(argc, argv, "-aC:cfhkM:m:P:s:S:w")) != -1)
switch (ch) {
case 'a':
f_all = 1;
@@ -117,6 +118,12 @@ main(argc, argv)
case 'P': /* Backward compatibility. */
p_path = optarg;
break;
+ case 's': /* SVR4 compatibility. */
+ sflag = optarg;
+ break;
+ case 'S':
+ machine = optarg;
+ break;
/*
* The -f and -k options are backward compatible,
* undocumented ways of calling whatis(1) and apropos(1).
@@ -151,8 +158,8 @@ main(argc, argv)
/* Read the configuration file. */
config(conffile);
- /* Get the machine type. */
- if ((machine = getenv("MACHINE")) == NULL)
+ /* Get the machine type unless specified by -S. */
+ if (machine == NULL && (machine = getenv("MACHINE")) == NULL)
machine = MACHINE;
/* If there's no _default list, create an empty one. */
@@ -191,10 +198,14 @@ main(argc, argv)
* 2: If the user did not specify MANPATH, -M or a section, rewrite
* the _default list to include the _subdir list and the machine.
*/
- if (argv[1] == NULL)
+ if (sflag == NULL && argv[1] == NULL)
section = NULL;
- else if ((section = getlist(*argv)) != NULL)
- ++argv;
+ else {
+ if (sflag != NULL && (section = getlist(sflag)) == NULL)
+ errx(1, "unknown manual section `%s'", sflag);
+ else if (sflag == NULL && (section = getlist(*argv)) != NULL)
+ ++argv;
+ }
if (p_path == NULL && section == NULL) {
defnewp = addlist("_default_new");
e_defp =