mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-20 00:33:57 +00:00
Look into machine specific subdirs.
This commit is contained in:
parent
1e7e78dca4
commit
02484f2b53
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=96858
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue