1diff -rc man-1.6f-orig/src/manpath.c man-1.6f/src/manpath.c
2*** man-1.6f-orig/src/manpath.c 2006-08-03 23:18:33.000000000 +0200
3--- man-1.6f/src/manpath.c 2008-02-07 15:31:43.000000000 +0100
4***************
5*** 109,121 ****
6 * or ../man or ../man1 or ../man8 subdirectories.
7 */
8 static char *
9! find_man_subdir (char *p) {
10 int len;
11 char *t, *sp;
12
13 len = strlen (p);
14
15! t = my_malloc ((unsigned) len + 20);
16
17 memcpy (t, p, len);
18 strcpy (t + len, "/man");
19--- 109,121 ----
20 * or ../man or ../man1 or ../man8 subdirectories.
21 */
22 static char *
23! find_man_subdir (char *p, char * maybe_share) {
24 int len;
25 char *t, *sp;
26
27 len = strlen (p);
28
29! t = my_malloc ((unsigned) len + 30);
30
31 memcpy (t, p, len);
32 strcpy (t + len, "/man");
33***************
34*** 139,159 ****
35 }
36
37 /* look for the situation with packagedir/bin and packagedir/man */
38! strcpy (t + len, "/man");
39
40 if (is_directory (t) == 1)
41 return t;
42
43 /* look for the situation with pkg/bin and pkg/man1 or pkg/man8 */
44 /* (looking for all man[1-9] would probably be a waste of stats) */
45! strcpy (t + len, "/man1");
46
47 if (is_directory (t) == 1) {
48 t[len] = 0;
49 return t;
50 }
51
52! strcpy (t + len, "/man8");
53
54 if (is_directory (t) == 1) {
55 t[len] = 0;
56--- 139,159 ----
57 }
58
59 /* look for the situation with packagedir/bin and packagedir/man */
60! sprintf (t + len, "%s/man", maybe_share);
61
62 if (is_directory (t) == 1)
63 return t;
64
65 /* look for the situation with pkg/bin and pkg/man1 or pkg/man8 */
66 /* (looking for all man[1-9] would probably be a waste of stats) */
67! sprintf (t + len, "%s/man1", maybe_share);
68
69 if (is_directory (t) == 1) {
70 t[len] = 0;
71 return t;
72 }
73
74! sprintf (t + len, "%s/man8", maybe_share);
75
76 if (is_directory (t) == 1) {
77 t[len] = 0;
78***************
79*** 341,347 ****
80 if (debug)
81 gripe (IS_NOT_IN_CONFIG);
82
83! t = find_man_subdir (dir);
84 if (t != NULL) {
85 if (debug)
86 gripe (MAN_NEARBY);
87--- 341,347 ----
88 if (debug)
89 gripe (IS_NOT_IN_CONFIG);
90
91! t = find_man_subdir (dir, "");
92 if (t != NULL) {
93 if (debug)
94 gripe (MAN_NEARBY);
95***************
96*** 352,357 ****
97--- 352,370 ----
98 if (debug)
99 gripe (NO_MAN_NEARBY);
100 }
101+
102+ t = find_man_subdir (dir, "/share");
103+ if (t != NULL) {
104+ if (debug)
105+ gripe (MAN_NEARBY);
106+
107+ add_to_mandirlist (t, perrs);
108+ free (t);
109+ } else {
110+ if (debug)
111+ gripe (NO_MAN_NEARBY);
112+ }
113+
114 }
115 }
116