From 085ca027177cfb5200f1004d5db1e5fc9bf0d5cd Mon Sep 17 00:00:00 2001 From: Edwin Groothuis Date: Thu, 20 Sep 2007 21:37:29 +0000 Subject: 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 Approved by: re@ (ken smith), grog@ (mentor) MFC after: 1 week --- gnu/usr.bin/man/man/man.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gnu/usr.bin') 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; -- cgit v1.3