# ChangeLog for sys-apps/groff
# Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/groff/ChangeLog,v 1.4 2002/07/29 16:23:23 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/groff/ChangeLog,v 1.5 2002/10/19 17:40:43 aliz Exp $
+
+*grpff-1.17.2-r3 (19 Oct 2002)
+
+ 19 Oct 2002; Daniel Ahlberg <aliz@gentoo.org> :
+ Security update.
*groff-1.18-r1 (29 Jul 2002)
*groff-1.17.2-r2 (29 Jul 2002)
--- /dev/null
+--- groff-1.17.2.orig/src/preproc/pic/pic.y
++++ groff-1.17.2/src/preproc/pic/pic.y
+@@ -1769,8 +1769,7 @@
+ return strsave(form);
+ }
+ }
+- sprintf(sprintf_buf, form, n);
+- return strsave(sprintf_buf);
++ return do_sprintf(form, &n, 1);
+ }
+
+ char *do_sprintf(const char *form, const double *v, int nv)
+@@ -1792,18 +1791,19 @@
+ if (*form == '%') {
+ one_format += *form++;
+ one_format += '\0';
+- sprintf(sprintf_buf, one_format.contents());
++ snprintf(sprintf_buf, sizeof(sprintf_buf), "%s", one_format.contents());
+ }
+ else {
+ if (i >= nv) {
+- lex_error("too few arguments to sprintf");
++ lex_error("too few arguments to snprintf");
+ result += one_format;
+ result += form;
+ break;
+ }
+ one_format += *form++;
+ one_format += '\0';
+- sprintf(sprintf_buf, one_format.contents(), v[i++]);
++ snprintf(sprintf_buf, sizeof(sprintf_buf),
++ one_format.contents(), v[i++]);
+ }
+ one_format.clear();
+ result += sprintf_buf;
--- /dev/null
+# Copyright 1999-2002 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/groff/groff-1.17.2-r3.ebuild,v 1.1 2002/10/19 17:40:43 aliz Exp $
+
+S=${WORKDIR}/${P}
+DESCRIPTION="Text formatter used for man pages"
+SRC_URI="ftp://gatekeeper.dec.com/pub/GNU/groff/${P}.tar.gz"
+HOMEPAGE="http://www.gnu.org/software/groff/groff.html"
+
+KEYWORDS="x86 sparc sparc64 alpha"
+SLOT="0"
+LICENSE="GPL-2"
+
+DEPEND="virtual/glibc"
+
+src_unpack() {
+ unpack ${A}
+
+ # Fix the info pages to have .info extensions,
+ # else they do not get gzipped.
+ cd ${S}
+ patch -p1 < ${FILESDIR}/${P}-infoext.patch || die
+
+ patch -p1 < ${FILESDIR}/${PF}-gentoo.diff || die
+
+}
+
+src_compile() {
+ # Fix problems with not finding g++
+ [ -z "${CC}" ] && export CC="gcc"
+ [ -z "${CXX}" ] && export CXX="g++"
+
+ ./configure --host=${CHOST} \
+ --prefix=/usr \
+ --mandir=/usr/share/man || die
+
+ # emake doesn't work
+ make || die
+
+ # do the info pages. this is only needed for 1.17*,
+ # as 1.18 do install its info pages
+ cd ${S}/doc
+ make groff.info || die
+
+ # Only build X stuff if we have X installed, but do
+ # not depend on it, else we get circular deps.
+ if [ -n "`use X`" ] && [ -x /usr/X11R6/bin/xmkmf ]
+ then
+ cd ${S}/src/xditview
+ xmkmf || die
+ make depend all || die
+ fi
+}
+
+src_install() {
+ dodir /usr /usr/share/doc/${PF}/{examples,html}
+ make prefix=${D}/usr \
+ manroot=${D}/usr/share/man \
+ docdir=${D}/usr/share/doc/${PF} \
+ install || die
+
+ if [ -n "`use X`" ] && [ -x /usr/X11R6/bin/xmkmf ]
+ then
+ cd ${S}/src/xditview
+ make DESTDIR=${D} \
+ BINDIR=/usr/bin \
+ MANPATH=/usr/share/man \
+ install \
+ install.man || die
+ fi
+
+ # the following links are required for xman
+ dosym eqn /usr/bin/geqn
+ dosym tbl /usr/bin/gtbl
+ dosym soelim /usr/bin/zsoelim
+
+ # this is only needed for 1.17*, as 1.18
+ # do install its info pages
+ cd ${S}/doc
+ doinfo groff.info*
+
+ cd ${S}
+ dodoc BUG-REPORT COPYING ChangeLog FDL MORE.STUFF NEWS \
+ PROBLEMS PROJECTS README REVISION TODO VERSION
+}
+