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
This commit is contained in:
Edwin Groothuis 2007-09-20 21:37:29 +00:00
parent c8790f5d09
commit 085ca02717
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172257

View file

@ -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;