Blob Blame History Raw
diff -up man-db-2.6.3/src/manp.c.overrides man-db-2.6.3/src/manp.c
--- man-db-2.6.3/src/manp.c.overrides	2012-10-24 16:52:35.134486439 +0200
+++ man-db-2.6.3/src/manp.c	2012-10-24 16:59:28.300037133 +0200
@@ -51,6 +51,7 @@
 #include <ctype.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/param.h>
 #include <assert.h>
 #include <errno.h>
 #include <dirent.h>
@@ -95,6 +96,9 @@ static struct list *namestore, *tailstor
 #define MANPATH_MAP	 0
 #define MANDATORY	 1
 
+/* Subdirectory of MANPATH entries searched for man pages before the directory itself. */
+#define OVERRIDES_DIR "/overrides"
+
 /* DIRLIST list[MAXDIRS]; */
 static char *tmplist[MAXDIRS];
 
@@ -933,6 +937,7 @@ char *get_manpath_from_path (const char
 	char **lp;
 	char *end;
 	char *manpathlist;
+	char overrides[MAXPATHLEN];
 	struct list *list;
 
 	tmppath = xstrdup (path);
@@ -960,6 +965,9 @@ char *get_manpath_from_path (const char
 		if (mandir_list) {
 			debug ("is in the config file\n");
 			while (mandir_list) {
+				strcpy(overrides, mandir_list->cont);
+				strcat(overrides, OVERRIDES_DIR);
+				add_dir_to_list (tmplist, overrides);
 				add_dir_to_list (tmplist, mandir_list->cont);
 				mandir_list = iterate_over_list
 					(mandir_list, p, MANPATH_MAP);
@@ -978,6 +986,9 @@ char *get_manpath_from_path (const char
 				       "../share/man, or share/man "
 				       "subdirectory\n");
 	
+				strcpy(overrides, t);
+				strcat(overrides, OVERRIDES_DIR);
+				add_dir_to_list (tmplist, overrides);
 				add_dir_to_list (tmplist, t);
 				free (t);
 		 	} else
@@ -993,8 +1004,12 @@ char *get_manpath_from_path (const char
 		debug ("\nadding mandatory man directories\n\n");
 
 		for (list = namestore; list; list = list->next)
-			if (list->flag == MANDATORY) 
+			if (list->flag == MANDATORY) {
+				strcpy(overrides, list->key);
+				strcat(overrides, OVERRIDES_DIR);
+				add_dir_to_list (tmplist, overrides);
 				add_dir_to_list (tmplist, list->key);
+			}
 	}
 
 	len = 0;