summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/man/files/man-1.6f-so-search-2.patch')
-rw-r--r--sys-apps/man/files/man-1.6f-so-search-2.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys-apps/man/files/man-1.6f-so-search-2.patch b/sys-apps/man/files/man-1.6f-so-search-2.patch
new file mode 100644
index 00000000..ac42c8df
--- /dev/null
+++ b/sys-apps/man/files/man-1.6f-so-search-2.patch
@@ -0,0 +1,34 @@
+improve the uncompressed .so search
+
+--- a/src/man.c
++++ b/src/man.c
+@@ -381,13 +381,23 @@ again:
+ }
+ /*
+ * Some people have compressed man pages, but uncompressed
+- * .so files - we could glob for all possible extensions,
+- * for now: only try .gz
++ * .so files - we should discover this list dynamically, but
++ * for now just hardcode it.
+ */
+- else if (fp == NULL && get_expander(".gz") &&
+- strlen(name)+strlen(".gz") < BUFSIZE) {
+- strcat(name, ".gz");
+- fp = fopen (name, "r");
++ else if (fp == NULL) {
++#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
++ size_t i, name_len = strlen(name);
++ const char *extensions[] = { ".gz", ".bz2", ".lzma", ".xz", ".z", ".Z" };
++ for (i = 0; i < ARRAY_SIZE(extensions); ++i) {
++ const char *comp = extensions[i];
++ name[name_len] = '\0';
++ if (get_expander(comp) && name_len+strlen(comp) < BUFSIZE) {
++ strcat(name, comp);
++ fp = fopen(name, "r");
++ if (fp)
++ break;
++ }
++ }
+ }
+
+ if (fp == NULL) {