diff -up man-1.6f/src/manpath.c.old man-1.6f/src/manpath.c diff -up man-1.6f/src/manpath.c.override_dir man-1.6f/src/manpath.c --- man-1.6f/src/manpath.c.override_dir 2009-10-06 12:53:39.138070464 +0200 +++ man-1.6f/src/manpath.c 2009-10-06 12:53:51.551064991 +0200 @@ -43,6 +43,9 @@ char **mandirlist; static int mandirlistlth = 0; static int mandirlistmax = 0; +/* Subdirectory of MANPATH entries searched for man pages before the directory itself. */ +#define OVERRIDES_DIR "/overrides" + /* * Input: a string, with : as separator * For each entry in the string, call fn. @@ -299,6 +302,17 @@ add_to_mandirlist (char *dir, int perrs) } } +/* Adds directory and its "overrides" subdirectory to man directory list. */ +static void +add_to_mandirlist_with_override (char *dir, int perrs) { + char overrides[MAXPATHLEN]; + strcpy(overrides, dir); + strcat(overrides, OVERRIDES_DIR); + add_to_mandirlist (overrides, perrs); + + add_to_mandirlist (dir, perrs); +} + /* * For each directory in the user's path, see if it is one of the * directories listed in the man.conf file. If so, and it is @@ -323,6 +337,7 @@ get_manpath_from_pathdir (char *dir, int /* * The directory we're working on is in the config file. * If we haven't added it to the list yet, do. + * Also add the overrides subdirectory. */ if (*dir) { for (dlp = cfdirlist.nxt; dlp; dlp = dlp->nxt) { @@ -330,7 +345,7 @@ get_manpath_from_pathdir (char *dir, int if (debug) gripe (IS_IN_CONFIG); - add_to_mandirlist (dlp->mandir, perrs); + add_to_mandirlist_with_override (dlp->mandir, perrs); return; } } @@ -368,8 +383,8 @@ add_default_manpath (int perrs) { gripe (ADDING_MANDIRS); for (dlp = cfdirlist.nxt; dlp; dlp = dlp->nxt) - if (dlp->mandatory) - add_to_mandirlist (dlp->mandir, perrs); + if (dlp->mandatory) + add_to_mandirlist_with_override (dlp->mandir, perrs); } static void