aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorEdwin Groothuis <edwin@FreeBSD.org>2007-09-20 21:37:29 +0000
committerEdwin Groothuis <edwin@FreeBSD.org>2007-09-20 21:37:29 +0000
commit085ca027177cfb5200f1004d5db1e5fc9bf0d5cd (patch)
treef8a0f6a139be448d5579e1993f50ef4249502160 /gnu/usr.bin
parentc8790f5d0971d21e6e72f8770214911e4d4fe649 (diff)
Notes
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 e6ce0184878d..cb88053fb753 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;