summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-12-05 14:22:12 +0000
committerru <ru@FreeBSD.org>2005-12-05 14:22:12 +0000
commit6e96e6259d287eca55fb509febe1122cd1742e16 (patch)
tree40d79d56305386356866f6c99a9547c2d0b01395 /gnu
parent92cbca9c0a7ad409d87bff6fa6943c6b016bfc94 (diff)
downloadFreeBSD-src-6e96e6259d287eca55fb509febe1122cd1742e16.zip
FreeBSD-src-6e96e6259d287eca55fb509febe1122cd1742e16.tar.gz
Prepare for MACHINE and hw.machine switching to "pc98" on FreeBSD/pc98.
Reviewed by: nyan
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/man/man/man.c37
-rw-r--r--gnu/usr.bin/man/man/man.man41
2 files changed, 67 insertions, 11 deletions
diff --git a/gnu/usr.bin/man/man/man.c b/gnu/usr.bin/man/man/man.c
index 18005df..e6ce018 100644
--- a/gnu/usr.bin/man/man/man.c
+++ b/gnu/usr.bin/man/man/man.c
@@ -24,6 +24,7 @@ static const char rcsid[] =
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/param.h>
+#include <sys/utsname.h>
#include <ctype.h>
#include <errno.h>
#ifdef __FreeBSD__
@@ -73,6 +74,7 @@ extern int do_system_command ();
char *prognam;
static char *pager;
+static char *machine_arch;
static char *machine;
static char *manp;
static char *manpathlist[MAXDIRS];
@@ -362,7 +364,11 @@ man_getopt (argc, argv)
apropos++;
break;
case 'm':
- machine = optarg;
+ machine_arch = optarg;
+ if ((machine = strchr(optarg, ':')) != NULL)
+ *machine++ = '\0';
+ else
+ machine = optarg;
break;
#ifdef __FreeBSD__
case 'o':
@@ -468,11 +474,23 @@ man_getopt (argc, argv)
if (debug)
fprintf (stderr, "\nusing %s as pager\n", pager);
+ if (machine_arch == NULL && (machine_arch = getenv ("MACHINE_ARCH")) == NULL)
+ machine_arch = MACHINE_ARCH;
+
if (machine == NULL && (machine = getenv ("MACHINE")) == NULL)
- machine = MACHINE;
+ {
+ static struct utsname utsname;
+
+ if (uname(&utsname) == -1)
+ {
+ perror ("uname");
+ exit (1);
+ }
+ machine = utsname.machine;
+ }
if (debug)
- fprintf (stderr, "\nusing %s architecture\n", machine);
+ fprintf (stderr, "\nusing %s:%s architecture\n", machine_arch, machine);
if (manp == NULL)
{
@@ -1498,6 +1516,19 @@ try_section (path, section, longsec, name, glob)
if (found && !findall) /* only do this architecture... */
return found;
}
+ if (strcmp(machine_arch, machine) != 0)
+ {
+ snprintf(buf, sizeof(buf), "%s/man%s/%s", path, section, machine_arch);
+ if (is_directory (buf) == 1)
+ {
+ snprintf(buf, sizeof(buf), "%s/%s", machine_arch, name);
+ arch_search++;
+ found = try_section (path, section, longsec, buf, glob);
+ arch_search--;
+ if (found && !findall) /* only do this architecture... */
+ return found;
+ }
+ }
}
if (debug)
diff --git a/gnu/usr.bin/man/man/man.man b/gnu/usr.bin/man/man/man.man
index 9f808bf..963d001 100644
--- a/gnu/usr.bin/man/man/man.man
+++ b/gnu/usr.bin/man/man/man.man
@@ -14,7 +14,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 5, 1991
+.Dd December 3, 2005
.Dt MAN 1
.Os
.Sh NAME
@@ -23,7 +23,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl adfhkotw
-.Op Fl m Ar machine
+.Op Fl m Ar arch Ns Op : Ns Ar machine
.Op Fl p Ar string
.Op Fl M Ar path
.Op Fl P Ar pager
@@ -103,20 +103,40 @@ Print a help message and exit.
.It Fl k
Equivalent to
.Nm apropos .
-.It Fl m Ar machine
-As some manual pages are intended only for specific architectures,
+.It Fl m Ar arch Ns Op : Ns Ar machine
+As some manual pages are intended only for specific
+architectures and machine types,
.Nm
searches any subdirectories,
-with the same name as the current architecture,
+with the same name as the current machine type and architecture,
in every directory which it searches.
-Machine specific areas are checked before general areas.
+Machine specific areas are checked before architecture specific areas,
+and architecture specific areas are checked before general areas.
+For example, for
+.Dq Li i386:pc98 ,
+the following subdirectories will be searched for section 8
+manpages, in order:
+.Pa man8/pc98, man8/i386 ,
+and
+.Pa man8 .
+.Pp
The current machine type may be overridden using this option
or by setting the environment variable
.Ev MACHINE
+to the name of a specific machine.
+The current architecture may be overridden using this option
+or by setting the environment variable
+.Ev MACHINE_ARCH
to the name of a specific architecture.
This option overrides the
.Ev MACHINE
-environment variable.
+and
+.Ev MACHINE_ARCH
+environment variables.
+A
+.Ar machine
+component, if omitted, defaults to
+.Ar arch .
.It Fl o
Look for original, non-localized manpages only.
.Pp
@@ -201,7 +221,7 @@ Do not actually display the man pages, but do print the location(s) of
the files that would be formatted or displayed.
.El
.Sh ENVIRONMENT
-.Bl -tag -width MANROFFSEQ
+.Bl -tag -width ".Ev MACHINE_ARCH"
.It Ev LC_ALL , LC_CTYPE , LANG
These variables specify the preferred language for manual pages.
(See the
@@ -212,6 +232,11 @@ If
.Ev MACHINE
is set, its value is used to override the current machine type
when searching machine specific subdirectories.
+.It Ev MACHINE_ARCH
+If
+.Ev MACHINE_ARCH
+is set, its value is used to override the current architecture
+when searching architecture specific subdirectories.
.It Ev MANPATH
If
.Ev MANPATH
OpenPOWER on IntegriCloud