summaryrefslogtreecommitdiff
path: root/src/manp.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2001-08-19 12:16:28 +0000
committerColin Watson <cjwatson@debian.org>2001-08-19 12:16:28 +0000
commit5f7226f2383b33abf8eaf662f5382e5d8a75d7d1 (patch)
tree95c312b5c2abda163f4cf0e1dbd78147977ed7f5 /src/manp.c
parent959af7c1db4759bdc5d7427953d60e76a902a5dc (diff)
Honour more than one MANPATH_MAP entry per $PATH element.
Diffstat (limited to 'src/manp.c')
-rw-r--r--src/manp.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/manp.c b/src/manp.c
index 33227043..17c40551 100644
--- a/src/manp.c
+++ b/src/manp.c
@@ -152,6 +152,17 @@ static char *get_from_list (char *key, int flag)
return NULL;
}
+static struct list *iterate_over_list (struct list *prev, char *key, int flag)
+{
+ struct list *list;
+
+ for (list = prev ? prev->next : namestore; list; list = list->next)
+ if (flag == list->flag && STREQ (key, list->key))
+ return list;
+
+ return NULL;
+}
+
char *get_def (char *thing, char *def)
{
char *config_def = get_from_list (thing, DEFINE);
@@ -825,7 +836,7 @@ static __inline__ char *get_manpath (char *path)
tmppath = xstrdup (path);
for (end = p = tmppath; end; p = end + 1) {
- char *mandir;
+ struct list *mandir_list;
end = strchr (p, ':');
if (end)
@@ -838,17 +849,21 @@ static __inline__ char *get_manpath (char *path)
if (debug)
fprintf (stderr, "\npath directory %s ", p);
- mandir = get_from_list (p, MANPATH_MAP);
+ mandir_list = iterate_over_list (NULL, p, MANPATH_MAP);
/*
* The directory we're working on is in the config file.
* If we haven't added it to the list yet, do.
*/
- if (mandir) {
+ if (mandir_list) {
if (debug)
fputs("is in the config file\n", stderr);
- add_dir_to_list (tmplist, mandir);
+ while (mandir_list) {
+ add_dir_to_list (tmplist, mandir_list->cont);
+ mandir_list = iterate_over_list
+ (mandir_list, p, MANPATH_MAP);
+ }
/* The directory we're working on isn't in the config file.
See if it has ../man or man subdirectories.