summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/catman/catman.111
-rw-r--r--usr.bin/catman/catman.c11
2 files changed, 18 insertions, 4 deletions
diff --git a/usr.bin/catman/catman.1 b/usr.bin/catman/catman.1
index 7449d4f..ea7e5e4 100644
--- a/usr.bin/catman/catman.1
+++ b/usr.bin/catman/catman.1
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 11, 2002
+.Dd December 22, 2004
.Dt CATMAN 1
.Os
.Sh NAME
@@ -32,7 +32,7 @@
.Nd "preformat man pages"
.Sh SYNOPSIS
.Nm
-.Op Fl fnrvL
+.Op Fl fLnrv
.Op Ar directories ...
.Sh DESCRIPTION
The
@@ -72,11 +72,14 @@ Cause
to be more verbose about what it is doing.
.El
.Sh ENVIRONMENT
-.Bl -tag -width ".Ev MANPATH" -compact
+.Bl -tag -width ".Ev MANPATH"
.It Ev LC_ALL , LC_CTYPE , LANG
These variables control what subdirectories will be processed if the
.Fl L
option is used.
+.It Ev MACHINE
+If set, overrides the current machine type when searching for
+machine specific man page subdirectories.
.It Ev MANPATH
Determines the set of directories to be processed if none are given on
the command line.
@@ -100,4 +103,4 @@ A previous version of the
command appeared in
.Fx 2.1 .
.Sh AUTHORS
-.An John Rochester .
+.An John Rochester
diff --git a/usr.bin/catman/catman.c b/usr.bin/catman/catman.c
index c43781e..2171a0e 100644
--- a/usr.bin/catman/catman.c
+++ b/usr.bin/catman/catman.c
@@ -65,6 +65,7 @@ static int force; /* -f flag: force overwriting all cat pages */
static int rm_junk; /* -r flag: remove garbage pages */
static char *locale; /* user's locale if -L is used */
static char *lang_locale; /* short form of locale */
+static const char *machine;
static int exit_code; /* exit code to use when finished */
/*
@@ -633,6 +634,7 @@ process_mandir(char *dir_name, char *section)
process_section(dir_name, section);
} else {
struct dirent **entries;
+ char *machine_dir;
int nsections;
int i;
@@ -644,6 +646,11 @@ process_mandir(char *dir_name, char *section)
}
for (i = 0; i < nsections; i++) {
process_section(dir_name, entries[i]->d_name);
+ asprintf(&machine_dir, "%s/%s", entries[i]->d_name,
+ machine);
+ if (test_path(machine_dir, NULL) & TEST_DIR)
+ process_section(dir_name, machine_dir);
+ free(machine_dir);
free(entries[i]);
}
free(entries);
@@ -782,6 +789,10 @@ main(int argc, char **argv)
signal(SIGHUP, trap_signal);
signal(SIGQUIT, trap_signal);
signal(SIGTERM, trap_signal);
+
+ if ((machine = getenv("MACHINE")) == NULL)
+ machine = MACHINE;
+
if (optind == argc) {
const char *manpath = getenv("MANPATH");
if (manpath == NULL)
OpenPOWER on IntegriCloud