diff options
Diffstat (limited to 'pkgs/tools/misc/man/share.patch')
-rw-r--r-- | pkgs/tools/misc/man/share.patch | 207 |
1 files changed, 105 insertions, 102 deletions
diff --git a/pkgs/tools/misc/man/share.patch b/pkgs/tools/misc/man/share.patch index 3367f4ceb61..837786e28eb 100644 --- a/pkgs/tools/misc/man/share.patch +++ b/pkgs/tools/misc/man/share.patch @@ -1,113 +1,116 @@ -diff -rc man-db-2.4.3/src/manp.c man-db-2.4.3-new/src/manp.c -*** man-db-2.4.3/src/manp.c Mon Nov 8 10:06:03 2004 ---- man-db-2.4.3-new/src/manp.c Tue Jan 9 17:08:31 2007 +diff -rc man-1.6f-orig/src/manpath.c man-1.6f/src/manpath.c +*** man-1.6f-orig/src/manpath.c 2006-08-03 23:18:33.000000000 +0200 +--- man-1.6f/src/manpath.c 2008-02-07 15:31:43.000000000 +0100 *************** -*** 101,107 **** - - static void mkcatdirs (const char *mandir, const char *catdir); - static __inline__ char *get_manpath (char *path); -! static __inline__ char *has_mandir (const char *p); - static __inline__ char *fsstnd (const char *path); - static char *def_path (int flag); - static void add_dir_to_list (char **lp, const char *dir); ---- 101,107 ---- - - static void mkcatdirs (const char *mandir, const char *catdir); - static __inline__ char *get_manpath (char *path); -! static __inline__ char *has_mandir (const char *p, const char *mandir); - static __inline__ char *fsstnd (const char *path); - static char *def_path (int flag); - static void add_dir_to_list (char **lp, const char *dir); -*************** -*** 885,891 **** - if (debug) - fputs ("is not in the config file\n", stderr); - -! t = has_mandir (p); - if (t) { - if (debug) - fprintf (stderr, "but does have a ../man or man subdirectory\n"); ---- 885,891 ---- - if (debug) - fputs ("is not in the config file\n", stderr); - -! t = has_mandir (p, "man"); - if (t) { - if (debug) - fprintf (stderr, "but does have a ../man or man subdirectory\n"); -*************** -*** 895,900 **** ---- 895,911 ---- - } else - if (debug) - fprintf (stderr, "and doesn't have ../man or man subdirectories\n"); -+ -+ t = has_mandir (p, "share/man"); -+ if (t) { -+ if (debug) -+ fprintf (stderr, "but does have a ../share/man or share/man subdirectory\n"); -+ -+ add_dir_to_list (tmplist, t); -+ free (t); -+ } -+ if (debug) -+ fprintf (stderr, "and doesn't have ../share/man or share/man subdirectories\n"); - } - } +*** 109,121 **** + * or ../man or ../man1 or ../man8 subdirectories. + */ + static char * +! find_man_subdir (char *p) { + int len; + char *t, *sp; -*************** -*** 973,979 **** + len = strlen (p); - /* path does not exist in config file: check to see if path/../man or - path/man exist. If so return it, if not return NULL. */ -! static __inline__ char *has_mandir (const char *path) - { - char *newpath = NULL; +! t = my_malloc ((unsigned) len + 20); ---- 984,990 ---- + memcpy (t, p, len); + strcpy (t + len, "/man"); +--- 109,121 ---- + * or ../man or ../man1 or ../man8 subdirectories. + */ + static char * +! find_man_subdir (char *p, char * maybe_share) { + int len; + char *t, *sp; - /* path does not exist in config file: check to see if path/../man or - path/man exist. If so return it, if not return NULL. */ -! static __inline__ char *has_mandir (const char *path, const char *mandir) - { - char *newpath = NULL; + len = strlen (p); +! t = my_malloc ((unsigned) len + 30); + + memcpy (t, p, len); + strcpy (t + len, "/man"); *************** -*** 983,991 **** - char *subdir = strrchr (path, '/'); - if (subdir) { - const int prefix_len = subdir + 1 - path; -! newpath = xmalloc (prefix_len + sizeof ("man") + 1); - strncpy (newpath, path, prefix_len); -! strcpy (newpath + prefix_len, "man"); - - if (is_directory (newpath) == 1) - return newpath; ---- 994,1002 ---- - char *subdir = strrchr (path, '/'); - if (subdir) { - const int prefix_len = subdir + 1 - path; -! newpath = xmalloc (prefix_len + strlen (mandir) + 2); - strncpy (newpath, path, prefix_len); -! strcpy (newpath + prefix_len, mandir); - - if (is_directory (newpath) == 1) - return newpath; -*************** -*** 993,999 **** - *newpath = '\0'; - } +*** 139,159 **** + } + + /* look for the situation with packagedir/bin and packagedir/man */ +! strcpy (t + len, "/man"); + + if (is_directory (t) == 1) + return t; + + /* look for the situation with pkg/bin and pkg/man1 or pkg/man8 */ + /* (looking for all man[1-9] would probably be a waste of stats) */ +! strcpy (t + len, "/man1"); + + if (is_directory (t) == 1) { + t[len] = 0; + return t; + } -! newpath = strappend (newpath, path, "/man", NULL); +! strcpy (t + len, "/man8"); - if (is_directory (newpath) == 1) - return newpath; ---- 1004,1010 ---- - *newpath = '\0'; - } + if (is_directory (t) == 1) { + t[len] = 0; +--- 139,159 ---- + } -! newpath = strappend (newpath, path, "/", mandir, NULL); + /* look for the situation with packagedir/bin and packagedir/man */ +! sprintf (t + len, "%s/man", maybe_share); + + if (is_directory (t) == 1) + return t; + + /* look for the situation with pkg/bin and pkg/man1 or pkg/man8 */ + /* (looking for all man[1-9] would probably be a waste of stats) */ +! sprintf (t + len, "%s/man1", maybe_share); + + if (is_directory (t) == 1) { + t[len] = 0; + return t; + } + +! sprintf (t + len, "%s/man8", maybe_share); + + if (is_directory (t) == 1) { + t[len] = 0; +*************** +*** 341,347 **** + if (debug) + gripe (IS_NOT_IN_CONFIG); + +! t = find_man_subdir (dir); + if (t != NULL) { + if (debug) + gripe (MAN_NEARBY); +--- 341,347 ---- + if (debug) + gripe (IS_NOT_IN_CONFIG); + +! t = find_man_subdir (dir, ""); + if (t != NULL) { + if (debug) + gripe (MAN_NEARBY); +*************** +*** 352,357 **** +--- 352,370 ---- + if (debug) + gripe (NO_MAN_NEARBY); + } ++ ++ t = find_man_subdir (dir, "/share"); ++ if (t != NULL) { ++ if (debug) ++ gripe (MAN_NEARBY); ++ ++ add_to_mandirlist (t, perrs); ++ free (t); ++ } else { ++ if (debug) ++ gripe (NO_MAN_NEARBY); ++ } ++ + } + } - if (is_directory (newpath) == 1) - return newpath; -Only in man-db-2.4.3-new/src: manp.c~ |