man-db/man-db-2.6.1-so-links.patch

64 lines
1.9 KiB
Diff
Raw Normal View History

diff -upr man-db-2.6.1.orig/src/Makefile.am man-db-2.6.1/src/Makefile.am
--- man-db-2.6.1.orig/src/Makefile.am 2012-04-24 18:47:20.023383735 +0200
+++ man-db-2.6.1/src/Makefile.am 2012-04-24 18:54:41.219294370 +0200
@@ -87,6 +87,8 @@ lexgrog_SOURCES = \
descriptions.h \
filenames.c \
filenames.h \
+ globbing.c \
+ globbing.h \
lexgrog.l \
lexgrog_test.c \
manconv.c \
diff -upr man-db-2.6.1.orig/src/ult_src.c man-db-2.6.1/src/ult_src.c
--- man-db-2.6.1.orig/src/ult_src.c 2012-02-05 14:21:24.000000000 +0100
+++ man-db-2.6.1/src/ult_src.c 2012-04-24 19:13:20.499950083 +0200
@@ -59,6 +59,8 @@
#include <unistd.h>
#include "canonicalize.h"
+#include "dirname.h"
+#include "globbing.h"
#include "gettext.h"
#define _(String) gettext (String)
@@ -343,6 +345,38 @@ const char *ult_src (const char *name, c
free (base);
base = appendstr (NULL, path, "/", include,
NULL);
+
+ /* If the original path from above doesn't exist, try to create
+ * new path as if the "include" was relative to the current
+ * man page.
+ */
+ if (access (base, F_OK) != 0) {
+ char *dirname = mdir_name (name);
+ char *tempFile = appendstr (NULL, dirname, "/", include,
+ NULL);
+ free (dirname);
+ if (access (tempFile, F_OK) == 0) {
+ free (base);
+ base = canonicalize_filename_mode (tempFile,
+ CAN_EXISTING);
+ } else {
+ char *tempFileAsterisk = appendstr (NULL, tempFile,
+ "*", NULL);
+ char **possibleFiles = expand_path (tempFileAsterisk);
+ free (tempFileAsterisk);
+ if (access (possibleFiles[0], F_OK) == 0) {
+ free (base);
+ base = canonicalize_filename_mode (possibleFiles[0],
+ CAN_EXISTING);
+ }
+ int i;
+ for (i = 0; possibleFiles[i] != NULL; i++) {
+ free (possibleFiles[i]);
+ }
+ free (possibleFiles);
+ }
+ free (tempFile);
+ }
free (include);
debug ("ult_src: points to %s\n", base);