Look into machine-specific manpage subdirectories too.

PR:		bin/72243
MFC after:	3 weeks
This commit is contained in:
ru 2004-12-22 16:04:58 +00:00
parent 46fa95804b
commit 2d481ce9df
2 changed files with 18 additions and 4 deletions

View File

@ -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

View File

@ -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)