summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authoredwin <edwin@FreeBSD.org>2007-09-20 21:37:29 +0000
committeredwin <edwin@FreeBSD.org>2007-09-20 21:37:29 +0000
commit4c08b03e8e53a05635c7f94ccfdec04534ec8f9f (patch)
treef8a0f6a139be448d5579e1993f50ef4249502160 /gnu/usr.bin
parente25b203061b232137e025efc647ecdab594849dd (diff)
downloadFreeBSD-src-4c08b03e8e53a05635c7f94ccfdec04534ec8f9f.zip
FreeBSD-src-4c08b03e8e53a05635c7f94ccfdec04534ec8f9f.tar.gz
man(1) can't handle compressed included files.
Some ports will install with compressed manpages. man handles this by looking for the .gz version of a man source file. It is also common to include other files with the .so directive where commands or functions share a man page. Traditionally ports have had to handle this by either not compressing the manpages, or using the _MLINKS macro in the port makefile to create symlinks to the actual source file, rather than using .so versions. Notably, the current version of Xorg port breaks. See ports/113096 and ports/115845. PR: bin/115850 Submitted by: Callum Gibson <callumgibson@optusnet.com.au> Approved by: re@ (ken smith), grog@ (mentor) MFC after: 1 week
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/man/man/man.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gnu/usr.bin/man/man/man.c b/gnu/usr.bin/man/man/man.c
index e6ce018..cb88053 100644
--- a/gnu/usr.bin/man/man/man.c
+++ b/gnu/usr.bin/man/man/man.c
@@ -884,11 +884,26 @@ ultimate_source (name, path)
next:
+#if HAVE_LIBZ > 0
+ if ((fp = gzopen (ult, "r")) == NULL)
+ {
+ /* check for the compressed version too */
+ strlcat(ult, ".gz", FILENAME_MAX);
+ if ((fp = gzopen (ult, "r")) == NULL)
+ return ult; /* we munged it, but it doesn't exist anyway */
+ }
+#else
if ((fp = fopen (ult, "r")) == NULL)
return ult;
+#endif
+#if HAVE_LIBZ > 0
+ gzgets (fp, buf, BUFSIZ);
+ gzclose(fp);
+#else
end = fgets (buf, BUFSIZ, fp);
fclose(fp);
+#endif
if (!end || strlen (buf) < 5)
return ult;
OpenPOWER on IntegriCloud