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$ .\" $FreeBSD$
.\" .\"
.Dd May 11, 2002 .Dd December 22, 2004
.Dt CATMAN 1 .Dt CATMAN 1
.Os .Os
.Sh NAME .Sh NAME
@ -32,7 +32,7 @@
.Nd "preformat man pages" .Nd "preformat man pages"
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl fnrvL .Op Fl fLnrv
.Op Ar directories ... .Op Ar directories ...
.Sh DESCRIPTION .Sh DESCRIPTION
The The
@ -72,11 +72,14 @@ Cause
to be more verbose about what it is doing. to be more verbose about what it is doing.
.El .El
.Sh ENVIRONMENT .Sh ENVIRONMENT
.Bl -tag -width ".Ev MANPATH" -compact .Bl -tag -width ".Ev MANPATH"
.It Ev LC_ALL , LC_CTYPE , LANG .It Ev LC_ALL , LC_CTYPE , LANG
These variables control what subdirectories will be processed if the These variables control what subdirectories will be processed if the
.Fl L .Fl L
option is used. option is used.
.It Ev MACHINE
If set, overrides the current machine type when searching for
machine specific man page subdirectories.
.It Ev MANPATH .It Ev MANPATH
Determines the set of directories to be processed if none are given on Determines the set of directories to be processed if none are given on
the command line. the command line.
@ -100,4 +103,4 @@ A previous version of the
command appeared in command appeared in
.Fx 2.1 . .Fx 2.1 .
.Sh AUTHORS .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 int rm_junk; /* -r flag: remove garbage pages */
static char *locale; /* user's locale if -L is used */ static char *locale; /* user's locale if -L is used */
static char *lang_locale; /* short form of locale */ static char *lang_locale; /* short form of locale */
static const char *machine;
static int exit_code; /* exit code to use when finished */ 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); process_section(dir_name, section);
} else { } else {
struct dirent **entries; struct dirent **entries;
char *machine_dir;
int nsections; int nsections;
int i; int i;
@ -644,6 +646,11 @@ process_mandir(char *dir_name, char *section)
} }
for (i = 0; i < nsections; i++) { for (i = 0; i < nsections; i++) {
process_section(dir_name, entries[i]->d_name); 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[i]);
} }
free(entries); free(entries);
@ -782,6 +789,10 @@ main(int argc, char **argv)
signal(SIGHUP, trap_signal); signal(SIGHUP, trap_signal);
signal(SIGQUIT, trap_signal); signal(SIGQUIT, trap_signal);
signal(SIGTERM, trap_signal); signal(SIGTERM, trap_signal);
if ((machine = getenv("MACHINE")) == NULL)
machine = MACHINE;
if (optind == argc) { if (optind == argc) {
const char *manpath = getenv("MANPATH"); const char *manpath = getenv("MANPATH");
if (manpath == NULL) if (manpath == NULL)