Look into machine specific subdirs.

This commit is contained in:
Ruslan Ermilov 2002-05-18 13:56:53 +00:00
parent 1e7e78dca4
commit 02484f2b53
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=96858
2 changed files with 13 additions and 1 deletions

View file

@ -90,11 +90,14 @@ Process only localized subdirectories corresponding to the locale specified
in the standard environment variables.
.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, its value is used to override the current
machine type when searching machine specific subdirectories.
.It Ev MANPATH
Determines the set of directories to be processed if none are given on
the command line.

View file

@ -98,6 +98,7 @@ static const char *whatis_name="whatis";/* -n option: the name */
static char *common_output; /* -o option: the single output file */
static char *locale; /* user's locale if -L is used */
static char *lang_locale; /* short form of locale */
static char *machine;
static int exit_code; /* exit code to use when finished */
static SLIST_HEAD(, visited_dir) visited_dirs =
@ -885,6 +886,7 @@ process_mandir(char *dir_name)
int nsections;
FILE *fp = NULL;
int i;
struct stat st;
if (already_visited(dir_name))
return;
@ -902,6 +904,10 @@ process_mandir(char *dir_name)
char section_dir[MAXPATHLEN];
snprintf(section_dir, sizeof section_dir, "%s/%s", dir_name, entries[i]->d_name);
process_section(section_dir);
snprintf(section_dir, sizeof section_dir, "%s/%s/%s", dir_name,
entries[i]->d_name, machine);
if (stat(section_dir, &st) == 0 && S_ISDIR(st.st_mode))
process_section(section_dir);
free(entries[i]);
}
free(entries);
@ -994,6 +1000,9 @@ main(int argc, char **argv)
whatis_proto = new_sbuf();
whatis_final = new_sbuf();
if ((machine = getenv("MACHINE")) == NULL)
machine = MACHINE;
if (common_output != NULL && (fp = open_output(common_output)) == NULL)
err(1, "%s", common_output);
if (optind == argc) {