summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-04-21 01:17:36 +0000
committerMike Frysinger <vapier@gentoo.org>2008-04-21 01:17:36 +0000
commit03ce412f5ae2ad6f19a32b17b597d51cd3b1f78d (patch)
treee9985a32c46a0e715ed16ba27f05920a0838f3e2 /sys-apps/man/files/man-1.6f-so-search.patch
parentStable for HPPA (bug #218407). (diff)
downloadgentoo-2-03ce412f5ae2ad6f19a32b17b597d51cd3b1f78d.tar.gz
gentoo-2-03ce412f5ae2ad6f19a32b17b597d51cd3b1f78d.tar.bz2
gentoo-2-03ce412f5ae2ad6f19a32b17b597d51cd3b1f78d.zip
Make uncompressed .so searching better.
(Portage version: 2.2_pre5)
Diffstat (limited to 'sys-apps/man/files/man-1.6f-so-search.patch')
-rw-r--r--sys-apps/man/files/man-1.6f-so-search.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys-apps/man/files/man-1.6f-so-search.patch b/sys-apps/man/files/man-1.6f-so-search.patch
new file mode 100644
index 000000000000..d9d4af4fe346
--- /dev/null
+++ b/sys-apps/man/files/man-1.6f-so-search.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", ".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) {