aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorEdwin Groothuis <edwin@FreeBSD.org>2007-09-28 02:31:57 +0000
committerEdwin Groothuis <edwin@FreeBSD.org>2007-09-28 02:31:57 +0000
commit76dac947298787ad4084e2eb4e69dc2a9f582580 (patch)
tree903a658c78f5d7e1cb35220ad910007aa2c95d32 /gnu/usr.bin
parentc29b0d0043cf382959def7bc749f49a4b3e71f08 (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 18005dfc036d..cf6bb5a32924 100644
--- a/gnu/usr.bin/man/man/man.c
+++ b/gnu/usr.bin/man/man/man.c
@@ -866,11 +866,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
+ end = gzgets (fp, buf, BUFSIZ);
+ gzclose(fp);
+#else
end = fgets (buf, BUFSIZ, fp);
fclose(fp);
+#endif
if (!end || strlen (buf) < 5)
return ult;