summaryrefslogtreecommitdiffstats
path: root/usr.bin/makewhatis
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2002-05-18 13:56:53 +0000
committerru <ru@FreeBSD.org>2002-05-18 13:56:53 +0000
commit7fbefe2fef672353e60211abb1507c185f7b2f22 (patch)
tree2e31ba7e4250ddc84e86d8263310c7192322f441 /usr.bin/makewhatis
parent35d66bbcdb782d13d542c467f0d7ea307bb148d4 (diff)
downloadFreeBSD-src-7fbefe2fef672353e60211abb1507c185f7b2f22.zip
FreeBSD-src-7fbefe2fef672353e60211abb1507c185f7b2f22.tar.gz
Look into machine specific subdirs.
Diffstat (limited to 'usr.bin/makewhatis')
-rw-r--r--usr.bin/makewhatis/makewhatis.15
-rw-r--r--usr.bin/makewhatis/makewhatis.c9
2 files changed, 13 insertions, 1 deletions
diff --git a/usr.bin/makewhatis/makewhatis.1 b/usr.bin/makewhatis/makewhatis.1
index 58fdb47..4dc0843 100644
--- a/usr.bin/makewhatis/makewhatis.1
+++ b/usr.bin/makewhatis/makewhatis.1
@@ -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.
diff --git a/usr.bin/makewhatis/makewhatis.c b/usr.bin/makewhatis/makewhatis.c
index 6f4e9fa..4fbdedf 100644
--- a/usr.bin/makewhatis/makewhatis.c
+++ b/usr.bin/makewhatis/makewhatis.c
@@ -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) {
OpenPOWER on IntegriCloud