summaryrefslogtreecommitdiffstats
path: root/source/t
diff options
context:
space:
mode:
Diffstat (limited to 'source/t')
-rwxr-xr-xsource/t/tetex/jadetex.build68
-rwxr-xr-xsource/t/tetex/profile.d/tetex.csh4
-rwxr-xr-xsource/t/tetex/profile.d/tetex.sh4
-rw-r--r--source/t/tetex/slack-desc.tetex20
-rw-r--r--source/t/tetex/slack-desc.tetex-doc19
-rw-r--r--source/t/tetex/tetex.CVE-2005-3193.diff169
-rwxr-xr-xsource/t/tetex/tetex.SlackBuild255
-rw-r--r--source/t/tetex/tetex.amstex.fmtutil.diff13
-rw-r--r--source/t/tetex/tetex.browsers.diff39
-rw-r--r--source/t/tetex/tetex.dvipdfm.mkstemp.diff20
-rw-r--r--source/t/tetex/tetex.etex.diff11
-rw-r--r--source/t/tetex/tetex.fontcachedirinhome.diff11
-rw-r--r--source/t/tetex/tetex.scripts.mktemp.diff244
-rw-r--r--source/t/tetex/tetex.tmp.cleanup.diff51
-rw-r--r--source/t/tetex/tetex.var.fonts.diff11
-rw-r--r--source/t/transfig/slack-desc19
-rw-r--r--source/t/transfig/transfig.3.2.4-gcc4.patch34
-rwxr-xr-xsource/t/transfig/transfig.SlackBuild112
-rw-r--r--source/t/transfig/transfig.diff29
-rw-r--r--source/t/xfig/slack-desc19
-rw-r--r--source/t/xfig/xfig-3.2.4-mkstemp.diff331
-rw-r--r--source/t/xfig/xfig.3.2.3d-international-std-fonts.diff49
-rw-r--r--source/t/xfig/xfig.3.2.3d-xcolor.diff10
-rw-r--r--source/t/xfig/xfig.3.2.3d-xim.diff33
-rw-r--r--source/t/xfig/xfig.3.2.4-gcc4.diff11
-rw-r--r--source/t/xfig/xfig.3.2.4-locale.diff117
-rw-r--r--source/t/xfig/xfig.3.2.4-null.diff64
-rw-r--r--source/t/xfig/xfig.3.2.4-quiet.diff183
-rw-r--r--source/t/xfig/xfig.3.2.4-urw-fonts.diff152
-rw-r--r--source/t/xfig/xfig.3.2.4.diff530
-rwxr-xr-xsource/t/xfig/xfig.SlackBuild98
-rw-r--r--source/t/xfig/xfig.docs.location.diff11
-rw-r--r--source/t/xfig/xfig.fig.ad.diff30
-rw-r--r--source/t/xfig/xfig.no.pdf.ref.diff13
-rw-r--r--source/t/xfig/xfig.no.xfig_ref_en.pdf.diff10
35 files changed, 2794 insertions, 0 deletions
diff --git a/source/t/tetex/jadetex.build b/source/t/tetex/jadetex.build
new file mode 100755
index 000000000..0d76f7e9f
--- /dev/null
+++ b/source/t/tetex/jadetex.build
@@ -0,0 +1,68 @@
+#!/bin/sh
+# jadetex build/install script taken from Stuart Winter's build
+# script for linuxdoc-tools.
+
+# Sanity check:
+if [ -z "$SLKCFLAGS" ]; then
+ echo "This script is only meant to be run from tetex.SlackBuild,"
+ echo "so I hope you know what you are doing."
+ echo -n "Hit Enter to continue anyway... "
+ read junk
+fi
+
+JADETEXVER=3.13
+
+# sgmltools-lite's POSTINSTALL document suggests that if jadetex
+# is eating huge amounts of RAM, we need to configure it thusly:
+# Slackware's t/tetex package contains this config file (without the
+# .jadetext config) so I won't overwrite it here. However, we may
+# wish to append this configuration to an install script for
+# this package; but it'd get overwritten by new versions of
+# t/tetex. Perhaps this configuration could be added to the tetex package?
+
+ cat << EOF >> /usr/share/texmf/web2c/texmf.cnf
+
+% options for jadetex:
+hash_extra.jadetex = 15000
+pool_size.jadetex = 200000
+max_strings.jadetex = 50000
+save_size.jadetex = 15000
+EOF
+chmod 644 /usr/share/texmf/web2c/texmf.cnf
+
+# Extract source:
+cd $TMP
+rm -rf jadetex-$JADETEXVER
+tar xvf $CWD/jadetex-$JADETEXVER.tar.gz || exit 1
+cd jadetex-$JADETEXVER
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Build:
+# The install phase breaks if we use tex or etex, so we use latex instead:
+sed -ie "s?tex -ini?latex -ini?" Makefile
+make $NUMJOBS || make || exit 1
+
+# Install onto filesystem:
+make install || exit 1
+
+# Create jadetex symlinks to the TeTex binaries:
+( cd /usr/share/texmf/bin
+ rm -f jadetex pdfjadetex
+ ln -sf latex jadetex
+ ln -sf pdfetex pdfjadetex
+)
+
+# Update the references to jadetex & pdfjadetex:
+mktexlsr
+
+# Install man pages - these are missed by the Makefile:
+mkdir -p /usr/share/texmf/man/man1
+install -m644 jadetex.1 pdfjadetex.1 /usr/share/texmf/man/man1
+gzip -9 /usr/share/texmf/man/man1/jadetex.1
+gzip -9 /usr/share/texmf/man/man1/pdfjadetex.1
+
diff --git a/source/t/tetex/profile.d/tetex.csh b/source/t/tetex/profile.d/tetex.csh
new file mode 100755
index 000000000..30496c4c2
--- /dev/null
+++ b/source/t/tetex/profile.d/tetex.csh
@@ -0,0 +1,4 @@
+#!/bin/csh
+# Add path and MANPATH for teTeX:
+set path = ( $path /usr/share/texmf/bin )
+setenv MANPATH ${MANPATH}:/usr/share/texmf/man
diff --git a/source/t/tetex/profile.d/tetex.sh b/source/t/tetex/profile.d/tetex.sh
new file mode 100755
index 000000000..8987135eb
--- /dev/null
+++ b/source/t/tetex/profile.d/tetex.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Add PATH and MANPATH for teTeX:
+PATH="$PATH:/usr/share/texmf/bin"
+MANPATH="$MANPATH:/usr/share/texmf/man"
diff --git a/source/t/tetex/slack-desc.tetex b/source/t/tetex/slack-desc.tetex
new file mode 100644
index 000000000..ce66d03fb
--- /dev/null
+++ b/source/t/tetex/slack-desc.tetex
@@ -0,0 +1,20 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+tetex: tetex (teTeX binaries and support files)
+tetex:
+tetex: This package contains the binaries and support files required for the
+tetex: teTeX TeX distribution, such as input files for TeX, runtime
+tetex: configuration files, hyphenation tables, manpages, and the computer
+tetex: modern fonts.
+tetex:
+tetex:
+tetex:
+tetex:
+tetex:
+tetex:
diff --git a/source/t/tetex/slack-desc.tetex-doc b/source/t/tetex/slack-desc.tetex-doc
new file mode 100644
index 000000000..7486398f2
--- /dev/null
+++ b/source/t/tetex/slack-desc.tetex-doc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+tetex-doc: tetex-doc (Documentation for teTeX)
+tetex-doc:
+tetex-doc: This package contains documentation for AMSTeX, BibTeX, extended plain
+tetex-doc: format, font packages, format files (babel, texdraw, pstricks, xypic),
+tetex-doc: LaTeX, MetaPost, Makeindex, pdftex, the Kpathsea library, as well as
+tetex-doc: general information about TeX such as a list of ftp servers, a draft
+tetex-doc: for the TeX Directory Standard (TDS), The TeX and LaTeX Catalogue,
+tetex-doc: TeX FAQs, and more.
+tetex-doc:
+tetex-doc:
+tetex-doc:
diff --git a/source/t/tetex/tetex.CVE-2005-3193.diff b/source/t/tetex/tetex.CVE-2005-3193.diff
new file mode 100644
index 000000000..b8f2fad59
--- /dev/null
+++ b/source/t/tetex/tetex.CVE-2005-3193.diff
@@ -0,0 +1,169 @@
+--- tetex-src-3.0/libs/xpdf/goo/gmem.c.CVE-2005-3193 2004-01-22 02:26:44.000000000 +0100
++++ tetex-src-3.0/libs/xpdf/goo/gmem.c 2006-01-16 15:41:04.000000000 +0100
+@@ -135,6 +135,28 @@ void *grealloc(void *p, int size) {
+ #endif
+ }
+
++void *gmallocn(int nObjs, int objSize) {
++ int n;
++
++ n = nObjs * objSize;
++ if (objSize == 0 || n / objSize != nObjs) {
++ fprintf(stderr, "Bogus memory allocation size\n");
++ exit(1);
++ }
++ return gmalloc(n);
++}
++
++void *greallocn(void *p, int nObjs, int objSize) {
++ int n;
++
++ n = nObjs * objSize;
++ if (objSize == 0 || n / objSize != nObjs) {
++ fprintf(stderr, "Bogus memory allocation size\n");
++ exit(1);
++ }
++ return grealloc(p, n);
++}
++
+ void gfree(void *p) {
+ #ifdef DEBUG_MEM
+ int size;
+--- tetex-src-3.0/libs/xpdf/goo/gmem.h.CVE-2005-3193 2004-01-22 02:26:44.000000000 +0100
++++ tetex-src-3.0/libs/xpdf/goo/gmem.h 2006-01-16 15:41:04.000000000 +0100
+@@ -28,6 +28,15 @@ extern void *gmalloc(int size);
+ extern void *grealloc(void *p, int size);
+
+ /*
++ * These are similar to gmalloc and grealloc, but take an object count
++ * and size. The result is similar to allocating nObjs * objSize
++ * bytes, but there is an additional error check that the total size
++ * doesn't overflow an int.
++ */
++extern void *gmallocn(int nObjs, int objSize);
++extern void *greallocn(void *p, int nObjs, int objSize);
++
++/*
+ * Same as free, but checks for and ignores NULL pointers.
+ */
+ extern void gfree(void *p);
+--- tetex-src-3.0/libs/xpdf/xpdf/JPXStream.cc.CVE-2005-3193 2004-01-22 02:26:45.000000000 +0100
++++ tetex-src-3.0/libs/xpdf/xpdf/JPXStream.cc 2006-01-16 15:41:04.000000000 +0100
+@@ -666,7 +666,7 @@ GBool JPXStream::readCodestream(Guint le
+ int segType;
+ GBool haveSIZ, haveCOD, haveQCD, haveSOT;
+ Guint precinctSize, style;
+- Guint segLen, capabilities, comp, i, j, r;
++ Guint segLen, capabilities, nTiles, comp, i, j, r;
+
+ //----- main header
+ haveSIZ = haveCOD = haveQCD = haveSOT = gFalse;
+@@ -701,8 +701,13 @@ GBool JPXStream::readCodestream(Guint le
+ / img.xTileSize;
+ img.nYTiles = (img.ySize - img.yTileOffset + img.yTileSize - 1)
+ / img.yTileSize;
+- img.tiles = (JPXTile *)gmalloc(img.nXTiles * img.nYTiles *
+- sizeof(JPXTile));
++ nTiles = img.nXTiles * img.nYTiles;
++ // check for overflow before allocating memory
++ if (nTiles == 0 || nTiles / img.nXTiles != img.nYTiles) {
++ error(getPos(), "Bad tile count in JPX SIZ marker segment");
++ return gFalse;
++ }
++ img.tiles = (JPXTile *)gmallocn(nTiles, sizeof(JPXTile));
+ for (i = 0; i < img.nXTiles * img.nYTiles; ++i) {
+ img.tiles[i].tileComps = (JPXTileComp *)gmalloc(img.nComps *
+ sizeof(JPXTileComp));
+--- tetex-src-3.0/libs/xpdf/xpdf/Stream.h.CVE-2005-3193 2004-01-22 02:26:45.000000000 +0100
++++ tetex-src-3.0/libs/xpdf/xpdf/Stream.h 2006-01-16 15:41:04.000000000 +0100
+@@ -233,6 +233,8 @@ public:
+
+ ~StreamPredictor();
+
++ GBool isOk() { return ok; }
++
+ int lookChar();
+ int getChar();
+
+@@ -250,6 +252,7 @@ private:
+ int rowBytes; // bytes per line
+ Guchar *predLine; // line buffer
+ int predIdx; // current index in predLine
++ GBool ok;
+ };
+
+ //------------------------------------------------------------------------
+--- tetex-src-3.0/libs/xpdf/xpdf/Stream.cc.CVE-2005-3193 2004-01-22 02:26:45.000000000 +0100
++++ tetex-src-3.0/libs/xpdf/xpdf/Stream.cc 2006-01-16 15:41:04.000000000 +0100
+@@ -407,18 +407,33 @@ void ImageStream::skipLine() {
+
+ StreamPredictor::StreamPredictor(Stream *strA, int predictorA,
+ int widthA, int nCompsA, int nBitsA) {
++ int totalBits;
++
+ str = strA;
+ predictor = predictorA;
+ width = widthA;
+ nComps = nCompsA;
+ nBits = nBitsA;
++ predLine = NULL;
++ ok = gFalse;
+
+ nVals = width * nComps;
++ totalBits = nVals * nBits;
++ if (totalBits == 0 ||
++ (totalBits / nBits) / nComps != width ||
++ totalBits + 7 < 0) {
++ return;
++ }
+ pixBytes = (nComps * nBits + 7) >> 3;
+- rowBytes = ((nVals * nBits + 7) >> 3) + pixBytes;
++ rowBytes = ((totalBits + 7) >> 3) + pixBytes;
++ if (rowBytes < 0) {
++ return;
++ }
+ predLine = (Guchar *)gmalloc(rowBytes);
+ memset(predLine, 0, rowBytes);
+ predIdx = rowBytes;
++
++ ok = gTrue;
+ }
+
+ StreamPredictor::~StreamPredictor() {
+@@ -1012,6 +1027,10 @@ LZWStream::LZWStream(Stream *strA, int p
+ FilterStream(strA) {
+ if (predictor != 1) {
+ pred = new StreamPredictor(this, predictor, columns, colors, bits);
++ if (!pred->isOk()) {
++ delete pred;
++ pred = NULL;
++ }
+ } else {
+ pred = NULL;
+ }
+@@ -2897,6 +2916,14 @@ GBool DCTStream::readBaselineSOF() {
+ height = read16();
+ width = read16();
+ numComps = str->getChar();
++ if (numComps <= 0 || numComps > 4) {
++ error(getPos(), "Bad number of components in DCT stream", prec);
++ return gFalse;
++ }
++ if (numComps <= 0 || numComps > 4) {
++ error(getPos(), "Bad number of components in DCT stream", prec);
++ return gFalse;
++ }
+ if (prec != 8) {
+ error(getPos(), "Bad DCT precision %d", prec);
+ return gFalse;
+@@ -3255,6 +3282,10 @@ FlateStream::FlateStream(Stream *strA, i
+ FilterStream(strA) {
+ if (predictor != 1) {
+ pred = new StreamPredictor(this, predictor, columns, colors, bits);
++ if (!pred->isOk()) {
++ delete pred;
++ pred = NULL;
++ }
+ } else {
+ pred = NULL;
+ }
diff --git a/source/t/tetex/tetex.SlackBuild b/source/t/tetex/tetex.SlackBuild
new file mode 100755
index 000000000..f19273323
--- /dev/null
+++ b/source/t/tetex/tetex.SlackBuild
@@ -0,0 +1,255 @@
+#!/bin/sh
+
+# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+VERSION=3.0
+ARCH=${ARCH:-x86_64}
+NUMJOBS=${NUMJOBS:-" -j7 "}
+BUILD=${BUILD:-6}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+fi
+
+# There were so many local security problems with this shared fontcache
+# scheme that it's not worth trying to support. It was not enabled by
+# default, and newer versions of teTeX don't seem to recongnize it any
+# longer either.
+#export fontcache=/var/cache/fonts
+#export vartexfonts=$fontcache
+#mkdir -p /var/cache/fonts/pk /var/cache/fonts/source /var/cache/fonts/tfm
+#chmod 1777 /var/cache/fonts /var/cache/fonts/pk \
+# /var/cache/fonts/source /var/cache/fonts/tfm
+
+# Safer to purge this first:
+rm -rf /usr/share/texmf
+rm -rf /usr/share/texmf-var
+rm -rf /usr/share/texi2html
+
+# Make a clean new directory:
+mkdir -p /usr/share/texmf
+( cd /usr/share/texmf
+ tar xvf $CWD/tetex-texmf-$VERSION.tar.xz
+ chown -R root:root .
+ find . -type f -perm 666 -exec chmod 644 {} \;
+)
+cd $TMP
+rm -rf tetex-src-$VERSION
+tar xvf $CWD/tetex-src-$VERSION.tar.xz
+cd tetex-src-$VERSION
+chown -R root:root .
+find . -type f -perm 666 -exec chmod 644 {} \;
+
+# Fix possible xpdf overflows:
+zcat $CWD/tetex.CVE-2005-3193.diff.gz | patch -p1 --verbose || exit 1
+
+# /var/lib/texmf is a better font location than /var/tmp/texfonts:
+zcat $CWD/tetex.var.fonts.diff.gz | patch -p1 --verbose || exit 1
+
+# Even better is something in your $HOME directory:
+zcat $CWD/tetex.fontcachedirinhome.diff.gz | patch -p1 --verbose || exit 1
+
+# Use mkstemp() in dvipdfm:
+zcat $CWD/tetex.dvipdfm.mkstemp.diff.gz | patch -p1 --verbose || exit 1
+
+# Use mktemp in scripts:
+zcat $CWD/tetex.scripts.mktemp.diff.gz | patch -p1 --verbose || exit 1
+
+# Try to use more modern browsers.
+# Attempt to use them in this order: firefox, seamonkey, mozilla, links, lynx.
+zcat $CWD/tetex.browsers.diff.gz | patch -p1 --verbose || exit 1
+
+# Add bplain and bamstex info to fmtutil.cnf:
+zcat $CWD/tetex.amstex.fmtutil.diff.gz | patch -p1 --verbose || exit 1
+
+# Don't leave texconfig junk in $TMP:
+zcat $CWD/tetex.tmp.cleanup.diff.gz | patch -p1 --verbose || exit 1
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure --prefix=/usr/share/texmf \
+ --datadir=/usr/share \
+ --disable-multiplatform \
+ --disable-a4 \
+ --without-dialog \
+ --without-texinfo \
+ --with-system-ncurses \
+ --with-system-pnglib \
+ --with-system-t1lib \
+ --with-system-tifflib \
+ --with-system-zlib \
+ --with-ps=gs \
+ --enable-ipc \
+ --enable-freetype \
+ --with-etex
+# --without-texinfo # Really, it doesn't hurt to include these twice...
+
+# This was reported to fix a problem with newer GNU sources and "make dvi".
+# It does, in fact, fix a bug where the etex binary/engine really should be
+# used when etex and dvi output are requested, but the example given to me
+# (which was "make dvi" in GNU binutils) also has some problems that have to
+# be fixed. This confused me for a good long time. ;-)
+# BTW, the fix for the binutils docs is to edit bfd.texinfo and remove that
+# @tex through @end tex section near the top. Then build twice. Hit enter
+# if it "sticks".
+zcat $CWD/tetex.etex.diff.gz | patch -p1 --verbose || exit 1
+
+make all $NUMJOBS || make all || exit 1
+make install strip || exit 1
+
+if ! echo $PATH | grep /usr/share/texmf/bin ; then
+ PATH=$PATH:/usr/share/texmf/bin
+fi
+# ... [don't] make links to all binaries in /usr/bin for the final package.
+# [that would be really pointless... $PATH should work, period. ]
+
+# If latex isn't there, maybe we need to do this:
+if [ ! -r /usr/share/texmf/bin/latex ]; then
+ texconfig init
+fi
+
+# Let's start with these defaults:
+texconfig confall
+texconfig dvips paper letter
+texconfig xdvi paper us
+
+# These *might* be useful...
+# Some are known to be not-so-useful, though, as they put the config files
+# into /root/.texmf-config, which we're simply going to throw away anyway
+# so it won't interfere with server testing. If you need these options,
+# you'll probably have to run texconfig yourself in your own user (or root)
+# account.
+texconfig mode ljfour
+#texconfig xdvi paper a4
+texconfig dvips mode ljfour
+#texconfig dvips paper a4
+texconfig dvips printcmd -
+texconfig dvips add bjc600
+texconfig dvips add stcolor
+texconfig dvips add deskjet
+texconfig dvips add ljet4
+texconfig dvips -P bjc600 mode canonbjc
+texconfig dvips -P stcolor mode epstylus
+texconfig dvips -P deskjet mode deskjet
+texconfig dvips -P ljet4 mode ljfour
+texconfig font ro
+texconfig rehash
+
+# Add jadetex to the package:
+. $CWD/jadetex.build
+
+# Toss redundant docs:
+( cd /usr/share/texmf/doc
+ for file in $(find . -name "*.dvi") ; do
+ rm -f $(dirname $file)/$(basename $file .dvi).pdf
+ done
+)
+
+# Discard local configurations:
+if [ -e /root/.texmf-config ]; then
+ mv /root/.texmf-config /root/.texmf-config-$(mcookie)
+ echo "/root/.texmf-config moved out of the way... you may wish"
+ echo "to purge any /root/.texmf-config-* directories if the"
+ echo "cruft heap gets too large."
+fi
+
+# Now, package the /usr/share/texmf/ and /usr/share/texi2html trees.
+# Package tetex-doc.txz and tetex-bin.txz seperately.
+
+PKG1=$TMP/package-tetex
+PKG2=$TMP/package-tetex-doc
+rm -rf $PKG1 $PKG2
+mkdir -p $PKG1 $PKG2
+
+mkdir -p $PKG1/usr/share
+mv /usr/share/texmf $PKG1/usr/share
+mv /usr/share/texmf-var $PKG1/usr/share
+mv /usr/share/texi2html $PKG1/usr/share
+
+# The tetex.txz file will need an installation script to add
+# /usr/share/texmf/bin to the $PATH and /usr/share/texmf/man to the $MANPATH:
+mkdir -p $PKG1/etc/profile.d
+cp -a $CWD/profile.d/tetex.* $PKG1/etc/profile.d
+chown root:root $PKG1/etc/profile.d/tetex.*
+chmod 755 $PKG1/etc/profile.d/tetex.*
+
+mkdir -p $PKG1/install
+cp $CWD/slack-desc.tetex $PKG1/install/slack-desc
+mkdir -p $PKG2/install
+cp $CWD/slack-desc.tetex-doc $PKG2/install/slack-desc
+
+# Strip everything:
+find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+# Gzip man pages:
+gzip -9 $PKG1/usr/share/texmf/man/man?/*.?
+
+# Fix manpage symlinks:
+( cd $PKG1/usr/share/texmf/man
+ for dir in man? ; do
+ ( cd $dir
+ for file in *.? ; do
+ if [ -L $file ]; then
+ LINK=$(readlink $file)
+ rm $file
+ ln -sf ${LINK}.gz ${file}.gz
+ fi
+ done
+ )
+ done
+)
+
+# Move some of the files into the docs package:
+mkdir -p $PKG2/usr/share/texmf/doc
+mv $PKG1/usr/share/texmf/doc/* $PKG2/usr/share/texmf/doc
+mkdir -p $PKG2/usr/share/texinfo
+mv /usr/share/texinfo/html $PKG2/usr/share/texinfo
+mv $PKG1/usr/share/texmf/info $PKG2/usr
+( cd $PKG1/usr/share/texmf ; ln -sf /usr/info . )
+
+# Compress info pages and purge "dir" file from the package:
+if [ -d $PKG2/usr/info ]; then
+ ( cd $PKG2/usr/info
+ rm -f dir
+ gzip -9 *
+ )
+fi
+
+# Make docs link in /usr/doc/:
+mkdir -p $PKG2/usr/doc
+( cd $PKG2/usr/doc ; rm -rf tetex-$VERSION )
+( cd $PKG2/usr/doc ; ln -sf /usr/share/texmf/doc tetex-$VERSION )
+
+# Build the packages:
+cd $PKG1
+/sbin/makepkg -l y -c n $TMP/tetex-$VERSION-$ARCH-$BUILD.txz
+cd $PKG2
+/sbin/makepkg -l y -c n $TMP/tetex-doc-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/t/tetex/tetex.amstex.fmtutil.diff b/source/t/tetex/tetex.amstex.fmtutil.diff
new file mode 100644
index 000000000..6ae5c1f93
--- /dev/null
+++ b/source/t/tetex/tetex.amstex.fmtutil.diff
@@ -0,0 +1,13 @@
+--- tetex-src-3.0/texk/web2c/fmtutil.in.fmtutil 2005-02-06 09:27:46.000000000 +0900
++++ tetex-src-3.0/texk/web2c/fmtutil.in 2005-02-07 15:22:31.828492229 +0900
+@@ -55,7 +55,9 @@
+
+ # Change "amstex.ini -> bamstex.ini" and "- -> language.dat"
+ # if you want babel support in amstex:
+-#! amstex pdfetex - -translate-file=cp227.tcx *amstex.ini
++amstex pdfetex - -translate-file=cp227.tcx *amstex.ini
++bplain pdfetex language.dat -translate-file=cp227.tcx bplain.ini
++bamstex pdfetex language.dat -translate-file=cp227.tcx bamstex.ini
+
+ # Change "pdfamstex.ini -> pdfbamstex.ini" and "- -> language.dat"
+ # if you want babel support in pdfamstex:
diff --git a/source/t/tetex/tetex.browsers.diff b/source/t/tetex/tetex.browsers.diff
new file mode 100644
index 000000000..42052aa07
--- /dev/null
+++ b/source/t/tetex/tetex.browsers.diff
@@ -0,0 +1,39 @@
+--- ./texk/xdvik/gui/xm_prefsP.h.orig 2004-04-21 16:12:09.000000000 -0500
++++ ./texk/xdvik/gui/xm_prefsP.h 2006-05-16 16:39:38.000000000 -0500
+@@ -96,8 +96,10 @@
+ #define Xdvi_APPLY_STR "Apply"
+
+ #define Xdvi_PREFS_BROWSER_DEFAULTS \
++ "firefox -remote 'openURL(%s,new-window)'\n" \
++ "seamonkey -remote 'openURL(%s,new-window)'\n" \
+ "mozilla -remote 'openURL(%s,new-window)'\n" \
+- "netscape -raise -remote 'openURL(%s,new-window)'\n" \
++ "xterm -e links %s\n" \
+ "xterm -e lynx %s\n" \
+ Xdvi_ADD_COMMAND_STR
+ #define Xdvi_PREFS_EDITOR_DEFAULTS \
+--- ./texk/xdvik/browser.c.orig 2004-11-11 19:25:26.000000000 -0600
++++ ./texk/xdvik/browser.c 2006-05-16 16:39:52.000000000 -0500
+@@ -39,7 +39,10 @@
+ #include "statusline.h"
+
+ static const char *const default_browser_cmd =
+- "netscape -raise -remote \"openURL(%s,new-window)\""
++ ":firefox -remote \"openURL(%s,new-window)\""
++ ":seamonkey -remote \"openURL(%s,new-window)\""
++ ":mozilla -remote \"openURL(%s,new-window)\""
++ ":xterm -e links %s"
+ ":xterm -e lynx %s"
+ ":xterm -e wget %s";
+
+--- ./texk/xdvik/xdvi.1.in.orig 2005-01-20 10:51:45.000000000 -0600
++++ ./texk/xdvik/xdvi.1.in 2006-05-16 16:40:25.000000000 -0500
+@@ -365,7 +365,7 @@
+ .B WWWBROWSER
+ (in that order) are used to determine the browser command. If these are
+ not set either, the following default value is used:
+-.SB netscape -raise -remote "openURL(%s,new-window)":xterm -e lynx %s:xterm -e wget %s
++.SB firefox -remote -remote "openURL(%s,new-window)":seamonkey -remote "openURL(%s,new-window)":mozilla -remote "openURL(%s,new-window)":xterm -e links %s:xterm -e lynx %s:xterm -e wget %s
+ .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+ .TP
+ .BI \-bw " width"
diff --git a/source/t/tetex/tetex.dvipdfm.mkstemp.diff b/source/t/tetex/tetex.dvipdfm.mkstemp.diff
new file mode 100644
index 000000000..5cae1bf22
--- /dev/null
+++ b/source/t/tetex/tetex.dvipdfm.mkstemp.diff
@@ -0,0 +1,20 @@
+--- tetex-src-2.0.2/texk/dvipdfm/psimage.c.dvipdfm-security 2001-06-28 20:55:26.000000000 +0100
++++ tetex-src-2.0.2/texk/dvipdfm/psimage.c 2003-03-12 18:12:56.000000000 +0000
+@@ -113,10 +113,15 @@
+ {
+ #ifdef HAVE_SYSTEM
+ pdf_obj *result = NULL;
+- char *tmp, *cmd;
++ char tmp[] = "/tmp/dvipdfm.XXXXXX", *cmd;
++ int tfd;
+ FILE *pdf_file = NULL;
+ /* Get a full qualified tmp name */
+- tmp = tmpnam (NULL);
++ tfd = mkstemp (tmp);
++ if (tfd == -1) {
++ fprintf (stderr, "\nCouldn't create temporary file for output\n");
++ return NULL;
++ } else close (tfd);
+ if ((cmd = build_command_line (file_name, tmp))) {
+ if (!system (cmd) && (pdf_file = MFOPEN (tmp, FOPEN_RBIN_MODE))) {
+ result = pdf_include_page (pdf_file, p, res_name);
diff --git a/source/t/tetex/tetex.etex.diff b/source/t/tetex/tetex.etex.diff
new file mode 100644
index 000000000..0f96a17a9
--- /dev/null
+++ b/source/t/tetex/tetex.etex.diff
@@ -0,0 +1,11 @@
+--- ./texk/web2c/fmtutil.cnf.orig 2005-07-17 17:09:33.000000000 -0700
++++ ./texk/web2c/fmtutil.cnf 2005-07-17 17:11:20.000000000 -0700
+@@ -40,7 +40,7 @@
+ # if you want babel support in tex:
+ tex tex - -translate-file=cp227.tcx tex.ini
+ latex pdfetex language.dat -translate-file=cp227.tcx *latex.ini
+-etex pdfetex language.def -translate-file=cp227.tcx *etex.ini
++etex etex language.def -translate-file=cp227.tcx *etex.ini
+ pdftex pdfetex - -translate-file=cp227.tcx *pdftex.ini
+ pdflatex pdfetex language.dat -translate-file=cp227.tcx *pdflatex.ini
+ pdfetex pdfetex language.def -translate-file=cp227.tcx *pdfetex.ini
diff --git a/source/t/tetex/tetex.fontcachedirinhome.diff b/source/t/tetex/tetex.fontcachedirinhome.diff
new file mode 100644
index 000000000..11760a4c3
--- /dev/null
+++ b/source/t/tetex/tetex.fontcachedirinhome.diff
@@ -0,0 +1,11 @@
+--- ./texk/kpathsea/texmf.in-teTeX.orig 2005-02-05 18:04:35.000000000 -0600
++++ ./texk/kpathsea/texmf.in-teTeX 2007-06-27 21:44:36.000000000 -0500
+@@ -119,7 +119,7 @@
+ % Where generated fonts may be written. This tree is used when the sources
+ % were found in a system tree and either that tree wasn't writable, or the
+ % varfonts feature was enabled in MT_FEATURES in mktex.cnf.
+-VARTEXFONTS = @vartexfonts@
++VARTEXFONTS = $TEXMFVAR
+
+ % Where to look for ls-R files. There need not be an ls-R in the
+ % directories in this path, but if there is one, Kpathsea will use it.
diff --git a/source/t/tetex/tetex.scripts.mktemp.diff b/source/t/tetex/tetex.scripts.mktemp.diff
new file mode 100644
index 000000000..7d38869cf
--- /dev/null
+++ b/source/t/tetex/tetex.scripts.mktemp.diff
@@ -0,0 +1,244 @@
+--- tetex-src-3.0/texk/tetex/allcm.badscript 2004-06-20 21:38:02.000000000 +0900
++++ tetex-src-3.0/texk/tetex/allcm 2005-02-07 15:31:32.578141611 +0900
+@@ -14,7 +14,7 @@
+ test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"'
+
+ progname=`basename $0`
+-tmpdir=${TMP-/tmp}/$progname.$$
++tmpdir=`mktemp -d ${TMP-/tmp}/$progname.XXXXXX`
+
+ case "$progname" in
+ allec)
+@@ -81,11 +81,6 @@
+ exit 1
+ ' 1 2 3 7 13 15
+
+-(umask 077; mkdir "$tmpdir") || {
+- echo "$progname: failed to create temp directory." >&2
+- exit 1
+-}
+-
+ cd $tmpdir || exit 1
+ echo >&2
+ echo "---------------------------------------------------------------------" >&2
+--- tetex-src-3.0/texk/tetex/fmtutil.badscript 2005-01-30 18:12:16.000000000 +0900
++++ tetex-src-3.0/texk/tetex/fmtutil 2005-02-07 15:31:32.579141429 +0900
+@@ -105,8 +105,6 @@
+
+ trap 'cleanup' 1 2 3 7 13 15
+ needsCleanup=true
+- (umask 077; mkdir "$tmpdir") \
+- || abort "could not create directory \`$tmpdir'"
+ }
+
+ ###############################################################################
+@@ -357,7 +355,7 @@
+ need_find_hyphenfile=false
+ cfgparam=
+ cfgmaint=
+- tmpdir=${TMP-/tmp}/$progname.$$
++ tmpdir=`mktemp -d ${TMP-/tmp}/$progname.XXXXXX`
+ verboseFlag=true
+
+ # mktexfmtMode: if called as mktexfmt, set to true. Will echo the generated
+--- tetex-src-3.0/texk/tetex/texconfig.badscript 2005-02-07 03:20:53.000000000 +0900
++++ tetex-src-3.0/texk/tetex/texconfig 2005-02-07 15:31:32.581141065 +0900
+@@ -35,7 +35,7 @@
+ TEXMFDBS TEXMFINI TEXMFSCRIPTS TEXPICTS TEXPKS TEXPOOL TEXPSHEADERS
+ TEXSOURCES TFMFONTS TRFONTS TTFONTS VFFONTS WEB2C WEBINPUTS
+ "
+-tmpdir=${TMP-/tmp}/tctmp.$$
++tmpdir=`mktemp -d "${TMP-/tmp}/$progname.XXXXXX"` || exit 1
+ needsCleanup=false
+ lastUpdatedFile=
+
+@@ -214,8 +214,6 @@
+
+ trap 'cleanup' 1 2 3 7 13 15
+ needsCleanup=true
+- (umask 077; mkdir "$tmpdir") \
+- || abort "could not create directory \`$tmpdir'"
+ }
+
+ ###############################################################################
+--- tetex-src-3.0/texk/tetex/texlinks.badscript 2004-05-11 03:53:38.000000000 +0900
++++ tetex-src-3.0/texk/tetex/texlinks 2005-02-07 15:31:32.583140701 +0900
+@@ -92,8 +92,6 @@
+
+ trap 'cleanup' 1 2 3 7 13 15
+ needsCleanup=true
+- (umask 077; mkdir "$tmpdir") \
+- || abort "could not create directory \`$tmpdir'"
+ }
+
+
+@@ -209,7 +207,7 @@
+ upd_symlinkdir()
+ {
+ search_symlinkdir || return 0
+- for i in `sed 's@ .*@@' cnf_file_ln.$$`; do
++ for i in `sed 's@ .*@@' $tmpdir/cnf_file_ln`; do
+ install_link "$selfautoloc/$i" "$symlinkdir/$i"
+ done
+ }
+@@ -253,7 +251,7 @@
+ test -f "$cnf_file" || abort "config file \`$cnf' not found"
+
+
+- tmpdir=${TMP-/tmp}/texlinks.$$
++ tmpdir=`mktemp -d ${TMP-/tmp}/$progname.XXXXXX` || exit 1
+ setupTmpDir
+ cd "$tmpdir" || {
+ false # some systems need this to set nonzero $?
+@@ -261,7 +259,7 @@
+ }
+
+ sed '/^[ ]*#/d; /^[ ]*$/d' $cnf_file \
+- | awk '{print $1, $2}' > cnf_file_ln.$$
++ | awk '{print $1, $2}' > $tmpdir/cnf_file_ln
+
+ if test -z "$dirs"; then
+ if test $multiplatform = true; then
+@@ -279,8 +277,8 @@
+ for d in $dirs; do
+ kpseaccess -w $d \
+ || { errmsg "$d: no write permissions. Skipping..."; continue; }
+- # cnf_file_ln.$$ has lines with "format engine" pairs
+- set x `cat cnf_file_ln.$$`; shift
++ # $tmpdir/cnf_file_ln has lines with "format engine" pairs
++ set x `cat $tmpdir/cnf_file_ln`; shift
+ while test $# != 0; do
+ fmt=$1; engine=$2; shift; shift
+
+--- tetex-src-3.0/texk/tetex/updmap.badscript 2005-02-05 06:34:26.000000000 +0900
++++ tetex-src-3.0/texk/tetex/updmap 2005-02-07 15:31:32.585140338 +0900
+@@ -761,7 +761,6 @@
+
+ trap 'cleanup' 1 2 3 7 13 15
+ needsCleanup=true
+- mkdir "$tmpdir" || abort "could not create directory \`$tmpdir'"
+ }
+
+ ###############################################################################
+@@ -1282,7 +1281,8 @@
+ dvipsoutputdir=; pdftexoutputdir=; dvipdfmoutputdir=
+ : ${TEXMFMAIN=`kpsewhich -var-value=TEXMFMAIN`}
+
+- tmpdir=${TMP-/tmp}/$progname.$$
++ tmpdir=`mktemp -d ${TMP-/tmp}/$progname.XXXXXX` || \
++ abort "could not create directory"
+ tmp1=$tmpdir/a
+ tmp2=$tmpdir/b
+ tmp3=$tmpdir/c
+--- tetex-src-3.0/texk/kpathsea/mktexlsr.badscript 2005-01-22 04:13:57.000000000 +0900
++++ tetex-src-3.0/texk/kpathsea/mktexlsr 2005-02-07 15:31:32.586140156 +0900
+@@ -119,9 +119,8 @@
+ # Skip if we cannot write the file:
+ kpseaccess -w "$db_file" || { echo "$progname: $db_file: no write permission. Skipping..." >&2; continue; }
+
+- db_dir_tmp="$db_dir/lsR$$.tmp"
+- (umask 077 && mkdir "$db_dir_tmp" ) \
+- || { echo "$progname: could not create directory '$db_dir_tmp'. Skipping..." >&2; continue; }
++ db_dir_tmp=`mktemp -d "$db_dir/lsR.XXXXXX"` \
++ || { echo "$progname: could not create secure temporary directory. Skipping..." >&2; continue; }
+ db_file_tmp="$db_dir_tmp/lsR$$.tmp"
+ rm -f "$db_file_tmp"
+
+--- tetex-src-3.0/texk/kpathsea/mktexmf.badscript 2005-01-26 02:39:21.000000000 +0900
++++ tetex-src-3.0/texk/kpathsea/mktexmf 2005-02-07 15:31:32.587139974 +0900
+@@ -87,50 +87,52 @@
+ exit 0
+ fi
+
++tmpfile=`mktemp mf.XXXXXX`
++
+ case "$name" in
+ ec*|tc*)
+- cat > "mf$$.tmp" <<END
++ cat > "$tmpfile" <<END
+ if unknown exbase: input exbase fi;
+ gensize:=$realsize;
+ generate $rootname;
+ END
+ ;;
+ dc*)
+- cat > "mf$$.tmp" <<END
++ cat > "$tmpfile" <<END
+ if unknown dxbase: input dxbase fi;
+ gensize:=$realsize;
+ generate $rootname;
+ END
+ ;;
+ cs*|lcsss*|icscsc*|icstt*|ilcsss*)
+- cat > "mf$$.tmp" <<END
++ cat > "$tmpfile" <<END
+ input cscode
+ use_driver;
+ END
+ ;;
+ wn[bcdfirstuv]*|rx[bcdfiorstuvx][bcfhilmostx]*|l[abcdhl][bcdfiorstuvx]*)
+- cat > "mf$$.tmp" <<END
++ cat > "$tmpfile" <<END
+ input fikparm;
+ END
+ ;;
+ g[lmorst][ijmtwx][cilnoru]*)
+ # A small superset of the names of the cbgreek fonts.
+- cat > "mf$$.tmp" <<END
++ cat > "$tmpfile" <<END
+ gensize:=$realsize;
+ input $rootname;
+ END
+ ;;
+ *)
+- cat > "mf$$.tmp" <<END
++ cat > "$tmpfile" <<END
+ design_size := $realsize;
+ input $rootname;
+ END
+ ;;
+ esac
+
+-chmod `kpsestat -xst,go-w .` "mf$$.tmp"
++chmod `kpsestat -xst,go-w .` "$tmpfile"
+ rm -f "$mfname"
+-mv "mf$$.tmp" "$mfname"
++mv "$tmpfile" "$mfname"
+
+ echo "$destdir/$mfname" >$STDOUT
+ echo "$progname: $destdir/$mfname: successfully generated." >&2
+--- tetex-src-3.0/texk/dviljk/dvihp.badscript 2002-07-08 02:49:09.000000000 +0900
++++ tetex-src-3.0/texk/dviljk/dvihp 2005-02-07 15:31:32.588139792 +0900
+@@ -7,9 +7,7 @@
+ : ${SPOOL=lpr} # used to print an LJ file
+ : ${TMP=/tmp} # for the dvicopy output
+
+-TMPDIR="${TMP}"/dvihp$$
+-(umask 077; mkdir "$TMPDIR") \
+- || { echo "cannot create directory \`$TMPDIR'."; exit 1; }
++TMPDIR=`mktemp -d ${TMPDIR}/dvihp.XXXXXX` || { echo "cannot create secure temporary directory."; exit 1; }
+
+ trap '
+ cd "${TMP}"
+--- tetex-src-3.0/texk/dvipdfm/dvipdft.badscript 2004-11-19 06:26:19.000000000 +0900
++++ tetex-src-3.0/texk/dvipdfm/dvipdft 2005-02-07 15:31:32.589139610 +0900
+@@ -31,7 +31,7 @@
+ $progname --help
+ $progname --version"
+
+-tmpdir=${TMP-/tmp}/$progname.$$
++tmpdir=`mktemp -d ${TMP-/tmp}/$progname.XXXXXX`
+
+ quoteit()
+ {
+--- tetex-src-3.0/texk/xdvik/xdvizilla.badscript 2004-02-25 08:08:56.000000000 +0900
++++ tetex-src-3.0/texk/xdvik/xdvizilla 2005-02-07 15:31:32.590139429 +0900
+@@ -61,7 +61,7 @@
+ trap 'do_cleanup' 1 2 3 7 13 15
+
+ ### create a temporary directory only read/writable by user
+-TMP_DIR=${TMP-/tmp}/$progname.$$
++TMP_DIR=`mktmp -d ${TMP-/tmp}/$progname.XXXXXX`
+ (umask 077; mkdir "$TMP_DIR") || do_abort "Could not create directory \`$TMP_DIR'"
+
+ if [ $# -gt 1 -a "x$1" = "x-no-rm" ]; then
diff --git a/source/t/tetex/tetex.tmp.cleanup.diff b/source/t/tetex/tetex.tmp.cleanup.diff
new file mode 100644
index 000000000..e2fb56ea1
--- /dev/null
+++ b/source/t/tetex/tetex.tmp.cleanup.diff
@@ -0,0 +1,51 @@
+--- tetex-src-3.0/texk/tetex/texconfig.tmpcleanup 2005-11-04 11:19:47.000000000 +0100
++++ tetex-src-3.0/texk/tetex/texconfig 2005-11-04 14:22:18.000000000 +0100
+@@ -36,7 +36,8 @@
+ TEXSOURCES TFMFONTS TRFONTS TTFONTS VFFONTS WEB2C WEBINPUTS
+ "
+ tmpdir=`mktemp -d "${TMP-/tmp}/$progname.XXXXXX"` || exit 1
+-needsCleanup=false
++trap -- "cleanup;" EXIT 1 2 3 7 13 15
++needsCleanup=true
+ lastUpdatedFile=
+
+ ###############################################################################
+--- tetex-src-3.0/texk/tetex/updmap.tmpcleanup 2005-11-04 11:19:47.000000000 +0100
++++ tetex-src-3.0/texk/tetex/updmap 2005-11-04 14:22:18.000000000 +0100
+@@ -1274,7 +1274,7 @@
+ texhashEnabled=true
+ mkmapEnabled=true
+ verbose=true
+- needsCleanup=false
++ needsCleanup=true
+
+ cnfFileShort=updmap.cfg
+ cnfFile=
+@@ -1282,7 +1282,8 @@
+ : ${TEXMFMAIN=`kpsewhich -var-value=TEXMFMAIN`}
+
+ tmpdir=`mktemp -d ${TMP-/tmp}/$progname.XXXXXX` || \
+- abort "could not create directory"
++ abort "could not create temporary directory"
++ trap -- "cleanup;" EXIT 1 2 3 7 13 15
+ tmp1=$tmpdir/a
+ tmp2=$tmpdir/b
+ tmp3=$tmpdir/c
+--- tetex-src-3.0/texk/tetex/fmtutil.tmpcleanup 2005-11-04 11:19:47.000000000 +0100
++++ tetex-src-3.0/texk/tetex/fmtutil 2005-11-04 14:22:18.000000000 +0100
+@@ -351,11 +351,13 @@
+ destdir= # global variable: where do we put the format files?
+ cnf_file= # global variable: full name of the config file
+ cmd= # desired action from command line
+- needsCleanup=false
++ needsCleanup=true
+ need_find_hyphenfile=false
+ cfgparam=
+ cfgmaint=
+- tmpdir=`mktemp -d ${TMP-/tmp}/$progname.XXXXXX`
++ tmpdir=`mktemp -d ${TMP-/tmp}/$progname.XXXXXX` || \
++ abort "could not create temporary directory"
++ trap -- "cleanup;" EXIT 1 2 3 7 13 15
+ verboseFlag=true
+
+ # mktexfmtMode: if called as mktexfmt, set to true. Will echo the generated
diff --git a/source/t/tetex/tetex.var.fonts.diff b/source/t/tetex/tetex.var.fonts.diff
new file mode 100644
index 000000000..9535ac6fa
--- /dev/null
+++ b/source/t/tetex/tetex.var.fonts.diff
@@ -0,0 +1,11 @@
+--- teTeX-1.0/texk/make/paths.mk.varconfig Sun Jan 10 16:42:53 1999
++++ teTeX-1.0/texk/make/paths.mk Wed Aug 25 19:18:13 1999
+@@ -46,7 +46,7 @@
+ texmf = @texmfmain@
+
+ # The directory used by varfonts.
+-vartexfonts = /var/tmp/texfonts
++vartexfonts = /var/lib/texmf
+
+ # Regular input files.
+ texinputdir = $(texmf)/tex
diff --git a/source/t/transfig/slack-desc b/source/t/transfig/slack-desc
new file mode 100644
index 000000000..e4ee4e7ee
--- /dev/null
+++ b/source/t/transfig/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+transfig: transfig (transform .fig files)
+transfig:
+transfig: This package contains the binaries to transform .fig files (created by
+transfig: xfig) to some other formats like epsf and LaTeX. If you have
+transfig: installed xfig, you should also install this package if you want to
+transfig: use xfig to create other files than .fig files, which can then be
+transfig: included in your LaTeX documents.
+transfig:
+transfig:
+transfig:
+transfig:
diff --git a/source/t/transfig/transfig.3.2.4-gcc4.patch b/source/t/transfig/transfig.3.2.4-gcc4.patch
new file mode 100644
index 000000000..a8ba41f63
--- /dev/null
+++ b/source/t/transfig/transfig.3.2.4-gcc4.patch
@@ -0,0 +1,34 @@
+diff -Naur transfig.3.2.4/fig2dev/dev/gensvg.c transfig.3.2.4-gcc4/fig2dev/dev/gensvg.c
+--- transfig.3.2.4/fig2dev/dev/gensvg.c 2002-12-18 20:38:18.000000000 -0200
++++ transfig.3.2.4-gcc4/fig2dev/dev/gensvg.c 2007-02-19 16:59:30.000000000 -0200
+@@ -692,16 +692,14 @@
+ if (t->angle != 0) {
+ fprintf (tfp, "<g transform=\"translate(%d,%d) rotate(%d)\" >\n",
+ (int) (t->base_x * mag), (int) (t->base_y * mag), degrees (t->angle));
+- fprintf (tfp, "<text x=\"0\" y=\"0\" fill=\"#%6.6x\" font-family=\"%s\"
+- font-style=\"%s\" font-weight=\"%s\" font-size=\"%d\" text-anchor=\"%s\" >\n",
++ fprintf (tfp, "<text x=\"0\" y=\"0\" fill=\"#%6.6x\" font-family=\"%s\" font-style=\"%s\" font-weight=\"%s\" font-size=\"%d\" text-anchor=\"%s\" >\n",
+ rgbColorVal (t->color), family[(int) ceil ((t->font + 1) / 4)],
+ (t->font % 2 == 0 ? "normal" : "italic"),
+ (t->font % 4 < 2 ? "normal" : "bold"), (int) (ceil (t->size * 12 * mag)),
+ anchor[t->type]);
+ }
+ else
+- fprintf (tfp, "<text x=\"%d\" y=\"%d\" fill=\"#%6.6x\" font-family=\"%s\"
+- font-style=\"%s\" font-weight=\"%s\" font-size=\"%d\" text-anchor=\"%s\" >\n",
++ fprintf (tfp, "<text x=\"%d\" y=\"%d\" fill=\"#%6.6x\" font-family=\"%s\" font-style=\"%s\" font-weight=\"%s\" font-size=\"%d\" text-anchor=\"%s\" >\n",
+ (int) (t->base_x * mag), (int) (t->base_y * mag), rgbColorVal (t->color),
+ family[(int) ceil ((t->font + 1) / 4)],
+ (t->font % 2 == 0 ? "normal" : "italic"),
+diff -Naur transfig.3.2.4/fig2dev/fig2dev.h transfig.3.2.4-gcc4/fig2dev/fig2dev.h
+--- transfig.3.2.4/fig2dev/fig2dev.h 2002-12-18 20:45:28.000000000 -0200
++++ transfig.3.2.4-gcc4/fig2dev/fig2dev.h 2007-02-19 16:58:18.000000000 -0200
+@@ -22,7 +22,7 @@
+ #include <sys/file.h>
+ #include <signal.h>
+ #include <string.h>
+-#include <varargs.h>
++#include <stdarg.h>
+ #include <pwd.h>
+ #include <errno.h>
+ #include <time.h>
diff --git a/source/t/transfig/transfig.SlackBuild b/source/t/transfig/transfig.SlackBuild
new file mode 100755
index 000000000..70aa22133
--- /dev/null
+++ b/source/t/transfig/transfig.SlackBuild
@@ -0,0 +1,112 @@
+#!/bin/sh
+
+# Copyright 2006, 2007, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+PKGNAM=transfig
+VERSION=${VERSION:-3.2.4}
+ARCH=${ARCH:-x86_64}
+BUILD=${BUILD:-2}
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-${PKGNAM}
+rm -rf $PKG
+mkdir -p $PKG $TMP
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+fi
+
+cd $TMP
+rm -rf ${PKGNAM}-${VERSION}
+tar xvf $CWD/${PKGNAM}.$VERSION.tar.gz || exit 1
+cd ${PKGNAM}.$VERSION || exit 1
+
+# Make sure ownerships and permissions are sane:
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+zcat $CWD/transfig.diff.gz | sed -e "s#/usr/lib/#/usr/lib${LIBDIRSUFFIX}/#" \
+ | patch -p1 --verbose || exit 1
+zcat $CWD/transfig.3.2.4-gcc4.patch.gz | patch -p1 --verbose || exit 1
+xmkmf
+make Makefiles
+
+# Build and install:
+make $NUMJOBS || make || exit 1
+
+mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/X11/fig2dev
+make install DESTDIR=$PKG || exit 1
+make install.man DESTDIR=$PKG || exit 1
+
+# Strip binaries:
+find $PKG | xargs file | grep -e "executable" -e "shared object" \
+ | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+# Compress and link manpages, if any:
+if [ -d $PKG/usr/man ]; then
+ ( cd $PKG/usr/man
+ for manpagedir in $(find . -type d -name "man*") ; do
+ ( cd $manpagedir
+ for eachpage in $( find . -type l -maxdepth 1) ; do
+ ln -s $( readlink $eachpage ).gz $eachpage.gz
+ rm $eachpage
+ done
+ gzip -9 *.*
+ )
+ done
+ )
+fi
+
+# Compress info files, if any:
+if [ -d $PKG/usr/info ]; then
+ ( cd $PKG/usr/info
+ rm -f dir
+ gzip -9 *
+ )
+fi
+
+# Add a documentation directory:
+mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
+cp -a \
+ CHANGES LATEX.AND.XFIG NOTES README doc/manual \
+ $PKG/usr/doc/${PKGNAM}-$VERSION
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/t/transfig/transfig.diff b/source/t/transfig/transfig.diff
new file mode 100644
index 000000000..40026dd1e
--- /dev/null
+++ b/source/t/transfig/transfig.diff
@@ -0,0 +1,29 @@
+--- ./fig2dev/Imakefile.orig 2002-12-19 09:33:44.000000000 -0800
++++ ./fig2dev/Imakefile 2003-03-03 19:58:09.000000000 -0800
+@@ -20,7 +20,7 @@
+ XCOMM You should point XFIGLIBDIR to the same directory you did when you compiled
+ XCOMM and installed xfig.
+
+-XFIGLIBDIR = /usr/local/lib/X11/xfig
++XFIGLIBDIR = /usr/lib/X11/xfig
+
+ XCOMM ******
+ XCOMM If your system has the strerror() function (doesn't have sys_errlist) then
+@@ -73,7 +73,7 @@
+ XCOMM Change XPMINC if necessary to point to the include file for xpm (xpm.h)
+ XCOMM
+
+-XCOMM #define USEXPM
++#define USEXPM
+
+ #ifdef USEXPM
+ XPMLIBDIR = $(USRLIBDIR)
+@@ -126,7 +126,7 @@
+
+ #ifdef I18N
+ I18N_DEFS = -DI18N
+-FIG2DEV_LIBDIR = /usr/local/lib/fig2dev
++FIG2DEV_LIBDIR = /usr/lib/X11/fig2dev
+ I18N_DEV_DEFS = $(I18N_DEFS) -DFIG2DEV_LIBDIR=\\\"$(FIG2DEV_LIBDIR)\\\"
+
+ install::
diff --git a/source/t/xfig/slack-desc b/source/t/xfig/slack-desc
new file mode 100644
index 000000000..85d1fefde
--- /dev/null
+++ b/source/t/xfig/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+xfig: xfig (interactive drawing tool)
+xfig:
+xfig: This package contains the binary for xfig, an interactive drawing tool
+xfig: under X. Xfig can create fig, epsf, and LaTeX files with various
+xfig: options. You also have to install the transfig package (transfig.tgz)
+xfig: so that xfig can export fig files as epsf and LaTeX files. This
+xfig: package also contains a set of basic examples of fig files.
+xfig:
+xfig:
+xfig:
+xfig:
diff --git a/source/t/xfig/xfig-3.2.4-mkstemp.diff b/source/t/xfig/xfig-3.2.4-mkstemp.diff
new file mode 100644
index 000000000..cf6bf2283
--- /dev/null
+++ b/source/t/xfig/xfig-3.2.4-mkstemp.diff
@@ -0,0 +1,331 @@
+--- xfig.3.2.4/f_readeps.c
++++ xfig.3.2.4/f_readeps.c 2003-05-06 12:07:54.000000000 +0200
+@@ -258,7 +258,7 @@
+ char buf[300];
+ FILE *tmpfp, *pixfile, *gsfile;
+ char *psnam, *driver;
+- int status, wid, ht, nbitmap;
++ int status, wid, ht, nbitmap, fd;
+ char tmpfile[PATH_MAX],
+ pixnam[PATH_MAX],
+ errnam[PATH_MAX],
+@@ -274,8 +274,12 @@
+ /* re-open the pipe */
+ close_picfile(file, filetype);
+ file = open_picfile(file, &filetype, PIPEOK, pixnam);
+- sprintf(tmpfile, "%s/%s%06d", TMPDIR, "xfig-eps", getpid());
+- if ((tmpfp = fopen(tmpfile, "wb")) == NULL) {
++ snprintf(tmpfile, sizeof(tmpfile), "%s/xfig-eps.XXXXXX", TMPDIR);
++ if ((fd = mkstemp(tmpfile)) == -1 || (tmpfp = fdopen(fd, "wb")) == NULL) {
++ if (fd != -1) {
++ unlink(tmpfile);
++ close(fd);
++ }
+ file_msg("Couldn't open tmp file %s, %s", tmpfile, strerror(errno));
+ return False;
+ }
+@@ -284,9 +288,21 @@
+ fclose(tmpfp);
+ }
+ /* make name /TMPDIR/xfig-pic.pix */
+- sprintf(pixnam, "%s/%s%06d.pix", TMPDIR, "xfig-pic", getpid());
++ snprintf(pixnam, sizeof(pixnam), "%s/xfig-pic.XXXXXX", TMPDIR);
++ if ((fd = mkstemp(pixnam)) == -1) {
++ file_msg("Couldn't open tmp file %s, %s", pixnam, strerror(errno));
++ return False;
++ }
++ close(fd);
++
+ /* and file name for any error messages from gs */
+- sprintf(errnam, "%s/%s%06d.err", TMPDIR, "xfig-pic", getpid());
++ snprintf(errnam, sizeof(errnam), "%s/xfig-picerr.XXXXXX", TMPDIR);
++ if ((fd = mkstemp(errnam)) == -1) {
++ file_msg("Couldn't open tmp file %s, %s", errnam, strerror(errno));
++ return False;
++ }
++ close(fd);
++
+ /* generate gs command line */
+ /* for monochrome, use pbm */
+ if (tool_cells <= 2 || appres.monochrome) {
+--- xfig.3.2.4/f_readgif.c
++++ xfig.3.2.4/f_readgif.c 2003-05-06 11:56:53.000000000 +0200
+@@ -75,7 +75,7 @@
+ char buf[BUFLEN],pcxname[PATH_MAX];
+ FILE *giftopcx;
+ struct Cmap localColorMap[MAX_COLORMAP_SIZE];
+- int i, stat, size;
++ int i, stat, size, fd;
+ int useGlobalColormap;
+ unsigned int bitPixel, red, green, blue;
+ unsigned char c;
+@@ -172,7 +172,13 @@
+ /* now call giftopnm and ppmtopcx */
+
+ /* make name for temp output file */
+- sprintf(pcxname, "%s/%s%06d.pix", TMPDIR, "xfig-pcx", getpid());
++ snprintf(pcxname, sizeof(pcxname), "%s/xfig-pcx.XXXXXX", TMPDIR);
++ if ((fd = mkstemp(pcxname)) == -1) {
++ file_msg("Cannot create temporary file\n");
++ return FileInvalid;
++ }
++ close(fd);
++
+ /* make command to convert gif to pcx into temp file */
+ sprintf(buf, "giftopnm | ppmtopcx > %s 2> /dev/null", pcxname);
+ if ((giftopcx = popen(buf,"w" )) == 0) {
+--- xfig.3.2.4/f_readppm.c
++++ xfig.3.2.4/f_readppm.c 2003-05-06 11:56:53.000000000 +0200
+@@ -33,10 +33,16 @@
+ {
+ char buf[BUFLEN],pcxname[PATH_MAX];
+ FILE *giftopcx;
+- int stat, size;
++ int stat, size, fd;
+
+ /* make name for temp output file */
+- sprintf(pcxname, "%s/%s%06d.pix", TMPDIR, "xfig-pcx", getpid());
++ snprintf(pcxname, sizeof(pcxname), "%s/xfig-pcx.XXXXXX", TMPDIR);
++ if ((fd = mkstemp(pcxname)) == -1) {
++ file_msg("Cannot open temp file %s: %s\n", pcxname, strerror(errno));
++ return FileInvalid;
++ }
++ close(fd);
++
+ /* make command to convert gif to pcx into temp file */
+ sprintf(buf, "ppmtopcx > %s 2> /dev/null", pcxname);
+ if ((giftopcx = popen(buf,"w" )) == 0) {
+--- xfig.3.2.4/f_readtif.c
++++ xfig.3.2.4/f_readtif.c 2003-05-06 11:56:53.000000000 +0200
+@@ -32,11 +32,16 @@
+ {
+ char buf[2*PATH_MAX+40],pcxname[PATH_MAX];
+ FILE *tiftopcx;
+- int stat;
++ int stat, fd;
+
+ /* make name for temp output file */
+- sprintf(pcxname, "%s/%s%06d.pix", TMPDIR, "xfig-pcx", getpid());
+-
++ snprintf(pcxname, sizeof(pcxname), "%s/xfig-pcx.XXXXXX", TMPDIR);
++ if ((fd = mkstemp(pcxname)) == -1) {
++ file_msg("Cannot open temp file %s: %s\n", pcxname, strerror(errno));
++ return FileInvalid;
++ }
++ close(fd);
++
+ /* make command to convert tif to pnm then to pcx into temp file */
+ /* for some reason, tifftopnm requires a file and can't work in a pipe */
+ sprintf(buf, "tifftopnm %s 2> /dev/null | ppmtopcx > %s 2> /dev/null",
+--- xfig.3.2.4/f_util.c
++++ xfig.3.2.4/f_util.c 2003-05-06 12:13:22.000000000 +0200
+@@ -902,14 +902,20 @@
+ char *name;
+ {
+ char line[RC_BUFSIZ+1], *tok;
++ int fd;
+
+ /* make a temp filename in the user's home directory so we
+ can just rename it to .xfigrc after creating it */
+- sprintf(tmpname, "%s/%s%06d", userhome, "xfig-xfigrc", getpid());
+- tmpf = fopen(tmpname,"wb");
+- if (tmpf == 0) {
+- file_msg("Can't make temporary file for .xfigrc - error: %s",strerror(errno));
+- return -1;
++ snprintf(tmpname, sizeof(tmpname), "%s/xfig-xfigrc.XXXXXX", userhome);
++
++ if ((fd = mkstemp(tmpname)) == -1 || (tmpf = fdopen(fd, "wb")) == NULL) {
++ file_msg("Can't make temporary file for .xfigrc - error: %s",
++ strerror(errno));
++ if (fd != -1) {
++ unlink(tmpname);
++ close(fd);
++ }
++ return -1;
+ }
+ /* read the .xfigrc file and write all to temp file except file names */
+ xfigrc = fopen(xfigrc_name,"r");
+--- xfig.3.2.4/main.c
++++ xfig.3.2.4/main.c 2003-05-06 11:56:53.000000000 +0200
+@@ -621,8 +621,10 @@
+ update_figs = False;
+
+ /* get the TMPDIR environment variable for temporary files */
+- if ((TMPDIR = getenv("XFIGTMPDIR"))==NULL)
+- TMPDIR = "/tmp";
++ if ((TMPDIR = getenv("XFIGTMPDIR"))==NULL) {
++ if ((TMPDIR = getenv("TMPDIR")) == NULL)
++ TMPDIR = "/tmp";
++ }
+
+ /* first check args to see if user wants to scale the figure as it is
+ read in and make sure it is a resonable (positive) number */
+@@ -1631,7 +1633,14 @@
+ if (userhome != NULL && *strcpy(cut_buf_name, userhome) != '\0') {
+ strcat(cut_buf_name, "/.xfig");
+ } else {
+- sprintf(cut_buf_name, "%s/xfig%06d", TMPDIR, getpid());
++ int fd;
++ sprintf(cut_buf_name, "%s/xfig.XXXXXX", TMPDIR);
++ if ((fd = mkstemp(cut_buf_name)) == -1) {
++ fprintf(stderr, "Can't create temporary file for cut_buff: %s\n",
++ strerror(errno));
++ exit(0);
++ }
++ close(fd);
+ }
+ }
+
+--- xfig.3.2.4/mode.c
++++ xfig.3.2.4/mode.c 2003-05-06 11:56:53.000000000 +0200
+@@ -93,7 +93,7 @@
+
+ int cur_exp_lang; /* gets initialized in main.c */
+ Boolean batch_exists = False;
+-char batch_file[32];
++char batch_file[PATH_MAX];
+
+ /*******************************************************************/
+ /* If you change the order of the lang_items[] you must change the */
+--- xfig.3.2.4/u_print.c
++++ xfig.3.2.4/u_print.c 2003-05-06 12:18:47.000000000 +0200
+@@ -85,9 +85,16 @@
+ char syspr[2*PATH_MAX+200];
+ char tmpfile[PATH_MAX];
+ char *name;
++ int fd;
+
+- sprintf(tmpfile, "%s/%s%06d", TMPDIR, "xfig-print", getpid());
++ snprintf(tmpfile, sizeof(tmpfile), "%s/xfig-print.XXXXXX", TMPDIR);
+ warnexist = False;
++ if ((fd = mkstemp(tmpfile)) == -1) {
++ file_msg("Can't open temp file %s: %s\n", tmpfile, strerror(errno));
++ return;
++ }
++ close(fd);
++
+ init_write_tmpfile();
+ if (write_file(tmpfile, False)) {
+ end_write_tmpfile();
+@@ -166,14 +173,21 @@
+ char tmp_name[PATH_MAX];
+ char tmp_fig_file[PATH_MAX];
+ char *outfile, *name, *real_lang;
++ int fd;
+
+ /* if file exists, ask if ok */
+ if (!ok_to_write(file, "EXPORT"))
+ return (1);
+
+- sprintf(tmp_fig_file, "%s/%s%06d", TMPDIR, "xfig-fig", getpid());
+- /* write the fig objects to a temporary file */
++ snprintf(tmp_fig_file, sizeof(tmp_fig_file), "%s/xfig-fig.XXXXXX", TMPDIR);
+ warnexist = False;
++ if ((fd = mkstemp(tmp_fig_file)) == -1) {
++ file_msg("Can't open temp file %s: %s\n", tmp_fig_file,
++ strerror(errno));
++ return 1;
++ }
++ close(fd);
++
+ init_write_tmpfile();
+ if (write_file(tmp_fig_file, False)) {
+ end_write_tmpfile();
+@@ -491,10 +505,16 @@
+ char errfname[PATH_MAX];
+ FILE *errfile;
+ char str[400];
+- int status;
++ int status, fd;
+
+ /* make temp filename for any errors */
+- sprintf(errfname, "%s/xfig-export%06d.err", TMPDIR, getpid());
++ snprintf(errfname, sizeof(errfname), "%s/xfig-export.XXXXXX", TMPDIR);
++ if ((fd = mkstemp(errfname)) == -1) {
++ file_msg("Can't open temp file %s: %s\n", errfname, strerror(errno));
++ return 1;
++ }
++ close(fd);
++
+ /* direct any output from fig2dev to this file */
+ strcat(command, " 2> ");
+ strcat(command, errfname);
+--- xfig.3.2.4/w_print.c
++++ xfig.3.2.4/w_print.c 2003-05-06 12:20:46.000000000 +0200
+@@ -289,9 +289,10 @@
+ Widget w;
+ {
+ FILE *infp,*outfp;
+- char tmp_exp_file[32];
++ char tmp_exp_file[PATH_MAX];
+ char str[255];
+ char backgrnd[10], grid[80];
++ int fd;
+
+ if (writing_batch || emptyfigure_msg(print_msg))
+ return;
+@@ -300,11 +301,20 @@
+ /* this could happen if the user presses the button too fast */
+ writing_batch = True;
+
+- /* make a temporary name to write the batch stuff to */
+- sprintf(batch_file, "%s/%s%06d", TMPDIR, "xfig-batch", getpid());
+ /* make a temporary name to write this figure to */
+- sprintf(tmp_exp_file, "%s/%s%06d", TMPDIR, "xfig-exp", getpid());
+- batch_exists = True;
++ snprintf(tmp_exp_file, sizeof(tmp_exp_file), "%s/xfig-exp.XXXXXX",
++ TMPDIR);
++
++ if (batch_exists != True) {
++ /* make a temporary name to write the batch stuff to */
++ sprintf(batch_file, "%s/xfig-batch.XXXXXX", TMPDIR);
++ if ((fd = mkstemp(batch_file)) == -1) {
++ file_msg("Error creating temporary file");
++ return;
++ }
++ close(fd);
++ batch_exists = True;
++ }
+ if (!print_popup)
+ create_print_panel(w);
+
+@@ -317,6 +327,12 @@
+ /* make a #rrggbb string from the background color */
+ make_rgb_string(export_background_color, backgrnd);
+
++ if ((fd = mkstemp(tmp_exp_file)) == -1) {
++ file_msg("Error creating temporary file");
++ return;
++ }
++ close(fd);
++
+ /* get grid params and assemble into fig2dev parm */
+ get_grid_spec(grid, print_grid_minor_text);
+
+--- xfig.3.2.4/w_srchrepl.c
++++ xfig.3.2.4/w_srchrepl.c 2003-05-06 11:56:53.000000000 +0200
+@@ -795,7 +795,7 @@
+ char *cmd;
+ char str[300];
+ FILE *fp;
+- int len, i;
++ int len, i, fd;
+ Boolean done = FALSE;
+ static int lines = 0;
+
+@@ -811,9 +811,12 @@
+ }
+ lines = 0;
+
+- sprintf(filename, "%s/xfig-spell.%d", TMPDIR, (int)getpid());
+- fp = fopen(filename, "w");
+- if (fp == NULL) {
++ snprintf(filename, sizeof(filename), "%s/xfig-spell.XXXXXX", TMPDIR);
++ if ((fd = mkstemp(filename)) == -1 || (fp = fdopen(fd, "w")) == NULL) {
++ if (fd != -1) {
++ unlink(filename);
++ close(fd);
++ }
+ file_msg("Can't open temporary file: %s: %s\n", filename, strerror(errno));
+ } else {
+ /* locate all text objects and write them to file fp */
diff --git a/source/t/xfig/xfig.3.2.3d-international-std-fonts.diff b/source/t/xfig/xfig.3.2.3d-international-std-fonts.diff
new file mode 100644
index 000000000..5dbdc2e6e
--- /dev/null
+++ b/source/t/xfig/xfig.3.2.3d-international-std-fonts.diff
@@ -0,0 +1,49 @@
+diff -ru xfig.3.2.3d.orig/main.c xfig.3.2.3d/main.c
+--- xfig.3.2.3d.orig/main.c 2001-01-25 22:49:19.000000000 +0100
++++ xfig.3.2.3d/main.c 2003-05-09 11:58:41.000000000 +0200
+@@ -259,18 +259,36 @@
+ XtOffset(appresPtr, always_use_fontset), XtRBoolean, (caddr_t) & false},
+ {"fixedFontSet", "FontSet", XtRFontSet, sizeof(XFontSet),
+ XtOffset(appresPtr, fixed_fontset), XtRString,
+- (caddr_t) "-*-times-medium-r-normal--16-*-*-*-*-*-*-*,"
+- "-*-*-medium-r-normal--16-*-*-*-*-*-*-*,*--16-*" },
++ (caddr_t) "-URW-Nimbus Roman No9 L-medium-r-normal--34-*-*-*-*-*-*-*,"
++ "-kochi-mincho-medium-r-normal--34-*-*-*-*-*-jisx0208.1983-0,"
++ "-baekmukttf-batang-medium-r-normal--34-*-*-*-*-*-ksc5601.1987-0,"
++ "-*-times-medium-r-normal--34-*-*-*-*-*-*-*,"
++ "-*-*-medium-r-normal--34-*-*-*-*-*-*-*,*--34-*"
++ "-*-times-medium-r-normal--16-*-*-*-*-*-*-*,"
++ "-*-*-medium-r-normal--16-*-*-*-*-*-*-*,*--16-*"
++ },
+ {"normalFontSet", "NormalFontSet", XtRFontSet, sizeof(XFontSet),
+ XtOffset(appresPtr, normal_fontset), XtRString,
+- (caddr_t) "-*-times-medium-r-normal--16-*-*-*-*-*-*-*,"
+- "-*-*-medium-r-normal--16-*-*-*-*-*-*-*,"
+- "-*-*-*-r-*--16-*-*-*-*-*-*-*" },
++ (caddr_t) "-URW-Nimbus Roman No9 L-medium-r-normal--34-*-*-*-*-*-*-*,"
++ "-kochi-mincho-medium-r-normal--34-*-*-*-*-*-jisx0208.1983-0,"
++ "-baekmukttf-batang-medium-r-normal--34-*-*-*-*-*-ksc5601.1987-0,"
++ "-*-times-medium-r-normal--34-*-*-*-*-*-*-*,"
++ "-*-*-medium-r-normal--34-*-*-*-*-*-*-*,"
++ "-*-*-*-r-*--34-*-*-*-*-*-*-*"
++ "-*-times-medium-r-normal--16-*-*-*-*-*-*-*,"
++ "-*-*-medium-r-normal--16-*-*-*-*-*-*-*,*--16-*"
++ },
+ {"boldFontSet", "BoldFontSet", XtRFontSet, sizeof(XFontSet),
+ XtOffset(appresPtr, bold_fontset), XtRString,
+- (caddr_t) "-*-times-bold-r-normal--16-*-*-*-*-*-*-*,"
+- "-*-*-bold-r-normal--16-*-*-*-*-*-*-*,"
+- "-*-*-*-r-*--16-*-*-*-*-*-*-*" },
++ (caddr_t) "-URW-Nimbus Roman No9 L-bold-r-normal--34-*-*-*-*-*-*-*,"
++ "-kochi-gothic-medium-r-normal--34-*-*-*-*-*-jisx0208.1983-0,"
++ "-baekmukttf-dotum-medium-r-normal--34-*-*-*-*-*-ksc5601.1987-0,"
++ "-*-times-bold-r-normal--34-*-*-*-*-*-*-*,"
++ "-*-*-bold-r-normal--34-*-*-*-*-*-*-*,"
++ "-*-*-*-r-*--34-*-*-*-*-*-*-*"
++ "-*-times-medium-r-normal--16-*-*-*-*-*-*-*,"
++ "-*-*-medium-r-normal--16-*-*-*-*-*-*-*,*--16-*"
++ },
+ {"fontSetSize", "FontSetSize", XtRInt, sizeof(int),
+ XtOffset(appresPtr, fontset_size), XtRImmediate, (caddr_t)0 },
+ {"inputStyle", "InputStyle", XtRString, sizeof(char *),
+
diff --git a/source/t/xfig/xfig.3.2.3d-xcolor.diff b/source/t/xfig/xfig.3.2.3d-xcolor.diff
new file mode 100644
index 000000000..11be8a56e
--- /dev/null
+++ b/source/t/xfig/xfig.3.2.3d-xcolor.diff
@@ -0,0 +1,10 @@
+--- w_color.c
++++ w_color.c
+@@ -1288,6 +1288,7 @@
+
+ create_cell(indx, color)
+ int indx;
++ XColor color;
+ {
+ char labl[5];
+
diff --git a/source/t/xfig/xfig.3.2.3d-xim.diff b/source/t/xfig/xfig.3.2.3d-xim.diff
new file mode 100644
index 000000000..918d00d9f
--- /dev/null
+++ b/source/t/xfig/xfig.3.2.3d-xim.diff
@@ -0,0 +1,33 @@
+--- xfig.3.2.3d/d_text.c
++++ xfig.3.2.3d/d_text.c
+@@ -1485,6 +1485,7 @@
+ int i;
+ XVaNestedList preedit_att, status_att;
+ XPoint spot;
++ char *modifier_list;
+
+ preferred_style = style_notuseful;
+ if (strncasecmp(appres.xim_input_style, "OverTheSpot", 3) == 0)
+@@ -1501,6 +1502,10 @@
+ if (preferred_style == style_notuseful) return;
+
+ if (appres.DEBUG) fprintf(stderr, "initialize_input_method()...\n");
++
++ if((modifier_list = XSetLocaleModifiers("")) == NULL) {
++ /* printf("Warning: XSetLocaleModifiers() failed.\n"); */
++ }
+
+ xim_im = XOpenIM(XtDisplay(w), NULL, NULL, NULL);
+ if (xim_im == NULL) {
+@@ -1517,7 +1522,10 @@
+ if (xim_style == 0) xim_style = style_root;
+ }
+ }
+- if (xim_style != preferred_style) {
++ if (xim_style != preferred_style
++ && *modifier_list != '\0'
++ && ! strstr(modifier_list,"@im=local")
++ && ! strstr(modifier_list,"@im=none")) {
+ fprintf(stderr, "xfig: this input-method doesn't support %s input style\n",
+ appres.xim_input_style);
+ if (xim_style == 0) {
diff --git a/source/t/xfig/xfig.3.2.4-gcc4.diff b/source/t/xfig/xfig.3.2.4-gcc4.diff
new file mode 100644
index 000000000..d8b8597ff
--- /dev/null
+++ b/source/t/xfig/xfig.3.2.4-gcc4.diff
@@ -0,0 +1,11 @@
+--- w_color.c
++++ w_color.c 2005/08/31 10:42:32
+@@ -1057,7 +1057,7 @@
+ {
+ F_compound *c;
+ int i, count;
+- char buf[10];
++ char buf[11];
+
+ /* keep array of counts of each color */
+ for (i=0; i<num_usr_cols; i++)
diff --git a/source/t/xfig/xfig.3.2.4-locale.diff b/source/t/xfig/xfig.3.2.4-locale.diff
new file mode 100644
index 000000000..5bb9f9252
--- /dev/null
+++ b/source/t/xfig/xfig.3.2.4-locale.diff
@@ -0,0 +1,117 @@
+--- main.c
++++ main.c 2006-07-31 17:56:25.000000000 +0200
+@@ -62,6 +62,7 @@
+ #ifdef I18N
+ #include <X11/keysym.h>
+ #include <locale.h>
++#include <langinfo.h>
+ #endif /* I18N */
+
+ /* EXPORTS */
+@@ -709,11 +710,6 @@ main(argc, argv)
+ }
+ }
+
+-#ifdef I18N
+- setlocale(LC_ALL, "");
+- XtSetLanguageProc(NULL, NULL, NULL);
+-#endif /* I18N */
+-
+ /*
+ * save the command line arguments
+ */
+@@ -807,6 +803,10 @@ main(argc, argv)
+ }
+
+ #ifdef I18N
++ if (NULL == strcasestr(nl_langinfo(CODESET),"ANSI") &&
++ NULL == strcasestr(nl_langinfo(CODESET),"ISO-8859-1"))
++ appres.international = True;
++
+ /************************************************************/
+ /* if the international option has been set, set the locale */
+ /************************************************************/
+@@ -1523,6 +1523,11 @@ setup_visual(argc_p, argv, args)
+ */
+ tool = XtAppInitialize (&tool_app, "Fig", options, XtNumber (options), argc_p, argv,
+ (String *) NULL, args, 0);
++#ifdef I18N
++ setlocale(LC_ALL, "");
++ setlocale(LC_NUMERIC, "C");
++ XtSetLanguageProc(tool_app, NULL, NULL);
++#endif /* I18N */
+ /* save important info */
+ tool_d = XtDisplay(tool);
+ tool_s = XtScreen(tool);
+--- u_print.c
++++ u_print.c 2006-11-16 12:45:46.000000000 +0000
+@@ -15,6 +15,7 @@
+ *
+ */
+
++#include <locale.h>
+ #include "fig.h"
+ #include "resources.h"
+ #include "mode.h"
+@@ -75,6 +76,7 @@ char *shell_protect_string(string)
+ return(buf);
+ }
+
++void
+ print_to_printer(printer, backgrnd, mag, print_all_layers, grid, params)
+ char printer[];
+ char *backgrnd;
+@@ -111,6 +113,8 @@ print_to_printer(printer, backgrnd, mag,
+ name = shell_protect_string(cur_filename);
+
+ #ifdef I18N
++ /* set the numeric locale to C so we set decimal points for numbers */
++ setlocale(LC_NUMERIC, "C");
+ sprintf(tmpcmd, "%s %s -L ps -z %s -m %f %s -n %s",
+ fig2dev_cmd, appres.international ? appres.fig2dev_localize_option : "",
+ #else
+@@ -119,6 +123,10 @@ print_to_printer(printer, backgrnd, mag,
+ #endif /* I18N */
+ paper_sizes[appres.papersize].sname, mag/100.0,
+ appres.landscape ? "-l xxx" : "-p xxx", name);
++#ifdef I18N
++ /* reset to original locale */
++ setlocale(LC_NUMERIC, "");
++#endif /* I18N */
+
+ if (appres.correct_font_size)
+ strcat(tmpcmd," -F ");
+@@ -223,9 +231,13 @@ print_to_file(file, lang, mag, xoff, yof
+
+ /* start with the command, language and internationalization, if applicable */
+ #ifdef I18N
++ /* set the numeric locale to C so we set decimal points for numbers */
++ setlocale(LC_NUMERIC, "C");
+ sprintf(prcmd, "%s %s -L %s -m %f ",
+ fig2dev_cmd, appres.international ? appres.fig2dev_localize_option : "",
+ real_lang, mag/100.0);
++ /* reset to original locale */
++ setlocale(LC_NUMERIC, "");
+ #else
+ sprintf(prcmd, "%s -L %s -m %f ", fig2dev_cmd, real_lang, mag/100.0);
+ #endif /* I18N */
+@@ -324,6 +336,8 @@ print_to_file(file, lang, mag, xoff, yof
+ strcat(tmp_name,"_t");
+ /* make it automatically input the postscript/pdf part (-p option) */
+ #ifdef I18N
++ /* set the numeric locale to C so we set decimal points for numbers */
++ setlocale(LC_NUMERIC, "C");
+ sprintf(prcmd, "%s %s -L %s -E %d -p %s -m %f ",
+ fig2dev_cmd, appres.international ? appres.fig2dev_localize_option : "",
+ #else
+@@ -332,6 +346,10 @@ print_to_file(file, lang, mag, xoff, yof
+ #endif /* I18N */
+ !strcmp(lang,"pstex")? "pstex_t": "pdftex_t",
+ appres.encoding, outfile, mag/100.0);
++#ifdef I18N
++ /* reset to original locale */
++ setlocale(LC_NUMERIC, "");
++#endif /* I18N */
+ /* add the -D +list if user doesn't want all layers printed */
+ if (!print_all_layers)
+ strcat(prcmd, layers);
diff --git a/source/t/xfig/xfig.3.2.4-null.diff b/source/t/xfig/xfig.3.2.4-null.diff
new file mode 100644
index 000000000..46120af18
--- /dev/null
+++ b/source/t/xfig/xfig.3.2.4-null.diff
@@ -0,0 +1,64 @@
+--- w_dir.c
++++ w_dir.c 2004-03-22 12:17:21.000000000 +0000
+@@ -126,6 +126,8 @@
+ {
+ XawListReturnStruct *ret_struct = (XawListReturnStruct *) call_data;
+
++ if (!ret_struct)
++ return;
+ strcpy(CurrentSelectionName, ret_struct->string);
+ FirstArg(XtNstring, CurrentSelectionName);
+ if (browse_up) {
+@@ -160,6 +162,8 @@
+ {
+ XawListReturnStruct *ret_struct = (XawListReturnStruct *) call_data;
+
++ if (!ret_struct)
++ return;
+ strcpy(CurrentSelectionName, ret_struct->string);
+ DoChangeDir(CurrentSelectionName);
+ }
+--- w_library.c
++++ w_library.c 2004-03-22 12:19:10.000000000 +0000
+@@ -461,6 +461,8 @@
+ int new_obj;
+ XawListReturnStruct *ret_struct = (XawListReturnStruct *) call_data;
+
++ if (!ret_struct)
++ return;
+ new_obj = ret_struct->list_index;
+ if (icons_made) {
+ /* unhighlight the current view icon */
+--- w_srchrepl.c
++++ w_srchrepl.c 2004-03-22 12:20:38.000000000 +0000
+@@ -894,6 +894,8 @@
+ {
+ XawListReturnStruct *ret_struct = (XawListReturnStruct *) call_data;
+
++ if (!ret_struct)
++ return;
+ /* save the selected word */
+ strcpy(selected_word, ret_struct->string);
+ /* copy the word to the correct_word ascii widget */
+--- w_style.c
++++ w_style.c 2004-03-22 12:13:00.000000000 +0000
+@@ -585,7 +585,8 @@
+
+ XawListReturnStruct *ret_struct = (XawListReturnStruct *) call_data;
+
+- current_family = ret_struct->list_index;
++ if (ret_struct)
++ current_family = ret_struct->list_index;
+ current_style = -1;
+ style_update ();
+ }
+@@ -598,7 +599,8 @@
+ {
+ XawListReturnStruct *ret_struct = (XawListReturnStruct *) call_data;
+
+- current_style = ret_struct->list_index;
++ if (ret_struct)
++ current_style = ret_struct->list_index;
+ style_update ();
+ cur_updatemask = set_style (&current_family_set[current_family].style[current_style]);
+
diff --git a/source/t/xfig/xfig.3.2.4-quiet.diff b/source/t/xfig/xfig.3.2.4-quiet.diff
new file mode 100644
index 000000000..36086eaf4
--- /dev/null
+++ b/source/t/xfig/xfig.3.2.4-quiet.diff
@@ -0,0 +1,183 @@
+--- main.c
++++ main.c 2004-08-25 14:21:34.000000000 +0200
+@@ -1018,6 +1018,11 @@
+ setup_sizes(init_canv_wd, init_canv_ht);
+ }
+
++ (void) init_tool_menus();
++ (void) init_tool_style_panel();
++ (void) init_tool_ind_pannel();
++ (void) init_tool_canvas();
++
+ (void) init_main_menus(tool_form, arg_filename);
+ (void) init_msg(tool_form);
+ (void) init_mousefun(tool_form);
+--- w_canvas.c
++++ w_canvas.c 2004-08-25 14:20:40.000000000 +0200
+@@ -173,6 +173,13 @@
+ ~Meta<Key>:EventCanv()\n\
+ <Expose>:ExposeCanv()\n";
+
++void
++init_tool_canvas(void)
++{
++ XtAppAddActions(tool_app, canvas_actions, XtNumber(canvas_actions));
++}
++
++int
+ init_canvas(tool)
+ Widget tool;
+ {
+@@ -193,7 +200,6 @@
+ canvas_middlebut_proc = null_proc;
+ canvas_rightbut_proc = null_proc;
+ canvas_kbd_proc = canvas_locmove_proc = null_proc;
+- XtAppAddActions(tool_app, canvas_actions, XtNumber(canvas_actions));
+ XtAugmentTranslations(canvas_sw,
+ XtParseTranslationTable(canvas_translations));
+ #ifndef NO_COMPKEYDB
+@@ -204,13 +210,14 @@
+ }
+
+ /* at this point, the canvas widget is realized so we can get the window from it */
+-
++void
+ setup_canvas()
+ {
+ init_grid();
+ reset_clip_window();
+ }
+
++void
+ canvas_selected(tool, event, params, nparams)
+ Widget tool;
+ XButtonEvent *event;
+--- w_canvas.h
++++ w_canvas.h 2004-08-25 14:21:18.000000000 +0200
+@@ -35,9 +35,12 @@
+ extern void toggle_show_borders();
+ extern void clear_canvas();
+
+-extern canvas_selected();
++extern void canvas_selected();
+ extern void paste_primary_selection();
+
++extern void init_tool_canvas(void);
++extern int init_canvas(Widget tool);
++
+ extern int clip_xmin, clip_ymin, clip_xmax, clip_ymax;
+ extern int clip_width, clip_height;
+ extern int cur_x, cur_y;
+--- w_cmdpanel.c
++++ w_cmdpanel.c 2004-08-25 14:26:00.000000000 +0200
+@@ -204,6 +204,13 @@
+
+ /* command panel */
+ void
++init_tool_menus(void)
++{
++ /* add actions to position the menus if the user uses an accelerator */
++ XtAppAddActions(tool_app, menu_actions, XtNumber(menu_actions));
++}
++
++void
+ init_main_menus(tool, filename)
+ Widget tool;
+ char *filename;
+@@ -212,6 +219,7 @@
+ Widget beside = NULL;
+ DeclareArgs(11);
+
++
+ FirstArg(XtNborderWidth, 0);
+ NextArg(XtNcolormap, tool_cm);
+ NextArg(XtNdefaultDistance, 0);
+@@ -246,8 +254,6 @@
+ filename_balloon_trigger, (XtPointer) name_panel);
+ XtAddEventHandler(name_panel, LeaveWindowMask, False,
+ filename_unballoon, (XtPointer) name_panel);
+- /* add actions to position the menus if the user uses an accelerator */
+- XtAppAddActions(tool_app, menu_actions, XtNumber(menu_actions));
+ refresh_view_menu();
+ }
+
+--- w_cmdpanel.h
++++ w_cmdpanel.h 2004-08-25 14:10:45.000000000 +0200
+@@ -33,6 +33,8 @@
+ extern int num_main_menus();
+ extern Widget create_menu_item();
+ extern void refresh_view_menu();
++extern void init_tool_menus(void);
++extern void init_main_menus(Widget tool, char* filename);
+
+ /* def for menu */
+
+--- w_indpanel.c
++++ w_indpanel.c 2004-08-25 14:12:57.000000000 +0200
+@@ -476,6 +476,12 @@
+ static ind_sw_info upd_sw_info, upd_set_sw_info, upd_clr_sw_info, upd_tog_sw_info;
+
+ void
++init_tool_ind_pannel(void)
++{
++ XtAppAddActions(tool_app, ind_actions, XtNumber(ind_actions));
++}
++
++void
+ init_ind_panel(tool)
+ Widget tool;
+ {
+@@ -626,8 +632,6 @@
+ ind_box = XtCreateManagedWidget("ind_box", boxWidgetClass, ind_panel,
+ Args, ArgCount);
+
+- XtAppAddActions(tool_app, ind_actions, XtNumber(ind_actions));
+-
+ for (i = 0; i < NUM_IND_SW; ++i) {
+ sw = &ind_switches[i];
+ sw->panel = (Widget) NULL; /* not created yet */
+--- w_indpanel.h
++++ w_indpanel.h 2004-08-25 14:14:07.000000000 +0200
+@@ -34,6 +34,9 @@
+ extern void wheel_inc_zoom(), wheel_dec_zoom();
+ #endif /* WHEELMOUSE */
+
++extern void init_tool_ind_pannel(void);
++extern void init_ind_panel(Widget tool);
++
+ /* size of buttons in indicator panel */
+ #define DEF_IND_SW_HT 34
+ #define DEF_IND_SW_WD 64
+--- w_style.c
++++ w_style.c 2004-08-25 14:05:33.000000000 +0200
+@@ -759,6 +759,12 @@
+ /**********************************/
+
+ void
++init_tool_style_panel(void)
++{
++ XtAppAddActions (tool_app, style_actions, XtNumber (style_actions));
++}
++
++void
+ init_manage_style_panel (void)
+ {
+ char buf[50];
+@@ -966,7 +972,6 @@
+ XtAddCallback (style_close_style, XtNcallback,
+ (XtCallbackProc) close_style, (XtPointer) NULL);
+
+- XtAppAddActions (tool_app, style_actions, XtNumber (style_actions));
+ style_update ();
+ }
+
+--- w_style.h
++++ w_style.h 2004-08-25 14:06:27.000000000 +0200
+@@ -14,6 +14,7 @@
+ *
+ */
+
++extern void init_tool_style_panel(void);
+ extern void init_manage_style_panel(void);
+ extern void setup_manage_style_panel(void);
+ extern void popup_manage_style_panel(void);
diff --git a/source/t/xfig/xfig.3.2.4-urw-fonts.diff b/source/t/xfig/xfig.3.2.4-urw-fonts.diff
new file mode 100644
index 000000000..396dead55
--- /dev/null
+++ b/source/t/xfig/xfig.3.2.4-urw-fonts.diff
@@ -0,0 +1,152 @@
+--- u_fonts.c
++++ u_fonts.c 2005-10-06 18:55:22.000000000 +0200
+@@ -21,7 +21,9 @@
+
+ /* X11 font names */
+
+-struct _xfstruct x_fontinfo[NUM_FONTS] = {
++struct _xfstruct x_fontinfo[NUM_FONTS];
++
++struct _xfstruct x_adobe_fontinfo[NUM_FONTS] = {
+ {"-*-times-medium-r-normal--", (struct xfont*) NULL},
+ {"-*-times-medium-i-normal--", (struct xfont*) NULL},
+ {"-*-times-bold-r-normal--", (struct xfont*) NULL},
+@@ -59,6 +61,44 @@
+ {"-*-itc zapf dingbats-*-*-*--", (struct xfont*) NULL},
+ };
+
++struct _xfstruct x_urw_fontinfo[NUM_FONTS] = {
++ {"-URW-*Nimbus Roman No9 L-medium-r-normal--", (struct xfont*) NULL}, /* Times-Roman */
++ {"-URW-*Nimbus Roman No9 L-medium-i-normal--", (struct xfont*) NULL}, /* Times-Italic */
++ {"-URW-*Nimbus Roman No9 L-bold-r-normal--", (struct xfont*) NULL}, /* Times-Bold */
++ {"-URW-*Nimbus Roman No9 L-bold-i-normal--", (struct xfont*) NULL}, /* Times-BoldItalic */
++ {"-URW-*Gothic L-medium-r-normal--", (struct xfont*) NULL}, /* AvantGarde-Book */
++ {"-URW-*Gothic L-medium-o-normal--", (struct xfont*) NULL}, /* AvantGarde-BookOblique */
++ {"-URW-*Gothic L-*bold-r-normal--", (struct xfont*) NULL}, /* AvantGarde-Demi */
++ {"-URW-*Gothic L-*bold-o-normal--", (struct xfont*) NULL}, /* AvantGarde-DemiOblique */
++ {"-URW-*Bookman L-medium-r-normal--", (struct xfont*) NULL}, /* Bookman-Light */
++ {"-URW-*Bookman L-medium-i-normal--", (struct xfont*) NULL}, /* Bookman-LightItalic */
++ {"-URW-*Bookman L-*bold-r-normal--", (struct xfont*) NULL}, /* Bookman-Demi */
++ {"-URW-*Bookman L-*bold-i-normal--", (struct xfont*) NULL}, /* Bookman-DemiItalic */
++ {"-URW-*Nimbus Mono L-medium-r-normal--", (struct xfont*) NULL}, /* Courier */
++ {"-URW-*Nimbus Mono L-medium-o-normal--", (struct xfont*) NULL}, /* Courier-Oblique */
++ {"-URW-*Nimbus Mono L-bold-r-normal--", (struct xfont*) NULL}, /* Courier-Bold */
++ {"-URW-*Nimbus Mono L-bold-o-normal--", (struct xfont*) NULL}, /* Courier-BoldOblique */
++ {"-URW-*Nimbus Sans L-medium-r-normal--", (struct xfont*) NULL}, /* Helvetica */
++ {"-URW-*Nimbus Sans L-medium-o-normal--", (struct xfont*) NULL}, /* Helvetica-Oblique */
++ {"-URW-*Nimbus Sans L-bold-r-normal--", (struct xfont*) NULL}, /* Helvetica-Bold */
++ {"-URW-*Nimbus Sans L-bold-o-normal--", (struct xfont*) NULL}, /* Helvetica-BoldOblique */
++ {"-URW-*Nimbus Sans L-medium-r-condensed--", (struct xfont*) NULL}, /* Helvetica-Narrow */
++ {"-URW-*Nimbus Sans L-medium-o-condensed--", (struct xfont*) NULL}, /* Helvetica-Narrow-Oblique */
++ {"-URW-*Nimbus Sans L-bold-r-condensed--", (struct xfont*) NULL}, /* Helvetica-Narrow-Bold */
++ {"-URW-*Nimbus Sans L-bold-o-condensed--", (struct xfont*) NULL}, /* Helvetica-Narrow-BoldOblique */
++ {"-URW-*Century Schoolbook L-medium-r-normal--", (struct xfont*) NULL}, /* NewCenturySchlbk-Roman */
++ {"-URW-*Century Schoolbook L-medium-i-normal--", (struct xfont*) NULL}, /* NewCenturySchlbk-Italic */
++ {"-URW-*Century Schoolbook L-bold-r-normal--", (struct xfont*) NULL}, /* NewCenturySchlbk-Bold */
++ {"-URW-*Century Schoolbook L-bold-i-normal--", (struct xfont*) NULL}, /* NewCenturySchlbk-BoldItalic */
++ {"-URW-*Palladio L-medium-r-normal--", (struct xfont*) NULL}, /* Palatino-Roman */
++ {"-URW-*Palladio L-medium-i-normal--", (struct xfont*) NULL}, /* Palatino-Italic */
++ {"-URW-*Palladio L-bold-r-normal--", (struct xfont*) NULL}, /* Palatino-Bold */
++ {"-URW-*Palladio L-bold-i-normal--", (struct xfont*) NULL}, /* Palatino-BoldItalic */
++ {"-URW-*Standard Symbols L-medium-r-normal--", (struct xfont*) NULL}, /* Symbol */
++ {"-URW-*Chancery L-medium-i-normal--", (struct xfont*) NULL}, /* ZapfChancery-MediumItalic */
++ {"-URW-*Dingbats-medium-r-normal--", (struct xfont*) NULL}, /* ZapfDingbats */
++};
++
+ /* Use the following font names for any font that doesn't exist in the table above.
+ * These come with the Open Group X distribution so they should be a common set.
+ *
+--- u_fonts.h
++++ u_fonts.h 2005-10-06 19:19:30.000000000 +0200
+@@ -32,9 +32,6 @@
+
+ extern int psfontnum();
+ extern int latexfontnum();
+-extern struct _xfstruct x_fontinfo[], x_backup_fontinfo[];
+-extern struct _fstruct ps_fontinfo[];
+-extern struct _fstruct latex_fontinfo[];
+
+ /* element of linked list for each font
+ The head of list is for the different font NAMES,
+@@ -61,5 +58,12 @@
+ * sizes */
+ };
+
++extern struct _xfstruct x_fontinfo[];
++extern struct _xfstruct x_urw_fontinfo[];
++extern struct _xfstruct x_adobe_fontinfo[];
++extern struct _xfstruct x_backup_fontinfo[];
++extern struct _fstruct ps_fontinfo[];
++extern struct _fstruct latex_fontinfo[];
++
+ int x_fontnum();
+ #endif /* U_FONTS_H */
+--- w_drawprim.c
++++ w_drawprim.c 2005-10-06 19:12:02.000000000 +0200
+@@ -99,6 +99,22 @@
+ appres.buttonFont, appres.normalFont);
+ button_font = XLoadQueryFont(tool_d, appres.normalFont);
+ }
++
++ /*
++ * Check for URW fonts, if not found use Adobe fonts
++ */
++ strcpy(template,x_urw_fontinfo[0].template);
++ strcat(template,"0-0-*-*-*-*-");
++ if (strstr(template,"ymbol") == NULL && strstr(template,"ingbats") == NULL)
++ strcat(template,"ISO8859-*");
++ else
++ strcat(template,"*-*");
++ if ((fontlist = XListFonts(tool_d, template, 1, &count)) == (char**)0)
++ memcpy(&x_fontinfo, &x_adobe_fontinfo, sizeof(struct _xfstruct) * NUM_FONTS);
++ else
++ memcpy(&x_fontinfo, &x_urw_fontinfo, sizeof(struct _xfstruct) * NUM_FONTS);
++ XFreeFontNames(fontlist);
++
+ /*
+ * Now initialize the font structure for the X fonts corresponding to the
+ * Postscript fonts for the canvas. OpenWindows can use any LaserWriter
+@@ -119,8 +135,8 @@
+ strcpy(template,x_fontinfo[0].template); /* nope, check for font size 0 */
+ strcat(template,"0-0-*-*-*-*-");
+ /* add ISO8859 (if not Symbol font or ZapfDingbats) to font name */
+- if (strstr(template,"symbol") == NULL &&
+- strstr(template,"zapf dingbats") == NULL)
++ if (strstr(template,"ymbol") == NULL &&
++ strstr(template,"ingbats") == NULL)
+ strcat(template,"ISO8859-*");
+ else
+ strcat(template,"*-*");
+@@ -139,8 +155,8 @@
+ strcpy(template,x_fontinfo[f].template);
+ strcat(template,"*-*-*-*-*-*-");
+ /* add ISO8859 (if not Symbol font or ZapfDingbats) to font name */
+- if (strstr(template,"symbol") == NULL &&
+- strstr(template,"zapf dingbats") == NULL)
++ if (strstr(template,"ymbol") == NULL &&
++ strstr(template,"ingbats") == NULL)
+ strcat(template,"ISO8859-*");
+ else
+ strcat(template,"*-*");
+@@ -287,8 +303,8 @@
+ /* attach pointsize to font name */
+ strcat(template,"%d-*-*-*-*-*-");
+ /* add ISO8859 (if not Symbol font or ZapfDingbats) to font name */
+- if (strstr(template,"symbol") == NULL &&
+- strstr(template,"zapf dingbats") == NULL)
++ if (strstr(template,"ymbol") == NULL &&
++ strstr(template,"ingbats") == NULL)
+ strcat(template,"ISO8859-*");
+ else
+ strcat(template,"*-*");
+@@ -299,8 +315,8 @@
+ strcpy(template,x_backup_fontinfo[fnum].template);
+ strcat(template,"%d-*-*-*-*-*-");
+ /* add ISO8859 (if not Symbol font or ZapfDingbats) to font name */
+- if (strstr(template,"symbol") == NULL &&
+- strstr(template,"zapf dingbats") == NULL)
++ if (strstr(template,"ymbol") == NULL &&
++ strstr(template,"ingbats") == NULL)
+ strcat(template,"ISO8859-*");
+ else
+ strcat(template,"*-*");
diff --git a/source/t/xfig/xfig.3.2.4.diff b/source/t/xfig/xfig.3.2.4.diff
new file mode 100644
index 000000000..821243a65
--- /dev/null
+++ b/source/t/xfig/xfig.3.2.4.diff
@@ -0,0 +1,530 @@
+--- Fig-color.ad
++++ Fig-color.ad 2008-04-13 20:50:28.000000000 +0200
+@@ -76,6 +76,12 @@ Fig*MenuButton*background: gray83
+ ! in the color editor popup
+ Fig*mixedEdit.background: gray83
+
++Fig*mode_panel.background: gray67
++Fig*mode_panel*topShadow:: white
++Fig*mode_panel*bottomShadow: gray17
++Fig*mode_panel*topShadowPixel: white
++Fig*mode_panel*bottomShadowPixel: gray17
++
+ Fig*cancel.background: gray88
+ Fig*dismiss.background: gray88
+ Fig*commands*background: gray88
+@@ -85,12 +91,35 @@ Fig*horizontal.background: gray88
+
+ Fig*topruler.background: gray95
+ Fig*sideruler.background: gray95
++Fig*topruler.foreground: black
++Fig*sideruler.foreground: black
+
+ ! file panel and scrollbar
+
+ Fig*FigList*background: gray95
+ Fig*List*background: gray95
+-Fig*Scrollbar.background: gray95
++Fig*Scrollbar.background: gray77
++Fig*Scrollbar.foreground: gray37
++Fig*ScrollbarBackground: gray67
++Fig*ScrollbarForeground: gray37
++
++Fig*horizontal.shadowWidth: 2
++Fig*horizontal.topShadowPixel: gray95
++Fig*horizontal.bottomShadowPixel: gray37
++Fig*horizontal.topShadow: gray95
++Fig*horizontal.bottomShadow: gray37
++
++Fig*Scrollbar.shadowWidth: 2
++Fig*Scrollbar.topShadow: gray95
++Fig*Scrollbar.bottomShadow: gray37
++Fig*Scrollbar.topShadowPixel: gray95
++Fig*Scrollbar.bottomShadowPixel: gray37
++
++Fig*stdColor.shadowWidth: 2
++Fig*stdColor.topShadow: gray95
++Fig*stdColor.bottomShadow: gray37
++Fig*stdColor.topShadowPixel: gray95
++Fig*stdColor.bottomShadowPixel: gray37
+
+ Fig*Label.background: gray80
+ Fig*ind_box.background: gray80
+--- Fig.ad
++++ Fig.ad 2008-04-13 20:50:28.000000000 +0200
+@@ -10,6 +10,8 @@ Fig.version: 3.2.4
+
+ Fig*AllowShellResize: false
+
++Fig.inches: false
++
+ ! Image editor - can edit imported image
+ Fig.image_editor: xv
+
+@@ -20,7 +22,7 @@ Fig.ghostscript: gs
+ ! This is for viewing the xfig html reference.
+ ! For netscape, this command will open the help pages in a running netscape,
+ ! or start a new netscape if one isn't already running
+-Fig.browser: netscape -remote 'openFile(%f)' || netscape %f
++Fig.browser: /usr/bin/firefox %f
+
+ ! pdfviewer - put your favorite pdf viewer here.
+ ! This is for viewing the xfig how-to guide and man pages
+@@ -99,60 +101,62 @@ Fig.internalborderwidth: 1
+ ! I include both for compatibility. Be sure to change both values when
+ ! modifying them.
+
+- Fig*horizontal.shadowWidth: 0
+- Fig*horizontal.topShadowPixel: black
+- Fig*horizontal.bottomShadowPixel: white
+- Fig*horizontal.topShadow: black
+- Fig*horizontal.bottomShadow: white
++Fig*horizontal.shadowWidth: 0
++Fig*horizontal.topShadowPixel: black
++Fig*horizontal.bottomShadowPixel: white
++Fig*horizontal.topShadow: black
++Fig*horizontal.bottomShadow: white
+
+ ! the following is done so the widget set doesn't try to make shades of
+ ! the scrollbar shadows (even though the width is 0 it takes more colors)
+- Fig*Scrollbar.shadowWidth: 0
+- Fig*Scrollbar.topShadow: black
+- Fig*Scrollbar.bottomShadow: white
+- Fig*Scrollbar.topShadowPixel: black
+- Fig*Scrollbar.bottomShadowPixel: white
++
++Fig*Scrollbar.shadowWidth: 0
++Fig*Scrollbar.topShadow: black
++Fig*Scrollbar.bottomShadow: white
++Fig*Scrollbar.topShadowPixel: black
++Fig*Scrollbar.bottomShadowPixel: white
+
+ ! this is for the standard color buttons in the color panel
+- Fig*stdColor.shadowWidth: 2
+- Fig*stdColor.topShadow: black
+- Fig*stdColor.bottomShadow: white
+- Fig*stdColor.topShadowPixel: black
+- Fig*stdColor.bottomShadowPixel: white
++
++Fig*stdColor.shadowWidth: 2
++Fig*stdColor.topShadow: black
++Fig*stdColor.bottomShadow: white
++Fig*stdColor.topShadowPixel: black
++Fig*stdColor.bottomShadowPixel: white
+
+ ! turn off any shadows for the user color cells
+- Fig*colorMemory.shadowWidth: 0
++Fig*colorMemory.shadowWidth: 0
+
+ ! You may need or want to adjust the highlight thickness for the mode
+ ! and indicator panels depending on the results. If it is too thick
+ ! it will erase part of the button graphics.
+- Fig*mode_panel*highlightThickness: 1
+- Fig*ind_panel.ind_box.button_form.button.highlightThickness: 1
++Fig*mode_panel*highlightThickness: 1
++Fig*ind_panel.ind_box.button_form.button.highlightThickness: 1
+ ! Same for the popup panels from the indicator panel
+- Fig*set_indicator_panel*Command.highlightThickness: 1
++Fig*set_indicator_panel*Command.highlightThickness: 1
+
+ ! If you use the 3D Athena widget set and the small icons for the mode panel
+ ! (because you have a small screen; see Imakefile) you may want to reduce
+ ! the shadow width to 1 or 0. Uncomment the following in that case:
+-! Fig*mode_panel*shadowWidth: 1
++Fig*mode_panel*shadowWidth: 1
+
+ ! The following is for the update marker in the upper-right corner of the
+ ! indicator buttons. You may not want any highlight thickness because
+ ! the boxes are so small.
+- Fig*ind_panel.ind_box.button_form.update.highlightThickness: 0
++Fig*ind_panel.ind_box.button_form.update.highlightThickness: 1
+
+ ! This sets the shadows for the spinner arrows
+- Fig*spinup.shadowWidth: 2
+- Fig*spindown.shadowWidth: 2
++Fig*spinup.shadowWidth: 0
++Fig*spindown.shadowWidth: 0
+
+ ! This gets rid of that funny black line that sometimes borders the canvas
+
+- Fig*canvas.shadowWidth: 0
++Fig*canvas.shadowWidth: 0
+
+ !if on monochrome server, or no Fig-color app-defaults file
+ ! This background resource shows between the buttons like a border
+- Fig*mode_panel.background: black
+- Fig*mode_panel.foreground: black
++Fig*mode_panel.background: black
++Fig*mode_panel.foreground: black
+
+ ! Specify a private Compose key database file. If this resource contains a "/"
+ ! then the wired-in name of the xfig global directory won't be prefixed to it.
+--- Imakefile
++++ Imakefile 2008-04-13 20:52:35.000000000 +0200
+@@ -49,7 +49,7 @@ XCOMM Redefine the following if your PNG
+ XCOMM are in different places
+
+ PNGLIBDIR = $(USRLIBDIR)
+-PNGINC = -I/usr/local/include
++PNGINC = -I/usr/include
+
+ XCOMM If don't want JPEG support, comment out the #define USEJPEG line
+ XCOMM Uncomment the #define for USEJPEG if you want to be able to import
+@@ -68,8 +68,8 @@ XCOMM You must have version 5b or newer
+
+ #ifdef USEJPEG
+ #ifdef USEINSTALLEDJPEG
+-JPEGLIBDIR = /usr/local/lib
+-JPEGINC = -I/usr/include/X11
++JPEGLIBDIR = /usr/lib
++JPEGINC = -I/usr/include
+ #else
+ JPEGLIBDIR = ../jpeg
+ JPEGINC = -I$(JPEGLIBDIR)
+@@ -87,8 +87,8 @@ XCOMM in /contrib/libraries.
+ XCOMM Change XPMLIBDIR if necessary to point to the xpm library (libXpm)
+ XCOMM Change XPMINC if necessary to point to the include file for xpm (xpm.h)
+
+-XCOMM #define USEXPM
+-XCOMM #define USEXPM_ICON
++#define USEXPM
++#define USEXPM_ICON
+
+ #ifdef USEXPM
+ XPMLIBDIR = $(USRLIBDIR)
+@@ -105,17 +105,20 @@ XCOMM the 3d Athena Widget Set (highly r
+ XCOMM Then be sure to change the XAW3DINC to point to the directory where your
+ XCOMM 3D Athena widget headers are located
+
+-XCOMM #define XAW3D
++#define XAW3D
+
+ #ifdef XAW3D
+ XAW3DINC = -I/usr/include/X11/Xaw3d
+ DUSEXAW3D = -DXAW3D
+ XAWLIB = -lXaw3d
++#else
++XAWSRC = SmeBSB.c SimpleMenu.c
++XAWOBJ = SmeBSB.o SimpleMenu.o
+ #endif
+
+ XCOMM Uncomment the following if you have a wheel mouse. See docs for description.
+
+-XCOMM #define WHEELMOUSE
++#define WHEELMOUSE
+
+ #ifdef WHEELMOUSE
+ DUSEWHEELMOUSE = -DWHEELMOUSE
+@@ -154,7 +157,7 @@ XCOMM uncomment the following line if yo
+ XCOMM inline functions. With the "INLINE" keyword, you should notice that
+ XCOMM the display will be a bit faster in complex figures
+
+-XCOMM USEINLINE = -DUSE_INLINE
++USEINLINE = -DUSE_INLINE
+
+ XCOMM use (and change) the following if you want the multi-key data base file
+ XCOMM somewhere other than the standard X11 library directory
+@@ -166,7 +169,7 @@ XFIGLIBDIR = $(LIBDIR)/xfig
+
+ XCOMM XFIGDOCDIR tells where the html and pdf documentation should go
+ XCOMM XFIGDOCDIR = $(DOCDIR)/xfig
+-XFIGDOCDIR = /usr/share/doc/xfig
++XFIGDOCDIR = /usr/share/doc/packages/xfig
+
+ XCOMM MANDIR tells where the standard man pages should go (no need to change it
+ XCOMM if you want the man pages installed in the standard place on your system
+@@ -200,7 +203,7 @@ XCOMM instead.
+ XCOMM Add `-DCACHE_SIZE_LIMIT=xxxx' where xxxx is the cache size in kilobytes.
+ XCOMM A cache size of zero turns caching off.
+
+-CACHE = -DCACHE_BITMAPS -DCACHE_SIZE_LIMIT=300
++CACHE = -DCACHE_BITMAPS -DCACHE_SIZE_LIMIT=512 -DMAXNUMPTS=50000 -DBSDLPR
+
+ XCOMM For SYSV systems with BSD-style printer command which use lpr instead of
+ XCOMM lp (SGI is one such machine), add -DBSDLPR to the DEFINES variable
+@@ -214,6 +217,7 @@ XCOMM number of vertices.
+ XCOMM If you want a compiler other than "cc", define it here
+
+ XCOMM CC = /opt/SUNWspro/bin/cc
++CC = gcc
+
+ XCOMM *****************************************************
+ XCOMM *****************************************************
+@@ -234,7 +238,7 @@ DEPLIBJPEG = $(JPEGLIBDIR)/libjpeg.a
+ #endif /* USEJPEG */
+
+ #ifdef I18N
+-I18N_DEFS = -DI18N -DSETLOCALE
++I18N_DEFS = -DI18N
+ I18N_SRC = w_i18n.c
+ I18N_OBJ = w_i18n.o
+ #endif
+@@ -304,7 +308,7 @@ XFIGSRC = d_arc.c d_arcbox.c d_box.c d_e
+ w_export.c w_file.c w_fontbits.c w_fontpanel.c w_grid.c w_icons.c \
+ w_indpanel.c w_library.c w_modepanel.c w_mousefun.c w_msgpanel.c \
+ w_print.c w_rottext.c w_rulers.c w_setup.c w_style.c w_util.c w_zoom.c \
+- $(I18N_SRC) SmeCascade.c SmeBSB.c SimpleMenu.c
++ $(I18N_SRC) SmeCascade.c $(XAWSRC)
+
+ XFIGOBJ = d_arc.o d_arcbox.o d_box.o d_ellipse.o d_picobj.o \
+ d_subspline.o d_line.o d_regpoly.o d_spline.o d_text.o \
+@@ -326,7 +330,7 @@ XFIGOBJ = d_arc.o d_arcbox.o d_box.o d_e
+ w_export.o w_file.o w_fontbits.o w_fontpanel.o w_grid.o w_icons.o \
+ w_indpanel.o w_library.o w_modepanel.o w_mousefun.o w_msgpanel.o \
+ w_print.o w_rottext.o w_rulers.o w_setup.o w_style.o w_util.o w_zoom.o \
+- $(I18N_OBJ) SmeCascade.o SmeBSB.o SimpleMenu.o
++ $(I18N_OBJ) SmeCascade.o $(XAWOBJ)
+
+ XCOMM Other dependencies should be handled by "make depend"
+
+--- e_addpt.c
++++ e_addpt.c 2008-04-13 20:50:28.000000000 +0200
+@@ -52,6 +52,7 @@ point_adding_selected()
+ force_nopositioning();
+ force_anglegeom();
+ constrained = MOVE_ARB;
++ reset_action_on();
+ }
+
+ static void
+--- e_align.c
++++ e_align.c 2008-04-13 20:50:28.000000000 +0200
+@@ -63,6 +63,7 @@ align_selected()
+ canvas_middlebut_proc = init_align_canvas;
+ canvas_rightbut_proc = null_proc;
+ set_cursor(pick15_cursor);
++ reset_action_on();
+ }
+
+ /* align objects to the whole canvas */
+--- e_arrow.c
++++ e_arrow.c 2008-04-13 20:50:28.000000000 +0200
+@@ -47,6 +47,7 @@ arrow_head_selected()
+ canvas_middlebut_proc = point_search_middle;
+ canvas_rightbut_proc = null_proc;
+ set_cursor(pick9_cursor);
++ reset_action_on();
+ }
+
+ static void
+--- e_break.c
++++ e_break.c 2008-04-13 20:50:28.000000000 +0200
+@@ -43,6 +43,7 @@ break_selected()
+ canvas_middlebut_proc = object_search_middle;
+ canvas_rightbut_proc = null_proc;
+ set_cursor(pick15_cursor);
++ reset_action_on();
+ }
+
+ static void
+@@ -82,8 +83,10 @@ init_break(p, type, x, y, px, py, loc_ta
+ list_delete_compound(&objects.compounds, cur_c);
+ tail(&objects, &object_tails);
+ append_objects(&objects, cur_c, &object_tails);
++#if 0
+ /* add the depths from this compound */
+ add_compound_depth(cur_c);
++#endif
+ toggle_markers_in_compound(cur_c);
+ set_tags(cur_c, loc_tag);
+ set_action(F_BREAK);
+--- e_convert.c
++++ e_convert.c 2008-04-13 20:50:28.000000000 +0200
+@@ -47,6 +47,7 @@ convert_selected()
+ canvas_middlebut_proc = null_proc;
+ canvas_rightbut_proc = point_search_right;
+ set_cursor(pick15_cursor);
++ reset_action_on();
+ }
+
+ static void
+--- e_deletept.c
++++ e_deletept.c 2008-04-13 20:50:28.000000000 +0200
+@@ -43,6 +43,7 @@ delete_point_selected()
+ canvas_middlebut_proc = null_proc;
+ canvas_rightbut_proc = null_proc;
+ set_cursor(pick9_cursor);
++ reset_action_on();
+ }
+
+ static void
+--- e_flip.c
++++ e_flip.c 2008-04-13 20:50:28.000000000 +0200
+@@ -61,6 +61,7 @@ flip_ud_selected()
+ setcenter = 0;
+ setanchor = 0;
+ flip_selected();
++ reset_action_on();
+ }
+
+ void
+@@ -76,6 +77,7 @@ flip_lr_selected()
+ setcenter = 0;
+ setanchor = 0;
+ flip_selected();
++ reset_action_on();
+ }
+
+ static void
+--- e_movept.c
++++ e_movept.c 2008-04-13 20:50:28.000000000 +0200
+@@ -80,6 +80,7 @@ move_point_selected()
+ canvas_rightbut_proc = null_proc;
+ set_cursor(pick9_cursor);
+ force_anglegeom();
++ reset_action_on();
+ }
+
+ static void
+--- e_rotate.c
++++ e_rotate.c 2008-04-13 20:50:28.000000000 +0200
+@@ -94,6 +94,7 @@ rotate_selected()
+ canvas_middlebut_proc = object_search_middle;
+ canvas_rightbut_proc = set_unset_center;
+ set_cursor(pick15_cursor);
++ reset_action_on();
+ }
+
+ static void
+--- e_update.c
++++ e_update.c 2008-04-13 20:50:28.000000000 +0200
+@@ -64,6 +64,7 @@ update_selected()
+ set_cursor(pick9_cursor);
+ /* manage on the update buttons */
+ manage_update_buts();
++ reset_action_on();
+ }
+
+ static int
+--- fig.h
++++ fig.h 2008-04-13 20:50:28.000000000 +0200
+@@ -26,6 +26,7 @@ extern char *my_strdup();
+ #if defined(ultrix) || defined(__bsdi__) || defined(Mips) || defined(apollo)
+ #include <sys/types.h> /* for stat structure */
+ #endif
++#include <sys/param.h>
+ #include <sys/stat.h>
+
+ #if defined(__convex__) && defined(__STDC__)
+--- mode.h
++++ mode.h 2008-04-13 20:50:28.000000000 +0200
+@@ -19,7 +19,7 @@
+ #define MODE_H
+
+ #define F_NULL 0
+-#define FIRST_DRAW_MODE F_CIRCLE_BY_RAD
++#define FIRST_DRAW_MODE F_CIRCLE_BY_RAD
+ #define F_CIRCLE_BY_RAD 1
+ #define F_CIRCLE_BY_DIA 2
+ #define F_ELLIPSE_BY_RAD 3
+@@ -38,7 +38,7 @@
+ #define F_PICOBJ 16
+ #define F_PLACE_LIB_OBJ 17
+
+-#define FIRST_EDIT_MODE F_GLUE
++#define FIRST_EDIT_MODE F_GLUE
+ #define F_GLUE 30
+ #define F_BREAK 31
+ #define F_SCALE 32
+--- w_canvas.c
++++ w_canvas.c 2008-04-13 20:50:28.000000000 +0200
+@@ -536,6 +536,7 @@ reset_click_counter(widget, closure, eve
+
+ /* clear the canvas - this can't be called to clear a pixmap, only a window */
+
++void
+ clear_canvas()
+ {
+ /* clear the splash graphic if it is still on the screen */
+--- w_canvas.h
++++ w_canvas.h 2008-04-13 20:50:28.000000000 +0200
+@@ -33,6 +33,7 @@ extern void toggle_show_balloons();
+ extern void toggle_show_lengths();
+ extern void toggle_show_vertexnums();
+ extern void toggle_show_borders();
++extern void clear_canvas();
+
+ extern void canvas_selected();
+ extern void paste_primary_selection();
+--- w_menuentry.c
++++ w_menuentry.c 2008-04-13 20:50:28.000000000 +0200
+@@ -170,7 +170,8 @@ Region region;
+ gc = entry->sme_bsb.norm_gray_gc;
+ }
+
+- if (entry->sme_bsb.label != NULL) {
++/* if (entry->sme_bsb.label != NULL) { */
++ if (entry->sme_bsb.label == XtName((Widget)(entry))) {
+ int x_loc = entry->sme_bsb.left_margin;
+ int len = strlen(entry->sme_bsb.label);
+ char * label = entry->sme_bsb.label;
+--- w_srchrepl.c
++++ w_srchrepl.c 2008-04-13 20:50:28.000000000 +0200
+@@ -56,7 +56,6 @@ There is currently no way to undo replac
+ #include "w_util.h"
+ #include "u_create.h"
+ #include <stdarg.h>
+-
+ #define MAX_MISSPELLED_WORDS 200
+ #define SEARCH_WIDTH 496 /* width of search message and results */
+
+--- w_util.c
++++ w_util.c 2008-04-13 20:50:28.000000000 +0200
+@@ -1102,7 +1102,7 @@ check_action_on()
+ finish_text_input(0,0,0);/* finish up any text input */
+ else {
+ if (cur_mode == F_PLACE_LIB_OBJ)
+- cancel_place_lib_obj();
++ cancel_place_lib_obj(0, 0, 0);
+ else {
+ put_msg("Finish (or cancel) the current operation before changing modes");
+ beep();
+--- Doc/xfig.html
++++ Doc/xfig.html 2008-04-13 20:50:28.000000000 +0200
+@@ -848,6 +848,20 @@ between all buttons and panels (default
+ </DL>
+ <P>
+
++<B>-international</B>
++
++<DL COMPACT>
++<DT><DD>
++Switch on international support (mainly Japanese
++and Korean), users of ISO Latin 1 (ISO-8859-1)
++probably should not use this, therefore the international
++support is switched off by default for locales using ISO-8859-1*
++codesets. For all other locales this option is already used
++by default.
++</DL>
++
++<P>
++
+
+ <B>-jpeg</B>[<B>_quality</B>]
+
+@@ -2208,6 +2222,7 @@ inches boolean true
+ -metric (false)
+ installowncmap boolean false -installowncmap
+ internalborderwidth integer 1 -internalBW
++international boolean false -international
+ jpeg_quality integer 75 -jpeg_quality
+ justify boolean false -left (false),
+ -right (true)
+--- Doc/xfig.man
++++ Doc/xfig.man 2008-04-13 20:50:28.000000000 +0200
+@@ -531,6 +531,15 @@ Use lines of width
+ between all buttons and panels (default = 1).
+ .\"-------
+ .At
++.BR \-international
++.Ap
++Switch on international support (mainly Japanese and Korean),
++users of ISO Latin 1 (ISO-8859-1) probably should not use this,
++therefore the international support is switched off by default
++for locales using ISO-8859-1* codesets. For all other locales this
++option is already used by default.
++.\"-------
++.At
+ .BR \-jpeg [ _quality ]
+ .I quality
+ .Ap
diff --git a/source/t/xfig/xfig.SlackBuild b/source/t/xfig/xfig.SlackBuild
new file mode 100755
index 000000000..010106ad0
--- /dev/null
+++ b/source/t/xfig/xfig.SlackBuild
@@ -0,0 +1,98 @@
+#!/bin/sh
+
+# Copyright 2007,2008,2009 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+VERSION=3.2.4
+ARCH=${ARCH:-x86_64}
+BUILD=${BUILD:-3}
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
+if [ "$ARCH" = "x86_64" ]; then
+ LIBDIRSUFFIX="64"
+else
+ LIBDIRSUFFIX=""
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-xfig
+rm -rf $PKG
+mkdir -p $PKG $TMP
+
+cd $TMP
+rm -rf xfig.$VERSION
+tar xvf $CWD/xfig.$VERSION.full.tar.bz2 || exit 1
+cd xfig.$VERSION || exit 1
+
+chown -R root:root .
+find . \
+ \( -perm 2775 -o -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+zcat $CWD/xfig-3.2.4-mkstemp.diff.gz | patch -E -p1 --verbose || exit 1
+zcat $CWD/xfig.3.2.3d-international-std-fonts.diff.gz | patch -E -p1 --verbose || exit 1
+zcat $CWD/xfig.3.2.3d-xcolor.diff.gz | patch -E -p0 --verbose || exit 1
+zcat $CWD/xfig.3.2.3d-xim.diff.gz | patch -E -p1 --verbose || exit 1
+zcat $CWD/xfig.3.2.4-gcc4.diff.gz | patch -E -p0 --verbose || exit 1
+zcat $CWD/xfig.3.2.4-locale.diff.gz | patch -E -p0 --verbose || exit 1
+zcat $CWD/xfig.3.2.4-null.diff.gz | patch -E -p0 --verbose || exit 1
+zcat $CWD/xfig.3.2.4-quiet.diff.gz | patch -E -p0 --verbose || exit 1
+zcat $CWD/xfig.3.2.4-urw-fonts.diff.gz | patch -E -p0 --verbose || exit 1
+zcat $CWD/xfig.3.2.4.diff.gz | patch -E -p0 --verbose || exit 1
+# Eliminate menu choice for non-distributed (redundant) PDF documentation:
+zcat $CWD/xfig.no.pdf.ref.diff.gz | patch -E -p1 --verbose || exit 1
+# Don't install PDF reference manual because the HTML manual is the same thing
+# (and also includes a Japanese translation):
+zcat $CWD/xfig.no.xfig_ref_en.pdf.diff.gz | patch -E -p1 --verbose || exit 1
+# Use Firefox and xpdf, not netscape and acroread:
+zcat $CWD/xfig.fig.ad.diff.gz | patch -E -p1 --verbose || exit 1
+zcat $CWD/xfig.docs.location.diff.gz | patch -E -p1 --verbose || exit 1
+
+xmkmf
+make $NUMJOBS || make || exit 1
+make install DESTDIR=$PKG || exit 1
+make install.man DESTDIR=$PKG || exit 1
+make install.libs DESTDIR=$PKG || exit 1
+make install.html DESTDIR=$PKG || exit 1
+
+find $PKG | xargs file | grep -e "executable" -e "shared object" \
+ | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+gzip -9 $PKG/usr/man/man1/*
+
+mkdir -p $PKG/usr/doc/xfig-$VERSION
+cp -a \
+ CHANGES FIGAPPS LATEX.AND.XFIG README \
+ $PKG/usr/doc/xfig-$VERSION
+( cd $PKG/usr/doc/xfig-$VERSION
+ ln -sf /usr/lib${LIBDIRSUFFIX}/X11/xfig/Libraries Libraries
+)
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/xfig-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/t/xfig/xfig.docs.location.diff b/source/t/xfig/xfig.docs.location.diff
new file mode 100644
index 000000000..78385c06c
--- /dev/null
+++ b/source/t/xfig/xfig.docs.location.diff
@@ -0,0 +1,11 @@
+--- ./Imakefile.orig 2007-02-19 03:29:55.000000000 -0600
++++ ./Imakefile 2007-02-19 03:32:49.000000000 -0600
+@@ -169,7 +169,7 @@
+
+ XCOMM XFIGDOCDIR tells where the html and pdf documentation should go
+ XCOMM XFIGDOCDIR = $(DOCDIR)/xfig
+-XFIGDOCDIR = /usr/share/doc/packages/xfig
++XFIGDOCDIR = /usr/doc/xfig-3.2.4
+
+ XCOMM MANDIR tells where the standard man pages should go (no need to change it
+ XCOMM if you want the man pages installed in the standard place on your system
diff --git a/source/t/xfig/xfig.fig.ad.diff b/source/t/xfig/xfig.fig.ad.diff
new file mode 100644
index 000000000..a6a763a15
--- /dev/null
+++ b/source/t/xfig/xfig.fig.ad.diff
@@ -0,0 +1,30 @@
+--- ./Fig.ad.orig 2007-02-19 03:01:42.000000000 -0600
++++ ./Fig.ad 2007-02-19 03:05:49.000000000 -0600
+@@ -22,16 +22,24 @@
+ ! This is for viewing the xfig html reference.
+ ! For netscape, this command will open the help pages in a running netscape,
+ ! or start a new netscape if one isn't already running
+-Fig.browser: /usr/bin/firefox %f
++! Fig.browser: netscape -remote 'openFile(%f)' || netscape %f
++! This example might work the same for SeaMonkey:
++! Fig.browser: seamonkey -remote 'openFile(%f)' || seamonkey %f
++! By default, let's try Firefox:
++Fig.browser: firefox %f
+
+ ! pdfviewer - put your favorite pdf viewer here.
+ ! This is for viewing the xfig how-to guide and man pages
+-Fig.pdfviewer: acroread %f
++! Fig.pdfviewer: acroread %f
++! Fig.pdfviewer: kpdf %f
++Fig.pdfviewer: xpdf %f
+
+ ! Spell check program - put your favorite spelling check program here.
+ ! It must write the misspelled words to standard output.
+
+-Fig.spellcheckcommand: spell %f
++! Fig.spellcheckcommand: spell %f
++! Fig.spellcheckcommand: aspell -a %f
++Fig.spellcheckcommand: aspell -a %f
+
+ ! delay before spinner automatically counts when pressed (milliseconds)
+ Fig.spinner_delay: 1000
diff --git a/source/t/xfig/xfig.no.pdf.ref.diff b/source/t/xfig/xfig.no.pdf.ref.diff
new file mode 100644
index 000000000..5e694ab8c
--- /dev/null
+++ b/source/t/xfig/xfig.no.pdf.ref.diff
@@ -0,0 +1,13 @@
+--- ./w_cmdpanel.c.orig 2006-08-14 18:53:22.000000000 -0500
++++ ./w_cmdpanel.c 2006-08-14 18:55:02.000000000 -0500
+@@ -176,7 +176,9 @@
+ /* Tom Sato said that the Japanese version of the pdf looked ugly so we'll not distribute it now */
+ {"Xfig Reference (PDF, Japanese)...", 0, launch_refpdf_jp}
+ #else
+- {"Xfig Reference (PDF)...", 0, launch_refpdf_en},
++ /* Why both a PDF and an HTML that are the same? Remove redundant option */
++ /* and don't distribute the English PDF with the Slackware package. */
++ /* {"Xfig Reference (PDF)...", 0, launch_refpdf_en}, */
+ #endif /* FIXED_JAPANESE_PDF */
+ {"Xfig Man Pages (HTML)...", 5, launch_man},
+ {"How-To Guide (PDF)...", 0, launch_howto},
diff --git a/source/t/xfig/xfig.no.xfig_ref_en.pdf.diff b/source/t/xfig/xfig.no.xfig_ref_en.pdf.diff
new file mode 100644
index 000000000..e0b9f9efc
--- /dev/null
+++ b/source/t/xfig/xfig.no.xfig_ref_en.pdf.diff
@@ -0,0 +1,10 @@
+--- ./Imakefile.orig 2002-12-19 11:57:11.000000000 -0600
++++ ./Imakefile 2006-08-14 19:20:56.000000000 -0500
+@@ -408,7 +408,6 @@
+ @(cd Doc ; \
+ echo Copying pdf and html files to $(DESTDIR)$(XFIGDOCDIR) ; \
+ $(INSTALL) -m 644 -c xfig_man.html $(DESTDIR)$(XFIGDOCDIR) ; \
+- $(INSTALL) -m 644 -c xfig_ref_en.pdf $(DESTDIR)$(XFIGDOCDIR) ; \
+ $(INSTALL) -m 644 -c xfig-howto.pdf $(DESTDIR)$(XFIGDOCDIR) ; \
+ if [ -d $(DESTDIR)$(XFIGDOCDIR)/html ]; then set +x; \
+ else (set -x; $(MKDIRHIER) $(DESTDIR)$(XFIGDOCDIR)/html ); fi ; \