--- jgroff-1.15+ja.orig/groff-ja.0.101.patch
+++ jgroff-1.15+ja/groff-ja.0.101.patch
@@ -251,8 +251,8 @@
 --- groff-1.15/DEBIAN-VERSION	Fri Feb 11 04:32:21 2000
 +++ jgroff-1.15/DEBIAN-VERSION	Fri Feb 11 06:04:50 2000
 @@ -1 +1 @@
--1.15-3 (debian)
-+1.15-3.1 (debian)
+-1.15-4 (debian)
++1.15-4.1 (debian)
 diff -Nru groff-1.15/Makefile jgroff-1.15/Makefile
 --- groff-1.15/Makefile	Fri May 21 13:50:37 1999
 +++ jgroff-1.15/Makefile	Thu Jan  1 09:00:00 1970
--- jgroff-1.15+ja.orig/debian/control
+++ jgroff-1.15+ja/debian/control
@@ -0,0 +1,23 @@
+Source: jgroff
+Section: text
+Priority: extra
+Maintainer: Yoshiaki Yanagihara <yochi@debian.or.jp>
+Standards-Version: 2.4.0.0
+
+Package: jgroff
+Architecture: any
+Depends: ${shlibs:Depends}
+Suggests: ${shlibs:Suggests}
+Conflicts: groff
+Replaces: groff
+Provides: groff
+Description: GNU troff text-formatting system (Japanese Extended). 
+ This package contains the traditional UN*X text formatting tools
+ troff, nroff, tbl, eqn and pic. These utilities, together with the
+ man package, are essential for displaying the on-line manual pages. 
+ .
+ Output can be produced in a number of formats including plain ASCII
+ and PostScript. All the standard macro packages are supported.  A
+ number of other utilities are also included together with several fonts.
+ .
+ jgroff-0.100 is based on groff-1.11a.
--- jgroff-1.15+ja.orig/debian/rules
+++ jgroff-1.15+ja/debian/rules
@@ -0,0 +1,138 @@
+#! /usr/bin/make -f
+#
+# rules to debianize groff
+
+CC = gcc
+CFLAGS = -O2
+LDFLAGS = -s
+
+package = jgroff
+base_package = groff
+upstreamversion=1.15
+debrevision=3
+d=$(base_package)-$(upstreamversion)
+
+DEBVER=`dpkg-parsechangelog | awk '/Version:/{ print $$2 }'`
+
+DOCUMENTS= BUG-REPORT ChangeLog NEWS PROBLEMS PROJECTS README TODO \
+	doc/meintro.me doc/meref.me doc/pic.ms
+
+unpack-stamp:
+	tar zxf groff_$(upstreamversion).orig.tar.gz
+	touch unpack-stamp
+
+debpatch-stamp: unpack-stamp
+	patch -p0 < groff_$(upstreamversion)-$(debrevision).diff
+	patch -p0 < groff_1.15.2-3.patch
+	touch debpatch-stamp
+
+japatch-stamp: debpatch-stamp
+	patch -p0 < groff-ja.0.101.patch
+	patch -p0 < groff-ja.0.101.fix.1
+	touch japatch-stamp
+
+$(d)/configure.in: unpack-stamp debpatch-stamp japatch-stamp
+
+$(d)/configure:	$(d)/configure.in
+	$(checkdir)
+	cd $(d) && autoconf
+
+$(d)/Makefile: $(d)/configure
+	$(checkdir)
+	-cd $(d) && rm -f config.log config.cache
+	cd $(d) && PSPRINT=lpr ./configure --prefix=/usr --enable-nippon
+
+$(d)/xditview/Makefile:
+	$(checkdir)
+	cd $(d)/xditview && xmkmf
+
+build:		$(d)/Makefile $(d)/xditview/Makefile
+	$(checkdir)
+	-test "`uname -n`" = "${mypc}" && ctags-exuberant */*.[ch] */*.cc
+	dpkg-parsechangelog | awk '/Version:/{ print $$2 " (debian)" }' > DEBIAN-VERSION
+	cd $(d) && $(MAKE) CC="$(CC)" CCFLAGS="$(CFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS) -lc"
+	cd $(d)/xditview && $(MAKE) depend &&  \
+	$(MAKE) CC="$(CC)" LIBS="$(LIBS) -lc" NIPPONDEFINES="-DNIPPON"
+	touch build
+
+clean:
+	$(checkdir)
+	-rm -rf debian/tmp debian/files*
+	-rm -f build man/index.* `find . -name '*~'` tags
+	-rm -rf $(d)
+	-rm -f *stamp
+	-dh_clean
+
+binary-indep:   checkroot build
+	$(checkdir)
+# There are no architecture-independent files to be uploaded
+# generated by this package.  If there were any they would be
+# made here.
+
+binary-arch:    checkroot build
+	$(checkdir)
+	#
+	install -d -g root -m 755 -o root debian/tmp/DEBIAN
+	install -d -g root -m 755 -o root debian/tmp/etc
+	install -d -g root -m 755 -o root debian/tmp/usr/share/doc/$(package)
+	install -d -g root -m 755 -o root debian/tmp/usr/lib/mime/packages
+	install -g root -m 644 -o root \
+		debian/mime	debian/tmp/usr/lib/mime/packages/jgroff
+	cd $(d) && $(MAKE) install prefix=`pwd`/../debian/tmp/usr
+	#install -d -g root -m 755 -o root debian/tmp/usr/X11R6/bin
+	#install -d -g root -m 755 -o root debian/tmp/usr/X11R6/man/man1
+	#install -d -g root -m 755 -o root debian/tmp/usr/X11R6/lib/X11/app-defaults
+	cd $(d)/xditview && $(MAKE) install install.man DESTDIR="../../debian/tmp"
+	ln -fs eqn debian/tmp/usr/bin/geqn
+	ln -fs tbl debian/tmp/usr/bin/gtbl
+	ln -fs pic debian/tmp/usr/bin/gpic
+	mv debian/tmp/usr/share/groff/tmac/man.local \
+			debian/tmp/etc/tmac.man.local
+	ln -fs /etc/tmac.man.local debian/tmp/usr/share/groff/tmac/man.local
+	#
+	install -g root -m 644 -o root \
+		debian/changelog debian/tmp/usr/share/doc/$(package)/changelog.Debian
+	cd $(d) && cp -p $(DOCUMENTS) ../debian/tmp/usr/share/doc/$(package)
+	cd debian/tmp/usr/share/doc/$(package) && mv ChangeLog changelog
+	chmod 644 `find debian/tmp/usr/share/doc/$(package) -type f -print`
+	chmod 755 `find debian/tmp/usr/share/doc/$(package) -type d -print`
+	-gzip -r9f debian/tmp/usr/share/doc/$(package)
+	# this not gzipped!
+	install -g root -m 644 -o root \
+		debian/copyright debian/tmp/usr/share/doc/$(package)
+	#
+	chmod 644 debian/tmp/usr/X11R6/lib/X11/app-defaults/*
+	chmod 644 debian/tmp/usr/X11*/man/man?/*
+	chmod 755 debian/tmp/usr/share/groff/font/devps/generate/afmname
+	chmod 755 debian/tmp/usr/share/groff/font/devps/generate/symbol.sed
+	chmod 755 debian/tmp/usr/share/groff/font/devdvi/generate/CompileFonts
+
+	-gzip -r9f debian/tmp/usr/share/man debian/tmp/usr/X11*/man
+	ln -sf eqn.1.gz debian/tmp/usr/share/man/man1/neqn.1.gz
+	ln -sf eqn.1.gz debian/tmp/usr/share/man/man1/geqn.1.gz
+	ln -sf tbl.1.gz debian/tmp/usr/share/man/man1/gtbl.1.gz
+	ln -sf pic.1.gz debian/tmp/usr/share/man/man1/gpic.1.gz
+	#
+	install -g root -m 644 -o root debian/control debian/tmp/DEBIAN
+	install -g root -m 644 -o root debian/conffiles debian/tmp/DEBIAN
+	install -g root -m 755 -o root debian/postinst debian/tmp/DEBIAN
+	install -g root -m 755 -o root debian/prerm debian/tmp/DEBIAN
+	install -g root -m 755 -o root debian/postrm debian/tmp/DEBIAN
+	#
+	dpkg-shlibdeps $(d)/$(base_package)/$(base_package) -dSuggests $(d)/xditview/gxditview
+	dpkg-gencontrol
+	chown -R root.root debian/tmp
+	chmod -R g-ws debian/tmp
+	dpkg --build debian/tmp ..
+
+define checkdir
+	test -f debian/rules
+endef
+
+binary:         binary-indep binary-arch
+
+checkroot:
+	$(checkdir)
+	test root = "`whoami`"
+
+.PHONY: binary binary-arch binary-indep clean checkroot
--- jgroff-1.15+ja.orig/debian/changelog
+++ jgroff-1.15+ja/debian/changelog
@@ -0,0 +1,186 @@
+jgroff (1.15+ja-3.4) stable; urgency=high
+
+  * NMU security updates
+   - oops, previous build was not synced with groff_1.15.2-3
+     add PSPRINT=lpr to ./configure, now sync with groff_1.15.2-3
+     (thanks Martin Schulze)
+    + Use lpr as the print spooler, even if it happens not to be installed on
+      the build system. Version 1.15.2-2 broke 'groff -l', which worked with
+      previous versions of groff in stable (thanks, Mike Fontenot).
+
+ -- Fumitoshi UKAI <ukai@debian.or.jp>  Mon, 28 Jan 2002 10:16:58 +0900
+
+jgroff (1.15+ja-3.3) stable; urgency=high
+
+  * NMU security updates
+   - sync with groff_1.15.2-3, closes: Bug#129374
+
+ -- Fumitoshi UKAI <ukai@debian.or.jp>  Mon, 21 Jan 2002 01:56:35 +0900
+
+jgroff (1.15+ja-3.2) frozen unstable; urgency=medium
+
+  * NMU release
+  - fix Segfaults with english printf, closes: Bug#59628
+
+ -- Fumitoshi UKAI <ukai@debian.or.jp>  Sun, 12 Mar 2000 03:38:48 +0900
+
+jgroff (1.15+ja-3.1) frozen unstable; urgency=low
+
+  * NMU release
+  * Based on previous gotom's work
+  * Code cleanups, source layout changed, so orig.tar.gz has been changed
+  * several fixes including security fixes in groff imported to jgroff
+  * to browse Japanese manpages, we need jgroff instead of groff, however
+    recent version of man-db depends on groff (>> 1.15-2), so jgroff
+    appearently is based on groff (>> 1.15), so it must go in frozen potato.
+  * It is based on groff 1.15-3, closes: Bug#39958
+    and import y2k fix in groff, closes: Bug#53819
+  * fix X drivers, now it can show Japanese character on X, closes: Bug#47800
+
+ -- Fumitoshi UKAI <ukai@debian.or.jp>  Fri, 11 Feb 2000 06:25:23 +0900
+
+jgroff (1.15-3.1) frozen unstable; urgency=low
+
+  * NMU release
+  * Updated original version based on groff-1.15 with
+    jgroff-0.100.
+  * debian/copyright: Fixed copyright-refers-to-old-directory.
+
+ -- GOTO Masanori <gotom@debian.or.jp>  Thu, 10 Feb 2000 21:11:19 +0900
+
+jgroff (0.100-2.1) unstable; urgency=medium
+
+  * NMU release
+  - rebuild with libstdc++2.10, closes: Bug#53340, Bug#53341.
+
+ -- Fumitoshi UKAI <ukai@debian.or.jp>  Tue, 28 Dec 1999 00:59:12 +0900
+
+jgroff (0.100-2) frozen unstable; urgency=low
+
+  * Rebuilt with libstdc++2.9 (BUG#26404)
+
+ -- Yoshiaki Yanagihara <yochi@debian.or.jp>  Thu, 17 Dec 1998 11:24:08 +0900
+
+jgroff (0.100-1) unstable; urgency=low
+
+  * New upstrem version (jgroff-0.100).
+  * Based on groff-1.11a-2 debian package.
+
+ -- Yoshiaki Yanagihara <yochi@debian.or.jp>  Sun, 15 Mar 1998 18:28:25 +0900
+
+groff (1.11a-2) unstable; urgency=low
+
+  * groff (1.11a-2) unstable; urgency=low
+  * groff (1.11a-0bo2) bo-unstable; urgency=low
+
+  * (lintian): added a symlink for neqn manpage.
+  * (lintian): changed mode of manpage gxditview.1x to 644.
+  * (lintian): changed mode of app-defaults/GXditview to 644.
+  * (lintian): updated the debian/copyright file (previously
+    debian/README), to point to the actual postal address of the FSF,
+    even if the sources in the distribution, including the COPYING file)
+    still point tro the old file (this should be reported as a bug to
+    upstream :-) .  Now it says:
+        A copy of the GNU General Public License is available in
+        /usr/doc/copyright/GPL (as installed by package base-files);
+        if not, write to the Free Software Foundation, Inc.,
+        59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+  * commented creation of ctags file in debian/rules (closes: #15825,
+    #16006).
+  * checked correct build of fontpath (closes: #16007).
+  * added gzipping of X11 manpage (closes: #17455), tx to David ROCHER.
+  * reverted security changes done in 1.10-3.5 due to added use of safer
+    macro.  Added -U flag to nroff/troff/groff/pic to revert to old
+    unsecure behaviour:
+    - nroff script defaults calling groff -S
+    - troff defaults as called with -msafer
+    - groff defaults as called with -S
+    - pic defaults as called with -S
+    Updated manpages nroff(1), groff(1), troff(1), pic(1) for the -U option.
+  * changed reference to me and msafer manpages in groff(1), to reflect
+    the change in their names (done in 1.10-3.5 and 1.10-5).
+
+ -- Fabrizio Polacco <fpolacco@debian.org>  Sun, 15 Feb 1998 13:09:27 +0200
+
+groff (1.11a-1) unstable; urgency=low
+
+  * changed Standards Version to 2.3.0.1
+  * corrected names of copyright and chnagelog files.
+  * added full copyright from MIT (for gzditview).
+  * avoid gzipping of copyright file (oops!)
+  * new upstream version 1.11a (fixes #12130) including:
+    - new document for pic.
+    - changes to groff manpage.
+  * full libc6 version (fixes #14592) Since there aren't changes to
+     code, there's no need for a libc5 version.
+
+ -- Fabrizio Polacco <fpolacco@debian.org>  Mon, 17 Nov 1997 11:00:21 +0200
+
+groff (1.10-3.5) stable; urgency=high
+
+  * Compiled under debian-1.3.1 (libc5) as a security bugfix; used
+     version number 3.5 (instead of 5) to avoid downgrading for hamm.
+  * Avoided execution of arbitrary code embedded in documents;
+     added warning WARN_SECURITY, enabled by default, to warn about .sy
+     directives, but not yet documented in manpage. Warning mode enabled
+     by default via ifdef, should be toggled by option flag. (need
+     coordination with upstream maintainer.)
+  * Applied patch from Brian Mays <bem5r@virginia.edu> to pic/tex.cc to
+     cast a long double value to double (fixes #13788)
+  * Changed name of manpages me and msafer to groff_me and groff_msafer.
+
+ -- Fabrizio Polacco <fpolacco@debian.org>  Wed, 15 Oct 1997 23:15:08 +0300
+
+groff (1.10-4) unstable; urgency=low
+
+  * libc6 version
+  * added explicit link to libc to let ld.so find libc dependencies.
+  * added dinamic dependence as Suggest for gxditview.
+  * forced configure to use /usr/bin/perl (fixes bug#11149 and #13239)
+  * added debian version number to option -v
+
+ -- Fabrizio Polacco <fpolacco@debian.org>  Sun, 28 Sep 1997 09:09:22 +0300
+
+groff (1.10-3) frozen unstable; urgency=low
+
+  * Applied changes to avoid problem with bash-2 (bug#8755)
+  * Added gxditview notice in file copyright.debian
+  * Compiled to supply gxditview, to let groff -X and man -X work.
+     (changed font path in device.c)
+
+ -- Fabrizio Polacco <fpolacco@debian.org>  Wed, 16 Apr 1997 22:50:58 +0300
+
+groff (1.10-2) frozen unstable; urgency=low
+
+    * corrected shlibs.local for libstd++ depenedency (fixes #5401)
+
+ -- Fabrizio Polacco <fpolacco@debian.org>  Thu, 14 Nov 1996 08:39:25 +0200
+
+groff (1.10-1) frozen; urgency=low
+
+    * new maintainer: Fabrizio Polacco <fpolacco@debian.org>
+    * changed description in control file (fixes bug #4013 part 2)
+    * new upstream sources 1.10 (fixes bug #4013 part 1)
+    * added symlinks for geqn, gpic, gtbl (bug #4754)
+    * compressed manpages.
+    * Updated to Standards-Version 2.1.1.0
+
+ -- Fabrizio Polacco <fpolacco@debian.org>  Fri, 8 Nov 1996 13:50:09 +0200
+
+groff (1.09-12) frozen; urgency=low
+
+    * this version was never uploaded
+    * new maintainer: Fabrizio Polacco <fpolacco@debian.org>
+    * built using original upstream sources 1.09 + patch 1.09-11
+    * Updated to Standards-Version 2.1.1.0
+
+ -- Fabrizio Polacco <fpolacco@debian.org>  Wed, 6 Nov 1996 15:15:10 +0200
+
+Changes:
+ 2-Jul-1995 Alvar Bray <alvar@meiko.co.uk>
+	Set permissions of /usr/doc/groff dir in post install script.
+	Previous versions of this package may have got these wrong and
+	replacing the package will not fix them.
+ 5-Mar-1995 Bruce Perens <Bruce@Pixar.com>
+	Added Debian GNU/Linux package maintenance system files.
+
--- jgroff-1.15+ja.orig/debian/postinst
+++ jgroff-1.15+ja/debian/postinst
@@ -0,0 +1,11 @@
+#! /bin/sh -e
+
+package="jgroff"
+
+if [ -x /usr/sbin/update-mime ]; then /usr/sbin/update-mime; fi
+
+if	[ "$1" = "configure" ]
+then	if	[ -d /usr/doc -a ! -e /usr/doc/${package} -a -d /usr/share/doc/${package} ]
+	then	ln -sf ../share/doc/${package} /usr/doc/${package}
+	fi
+fi
--- jgroff-1.15+ja.orig/debian/copyright
+++ jgroff-1.15+ja/debian/copyright
@@ -0,0 +1,64 @@
+This is the Debian GNU/Linux prepackaged version of the GNU groff
+document formatting system. Groff was written by James Clark <jjc@jclark.com>
+and others.
+
+This package was put together by Bruce Perens <Bruce@Pixar.com>, from
+sources retrieved from prep.ai.mit.edu:/pub/gnu/groff-1.10.tar.gz .
+
+This package is now maintained by Yoshiaki Yanagiahra <yochi@debian.or.jp>
+
+=========================================================================
+
+   Groff is Copyright (c) 1989-1997 Free Software Foundation, Inc.
+   Written by James Clark (jjc@jclark.com)
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 dated June, 1991.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   A copy of the GNU General Public License is available in
+   /usr/share/common-licenses/GPL (as installed by package base-files);
+   if not, write to the Free Software Foundation, Inc.,
+   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+=========================================================================
+
+This groff package contains gxditview, a X11 previewer for groff based
+on MIT's xditview.
+This version can be used with the output of gtroff -Tps as well as
+with -TX75 and -TX100.  You will need X11R5 to install it (it might
+work on X11R4, but I haven't tested it.)
+
+xditview is copyrighted by MIT under the usual X terms (see
+gxditview.man); my changes to it are in the public domain.
+
+James Clark
+jjc@jclark.com
+
+/*
+ * Copyright 1991 Massachusetts Institute of Technology
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  M.I.T. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
--- jgroff-1.15+ja.orig/debian/conffiles
+++ jgroff-1.15+ja/debian/conffiles
@@ -0,0 +1 @@
+/etc/tmac.man.local
--- jgroff-1.15+ja.orig/debian/mime
+++ jgroff-1.15+ja/debian/mime
@@ -0,0 +1 @@
+application/x-troff-man; /usr/bin/nroff -mandoc -Tnippon; copiousoutput; print=/usr/bin/nroff -mandoc -Tnippon | print text/plain:-
--- jgroff-1.15+ja.orig/debian/postrm
+++ jgroff-1.15+ja/debian/postrm
@@ -0,0 +1,5 @@
+#! /bin/sh -e
+
+test -x "$(which update-mime)" && update-mime || true
+
+
--- jgroff-1.15+ja.orig/debian/prerm
+++ jgroff-1.15+ja/debian/prerm
@@ -0,0 +1,7 @@
+#! /bin/sh -e
+
+package="jgroff"
+
+if	[ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/${package} ]
+then	rm -f /usr/doc/${package}
+fi
--- jgroff-1.15+ja.orig/groff_1.15-3.diff
+++ jgroff-1.15+ja/groff_1.15-3.diff
@@ -0,0 +1,825 @@
+--- groff-1.15.orig/include/lib.h
++++ groff-1.15/include/lib.h
+@@ -76,6 +76,10 @@
+   return c >= 0 && illegal_char_table[c];
+ }
+ 
++#ifndef HAVE_STRCASECMP
++#  define	strcasecmp(a,b)	strcmp((a),(b))
++#endif
++
+ #ifdef HAVE_CC_LIMITS_H
+ #include <limits.h>
+ #else /* not HAVE_CC_LIMITS_H */
+--- groff-1.15.orig/libgroff/Makefile.sub
++++ groff-1.15/libgroff/Makefile.sub
+@@ -13,3 +13,5 @@
+ version.cc: $(srcdir)/../VERSION
+ 	@echo Making version.cc
+ 	@echo const char \*version_string = \"`cat $(srcdir)/../VERSION`\"\; >$@
++	@test -s $(srcdir)/../REVISION || echo 0 >$(srcdir)/../REVISION 
++	@echo const char \*revision_string = \"`cat $(srcdir)/../REVISION`\"\; >>$@
+--- groff-1.15.orig/grops/ps.cc
++++ groff-1.15/grops/ps.cc
+@@ -25,6 +25,7 @@
+ #include "ps.h"
+ #include <time.h>
+ 
++static int paperlength = 0;
+ static int landscape_flag = 0;
+ static int manual_feed_flag = 0;
+ static int ncopies = 1;
+@@ -413,6 +414,37 @@
+     else if (!bflag)
+       broken_flags = atoi(arg);
+   }
++  if (strcmp(command, "paperfile") == 0) {
++    if (arg == 0)
++      error_with_file_and_line(filename, lineno,
++			       "`paperfile' command requires an argument");
++    else if (font::paperlength == 0) {
++      errno = 0;
++      FILE *paper_file = fopen(arg, "r");
++      if (paper_file == 0) {
++        error("can't open `%1'", arg);
++        return;
++      }
++      char paper_file_buf[1024];
++      if ( fgets( paper_file_buf, 1024, paper_file)) {
++	int l = strlen(paper_file_buf) - 1;
++	if ( paper_file_buf[l] == '\n' )
++	  paper_file_buf[l] = 0;
++	if ( strcasecmp(paper_file_buf, "a4") == 0)
++		paperlength = 841890;
++//	else if ( strcasecmp(paper_file_buf, "letter") == 0)
++//		paperlength = 792000;
++//	else
++//	  error_with_file_and_line(filename, lineno,
++//				   "unknown paper size in file `%1'", arg);
++        else
++		paperlength = 792000;
++      } else
++	  error_with_file_and_line(filename, lineno,
++				   "error in content of paper file `%1'", arg);
++      fclose( paper_file);
++    }
++  }
+ }
+ 
+ struct style {
+@@ -543,7 +575,10 @@
+   res = r;
+   out.set_fixed_point(point);
+   space_char_index = font::name_to_index("space");
+-  paper_length = font::paperlength;
++  if ( paperlength )
++    paper_length = paperlength;
++  else
++    paper_length = font::paperlength;
+   if (paper_length == 0)
+     paper_length = 11*font::res;
+   equalise_spaces = font::res >= 72000;
+--- groff-1.15.orig/grops/psrm.cc
++++ groff-1.15/grops/psrm.cc
+@@ -51,6 +51,29 @@
+ 
+ const int NRESOURCES = sizeof(resource_table)/sizeof(resource_table[0]);
+ 
++static int read_uint_arg(const char **pp, unsigned *res)
++{
++  while (white_space(**pp))
++    *pp += 1;
++  if (**pp == '\0') {
++    error("missing argument");
++    return 0;
++  }
++  const char *start = *pp;
++  // XXX use strtoul
++  long n = strtol(start, (char **)pp, 10);
++  if (n == 0 && *pp == start) {
++    error("not an integer");
++    return 0;
++  }
++  if (n < 0) {
++    error("argument must not be negative");
++    return 0;
++  }
++  *res = unsigned(n);
++  return 1;
++}
++
+ struct resource {
+   resource *next;
+   resource_type type;
+@@ -101,9 +124,13 @@
+   read_download_file();
+   string procset_name("grops");
+   extern const char *version_string;
++  extern const char *revision_string;
++  unsigned revision_uint;
++  if ( !read_uint_arg( &revision_string, &revision_uint) )
++	  revision_uint = 0;
+   string procset_version(version_string);
+   procset_resource = lookup_resource(RESOURCE_PROCSET, procset_name,
+-				     procset_version, 0);
++				     procset_version, revision_uint);
+   procset_resource->flags |= resource::SUPPLIED;
+ }
+ 
+@@ -447,29 +474,6 @@
+       res += **pp;
+     *pp += 1;
+   }
+-  return 1;
+-}
+-
+-static int read_uint_arg(const char **pp, unsigned *res)
+-{
+-  while (white_space(**pp))
+-    *pp += 1;
+-  if (**pp == '\0') {
+-    error("missing argument");
+-    return 0;
+-  }
+-  const char *start = *pp;
+-  // XXX use strtoul
+-  long n = strtol(start, (char **)pp, 10);
+-  if (n == 0 && *pp == start) {
+-    error("not an integer");
+-    return 0;
+-  }
+-  if (n < 0) {
+-    error("argument must not be negative");
+-    return 0;
+-  }
+-  *res = unsigned(n);
+   return 1;
+ }
+ 
+--- groff-1.15.orig/grolj4/lj4.cc
++++ groff-1.15/grolj4/lj4.cc
+@@ -567,11 +567,12 @@
+ static
+ int lookup_paper_size(const char *s)
+ {
+-  for (int i = 0; i < sizeof(paper_table)/sizeof(paper_table[0]); i++)
++  for (int i = 0; i < sizeof(paper_table)/sizeof(paper_table[0]); i++) {
+     // FIXME Do this case-insensitively.
+     // Perhaps allow unique prefix.
+-    if (strcmp(s, paper_table[i].name) == 0)
++    if (strcasecmp(s, paper_table[i].name) == 0)
+       return i;
++  }
+   return -1;
+ }
+ 
+@@ -590,6 +591,34 @@
+ 				 "unknown paper size `%1'", arg);
+       else
+ 	paper_size = n;
++    }
++  }
++  if (strcmp(command, "paperfile") == 0) {
++    if (arg == 0)
++      error_with_file_and_line(filename, lineno,
++			       "`paperfile' command requires an argument");
++    else if (paper_size < 0) {
++      errno = 0;
++      FILE *paper_file = fopen(arg, "r");
++      if (paper_file == 0) {
++        error("can't open `%1'", arg);
++        return;
++      }
++      char paper_file_buf[1024];
++      if ( fgets( paper_file_buf, 1024, paper_file)) {
++	int l = strlen(paper_file_buf) - 1;
++	if ( paper_file_buf[l] == '\n' )
++	  paper_file_buf[l] = 0;
++        int n = lookup_paper_size( paper_file_buf);
++        if (n < 0)
++	  error_with_file_and_line(filename, lineno,
++				   "unknown paper size in file `%1'", arg);
++        else
++	  paper_size = n;
++      } else
++	  error_with_file_and_line(filename, lineno,
++				   "error in content of paper file `%1'", arg);
++      fclose( paper_file);
+     }
+   }
+ }
+--- groff-1.15.orig/devps/Makefile.sub
++++ groff-1.15/devps/Makefile.sub
+@@ -15,12 +15,14 @@
+ 	-rm -f DESC
+ 	cat $(srcdir)/DESC.in >DESC
+ 	echo broken $(BROKEN_SPOOLER_FLAGS) >>DESC
+-	if test "$(PAGE)" = A4; then \
+-	  echo "paperlength 841890" >>DESC; \
+-	else \
+-	  echo "paperlength 792000" >>DESC; \
+-	fi
++#	if test "$(PAGE)" = A4; then \
++#	  echo "paperlength 841890" >>DESC; \
++#	else \
++#	  echo "paperlength 792000" >>DESC; \
++#	fi
++	echo "paperfile /etc/papersize" >>DESC;
+ 	test -z '$(PSPRINT)' ||	echo print '$(PSPRINT)' >>DESC
++
+ 
+ fonts: DESC
+ 	$(MAKE) -f $(srcdir)/generate/Makefile \
+--- groff-1.15.orig/devlj4/Makefile.sub
++++ groff-1.15/devlj4/Makefile.sub
+@@ -21,11 +21,12 @@
+ 	echo "res $(LJ4RES)" >DESC
+ 	echo "unitwidth `expr 7620000 / $(LJ4RES)`" >>DESC
+ 	cat $(srcdir)/DESC.in >>DESC
+-	if test "$(PAGE)" = A4; then \
+-	  echo "papersize a4" >>DESC; \
+-	else \
+-	  echo "papersize letter" >>DESC; \
+-	fi
++#	if test "$(PAGE)" = A4; then \
++#	  echo "papersize a4" >>DESC; \
++#	else \
++#	  echo "papersize letter" >>DESC; \
++#	fi
++	echo "paperfile /etc/papersize" >>DESC;
+ 	test -z '$(LJ4PRINT)' || echo print '$(LJ4PRINT)' >>DESC
+ 
+ fonts:
+--- groff-1.15.orig/mm/Makefile.sub
++++ groff-1.15/mm/Makefile.sub
+@@ -1,6 +1,8 @@
+ #
+ # $Id: Makefile.sub,v 1.32 1999/09/03 05:33:12 jh Exp $
+ #
++tmac_m = m
++
+ MAN7=groff_mm.n groff_mmse.n
+ FILES=0.MT 5.MT 4.MT ms.cov se_ms.cov 
+ # Local configuration files with default values.
+@@ -22,7 +24,7 @@
+ 	-test -d $(tmacdir) || mkdir $(tmacdir)
+ 	-rm -f $(tmacdir)/tmac.$(tmac_m)
+ 	$(INSTALL_DATA) $(srcdir)/tmac.m $(tmacdir)/tmac.$(tmac_m)
+-	@sed -e "s;^.mso tmac.m;.mso $(tmac_m);g" $(srcdir)/tmac.mse \
++	@sed -e "s;^.mso tmac.m;.mso tmac.$(tmac_m);g" $(srcdir)/tmac.mse \
+ 		> $(tmacdir)/tmac.$(tmac_m)se
+ 
+ 
+--- groff-1.15.orig/xditview/Imakefile
++++ groff-1.15/xditview/Imakefile
+@@ -1,4 +1,4 @@
+-GROFF_LIBDIR = /usr/local/share/groff
++GROFF_LIBDIR = /usr/share/groff
+ GROFF_FONTDIR = $(GROFF_LIBDIR)/font
+ GROFF_FONTPATH = .:$(GROFF_FONTDIR):/usr/local/lib/font:/usr/lib/font
+ DPIS = 75 100
+--- groff-1.15.orig/xditview/device.c
++++ groff-1.15/xditview/device.c
+@@ -9,7 +9,7 @@
+ #include "device.h"
+ 
+ #ifndef FONTPATH
+-#define FONTPATH "/usr/local/share/groff/font:/usr/local/lib/font:/usr/lib/font"
++#define FONTPATH "/usr/share/groff/font:/usr/local/lib/font:/usr/lib/font"
+ #endif
+ 
+ #ifndef isascii
+--- groff-1.15.orig/doc/Makefile
++++ groff-1.15/doc/Makefile
+@@ -33,7 +33,7 @@
+ 
+ .me.dit:
+ 	$(SOELIM) $< \
+-	| sed -e "s;@VERSION@;`cat ../VERSION`;" \
++	| sed -e "s;@VERSION@;`cat ../DEBIAN-VERSION`;" \
+ 	| $(TROFF) -Tps $(FFLAG) -me  >$@
+ 
+ .tr.dit:
+--- groff-1.15.orig/Makefile.in
++++ groff-1.15/Makefile.in
+@@ -131,7 +131,7 @@
+ common_words_file=$(datasubdir)/eign
+ 
+ # manroot is the root of the man page directory tree.
+-manroot=$(prefix)/man
++manroot=$(prefix)/share/man
+ 
+ # man1ext is the man section for user commands.
+ man1ext=1
+@@ -265,7 +265,7 @@
+   realclean extraclean distfiles TAGS depend uninstall_sub
+ 
+ do=all
+-dodirs=$(ALLDIRS) dot
++dodirs=$(DISTDIRS) dot
+ # Default target for subdir_Makefile
+ subdir=troff
+ 
+@@ -358,6 +358,10 @@
+ 	rm -f groff-$(version).tar.gz
+ 	tar cfh - groff-$(version) | gzip -c >groff-$(version).tar.gz
+ 	rm -fr groff-$(version)
++
++.PHONY: debian
++debian:        ../groff_$(shell cat ${srcdir}/VERSION).orig.tar.gz
++	dpkg-buildpackage -rfakeroot 2>&1 | tee ../dpkg.log.${version}
+ 
+ # $(PROGDIRS): libgroff
+ # grops grotty grodvi: libdriver
+--- groff-1.15.orig/configure.in
++++ groff-1.15/configure.in
+@@ -38,7 +38,7 @@
+ LIBS="$LIBS -lc $LIBM"
+ AC_REPLACE_FUNCS(fmod strtol getcwd strerror putenv)
+ LIBS="$saved_libs"
+-AC_CHECK_FUNCS(rename mkstemp)
++AC_CHECK_FUNCS(rename mkstemp strcasecmp)
+ AC_DECL_SYS_SIGLIST
+ dnl checks for compiler characteristics
+ GROFF_ARRAY_DELETE
+--- groff-1.15.orig/debian/changelog
++++ groff-1.15/debian/changelog
+@@ -0,0 +1,212 @@
++groff (1.15-3) frozen unstable; urgency=high
++
++  * mm and mse macros were missing (thanx to Daniel Quinlan to make me
++    discover this grave bug); closes: #55428.
++  * corrected wrong .so request in macro mse
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Mon, 17 Jan 2000 15:25:06 +0200
++
++groff (1.15-2) unstable; urgency=low
++
++  * quick fix to a bug reported only mainstream.
++    postscript device fails if paper format is not a4 or letter.
++    Fixed using "letter" for all other formats, as it _was_ before.
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Fri, 14 Jan 2000 12:21:38 +0200
++
++groff (1.15-1) unstable; urgency=low
++
++  * new upstream release: only minor bugfixes.
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Thu,  6 Jan 2000 18:23:41 +0200
++
++groff (1.12-1) unstable; urgency=low
++
++  * new upstream release.
++    Got all previous changes (except papersize),
++    plus: new HTML device! (expermental).
++  * leaved version numeric only: closes: #31739, thanx to 
++    Jonathan H N Chin <jhnc@pfaff.newton.cam.ac.uk>.
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Fri, 17 Dec 1999 14:40:46 +0200
++
++groff (1.11b-1) unstable; urgency=low
++
++  * updated to policy 3.1.0.
++  * new imminent release 1.12; this use groff-current renamed
++    groff-1.11b.  Not to be uploaded until 1.12 is released.
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Sun, 12 Dec 1999 18:15:26 +0200
++
++groff (1.11a-9) unstable; urgency=low
++
++  * not uploaded due to imminent 1.12
++  * added management of /etc/papersize in driver lj4.
++    todo: the same in driver ps.
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Sun,  5 Dec 1999 14:26:18 +0200
++
++groff (1.11a-8) unstable; urgency=low
++
++  * moved tmac.local to /etc (as tmac.man.local) and symlinked from the
++    original place; made it a conffile. Thanx to Decklin Foster
++    <decklin@home.com>, closes: #39043
++  * recompiled with libstdc++2.10 . closes: #49392.
++  * added manpages groff_mdoc(7) and groff_mdoc.samples(7) taken from
++    netBSD, thanks to Ben Harris <bjh21@cam.ac.uk>. closes: #49159.
++  * added Y2K corrections from the beta-12, from Paul Eggert.
++  * Got rid of old and unusefull checks in postinst.
++  * added symlink from /usr/doc, and added -e to script; closes: #39410
++  * Bugs fixed in previous releases: closes: #27016, #28097.
++  * Updated to std policy 3.0.1
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Tue, 26 Oct 1999 14:39:10 +0300
++
++groff (1.11a-7) unstable; urgency=low
++
++  * Applied patch to add include path search to groff e gsoelim, provided by 
++    Peter Miller <millerp@canb.auug.org.au> needed by aegis.
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Sat, 17 Oct 1998 23:45:27 +0300
++
++groff (1.11a-6) unstable; urgency=low
++
++  * Recompiled to generate new dependencies into libs
++    (closes: #27790, thanx to Zephaniah E, Hull.)
++    [Previous attempt wasn't succesful.]
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Sat, 17 Oct 1998 02:39:10 +0300
++
++groff (1.11a-5) unstable; urgency=low
++
++  * Recompiled to generate new dependencies into libs
++    (closes: #27790, thanx to Zephaniah E, Hull.)
++  * added mime file as suggested by Brian White 
++    (closes: #27016)
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Tue, 13 Oct 1998 18:54:55 +0300
++
++groff (1.11a-4) unstable; urgency=low
++
++  * Added groff_man(7) manpage for tmac.an macro written by Susan Kleinmann.
++  * Added patch from Andy Dougherty to let groff pass the -U flag along to
++    troff. (closes: #20628)
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Sat,  4 Apr 1998 23:46:42 +0300
++
++groff (1.11a-2) unstable; urgency=low
++
++  * groff (1.11a-2) unstable; urgency=low
++  * groff (1.11a-0bo2) bo-unstable; urgency=low
++
++  * (lintian): added a symlink for neqn manpage.
++  * (lintian): changed mode of manpage gxditview.1x to 644.
++  * (lintian): changed mode of app-defaults/GXditview to 644.
++  * (lintian): updated the debian/copyright file (previously
++    debian/README), to point to the actual postal address of the FSF,
++    even if the sources in the distribution, including the COPYING file)
++    still point tro the old file (this should be reported as a bug to
++    upstream :-) .  Now it says:
++        A copy of the GNU General Public License is available in
++        /usr/doc/copyright/GPL (as installed by package base-files);
++        if not, write to the Free Software Foundation, Inc.,
++        59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++  * commented creation of ctags file in debian/rules (closes: #15825,
++    #16006).
++  * checked correct build of fontpath (closes: #16007).
++  * added gzipping of X11 manpage (closes: #17455), tx to David ROCHER.
++  * reverted security changes done in 1.10-3.5 due to added use of safer
++    macro.  Added -U flag to nroff/troff/groff/pic to revert to old
++    unsecure behaviour:
++    - nroff script defaults calling groff -S
++    - troff defaults as called with -msafer
++    - groff defaults as called with -S
++    - pic defaults as called with -S
++    Updated manpages nroff(1), groff(1), troff(1), pic(1) for the -U option.
++  * changed reference to me and msafer manpages in groff(1), to reflect
++    the change in their names (done in 1.10-3.5 and 1.10-5).
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Sun, 15 Feb 1998 13:09:27 +0200
++
++groff (1.11a-1) unstable; urgency=low
++
++  * changed Standards Version to 2.3.0.1
++  * corrected names of copyright and chnagelog files.
++  * added full copyright from MIT (for gzditview).
++  * avoid gzipping of copyright file (oops!)
++  * new upstream version 1.11a (fixes #12130) including:
++    - new document for pic.
++    - changes to groff manpage.
++  * full libc6 version (fixes #14592) Since there aren't changes to
++     code, there's no need for a libc5 version.
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Mon, 17 Nov 1997 11:00:21 +0200
++
++groff (1.10-3.5) stable; urgency=high
++
++  * Compiled under debian-1.3.1 (libc5) as a security bugfix; used
++     version number 3.5 (instead of 5) to avoid downgrading for hamm.
++  * Avoided execution of arbitrary code embedded in documents;
++     added warning WARN_SECURITY, enabled by default, to warn about .sy
++     directives, but not yet documented in manpage. Warning mode enabled
++     by default via ifdef, should be toggled by option flag. (need
++     coordination with upstream maintainer.)
++  * Applied patch from Brian Mays <bem5r@virginia.edu> to pic/tex.cc to
++     cast a long double value to double (fixes #13788)
++  * Changed name of manpages me and msafer to groff_me and groff_msafer.
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Wed, 15 Oct 1997 23:15:08 +0300
++
++groff (1.10-4) unstable; urgency=low
++
++  * libc6 version
++  * added explicit link to libc to let ld.so find libc dependencies.
++  * added dinamic dependence as Suggest for gxditview.
++  * forced configure to use /usr/bin/perl (fixes bug#11149 and #13239)
++  * added debian version number to option -v
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Sun, 28 Sep 1997 09:09:22 +0300
++
++groff (1.10-3) frozen unstable; urgency=low
++
++  * Applied changes to avoid problem with bash-2 (bug#8755)
++  * Added gxditview notice in file copyright.debian
++  * Compiled to supply gxditview, to let groff -X and man -X work.
++     (changed font path in device.c)
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Wed, 16 Apr 1997 22:50:58 +0300
++
++groff (1.10-2) frozen unstable; urgency=low
++
++    * corrected shlibs.local for libstd++ depenedency (fixes #5401)
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Thu, 14 Nov 1996 08:39:25 +0200
++
++groff (1.10-1) frozen; urgency=low
++
++    * new maintainer: Fabrizio Polacco <fpolacco@debian.org>
++    * changed description in control file (fixes bug #4013 part 2)
++    * new upstream sources 1.10 (fixes bug #4013 part 1)
++    * added symlinks for geqn, gpic, gtbl (bug #4754)
++    * compressed manpages.
++    * Updated to Standards-Version 2.1.1.0
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Fri, 8 Nov 1996 13:50:09 +0200
++
++groff (1.09-12) frozen; urgency=low
++
++    * this version was never uploaded
++    * new maintainer: Fabrizio Polacco <fpolacco@debian.org>
++    * built using original upstream sources 1.09 + patch 1.09-11
++    * Updated to Standards-Version 2.1.1.0
++
++ -- Fabrizio Polacco <fpolacco@debian.org>  Wed, 6 Nov 1996 15:15:10 +0200
++
++Changes:
++ 2-Jul-1995 Alvar Bray <alvar@meiko.co.uk>
++	Set permissions of /usr/doc/groff dir in post install script.
++	Previous versions of this package may have got these wrong and
++	replacing the package will not fix them.
++ 5-Mar-1995 Bruce Perens <Bruce@Pixar.com>
++	Added Debian GNU/Linux package maintenance system files.
++
+--- groff-1.15.orig/debian/control
++++ groff-1.15/debian/control
+@@ -0,0 +1,18 @@
++Source: groff
++Section: text
++Priority: important
++Maintainer: Fabrizio Polacco <fpolacco@debian.org>
++Standards-Version: 3.1.0
++
++Package: groff
++Architecture: any
++Depends: ${shlibs:Depends}
++Suggests: ${shlibs:Suggests}
++Description: GNU troff text-formatting system. 
++ This package contains the traditional UN*X text formatting tools
++ troff, nroff, tbl, eqn and pic. These utilities, together with the
++ man package, are essential for displaying the on-line manual pages. 
++ .
++ Output can be produced in a number of formats including plain ASCII
++ and PostScript. All the standard macro packages are supported.  A
++ number of other utilities are also included together with several fonts.
+--- groff-1.15.orig/debian/copyright
++++ groff-1.15/debian/copyright
+@@ -0,0 +1,65 @@
++This is the Debian GNU/Linux prepackaged version of the GNU groff
++document formatting system. 
++GNU groff was written by James Clark <jjc@jclark.com>.  
++It is now maintained by Ted Harding <ted.harding@nessie.mcc.ac.uk> and
++Werner Lemberg <wl@gnu.org>.
++
++This debian package is maintained by Fabrizio Polacco <fpolacco@debian.org>
++who got the original tarball from   ftp://ftp.ffii.org/pub/groff/
++0c87c54b39a71da4ad92a67f13b740a2  1156304 groff_1.15.tar.gz
++which he simply renamed to groff_1.15.orig.tar.gz
++
++
++=========================================================================
++
++   Groff is Copyright (c) 1989-1997 Free Software Foundation, Inc.
++   Written by James Clark (jjc@jclark.com)
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; version 2 dated June, 1991.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   A copy of the GNU General Public License is available in
++   /usr/share/common-licenses/GPL (as installed by package base-files);
++   if not, write to the Free Software Foundation, Inc.,
++   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++=========================================================================
++
++Included in this release are implementations of troff, pic, eqn, tbl,
++refer, the -man macros and the -ms macros, and drivers for PostScript,
++TeX dvi format, HP LaserJet 4 printers, HTML format (still alpha), and
++typewriter-like devices.  Also included is a modified version of the
++Berkeley -me macros, an enhanced version of the X11 xditview
++previewer, and an implementation of the -mm macros contributed by
++Joergen Haegg (jh@axis.se).
++
++xditview is copyrighted by MIT under the usual X terms.
++
++/*
++ * Copyright 1991 Massachusetts Institute of Technology
++ *
++ * Permission to use, copy, modify, distribute, and sell this software and its
++ * documentation for any purpose is hereby granted without fee, provided that
++ * the above copyright notice appear in all copies and that both that
++ * copyright notice and this permission notice appear in supporting
++ * documentation, and that the name of M.I.T. not be used in advertising or
++ * publicity pertaining to distribution of the software without specific,
++ * written prior permission.  M.I.T. makes no representations about the
++ * suitability of this software for any purpose.  It is provided "as is"
++ * without express or implied warranty.
++ *
++ * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
++ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
++ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
++ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ *
++ */
++
+--- groff-1.15.orig/debian/prerm
++++ groff-1.15/debian/prerm
+@@ -0,0 +1,7 @@
++#! /bin/sh -e
++
++package="groff"
++
++if	[ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/${package} ]
++then	rm -f /usr/doc/${package}
++fi
+--- groff-1.15.orig/debian/mime
++++ groff-1.15/debian/mime
+@@ -0,0 +1 @@
++application/x-troff-man; /usr/bin/nroff -mandoc -Tlatin1; copiousoutput; print=/usr/bin/nroff -mandoc -Tlatin1 | print text/plain:-
+--- groff-1.15.orig/debian/postinst
++++ groff-1.15/debian/postinst
+@@ -0,0 +1,12 @@
++#! /bin/sh -e
++
++package="groff"
++
++if [ -x /usr/sbin/update-mime ]; then /usr/sbin/update-mime; fi
++
++if	[ "$1" = "configure" ]
++then	if	[ -d /usr/doc -a ! -e /usr/doc/${package} -a -d /usr/share/doc/${package} ]
++	then	ln -sf ../share/doc/${package} /usr/doc/${package}
++	fi
++fi
++
+--- groff-1.15.orig/debian/postrm
++++ groff-1.15/debian/postrm
+@@ -0,0 +1,4 @@
++#! /bin/sh -e
++
++test -x "$(which update-mime)" && update-mime || true
++
+--- groff-1.15.orig/debian/rules
++++ groff-1.15/debian/rules
+@@ -0,0 +1,121 @@
++#! /usr/bin/make -f
++#
++# rules to debianize groff
++
++CC = gcc
++CFLAGS = -O2
++LDFLAGS = -s
++
++package = groff
++
++mypc = polacco
++
++DEBVER=`dpkg-parsechangelog | awk '/Version:/{ print $$2 }'`
++
++DOCUMENTS= BUG-REPORT ChangeLog NEWS PROBLEMS PROJECTS README TODO \
++	doc/meintro.me doc/meref.me doc/pic.ms
++
++./configure:	./configure.in
++	$(checkdir)
++	autoconf
++
++Makefile:	./configure
++	$(checkdir)
++	-rm -f config.log config.cache
++	./configure --prefix=/usr
++
++xditview/Makefile:
++	$(checkdir)
++	cd xditview; xmkmf
++
++build:		Makefile xditview/Makefile
++	$(checkdir)
++	-test "`uname -n`" = "${mypc}" && ctags-exuberant */*.[ch] */*.cc
++	# libgroff/Makefile.sub use DEBIAN-VERSION instead of VERSION
++	dpkg-parsechangelog | awk '/Version:/{ print $$2 " (debian)" }' > DEBIAN-VERSION
++	$(MAKE) CC="$(CC)" CCFLAGS="$(CFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS) -lc"
++	cd xditview; $(MAKE) depend;  \
++	$(MAKE) CC="$(CC)" CCFLAGS="$(CFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS) -lc"
++	touch build
++
++clean:		Makefile xditview/Makefile
++	$(checkdir)
++	-rm -rf debian/tmp debian/files*
++	-rm -f build man/index.* `find . -name '*~'` tags
++	-$(MAKE) -i distclean
++	-cd xditview;$(MAKE) extraclean; rm -f Makefile
++	-rm -f configure config.log config.cache
++
++binary-indep:   checkroot build
++	$(checkdir)
++# There are no architecture-independent files to be uploaded
++# generated by this package.  If there were any they would be
++# made here.
++
++binary-arch:    checkroot build
++	$(checkdir)
++	#
++	install -d -g root -m 755 -o root debian/tmp/DEBIAN
++	install -d -g root -m 755 -o root debian/tmp/etc
++	install -d -g root -m 755 -o root debian/tmp/usr/share/doc/$(package)
++	install -d -g root -m 755 -o root debian/tmp/usr/lib/mime/packages
++	install -g root -m 644 -o root \
++		debian/mime	debian/tmp/usr/lib/mime/packages/groff
++	$(MAKE) install prefix=`pwd`/debian/tmp/usr
++	#install -d -g root -m 755 -o root debian/tmp/usr/X11R6/bin
++	#install -d -g root -m 755 -o root debian/tmp/usr/X11R6/man/man1
++	#install -d -g root -m 755 -o root debian/tmp/usr/X11R6/lib/X11/app-defaults
++	cd xditview; $(MAKE) install install.man DESTDIR="../debian/tmp"
++	ln -fs eqn debian/tmp/usr/bin/geqn
++	ln -fs tbl debian/tmp/usr/bin/gtbl
++	ln -fs pic debian/tmp/usr/bin/gpic
++	mv debian/tmp/usr/share/groff/tmac/man.local \
++			debian/tmp/etc/tmac.man.local
++	ln -fs /etc/tmac.man.local debian/tmp/usr/share/groff/tmac/man.local
++	#
++	install -g root -m 644 -o root \
++		debian/changelog debian/tmp/usr/share/doc/$(package)/changelog.Debian
++	cp -p $(DOCUMENTS) debian/tmp/usr/share/doc/$(package)
++	cd debian/tmp/usr/share/doc/$(package) && mv ChangeLog changelog
++	chmod 644 `find debian/tmp/usr/share/doc/$(package) -type f -print`
++	chmod 755 `find debian/tmp/usr/share/doc/$(package) -type d -print`
++	-gzip -r9f debian/tmp/usr/share/doc/$(package)
++	# this not gzipped!
++	install -g root -m 644 -o root \
++		debian/copyright debian/tmp/usr/share/doc/$(package)
++	#
++	chmod 644 debian/tmp/usr/X11R6/lib/X11/app-defaults/*
++	chmod 644 debian/tmp/usr/X11*/man/man?/*
++	chmod 755 debian/tmp/usr/share/groff/font/devps/generate/afmname
++	chmod 755 debian/tmp/usr/share/groff/font/devps/generate/symbol.sed
++	chmod 755 debian/tmp/usr/share/groff/font/devdvi/generate/CompileFonts
++
++	-gzip -r9f debian/tmp/usr/share/man debian/tmp/usr/X11*/man
++	ln -sf eqn.1.gz debian/tmp/usr/share/man/man1/neqn.1.gz
++	ln -sf eqn.1.gz debian/tmp/usr/share/man/man1/geqn.1.gz
++	ln -sf tbl.1.gz debian/tmp/usr/share/man/man1/gtbl.1.gz
++	ln -sf pic.1.gz debian/tmp/usr/share/man/man1/gpic.1.gz
++	#
++	install -g root -m 644 -o root debian/control debian/tmp/DEBIAN
++	install -g root -m 644 -o root debian/conffiles debian/tmp/DEBIAN
++	install -g root -m 755 -o root debian/postinst debian/tmp/DEBIAN
++	install -g root -m 755 -o root debian/prerm debian/tmp/DEBIAN
++	install -g root -m 755 -o root debian/postrm debian/tmp/DEBIAN
++	#
++	dpkg-shlibdeps $(package)/$(package) -dSuggests xditview/gxditview
++	dpkg-gencontrol
++	chown -R root.root debian/tmp
++	chmod -R g-ws debian/tmp
++	dpkg --build debian/tmp ..
++
++define checkdir
++	test -f $(package)/$(package).cc -a -f debian/rules
++endef
++
++binary:         binary-indep binary-arch
++
++checkroot:
++	$(checkdir)
++	test root = "`whoami`"
++
++.PHONY: binary binary-arch binary-indep clean checkroot
+--- groff-1.15.orig/debian/substvars
++++ groff-1.15/debian/substvars
+@@ -0,0 +1,2 @@
++shlibs:Depends=libc6 (>= 2.1), libc6 (>= 2.1.2), libstdc++2.10
++shlibs:Suggests=xlib6g (>= 3.3-5), xlib6g (>= 3.3.5)
+--- groff-1.15.orig/debian/conffiles
++++ groff-1.15/debian/conffiles
+@@ -0,0 +1 @@
++/etc/tmac.man.local
+--- groff-1.15.orig/DEBIAN-VERSION
++++ groff-1.15/DEBIAN-VERSION
+@@ -0,0 +1 @@
++1.15-3 (debian)
+--- groff-1.15.orig/REVISION
++++ groff-1.15/REVISION
+@@ -0,0 +1 @@
++1
--- jgroff-1.15+ja.orig/DEBIAN-VERSION
+++ jgroff-1.15+ja/DEBIAN-VERSION
@@ -0,0 +1 @@
+1.15+ja-3.3 (debian)
--- jgroff-1.15+ja.orig/groff-ja.0.101.fix.1
+++ jgroff-1.15+ja/groff-ja.0.101.fix.1
@@ -0,0 +1,10 @@
+--- groff-1.15/troff/node.cc.orig	Sun Mar 12 03:36:50 2000
++++ groff-1.15/troff/node.cc	Sun Mar 12 03:37:14 2000
+@@ -2465,6 +2465,7 @@
+ {
+   bracket_node *on = new bracket_node;
+   node *last, *tem;
++  list->last = 0;
+   for (tem = list; tem; tem = tem->next) {
+     if (tem->next)
+       tem->next->last = tem;
--- jgroff-1.15+ja.orig/groff_1.15.2-3.patch
+++ jgroff-1.15+ja/groff_1.15.2-3.patch
@@ -0,0 +1,103 @@
+diff --exclude=debian -Nru groff-1.15/DEBIAN-VERSION ../groff-1.15.2/DEBIAN-VERSION
+--- groff-1.15/DEBIAN-VERSION	Mon Jan 21 01:54:04 2002
++++ ../groff-1.15.2/DEBIAN-VERSION	Mon Jan 21 01:48:53 2002
+@@ -1 +1 @@
+-1.15-3 (debian)
++1.15-4 (debian)
+diff --exclude=debian -Nru groff-1.15/pic/pic.y ../groff-1.15.2/pic/pic.y
+--- groff-1.15/pic/pic.y	Tue Dec 14 22:18:58 1999
++++ ../groff-1.15.2/pic/pic.y	Mon Jan 21 01:48:53 2002
+@@ -1751,8 +1751,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)
+@@ -1774,18 +1773,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;
+diff --exclude=debian -Nru groff-1.15/tmac/groff_man.man ../groff-1.15.2/tmac/groff_man.man
+--- groff-1.15/tmac/groff_man.man	Sun Sep 12 22:06:05 1999
++++ ../groff-1.15.2/tmac/groff_man.man	Mon Jan 21 01:48:53 2002
+@@ -1,7 +1,7 @@
+ .TH GROFF_MAN @MAN7EXT@ "@MDATE@" "Groff Version @VERSION@"
+-.
++..
+ .SH NAME
+-.
++..
+ groff_man \- groff `an' macros to support generation of man pages
+ .SH SYNOPSIS
+ .B groff
+@@ -12,9 +12,9 @@
+ [
+ .IR files .\|.\|.
+ ]
+-.
++..
+ .SH DESCRIPTION
+-.
++..
+ The 
+ .B tmac.an 
+ macros used to generate man pages with 
+@@ -102,9 +102,9 @@
+ This is a pagraph following an invocation of the `.HP' macro.
+ As you can see, it produces a paragraph where all lines but the first are
+ flushed right and are shorter than the preceding lines.
+-.
++..
+ .SH "MACROS TO SET FONTS"
+-.
++..
+ .TP
+ .BI .SM 
+ Causes the text on the same line or the text on the next line to appear in a
+@@ -148,9 +148,9 @@
+ Causes text to appear in italic.
+ If no text is present on the line where the macro is called, then the text
+ of the next line appears in italic.
+-.
++..
+ .SH "SEE ALSO"
+-.
++..
+ Since the 
+ .B tmac.an
+ macros consist of groups of 
+@@ -163,9 +163,9 @@
+ A complete list of these requests is available on the WWW at
+ .ce 1
+ http://www.cs.pdx.edu/~trent/gnu/groff/groff_toc.html
+-.
++..
+ .SH AUTHOR
+-.
++..
+ This manual page was originally written for the Debian GNU/Linux system by
+ Susan G. Kleinmann <sgk@debian.org>, corrected by Werner Lemberg
+ <wl@gnu.org>, and is now part of the GNU troff distribution.

