summaryrefslogtreecommitdiffstats
path: root/source/xap
diff options
context:
space:
mode:
Diffstat (limited to 'source/xap')
-rwxr-xr-xsource/xap/MPlayer/MPlayer.SlackBuild23
-rw-r--r--source/xap/audacious-plugins/amidi-plug.fix-drct.diff11
-rwxr-xr-xsource/xap/audacious-plugins/audacious-plugins.SlackBuild31
-rw-r--r--source/xap/audacious-plugins/audacious-plugins.libmtp8.diff16
-rwxr-xr-xsource/xap/audacious/audacious.SlackBuild42
-rw-r--r--source/xap/audacious/audacious.handle_cmd_line_options.diff38
-rw-r--r--source/xap/audacious/doinst.sh4
-rw-r--r--source/xap/blackbox/blackbox-0.70.1-gcc-4.3.patch109
-rwxr-xr-xsource/xap/blackbox/blackbox.SlackBuild120
-rw-r--r--source/xap/blackbox/blackbox_0.65.0-5.diff12462
-rw-r--r--source/xap/blackbox/xinitrc.blackbox4
-rw-r--r--source/xap/blueman/blueman-open114
-rw-r--r--source/xap/blueman/blueman-use_blueman-open_for_obexfs.diff12
-rwxr-xr-xsource/xap/blueman/blueman.SlackBuild142
-rw-r--r--source/xap/blueman/doinst.sh23
-rw-r--r--source/xap/blueman/fix_on_off_loop.diff58
-rw-r--r--source/xap/blueman/no_hide_applet.diff30
-rw-r--r--source/xap/blueman/slack-desc19
-rwxr-xr-xsource/xap/electricsheep/electricsheep.SlackBuild16
-rwxr-xr-xsource/xap/fluxbox/fluxbox.SlackBuild22
-rw-r--r--source/xap/fluxbox/xinitrc.fluxbox4
-rw-r--r--source/xap/geeqie/doinst.sh7
-rwxr-xr-xsource/xap/geeqie/geeqie.SlackBuild (renamed from source/xap/gqview/gqview.SlackBuild)54
-rw-r--r--source/xap/geeqie/slack-desc (renamed from source/xap/gqview/slack-desc)23
-rwxr-xr-xsource/xap/gimp/gimp.SlackBuild28
-rw-r--r--source/xap/gimp/gimp.png14.diff19
-rwxr-xr-xsource/xap/gkrellm/gkrellm.SlackBuild35
-rw-r--r--source/xap/gnuchess/eboard.assert.diff41
-rwxr-xr-xsource/xap/gnuchess/gnuchess.SlackBuild29
-rw-r--r--source/xap/gnuchess/gnuchess.getline.glibc.diff39
-rw-r--r--source/xap/gnuchess/xboard.buffer_overflow_fix.diff95
-rw-r--r--source/xap/gnuchess/xboard.infodir.diff11
-rwxr-xr-xsource/xap/gnuplot/gnuplot.SlackBuild21
-rw-r--r--source/xap/gqview/doinst.sh7
-rwxr-xr-xsource/xap/gucharmap/gucharmap.SlackBuild26
-rwxr-xr-xsource/xap/gv/gv.SlackBuild28
-rwxr-xr-xsource/xap/imagemagick/imagemagick.SlackBuild59
-rwxr-xr-xsource/xap/mozilla-firefox/mozilla-firefox.SlackBuild18
-rw-r--r--source/xap/mozilla-thunderbird/mimeTypes.rdf113
-rw-r--r--source/xap/mozilla-thunderbird/mozilla-thunderbird-firefox.diff11
-rwxr-xr-xsource/xap/mozilla-thunderbird/mozilla-thunderbird.SlackBuild117
-rw-r--r--source/xap/mozilla-thunderbird/thunderbird.pngbin2980 -> 47617 bytes
-rwxr-xr-xsource/xap/pan/pan.SlackBuild22
-rw-r--r--source/xap/pan/pan.gcc44.diff50
-rw-r--r--source/xap/pan/pan.gmime2.4.diff1271
-rwxr-xr-xsource/xap/pidgin/pidgin.SlackBuild58
-rw-r--r--source/xap/sane/sane-frontends-1.0.14-sane_cap_always_settable.diff11
-rwxr-xr-xsource/xap/sane/sane.SlackBuild35
-rw-r--r--source/xap/seamonkey/pkgconfig/seamonkey-gtkmozembed.pc11
-rw-r--r--source/xap/seamonkey/pkgconfig/seamonkey-js.pc11
-rw-r--r--source/xap/seamonkey/pkgconfig/seamonkey-nspr.pc12
-rw-r--r--source/xap/seamonkey/pkgconfig/seamonkey-nss.pc11
-rw-r--r--source/xap/seamonkey/pkgconfig/seamonkey-plugin.pc10
-rw-r--r--source/xap/seamonkey/pkgconfig/seamonkey-xpcom.pc12
-rwxr-xr-xsource/xap/seamonkey/seamonkey.SlackBuild121
-rw-r--r--source/xap/seamonkey/seamonkey.moz_plugin_path.diff16
-rw-r--r--source/xap/seamonkey/slack-desc6
-rwxr-xr-xsource/xap/windowmaker/windowmaker.SlackBuild37
-rw-r--r--source/xap/windowmaker/windowmaker.png.1.4.0.diff11
-rw-r--r--source/xap/windowmaker/xinitrc.wmaker4
-rwxr-xr-xsource/xap/xchat/xchat.SlackBuild18
-rw-r--r--source/xap/xfce/patches/exo_quoting_fix.diff66
-rw-r--r--source/xap/xfce/patches/launcher-plugin-migrate-icon-cat.diff48
-rw-r--r--source/xap/xfce/patches/migrate-itheme-smartly.diff92
-rw-r--r--source/xap/xfce/patches/terminal-0.4.0-fixup_docdir.diff132
-rw-r--r--source/xap/xfce/patches/terminal.gtk.2.18.fix.diff101
-rw-r--r--source/xap/xfce/patches/thunar-1.0.1-png14.diff11
-rw-r--r--source/xap/xfce/patches/thunar-fix_umask_properly.diff52
-rw-r--r--source/xap/xfce/patches/xfce-utils.xinitrc.consolekit.diff11
-rw-r--r--source/xap/xfce/patches/xfce4-settings.libxklavier5.diff11
-rwxr-xr-xsource/xap/xfce/xfce.SlackBuild65
-rw-r--r--source/xap/xfce4-notifyd/doinst.sh10
-rw-r--r--source/xap/xfce4-notifyd/slack-desc19
-rwxr-xr-xsource/xap/xfce4-notifyd/xfce4-notifyd.SlackBuild103
-rwxr-xr-xsource/xap/xfce4-power-manager/xfce4-power-manager.SlackBuild57
-rw-r--r--source/xap/xine-lib/xine-lib-1.1.17.ff.diff1044
-rwxr-xr-xsource/xap/xine-lib/xine-lib.SlackBuild23
-rwxr-xr-xsource/xap/xine-ui/xine-ui.SlackBuild19
-rw-r--r--source/xap/xine-ui/xine-ui.png14.diff11
-rwxr-xr-xsource/xap/xmms/xmms.SlackBuild28
-rw-r--r--source/xap/xmms/xmms.pngbin0 -> 2475 bytes
-rwxr-xr-xsource/xap/xpaint/xpaint.SlackBuild33
-rw-r--r--source/xap/xpaint/xpaint_2.7.8.1-1.2.diff47
-rw-r--r--source/xap/xpaint/xpaint_xaw3d_no_scroll_mode.diff11
-rw-r--r--source/xap/xpdf/VendorP.h.buggy.diff19
-rw-r--r--source/xap/xpdf/doinst.sh19
-rw-r--r--source/xap/xpdf/lang/xpdf-arabic.diff (renamed from source/xap/xpdf/xpdf-arabic.diff)0
-rw-r--r--source/xap/xpdf/lang/xpdf-chinese-simplified.diff (renamed from source/xap/xpdf/xpdf-chinese-simplified.diff)0
-rw-r--r--source/xap/xpdf/lang/xpdf-chinese-traditional.diff (renamed from source/xap/xpdf/xpdf-chinese-traditional.diff)0
-rw-r--r--source/xap/xpdf/lang/xpdf-cyrillic.diff (renamed from source/xap/xpdf/xpdf-cyrillic.diff)0
-rw-r--r--source/xap/xpdf/lang/xpdf-greek.diff (renamed from source/xap/xpdf/xpdf-greek.diff)0
-rw-r--r--source/xap/xpdf/lang/xpdf-hebrew.diff (renamed from source/xap/xpdf/xpdf-hebrew.diff)0
-rw-r--r--source/xap/xpdf/lang/xpdf-japanese.diff (renamed from source/xap/xpdf/xpdf-japanese.diff)0
-rw-r--r--source/xap/xpdf/lang/xpdf-korean.diff (renamed from source/xap/xpdf/xpdf-korean.diff)0
-rw-r--r--source/xap/xpdf/lang/xpdf-latin2.diff (renamed from source/xap/xpdf/xpdf-latin2.diff)0
-rw-r--r--source/xap/xpdf/lang/xpdf-thai.diff (renamed from source/xap/xpdf/xpdf-thai.diff)0
-rw-r--r--source/xap/xpdf/lang/xpdf-turkish.diff (renamed from source/xap/xpdf/xpdf-turkish.diff)0
-rw-r--r--source/xap/xpdf/patches/xpdf-3.02pl1.patch (renamed from source/xap/xpdf/xpdf-3.02pl1.patch)0
-rw-r--r--source/xap/xpdf/patches/xpdf-3.02pl2.patch (renamed from source/xap/xpdf/xpdf-3.02pl2.patch)0
-rw-r--r--source/xap/xpdf/patches/xpdf-3.02pl3.patch (renamed from source/xap/xpdf/xpdf-3.02pl3.patch)0
-rw-r--r--source/xap/xpdf/patches/xpdf-3.02pl4.patch282
-rw-r--r--source/xap/xpdf/patches/xpdf-resizefix.diff (renamed from source/xap/xpdf/xpdf-resizefix.diff)0
-rw-r--r--source/xap/xpdf/patches/xpdf_3.02-1.3.diff (renamed from source/xap/xpdf/xpdf_3.02-1.3.diff)0
-rw-r--r--source/xap/xpdf/patches/xpdfrc.diff (renamed from source/xap/xpdf/xpdfrc.diff)0
-rwxr-xr-xsource/xap/xpdf/xpdf.SlackBuild124
-rw-r--r--source/xap/xpdf/xpdf.desktop6
-rwxr-xr-xsource/xap/xsane/xsane.SlackBuild15
-rwxr-xr-xsource/xap/xscreensaver/xscreensaver.SlackBuild22
-rw-r--r--source/xap/xv/xv-3.10a-enhancements.20070520-20081216.diff293
-rw-r--r--source/xap/xv/xv-3.10a-jumbo-README.txt271
-rw-r--r--source/xap/xv/xv-3.10a-jumbo-additions.diff (renamed from source/xap/xv/xv-3.10a-jumbo-enh-patch-20050501.txt)15716
-rw-r--r--source/xap/xv/xv-3.10a-jumbo-fix-enh-patch-20070520.txt (renamed from source/xap/xv/xv-3.10a-jumbo-fix-patch-20050410.txt)20360
-rwxr-xr-xsource/xap/xv/xv.SlackBuild27
-rw-r--r--source/xap/xv/xv.jasper.diff20
-rw-r--r--source/xap/xv/xv.prefix.diff16
-rw-r--r--source/xap/xv/xv.prefix_x86_64.diff18
116 files changed, 25489 insertions, 29521 deletions
diff --git a/source/xap/MPlayer/MPlayer.SlackBuild b/source/xap/MPlayer/MPlayer.SlackBuild
index 20b947417..0ce4b79ed 100755
--- a/source/xap/MPlayer/MPlayer.SlackBuild
+++ b/source/xap/MPlayer/MPlayer.SlackBuild
@@ -1,7 +1,7 @@
#!/bin/sh
# Copyright 2006, 2007, 2008, 2009 Eric Hameleers, Eindhoven, NL
-# Copyright 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for
@@ -32,12 +32,21 @@
# -----------------------------------------------------------------------------
PRGNAM=MPlayer
-VERSION=${VERSION:-r29390}
-ARCH=${ARCH:-x86_64}
+VERSION=${VERSION:-20100218}
BUILD=${BUILD:-1}
TAG=${TAG:-}
-DOCS="AUTHORS Changelog Copyright LICENSE README DOCS/HTML-single DOCS/tech"
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
+DOCS="AUTHORS Changelog Copyright LICENSE README DOCS/HTML DOCS/tech"
DEFSKIN=${DEFSKIN:-"Blue"} # Download more skins at the following url:
SKINVER=${SKINVER:-"1.7"} # http://www.mplayerhq.hu/design7/dload.html
@@ -135,6 +144,7 @@ src_checkout() {
mkdir MPlayer-${VERSION} \
&& cd MPlayer-${VERSION} \
&& svn checkout --revision $REV svn://svn.mplayerhq.hu/mplayer/trunk . \
+ && svn propget svn:externals | sed -e 's/[[:space:]].*$//g' | xargs svn up --revision $REV \
&& find . -type d -name '.svn' -depth | xargs rm -rf \
&& ([ "$USE_PATENTS" != "YES" ] && rm -rf libdvdcss || true) \
&& chown -R root:root . \
@@ -247,7 +257,8 @@ if [ "$USE_PATENTS" != "YES" ]; then
DO_PATENTED="--disable-libdvdcss-internal \
--disable-mp3lame --disable-mp3lame-lavc \
--disable-faac --disable-faac-lavc \
- --disable-libamr_nb --disable-libamr_wb"
+ --disable-libopencore_amrnb \
+ --disable-libopencore_amrwb"
else
DO_PATENTED=""
fi
@@ -345,7 +356,7 @@ EOINS
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true
cp -a $SRCDIR/$(basename $0) $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
-mv $PKG/usr/doc/$PRGNAM-$VERSION/HTML-single $PKG/usr/doc/$PRGNAM-$VERSION/html
+#mv $PKG/usr/doc/$PRGNAM-$VERSION/HTML-single $PKG/usr/doc/$PRGNAM-$VERSION/html
# Save a sample of all configuration files:
for i in etc/*.conf ; do
cp $i $PKG/usr/doc/$PRGNAM-$VERSION/$(basename $i)-sample
diff --git a/source/xap/audacious-plugins/amidi-plug.fix-drct.diff b/source/xap/audacious-plugins/amidi-plug.fix-drct.diff
deleted file mode 100644
index 432b955d7..000000000
--- a/source/xap/audacious-plugins/amidi-plug.fix-drct.diff
+++ /dev/null
@@ -1,11 +0,0 @@
-diff -ur ./src/amidi-plug/i_configure.c ../audacious-plugins-1.5.1/src/amidi-plug/i_configure.c
---- ./src/amidi-plug/i_configure.c 2008-05-24 00:44:19.000000000 +0200
-+++ ./src/amidi-plug/i_configure.c 2008-11-13 15:08:57.000000000 +0100
-@@ -28,6 +28,7 @@
- #include "i_configure-fluidsynth.h"
- #include "i_configure-dummy.h"
- #include "i_utils.h"
-+#include <audacious/plugin.h>
- #include <audacious/auddrct.h>
-
-
diff --git a/source/xap/audacious-plugins/audacious-plugins.SlackBuild b/source/xap/audacious-plugins/audacious-plugins.SlackBuild
index 47bc40f9f..84417ccbc 100755
--- a/source/xap/audacious-plugins/audacious-plugins.SlackBuild
+++ b/source/xap/audacious-plugins/audacious-plugins.SlackBuild
@@ -22,18 +22,24 @@
PKGNAM=audacious-plugins
-VERSION=${VERSION:-1.5.1}
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-4}
+VERSION=${VERSION:-2.3}
+BUILD=${BUILD:-1}
NUMJOBS=${NUMJOBS:-" -j7 "}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-${PKGNAM}
-rm -rf $PKG
-mkdir -p $TMP $PKG
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
@@ -47,16 +53,19 @@ elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2"
LIBDIRSUFFIX="64"
ARCHOPTS=""
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+ ARCHOPTS=""
fi
+rm -rf $PKG
+mkdir -p $TMP $PKG
cd $TMP
rm -rf ${PKGNAM}-${VERSION}
-tar xvf $CWD/${PKGNAM}-$VERSION.tar.bz2 || exit 1
+tar xvf $CWD/${PKGNAM}-$VERSION.tar.xz || exit 1
cd ${PKGNAM}-$VERSION || exit 1
-zcat $CWD/audacious-plugins.libmtp8.diff.gz | patch -p1 || exit 1
-zcat $CWD/amidi-plug.fix-drct.diff.gz | patch -p1 || exit 1
-
# Make sure ownerships and permissions are sane:
chown -R root:root .
find . \
@@ -75,7 +84,6 @@ CXXFLAGS="$SLKCFLAGS" \
--mandir=/usr/man \
--enable-chardet \
--enable-amidiplug \
- --enable-timidity \
--disable-altivec \
--program-prefix= \
--program-suffix= \
@@ -116,11 +124,10 @@ fi
# Add a documentation directory:
mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
cp -a \
- AUTHORS COPYING INSTALL Mercurial-Access \
+ AUTHORS COPYING INSTALL Mercurial-Access README* \
$PKG/usr/doc/${PKGNAM}-$VERSION
mkdir -p $PKG/install
-#zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
diff --git a/source/xap/audacious-plugins/audacious-plugins.libmtp8.diff b/source/xap/audacious-plugins/audacious-plugins.libmtp8.diff
deleted file mode 100644
index 6c224fa5d..000000000
--- a/source/xap/audacious-plugins/audacious-plugins.libmtp8.diff
+++ /dev/null
@@ -1,16 +0,0 @@
---- ./src/mtp_up/mtp.c.orig 2008-05-23 17:44:20.000000000 -0500
-+++ ./src/mtp_up/mtp.c 2008-09-14 14:28:44.000000000 -0500
-@@ -193,11 +193,12 @@
- g_free(from_path);
- g_free(tmp);
- parent_id = mtp_device->default_music_folder;
-+ gentrack->parent_id = parent_id;
-
- #if DEBUG
- g_print("Uploading track '%s'\n",filename);
- #endif
-- ret = LIBMTP_Send_Track_From_File(mtp_device, filename , gentrack, NULL , NULL, parent_id);
-+ ret = LIBMTP_Send_Track_From_File(mtp_device, filename , gentrack, NULL , NULL);
- LIBMTP_destroy_track_t(gentrack);
- if (ret == 0)
- g_print("Track upload finished!\n");
diff --git a/source/xap/audacious/audacious.SlackBuild b/source/xap/audacious/audacious.SlackBuild
index b18a06700..45b5c1717 100755
--- a/source/xap/audacious/audacious.SlackBuild
+++ b/source/xap/audacious/audacious.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2006, 2007, 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2006-2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,18 +22,24 @@
PKGNAM=audacious
-VERSION=${VERSION:-1.5.1}
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-3}
+VERSION=${VERSION:-2.3}
+BUILD=${BUILD:-1}
NUMJOBS=${NUMJOBS:-" -j7 "}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-${PKGNAM}
-rm -rf $PKG
-mkdir -p $TMP $PKG
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
@@ -53,16 +59,18 @@ elif [ "$ARCH" = "arm" ]; then
elif [ "$ARCH" = "armel" ]; then
SLKCFLAGS="-O2 -march=armv4t"
LIBDIRSUFFIX=""
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
+rm -rf $PKG
+mkdir -p $TMP $PKG
cd $TMP
rm -rf ${PKGNAM}-${VERSION}
-tar xvf $CWD/${PKGNAM}-$VERSION.tar.bz2 || exit 1
+tar xvf $CWD/${PKGNAM}-$VERSION.tar.xz || exit 1
cd ${PKGNAM}-$VERSION || exit 1
-# Fix command line options handling:
-zcat $CWD/audacious.handle_cmd_line_options.diff.gz | patch -p1 || exit 1
-
# Make sure ownerships and permissions are sane:
chown -R root:root .
find . \
@@ -78,8 +86,7 @@ CFLAGS="$SLKCFLAGS" \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--mandir=/usr/man \
- --enable-ipv6 \
- --enable-chardet \
+ --docdir=/usr/doc/${PKGNAM}-$VERSION \
--disable-altivec \
--program-prefix= \
--program-suffix= \
@@ -90,6 +97,13 @@ CFLAGS="$SLKCFLAGS" \
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
+# Fix broken symlinks pointing into the build directory
+( cd $PKG/usr/bin
+ rm -f audacious audtool
+ ln -s audacious2 audacious
+ ln -s audtool2 audtool
+)
+
# 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
@@ -120,11 +134,11 @@ fi
# Add a documentation directory:
mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
cp -a \
- ABOUT-NLS AUTHORS COPYING INSTALL Mercurial-Access NEWS README \
+ AUTHORS COPYING INSTALL Mercurial-Access NEWS README doc/* \
$PKG/usr/doc/${PKGNAM}-$VERSION
mkdir -p $PKG/install
-#zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
+zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
diff --git a/source/xap/audacious/audacious.handle_cmd_line_options.diff b/source/xap/audacious/audacious.handle_cmd_line_options.diff
deleted file mode 100644
index 6ccb22433..000000000
--- a/source/xap/audacious/audacious.handle_cmd_line_options.diff
+++ /dev/null
@@ -1,38 +0,0 @@
---- ./src/audacious/main.c.orig 2008-05-23 17:00:34.000000000 -0500
-+++ ./src/audacious/main.c 2009-04-10 17:03:00.000000000 -0500
-@@ -315,7 +315,7 @@
- }
-
- static void
--handle_cmd_line_options()
-+handle_cmd_line_options(gboolean skip)
- {
- gchar **filenames = options.filenames;
- #ifdef USE_DBUS
-@@ -430,7 +430,7 @@
- } /* is_running */
- else
- #endif
-- { /* !is_running */
-+ if (!skip) { /* !is_running */
- if (filenames != NULL)
- {
- gint pos = 0;
-@@ -715,7 +715,7 @@
-
- signal_handlers_init();
-
-- handle_cmd_line_options();
-+ handle_cmd_line_options(TRUE);
-
- if (options.headless == FALSE)
- {
-@@ -735,6 +735,8 @@
- plugin_system_init();
- playlist_system_init();
-
-+ handle_cmd_line_options(FALSE);
-+
- #ifdef USE_DBUS
- init_dbus();
- #endif
diff --git a/source/xap/audacious/doinst.sh b/source/xap/audacious/doinst.sh
new file mode 100644
index 000000000..4e8ba7071
--- /dev/null
+++ b/source/xap/audacious/doinst.sh
@@ -0,0 +1,4 @@
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
+fi
+
diff --git a/source/xap/blackbox/blackbox-0.70.1-gcc-4.3.patch b/source/xap/blackbox/blackbox-0.70.1-gcc-4.3.patch
new file mode 100644
index 000000000..480b99e85
--- /dev/null
+++ b/source/xap/blackbox/blackbox-0.70.1-gcc-4.3.patch
@@ -0,0 +1,109 @@
+http://mirrors.usc.edu/pub/linux/distributions/gentoo/x11-wm/blackbox/files/blackbox-0.70.1-gcc-4.3.patch
+
+
+diff -Naupr blackbox-0.70.1.orig/lib/Image.cc blackbox-0.70.1/lib/Image.cc
+--- blackbox-0.70.1.orig/lib/Image.cc 2005-04-08 17:41:09.000000000 +0200
++++ blackbox-0.70.1/lib/Image.cc 2008-02-24 08:31:28.000000000 +0100
+@@ -42,8 +42,9 @@
+
+ #include <assert.h>
+ #include <math.h>
+-#include <stdio.h>
+-#include <stdlib.h>
++#include <cstdio>
++#include <cstdlib>
++#include <cstring>
+
+ // #define COLORTABLE_DEBUG
+ // #define MITSHM_DEBUG
+diff -Naupr blackbox-0.70.1.orig/lib/Resource.cc blackbox-0.70.1/lib/Resource.cc
+--- blackbox-0.70.1.orig/lib/Resource.cc 2005-04-06 23:16:50.000000000 +0200
++++ blackbox-0.70.1/lib/Resource.cc 2008-02-24 08:33:11.000000000 +0100
+@@ -28,7 +28,8 @@
+ #include <X11/Xlib.h>
+ #include <X11/Xresource.h>
+
+-#include <stdio.h>
++#include <cstdio>
++#include <cstring>
+
+
+ bt::Resource::Resource(void)
+diff -Naupr blackbox-0.70.1.orig/lib/XDG.cc blackbox-0.70.1/lib/XDG.cc
+--- blackbox-0.70.1.orig/lib/XDG.cc 2005-04-06 16:04:38.000000000 +0200
++++ blackbox-0.70.1/lib/XDG.cc 2008-02-24 08:34:11.000000000 +0100
+@@ -25,7 +25,8 @@
+ #include "Util.hh"
+ #include "XDG.hh"
+
+-#include <stdlib.h>
++#include <cstdlib>
++#include <algorithm>
+
+
+ // make sure directory names end with a slash
+diff -Naupr blackbox-0.70.1.orig/src/BlackboxResource.cc blackbox-0.70.1/src/BlackboxResource.cc
+--- blackbox-0.70.1.orig/src/BlackboxResource.cc 2005-10-18 09:34:46.000000000 +0200
++++ blackbox-0.70.1/src/BlackboxResource.cc 2008-02-24 08:34:49.000000000 +0100
+@@ -33,6 +33,8 @@
+ #include <X11/Xutil.h>
+ #include <X11/cursorfont.h>
+
++#include <cstring>
++
+
+ BlackboxResource::BlackboxResource(const std::string& rc): rc_file(rc) {
+ screen_resources = 0;
+diff -Naupr blackbox-0.70.1.orig/src/main.cc blackbox-0.70.1/src/main.cc
+--- blackbox-0.70.1.orig/src/main.cc 2005-01-03 10:42:57.000000000 +0100
++++ blackbox-0.70.1/src/main.cc 2008-02-24 08:37:16.000000000 +0100
+@@ -34,7 +34,8 @@
+ #include "blackbox.hh"
+ #include "../version.h"
+
+-#include <stdio.h>
++#include <cstdio>
++#include <cstring>
+
+
+ static void showHelp(int exitval) {
+diff -Naupr blackbox-0.70.1.orig/src/Screen.cc blackbox-0.70.1/src/Screen.cc
+--- blackbox-0.70.1.orig/src/Screen.cc 2005-10-18 10:07:22.000000000 +0200
++++ blackbox-0.70.1/src/Screen.cc 2008-02-24 08:35:46.000000000 +0100
+@@ -45,8 +45,9 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <assert.h>
+-#include <ctype.h>
+ #include <dirent.h>
++#include <cctype>
++#include <cstring>
+
+
+ static bool running = true;
+diff -Naupr blackbox-0.70.1.orig/src/ScreenResource.cc blackbox-0.70.1/src/ScreenResource.cc
+--- blackbox-0.70.1.orig/src/ScreenResource.cc 2005-04-13 07:54:08.000000000 +0200
++++ blackbox-0.70.1/src/ScreenResource.cc 2008-02-24 08:36:31.000000000 +0100
+@@ -33,6 +33,8 @@
+
+ #include <assert.h>
+
++#include <cstring>
++
+
+ static const int iconify_width = 9;
+ static const int iconify_height = 9;
+diff -Naupr blackbox-0.70.1.orig/util/bsetroot.cc blackbox-0.70.1/util/bsetroot.cc
+--- blackbox-0.70.1.orig/util/bsetroot.cc 2005-03-15 08:01:37.000000000 +0100
++++ blackbox-0.70.1/util/bsetroot.cc 2008-02-24 08:38:41.000000000 +0100
+@@ -30,7 +30,9 @@
+ #include <cctype>
+
+ #include <X11/Xatom.h>
+-#include <stdio.h>
++#include <cstdio>
++#include <cstdlib>
++#include <cstring>
+
+
+ // ignore all X errors
diff --git a/source/xap/blackbox/blackbox.SlackBuild b/source/xap/blackbox/blackbox.SlackBuild
index 4505d06e3..130355f4b 100755
--- a/source/xap/blackbox/blackbox.SlackBuild
+++ b/source/xap/blackbox/blackbox.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2006, 2007, 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2006, 2007, 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,23 +20,48 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# http://downloads.sourceforge.net/project/blackboxwm/blackboxwm/Blackbox%200.70.1/blackbox-0.70.1.tar.bz2
+# http://downloads.sourceforge.net/project/bbkeys/bbkeys/0.9.1/bbkeys-0.9.1.tar.gz
PKGNAM=blackbox
-VERSION=${VERSION:-0.65.0}
-BBVER=${BBVER:-0.8.6}
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-4}
-
+VERSION=${VERSION:-0.70.1}
+BBKEYSVER=${BBKEYSVER:-0.9.1}
+BUILD=${BUILD:-3}
NUMJOBS=${NUMJOBS:-" -j7 "}
+PKGEXT=${PKGEXT:-txz}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+# Determine the CFLAGS for the known architectures:
+case $ARCH in
+ i486) export SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ export LIBDIRSUFFIX=""
+ export ARCHQUADLET="" ;;
+ i686) export SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ export LIBDIRSUFFIX=""
+ export ARCHQUADLET="" ;;
+ x86_64) export SLKCFLAGS="-O2 -fPIC"
+ export LIBDIRSUFFIX="64"
+ export ARCHQUADLET="" ;;
+ s390) export SLKCFLAGS="-O2"
+ export LIBDIRSUFFIX=""
+ export ARCHQUADLET="" ;;
+ arm) export SLKCFLAGS="-O2 -march=armv4t"
+ export LIBDIRSUFFIX=""
+ export ARCHQUADLET="-gnueabi" ;;
+ *) export SLKCFLAGS="-O2"
+ export LIBDIRSUFFIX=""
+ export ARCHQUADLET="" ;;
+esac
-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
CWD=$(pwd)
TMP=${TMP:-/tmp}
@@ -46,7 +71,7 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf ${PKGNAM}-${VERSION}
-tar xvf $CWD/${PKGNAM}-$VERSION.tar.gz || exit 1
+tar xvf $CWD/${PKGNAM}-$VERSION.tar.xz || exit 1
cd ${PKGNAM}-$VERSION || exit 1
# Make sure ownerships and permissions are sane:
@@ -57,24 +82,33 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
-# Thanks for the gcc-4.1.1 patch, Debian. :-)
-zcat $CWD/blackbox_0.65.0-5.diff.gz | patch -p1 --verbose || exit 1
+# Build fix for gcc-4:
+zcat $CWD/blackbox-0.70.1-gcc-4.3.patch.gz | patch --verbose -p1 || exit 1
# Configure:
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
--enable-shape \
--enable-slit \
--enable-interlace \
--enable-nls \
+ --enable-shared=yes \
+ --enable-static=no \
--enable-timed-cache \
- $ARCH-slackware-linux
+ --infodir=/usr/info \
+ --mandir=/usr/man \
+ --build=$ARCH-slackware-linux$ARCHQUADLET || exit 1
-# Build and install:
+# Build:
make $NUMJOBS || make || exit 1
-make install DESTDIR=$PKG || exit 1
+# Install onto filesystem - needed for bbkeys to find libbt:
+make install || exit 1
+
+# Install into package:
+make install DESTDIR=$PKG || exit 1
mkdir -p $PKG/etc/X11/xinit
zcat $CWD/xinitrc.blackbox.gz > $PKG/etc/X11/xinit/xinitrc.blackbox
chmod 755 $PKG/etc/X11/xinit/xinitrc.blackbox
@@ -85,12 +119,20 @@ cp -a \
AUTHORS INSTALL LICENSE README* TODO \
$PKG/usr/doc/${PKGNAM}-$VERSION
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
######################################
# Compile bbkeys program for blackbox:
cd $TMP
-rm -rf bbkeys-${BBVER}
-tar xvf $CWD/bbkeys-${BBVER}.tar.gz || exit 1
-cd bbkeys-${BBVER} || exit 1
+rm -rf bbkeys-${BBKEYSVER}
+tar xvf $CWD/bbkeys-${BBKEYSVER}.tar.xz
+cd bbkeys-${BBKEYSVER} || exit 1
# Make sure ownerships and permissions are sane:
chown -R root:root .
@@ -104,18 +146,27 @@ find . \
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
- --enable-interlace \
- $ARCH-slackware-linux
+ --infodir=/usr/info \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/bbkeys-$BBKEYSVER \
+ --build=$ARCH-slackware-linux$ARCHQUADLET || exit 1
+
+# --docdir isn't honoured:
+sed -i 's?^docdir.*=.*?docdir = /usr/doc/bbkeys-'"$BBKEYSVER"'?g' Makefile
+
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/bbkeys-${BBKEYSVER})
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
-# Build and install:
+# Build and install into package:
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
-mkdir -p /usr/doc/bbkeys-$BBKEYS
-cp -a \
- AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README* TODO \
- /usr/doc/bbkeys-$BBKEYS
-
# 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
@@ -135,9 +186,12 @@ if [ -d $PKG/usr/man ]; then
)
fi
+# Set doc permissions:
+find $PKG/usr/doc -type f -print0 | xargs -0 chmod 644
+find $PKG/usr/doc -type d -print0 | xargs -0 chmod 755
+
mkdir -p $PKG/install
-cat $CWD/slack-desc > $PKG/install/slack-desc
+install -vpm644 $CWD/slack-desc $PKG/install/
cd $PKG
-/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz
-
+/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.$PKGEXT
diff --git a/source/xap/blackbox/blackbox_0.65.0-5.diff b/source/xap/blackbox/blackbox_0.65.0-5.diff
deleted file mode 100644
index 4b6959d85..000000000
--- a/source/xap/blackbox/blackbox_0.65.0-5.diff
+++ /dev/null
@@ -1,12462 +0,0 @@
---- blackbox-0.65.0.orig/Makefile.in
-+++ blackbox-0.65.0/Makefile.in
-@@ -68,6 +68,7 @@
- ORDEREDPSEUDO = @ORDEREDPSEUDO@
- PACKAGE = @PACKAGE@
- SHAPE = @SHAPE@
-+XINERAMA = @XINERAMA@
- TIMEDCACHE = @TIMEDCACHE@
- VERSION = @VERSION@
- gencat_cmd = @gencat_cmd@
---- blackbox-0.65.0.orig/configure
-+++ blackbox-0.65.0/configure
-@@ -1,42 +1,325 @@
- #! /bin/sh
--
- # Guess values for system-dependent variables and create Makefiles.
--# Generated automatically using autoconf version 2.13
--# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-+# Generated by GNU Autoconf 2.59.
- #
-+# Copyright (C) 2003 Free Software Foundation, Inc.
- # This configure script is free software; the Free Software Foundation
- # gives unlimited permission to copy, distribute and modify it.
-+## --------------------- ##
-+## M4sh Initialization. ##
-+## --------------------- ##
-+
-+# Be Bourne compatible
-+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-+ emulate sh
-+ NULLCMD=:
-+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-+ # is contrary to our usage. Disable this feature.
-+ alias -g '${1+"$@"}'='"$@"'
-+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-+ set -o posix
-+fi
-+DUALCASE=1; export DUALCASE # for MKS sh
-+
-+# Support unset when possible.
-+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-+ as_unset=unset
-+else
-+ as_unset=false
-+fi
-+
-+
-+# Work around bugs in pre-3.0 UWIN ksh.
-+$as_unset ENV MAIL MAILPATH
-+PS1='$ '
-+PS2='> '
-+PS4='+ '
-+
-+# NLS nuisances.
-+for as_var in \
-+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-+ LC_TELEPHONE LC_TIME
-+do
-+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-+ eval $as_var=C; export $as_var
-+ else
-+ $as_unset $as_var
-+ fi
-+done
-+
-+# Required to use basename.
-+if expr a : '\(a\)' >/dev/null 2>&1; then
-+ as_expr=expr
-+else
-+ as_expr=false
-+fi
-+
-+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
-+ as_basename=basename
-+else
-+ as_basename=false
-+fi
-+
-+
-+# Name of the executable.
-+as_me=`$as_basename "$0" ||
-+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-+ X"$0" : 'X\(//\)$' \| \
-+ X"$0" : 'X\(/\)$' \| \
-+ . : '\(.\)' 2>/dev/null ||
-+echo X/"$0" |
-+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-+ /^X\/\(\/\/\)$/{ s//\1/; q; }
-+ /^X\/\(\/\).*/{ s//\1/; q; }
-+ s/.*/./; q'`
-+
-+
-+# PATH needs CR, and LINENO needs CR and PATH.
-+# Avoid depending upon Character Ranges.
-+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-+as_cr_digits='0123456789'
-+as_cr_alnum=$as_cr_Letters$as_cr_digits
-+
-+# The user is always right.
-+if test "${PATH_SEPARATOR+set}" != set; then
-+ echo "#! /bin/sh" >conf$$.sh
-+ echo "exit 0" >>conf$$.sh
-+ chmod +x conf$$.sh
-+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-+ PATH_SEPARATOR=';'
-+ else
-+ PATH_SEPARATOR=:
-+ fi
-+ rm -f conf$$.sh
-+fi
-+
-+
-+ as_lineno_1=$LINENO
-+ as_lineno_2=$LINENO
-+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-+ test "x$as_lineno_1" != "x$as_lineno_2" &&
-+ test "x$as_lineno_3" = "x$as_lineno_2" || {
-+ # Find who we are. Look in the path if we contain no path at all
-+ # relative or not.
-+ case $0 in
-+ *[\\/]* ) as_myself=$0 ;;
-+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-+done
-+
-+ ;;
-+ esac
-+ # We did not find ourselves, most probably we were run as `sh COMMAND'
-+ # in which case we are not to be found in the path.
-+ if test "x$as_myself" = x; then
-+ as_myself=$0
-+ fi
-+ if test ! -f "$as_myself"; then
-+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
-+ { (exit 1); exit 1; }; }
-+ fi
-+ case $CONFIG_SHELL in
-+ '')
-+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for as_base in sh bash ksh sh5; do
-+ case $as_dir in
-+ /*)
-+ if ("$as_dir/$as_base" -c '
-+ as_lineno_1=$LINENO
-+ as_lineno_2=$LINENO
-+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-+ test "x$as_lineno_1" != "x$as_lineno_2" &&
-+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
-+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-+ CONFIG_SHELL=$as_dir/$as_base
-+ export CONFIG_SHELL
-+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
-+ fi;;
-+ esac
-+ done
-+done
-+;;
-+ esac
-+
-+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-+ # uniformly replaced by the line number. The first 'sed' inserts a
-+ # line-number line before each line; the second 'sed' does the real
-+ # work. The second script uses 'N' to pair each line-number line
-+ # with the numbered line, and appends trailing '-' during
-+ # substitution so that $LINENO is not a special case at line end.
-+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
-+ sed '=' <$as_myself |
-+ sed '
-+ N
-+ s,$,-,
-+ : loop
-+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
-+ t loop
-+ s,-$,,
-+ s,^['$as_cr_digits']*\n,,
-+ ' >$as_me.lineno &&
-+ chmod +x $as_me.lineno ||
-+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-+ { (exit 1); exit 1; }; }
-+
-+ # Don't try to exec as it changes $[0], causing all sort of problems
-+ # (the dirname of $[0] is not the place where we might find the
-+ # original and so on. Autoconf is especially sensible to this).
-+ . ./$as_me.lineno
-+ # Exit status is that of the last command.
-+ exit
-+}
-+
-+
-+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
-+ *c*,-n*) ECHO_N= ECHO_C='
-+' ECHO_T=' ' ;;
-+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
-+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-+esac
-+
-+if expr a : '\(a\)' >/dev/null 2>&1; then
-+ as_expr=expr
-+else
-+ as_expr=false
-+fi
-+
-+rm -f conf$$ conf$$.exe conf$$.file
-+echo >conf$$.file
-+if ln -s conf$$.file conf$$ 2>/dev/null; then
-+ # We could just check for DJGPP; but this test a) works b) is more generic
-+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
-+ if test -f conf$$.exe; then
-+ # Don't use ln at all; we don't have any links
-+ as_ln_s='cp -p'
-+ else
-+ as_ln_s='ln -s'
-+ fi
-+elif ln conf$$.file conf$$ 2>/dev/null; then
-+ as_ln_s=ln
-+else
-+ as_ln_s='cp -p'
-+fi
-+rm -f conf$$ conf$$.exe conf$$.file
-+
-+if mkdir -p . 2>/dev/null; then
-+ as_mkdir_p=:
-+else
-+ test -d ./-p && rmdir ./-p
-+ as_mkdir_p=false
-+fi
-+
-+as_executable_p="test -f"
-+
-+# Sed expression to map a string onto a valid CPP name.
-+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-+
-+# Sed expression to map a string onto a valid variable name.
-+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-+
-
--# Defaults:
--ac_help=
-+# IFS
-+# We need space, tab and new line, in precisely that order.
-+as_nl='
-+'
-+IFS=" $as_nl"
-+
-+# CDPATH.
-+$as_unset CDPATH
-+
-+
-+# Name of the host.
-+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-+# so uname gets run too.
-+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-+
-+exec 6>&1
-+
-+#
-+# Initializations.
-+#
- ac_default_prefix=/usr/local
--# Any additions from configure.in:
--ac_help="$ac_help
-- --with-x use the X Window System"
--ac_help="$ac_help
-- --enable-shape enable support of the XShape extension [default=yes]"
--ac_help="$ac_help
-- --enable-ordered-pseudo include code for ordered pseudocolor (8bpp)
-- dithering [default=no]"
--ac_help="$ac_help
-- --enable-debug include verbose debugging code [default=no]"
--ac_help="$ac_help
-- --enable-nls include natural language support [default=yes]"
--ac_help="$ac_help
-- --enable-timed-cache use new timed pixmap cache [default=yes]"
--ac_help="$ac_help
-- --enable-maintainer-mode enable make rules and dependencies not useful
-- (and sometimes confusing) to the casual installer"
-+ac_config_libobj_dir=.
-+cross_compiling=no
-+subdirs=
-+MFLAGS=
-+MAKEFLAGS=
-+SHELL=${CONFIG_SHELL-/bin/sh}
-+
-+# Maximum number of lines to put in a shell here document.
-+# This variable seems obsolete. It should probably be removed, and
-+# only ac_max_sed_lines should be used.
-+: ${ac_max_here_lines=38}
-+
-+# Identity of this package.
-+PACKAGE_NAME=
-+PACKAGE_TARNAME=
-+PACKAGE_VERSION=
-+PACKAGE_STRING=
-+PACKAGE_BUGREPORT=
-+
-+ac_unique_file="src/blackbox.cc"
-+# Factoring default headers for most tests.
-+ac_includes_default="\
-+#include <stdio.h>
-+#if HAVE_SYS_TYPES_H
-+# include <sys/types.h>
-+#endif
-+#if HAVE_SYS_STAT_H
-+# include <sys/stat.h>
-+#endif
-+#if STDC_HEADERS
-+# include <stdlib.h>
-+# include <stddef.h>
-+#else
-+# if HAVE_STDLIB_H
-+# include <stdlib.h>
-+# endif
-+#endif
-+#if HAVE_STRING_H
-+# if !STDC_HEADERS && HAVE_MEMORY_H
-+# include <memory.h>
-+# endif
-+# include <string.h>
-+#endif
-+#if HAVE_STRINGS_H
-+# include <strings.h>
-+#endif
-+#if HAVE_INTTYPES_H
-+# include <inttypes.h>
-+#else
-+# if HAVE_STDINT_H
-+# include <stdint.h>
-+# endif
-+#endif
-+#if HAVE_UNISTD_H
-+# include <unistd.h>
-+#endif"
-+
-+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX regex_cmd CPP EGREP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS SHAPE XINERAMA ORDEREDPSEUDO DEBUG NLS gencat_cmd TIMEDCACHE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBOBJS LTLIBOBJS'
-+ac_subst_files=''
-
- # Initialize some variables set by options.
-+ac_init_help=
-+ac_init_version=false
- # The variables have the same names as the options, with
- # dashes changed to underlines.
--build=NONE
--cache_file=./config.cache
-+cache_file=/dev/null
- exec_prefix=NONE
--host=NONE
- no_create=
--nonopt=NONE
- no_recursion=
- prefix=NONE
- program_prefix=NONE
-@@ -45,10 +328,15 @@
- silent=
- site=
- srcdir=
--target=NONE
- verbose=
- x_includes=NONE
- x_libraries=NONE
-+
-+# Installation directory options.
-+# These are left unexpanded so users can "make install exec_prefix=/foo"
-+# and all the variables that are supposed to be based on exec_prefix
-+# by default will actually change.
-+# Use braces instead of parens because sh, perl, etc. also accept them.
- bindir='${exec_prefix}/bin'
- sbindir='${exec_prefix}/sbin'
- libexecdir='${exec_prefix}/libexec'
-@@ -62,17 +350,9 @@
- infodir='${prefix}/info'
- mandir='${prefix}/man'
-
--# Initialize some other variables.
--subdirs=
--MFLAGS= MAKEFLAGS=
--SHELL=${CONFIG_SHELL-/bin/sh}
--# Maximum number of lines to put in a shell here document.
--ac_max_here_lines=12
--
- ac_prev=
- for ac_option
- do
--
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
-@@ -80,59 +360,59 @@
- continue
- fi
-
-- case "$ac_option" in
-- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-- *) ac_optarg= ;;
-- esac
-+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
-- case "$ac_option" in
-+ case $ac_option in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-- bindir="$ac_optarg" ;;
-+ bindir=$ac_optarg ;;
-
- -build | --build | --buil | --bui | --bu)
-- ac_prev=build ;;
-+ ac_prev=build_alias ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-- build="$ac_optarg" ;;
-+ build_alias=$ac_optarg ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-- cache_file="$ac_optarg" ;;
-+ cache_file=$ac_optarg ;;
-+
-+ --config-cache | -C)
-+ cache_file=config.cache ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
-- datadir="$ac_optarg" ;;
-+ datadir=$ac_optarg ;;
-
- -disable-* | --disable-*)
-- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
-+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
- # Reject names that are not valid shell variable names.
-- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
-- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-- fi
-- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-- eval "enable_${ac_feature}=no" ;;
-+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
-+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
-+ { (exit 1); exit 1; }; }
-+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-+ eval "enable_$ac_feature=no" ;;
-
- -enable-* | --enable-*)
-- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
-+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
-- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
-- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-- fi
-- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-- case "$ac_option" in
-- *=*) ;;
-+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
-+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
-+ { (exit 1); exit 1; }; }
-+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-+ case $ac_option in
-+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
-- eval "enable_${ac_feature}='$ac_optarg'" ;;
-+ eval "enable_$ac_feature='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
-@@ -141,95 +421,47 @@
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
-- exec_prefix="$ac_optarg" ;;
-+ exec_prefix=$ac_optarg ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
-- -help | --help | --hel | --he)
-- # Omit some internal or obsolete options to make the list less imposing.
-- # This message is too long to be a string in the A/UX 3.1 sh.
-- cat << EOF
--Usage: configure [options] [host]
--Options: [defaults in brackets after descriptions]
--Configuration:
-- --cache-file=FILE cache test results in FILE
-- --help print this message
-- --no-create do not create output files
-- --quiet, --silent do not print \`checking...' messages
-- --version print the version of autoconf that created configure
--Directory and file names:
-- --prefix=PREFIX install architecture-independent files in PREFIX
-- [$ac_default_prefix]
-- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
-- [same as prefix]
-- --bindir=DIR user executables in DIR [EPREFIX/bin]
-- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
-- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
-- --datadir=DIR read-only architecture-independent data in DIR
-- [PREFIX/share]
-- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
-- --sharedstatedir=DIR modifiable architecture-independent data in DIR
-- [PREFIX/com]
-- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
-- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
-- --includedir=DIR C header files in DIR [PREFIX/include]
-- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
-- --infodir=DIR info documentation in DIR [PREFIX/info]
-- --mandir=DIR man documentation in DIR [PREFIX/man]
-- --srcdir=DIR find the sources in DIR [configure dir or ..]
-- --program-prefix=PREFIX prepend PREFIX to installed program names
-- --program-suffix=SUFFIX append SUFFIX to installed program names
-- --program-transform-name=PROGRAM
-- run sed PROGRAM on installed program names
--EOF
-- cat << EOF
--Host type:
-- --build=BUILD configure for building on BUILD [BUILD=HOST]
-- --host=HOST configure for HOST [guessed]
-- --target=TARGET configure for TARGET [TARGET=HOST]
--Features and packages:
-- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
-- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
-- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
-- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
-- --x-includes=DIR X include files are in DIR
-- --x-libraries=DIR X library files are in DIR
--EOF
-- if test -n "$ac_help"; then
-- echo "--enable and --with options recognized:$ac_help"
-- fi
-- exit 0 ;;
-+ -help | --help | --hel | --he | -h)
-+ ac_init_help=long ;;
-+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
-+ ac_init_help=recursive ;;
-+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
-+ ac_init_help=short ;;
-
- -host | --host | --hos | --ho)
-- ac_prev=host ;;
-+ ac_prev=host_alias ;;
- -host=* | --host=* | --hos=* | --ho=*)
-- host="$ac_optarg" ;;
-+ host_alias=$ac_optarg ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
-- includedir="$ac_optarg" ;;
-+ includedir=$ac_optarg ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-- infodir="$ac_optarg" ;;
-+ infodir=$ac_optarg ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
-- libdir="$ac_optarg" ;;
-+ libdir=$ac_optarg ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
-- libexecdir="$ac_optarg" ;;
-+ libexecdir=$ac_optarg ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
-@@ -238,19 +470,19 @@
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
-- localstatedir="$ac_optarg" ;;
-+ localstatedir=$ac_optarg ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-- mandir="$ac_optarg" ;;
-+ mandir=$ac_optarg ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-- | --no-cr | --no-c)
-+ | --no-cr | --no-c | -n)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-@@ -264,26 +496,26 @@
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-- oldincludedir="$ac_optarg" ;;
-+ oldincludedir=$ac_optarg ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-- prefix="$ac_optarg" ;;
-+ prefix=$ac_optarg ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-- program_prefix="$ac_optarg" ;;
-+ program_prefix=$ac_optarg ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-- program_suffix="$ac_optarg" ;;
-+ program_suffix=$ac_optarg ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
-@@ -300,7 +532,7 @@
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
-- program_transform_name="$ac_optarg" ;;
-+ program_transform_name=$ac_optarg ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
-@@ -310,7 +542,7 @@
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
-- sbindir="$ac_optarg" ;;
-+ sbindir=$ac_optarg ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
-@@ -321,58 +553,57 @@
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
-- sharedstatedir="$ac_optarg" ;;
-+ sharedstatedir=$ac_optarg ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
-- site="$ac_optarg" ;;
-+ site=$ac_optarg ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-- srcdir="$ac_optarg" ;;
-+ srcdir=$ac_optarg ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-- sysconfdir="$ac_optarg" ;;
-+ sysconfdir=$ac_optarg ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
-- ac_prev=target ;;
-+ ac_prev=target_alias ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-- target="$ac_optarg" ;;
-+ target_alias=$ac_optarg ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
-- -version | --version | --versio | --versi | --vers)
-- echo "configure generated by autoconf version 2.13"
-- exit 0 ;;
-+ -version | --version | --versio | --versi | --vers | -V)
-+ ac_init_version=: ;;
-
- -with-* | --with-*)
-- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
-+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
-- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
-- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-- fi
-+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
-+ { echo "$as_me: error: invalid package name: $ac_package" >&2
-+ { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package| sed 's/-/_/g'`
-- case "$ac_option" in
-- *=*) ;;
-+ case $ac_option in
-+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
-- eval "with_${ac_package}='$ac_optarg'" ;;
-+ eval "with_$ac_package='$ac_optarg'" ;;
-
- -without-* | --without-*)
-- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
-+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
- # Reject names that are not valid shell variable names.
-- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
-- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-- fi
-- ac_package=`echo $ac_package| sed 's/-/_/g'`
-- eval "with_${ac_package}=no" ;;
-+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
-+ { echo "$as_me: error: invalid package name: $ac_package" >&2
-+ { (exit 1); exit 1; }; }
-+ ac_package=`echo $ac_package | sed 's/-/_/g'`
-+ eval "with_$ac_package=no" ;;
-
- --x)
- # Obsolete; use --with-x.
-@@ -383,99 +614,110 @@
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-- x_includes="$ac_optarg" ;;
-+ x_includes=$ac_optarg ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-- x_libraries="$ac_optarg" ;;
-+ x_libraries=$ac_optarg ;;
-
-- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
-+ -*) { echo "$as_me: error: unrecognized option: $ac_option
-+Try \`$0 --help' for more information." >&2
-+ { (exit 1); exit 1; }; }
- ;;
-
-+ *=*)
-+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
-+ # Reject names that are not valid shell variable names.
-+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
-+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
-+ { (exit 1); exit 1; }; }
-+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
-+ eval "$ac_envvar='$ac_optarg'"
-+ export $ac_envvar ;;
-+
- *)
-- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
-- echo "configure: warning: $ac_option: invalid host type" 1>&2
-- fi
-- if test "x$nonopt" != xNONE; then
-- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
-- fi
-- nonopt="$ac_option"
-+ # FIXME: should be removed in autoconf 3.0.
-+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
-+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
- ;;
-
- esac
- done
-
- if test -n "$ac_prev"; then
-- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
--fi
--
--trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
--
--# File descriptor usage:
--# 0 standard input
--# 1 file creation
--# 2 errors and warnings
--# 3 some systems may open it to /dev/tty
--# 4 used on the Kubota Titan
--# 6 checking for... messages and results
--# 5 compiler messages saved in config.log
--if test "$silent" = yes; then
-- exec 6>/dev/null
--else
-- exec 6>&1
-+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-+ { echo "$as_me: error: missing argument to $ac_option" >&2
-+ { (exit 1); exit 1; }; }
- fi
--exec 5>./config.log
-
--echo "\
--This file contains any messages produced by compilers while
--running configure, to aid debugging if configure makes a mistake.
--" 1>&5
-+# Be sure to have absolute paths.
-+for ac_var in exec_prefix prefix
-+do
-+ eval ac_val=$`echo $ac_var`
-+ case $ac_val in
-+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
-+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-+ { (exit 1); exit 1; }; };;
-+ esac
-+done
-
--# Strip out --no-create and --no-recursion so they do not pile up.
--# Also quote any args containing shell metacharacters.
--ac_configure_args=
--for ac_arg
-+# Be sure to have absolute paths.
-+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
-+ localstatedir libdir includedir oldincludedir infodir mandir
- do
-- case "$ac_arg" in
-- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-- | --no-cr | --no-c) ;;
-- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
-- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
-- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
-+ eval ac_val=$`echo $ac_var`
-+ case $ac_val in
-+ [\\/$]* | ?:[\\/]* ) ;;
-+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-+ { (exit 1); exit 1; }; };;
- esac
- done
-
--# NLS nuisances.
--# Only set these to C if already set. These must not be set unconditionally
--# because not all systems understand e.g. LANG=C (notably SCO).
--# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
--# Non-C LC_CTYPE values break the ctype check.
--if test "${LANG+set}" = set; then LANG=C; export LANG; fi
--if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
--if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
--if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-+# There might be people who depend on the old broken behavior: `$host'
-+# used to hold the argument of --host etc.
-+# FIXME: To remove some day.
-+build=$build_alias
-+host=$host_alias
-+target=$target_alias
-+
-+# FIXME: To remove some day.
-+if test "x$host_alias" != x; then
-+ if test "x$build_alias" = x; then
-+ cross_compiling=maybe
-+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
-+ If a cross compiler is detected then cross compile mode will be used." >&2
-+ elif test "x$build_alias" != "x$host_alias"; then
-+ cross_compiling=yes
-+ fi
-+fi
-
--# confdefs.h avoids OS command line length limits that DEFS can exceed.
--rm -rf conftest* confdefs.h
--# AIX cpp loses on an empty file, so make sure it contains at least a newline.
--echo > confdefs.h
-+ac_tool_prefix=
-+test -n "$host_alias" && ac_tool_prefix=$host_alias-
-+
-+test "$silent" = yes && exec 6>/dev/null
-
--# A filename unique to this package, relative to the directory that
--# configure is in, which we can look for to find out if srcdir is correct.
--ac_unique_file=src/blackbox.cc
-
- # Find the source files, if location was not specified.
- if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
-- ac_prog=$0
-- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
-- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
-+ ac_confdir=`(dirname "$0") 2>/dev/null ||
-+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-+ X"$0" : 'X\(//\)[^/]' \| \
-+ X"$0" : 'X\(//\)$' \| \
-+ X"$0" : 'X\(/\)' \| \
-+ . : '\(.\)' 2>/dev/null ||
-+echo X"$0" |
-+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-+ /^X\(\/\/\)$/{ s//\1/; q; }
-+ /^X\(\/\).*/{ s//\1/; q; }
-+ s/.*/./; q'`
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
-@@ -485,13 +727,491 @@
- fi
- if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
-- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
-+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
-+ { (exit 1); exit 1; }; }
- else
-- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
-+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-+ { (exit 1); exit 1; }; }
- fi
- fi
--srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
-+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
-+ { (exit 1); exit 1; }; }
-+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-+ac_env_build_alias_set=${build_alias+set}
-+ac_env_build_alias_value=$build_alias
-+ac_cv_env_build_alias_set=${build_alias+set}
-+ac_cv_env_build_alias_value=$build_alias
-+ac_env_host_alias_set=${host_alias+set}
-+ac_env_host_alias_value=$host_alias
-+ac_cv_env_host_alias_set=${host_alias+set}
-+ac_cv_env_host_alias_value=$host_alias
-+ac_env_target_alias_set=${target_alias+set}
-+ac_env_target_alias_value=$target_alias
-+ac_cv_env_target_alias_set=${target_alias+set}
-+ac_cv_env_target_alias_value=$target_alias
-+ac_env_CC_set=${CC+set}
-+ac_env_CC_value=$CC
-+ac_cv_env_CC_set=${CC+set}
-+ac_cv_env_CC_value=$CC
-+ac_env_CFLAGS_set=${CFLAGS+set}
-+ac_env_CFLAGS_value=$CFLAGS
-+ac_cv_env_CFLAGS_set=${CFLAGS+set}
-+ac_cv_env_CFLAGS_value=$CFLAGS
-+ac_env_LDFLAGS_set=${LDFLAGS+set}
-+ac_env_LDFLAGS_value=$LDFLAGS
-+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-+ac_cv_env_LDFLAGS_value=$LDFLAGS
-+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-+ac_env_CPPFLAGS_value=$CPPFLAGS
-+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-+ac_env_CXX_set=${CXX+set}
-+ac_env_CXX_value=$CXX
-+ac_cv_env_CXX_set=${CXX+set}
-+ac_cv_env_CXX_value=$CXX
-+ac_env_CXXFLAGS_set=${CXXFLAGS+set}
-+ac_env_CXXFLAGS_value=$CXXFLAGS
-+ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
-+ac_cv_env_CXXFLAGS_value=$CXXFLAGS
-+ac_env_CPP_set=${CPP+set}
-+ac_env_CPP_value=$CPP
-+ac_cv_env_CPP_set=${CPP+set}
-+ac_cv_env_CPP_value=$CPP
-+
-+#
-+# Report the --help message.
-+#
-+if test "$ac_init_help" = "long"; then
-+ # Omit some internal or obsolete options to make the list less imposing.
-+ # This message is too long to be a string in the A/UX 3.1 sh.
-+ cat <<_ACEOF
-+\`configure' configures this package to adapt to many kinds of systems.
-+
-+Usage: $0 [OPTION]... [VAR=VALUE]...
-+
-+To assign environment variables (e.g., CC, CFLAGS...), specify them as
-+VAR=VALUE. See below for descriptions of some of the useful variables.
-+
-+Defaults for the options are specified in brackets.
-+
-+Configuration:
-+ -h, --help display this help and exit
-+ --help=short display options specific to this package
-+ --help=recursive display the short help of all the included packages
-+ -V, --version display version information and exit
-+ -q, --quiet, --silent do not print \`checking...' messages
-+ --cache-file=FILE cache test results in FILE [disabled]
-+ -C, --config-cache alias for \`--cache-file=config.cache'
-+ -n, --no-create do not create output files
-+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
-+
-+_ACEOF
-+
-+ cat <<_ACEOF
-+Installation directories:
-+ --prefix=PREFIX install architecture-independent files in PREFIX
-+ [$ac_default_prefix]
-+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
-+ [PREFIX]
-+
-+By default, \`make install' will install all the files in
-+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
-+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-+for instance \`--prefix=\$HOME'.
-+
-+For better control, use the options below.
-+
-+Fine tuning of the installation directories:
-+ --bindir=DIR user executables [EPREFIX/bin]
-+ --sbindir=DIR system admin executables [EPREFIX/sbin]
-+ --libexecdir=DIR program executables [EPREFIX/libexec]
-+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
-+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
-+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
-+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
-+ --libdir=DIR object code libraries [EPREFIX/lib]
-+ --includedir=DIR C header files [PREFIX/include]
-+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
-+ --infodir=DIR info documentation [PREFIX/info]
-+ --mandir=DIR man documentation [PREFIX/man]
-+_ACEOF
-+
-+ cat <<\_ACEOF
-+
-+Program names:
-+ --program-prefix=PREFIX prepend PREFIX to installed program names
-+ --program-suffix=SUFFIX append SUFFIX to installed program names
-+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
-+
-+X features:
-+ --x-includes=DIR X include files are in DIR
-+ --x-libraries=DIR X library files are in DIR
-+_ACEOF
-+fi
-+
-+if test -n "$ac_init_help"; then
-+
-+ cat <<\_ACEOF
-+
-+Optional Features:
-+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
-+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
-+ --enable-shape enable support of the XShape extension default=yes
-+ --enable-xinerama enable support of the xinerama extension default=yes
-+ --enable-ordered-pseudo include code for ordered pseudocolor (8bpp)
-+ dithering default=no
-+ --enable-debug include verbose debugging code default=no
-+ --enable-nls include natural language support default=yes
-+ --enable-timed-cache use new timed pixmap cache default=yes
-+ --enable-maintainer-mode enable make rules and dependencies not useful
-+ (and sometimes confusing) to the casual installer
-+
-+Optional Packages:
-+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
-+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
-+ --with-x use the X Window System
-+
-+Some influential environment variables:
-+ CC C compiler command
-+ CFLAGS C compiler flags
-+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
-+ nonstandard directory <lib dir>
-+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
-+ headers in a nonstandard directory <include dir>
-+ CXX C++ compiler command
-+ CXXFLAGS C++ compiler flags
-+ CPP C preprocessor
-+
-+Use these variables to override the choices made by `configure' or to help
-+it to find libraries and programs with nonstandard names/locations.
-+
-+_ACEOF
-+fi
-+
-+if test "$ac_init_help" = "recursive"; then
-+ # If there are subdirs, report their specific --help.
-+ ac_popdir=`pwd`
-+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-+ test -d $ac_dir || continue
-+ ac_builddir=.
-+
-+if test "$ac_dir" != .; then
-+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-+ # A "../" for each directory in $ac_dir_suffix.
-+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-+else
-+ ac_dir_suffix= ac_top_builddir=
-+fi
-+
-+case $srcdir in
-+ .) # No --srcdir option. We are building in place.
-+ ac_srcdir=.
-+ if test -z "$ac_top_builddir"; then
-+ ac_top_srcdir=.
-+ else
-+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-+ fi ;;
-+ [\\/]* | ?:[\\/]* ) # Absolute path.
-+ ac_srcdir=$srcdir$ac_dir_suffix;
-+ ac_top_srcdir=$srcdir ;;
-+ *) # Relative path.
-+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
-+esac
-+
-+# Do not use `cd foo && pwd` to compute absolute paths, because
-+# the directories may not exist.
-+case `pwd` in
-+.) ac_abs_builddir="$ac_dir";;
-+*)
-+ case "$ac_dir" in
-+ .) ac_abs_builddir=`pwd`;;
-+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
-+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
-+ esac;;
-+esac
-+case $ac_abs_builddir in
-+.) ac_abs_top_builddir=${ac_top_builddir}.;;
-+*)
-+ case ${ac_top_builddir}. in
-+ .) ac_abs_top_builddir=$ac_abs_builddir;;
-+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
-+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
-+ esac;;
-+esac
-+case $ac_abs_builddir in
-+.) ac_abs_srcdir=$ac_srcdir;;
-+*)
-+ case $ac_srcdir in
-+ .) ac_abs_srcdir=$ac_abs_builddir;;
-+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
-+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
-+ esac;;
-+esac
-+case $ac_abs_builddir in
-+.) ac_abs_top_srcdir=$ac_top_srcdir;;
-+*)
-+ case $ac_top_srcdir in
-+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
-+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
-+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
-+ esac;;
-+esac
-+
-+ cd $ac_dir
-+ # Check for guested configure; otherwise get Cygnus style configure.
-+ if test -f $ac_srcdir/configure.gnu; then
-+ echo
-+ $SHELL $ac_srcdir/configure.gnu --help=recursive
-+ elif test -f $ac_srcdir/configure; then
-+ echo
-+ $SHELL $ac_srcdir/configure --help=recursive
-+ elif test -f $ac_srcdir/configure.ac ||
-+ test -f $ac_srcdir/configure.in; then
-+ echo
-+ $ac_configure --help
-+ else
-+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-+ fi
-+ cd "$ac_popdir"
-+ done
-+fi
-+
-+test -n "$ac_init_help" && exit 0
-+if $ac_init_version; then
-+ cat <<\_ACEOF
-+
-+Copyright (C) 2003 Free Software Foundation, Inc.
-+This configure script is free software; the Free Software Foundation
-+gives unlimited permission to copy, distribute and modify it.
-+_ACEOF
-+ exit 0
-+fi
-+exec 5>config.log
-+cat >&5 <<_ACEOF
-+This file contains any messages produced by compilers while
-+running configure, to aid debugging if configure makes a mistake.
-+
-+It was created by $as_me, which was
-+generated by GNU Autoconf 2.59. Invocation command line was
-+
-+ $ $0 $@
-+
-+_ACEOF
-+{
-+cat <<_ASUNAME
-+## --------- ##
-+## Platform. ##
-+## --------- ##
-+
-+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-+uname -m = `(uname -m) 2>/dev/null || echo unknown`
-+uname -r = `(uname -r) 2>/dev/null || echo unknown`
-+uname -s = `(uname -s) 2>/dev/null || echo unknown`
-+uname -v = `(uname -v) 2>/dev/null || echo unknown`
-+
-+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
-+
-+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
-+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
-+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
-+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
-+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
-+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
-+
-+_ASUNAME
-+
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ echo "PATH: $as_dir"
-+done
-+
-+} >&5
-+
-+cat >&5 <<_ACEOF
-+
-+
-+## ----------- ##
-+## Core tests. ##
-+## ----------- ##
-+
-+_ACEOF
-+
-+
-+# Keep a trace of the command line.
-+# Strip out --no-create and --no-recursion so they do not pile up.
-+# Strip out --silent because we don't want to record it for future runs.
-+# Also quote any args containing shell meta-characters.
-+# Make two passes to allow for proper duplicate-argument suppression.
-+ac_configure_args=
-+ac_configure_args0=
-+ac_configure_args1=
-+ac_sep=
-+ac_must_keep_next=false
-+for ac_pass in 1 2
-+do
-+ for ac_arg
-+ do
-+ case $ac_arg in
-+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-+ | -silent | --silent | --silen | --sile | --sil)
-+ continue ;;
-+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
-+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-+ esac
-+ case $ac_pass in
-+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
-+ 2)
-+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
-+ if test $ac_must_keep_next = true; then
-+ ac_must_keep_next=false # Got value, back to normal.
-+ else
-+ case $ac_arg in
-+ *=* | --config-cache | -C | -disable-* | --disable-* \
-+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-+ | -with-* | --with-* | -without-* | --without-* | --x)
-+ case "$ac_configure_args0 " in
-+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-+ esac
-+ ;;
-+ -* ) ac_must_keep_next=true ;;
-+ esac
-+ fi
-+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
-+ # Get rid of the leading space.
-+ ac_sep=" "
-+ ;;
-+ esac
-+ done
-+done
-+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-+
-+# When interrupted or exit'd, cleanup temporary files, and complete
-+# config.log. We remove comments because anyway the quotes in there
-+# would cause problems or look ugly.
-+# WARNING: Be sure not to use single quotes in there, as some shells,
-+# such as our DU 5.0 friend, will then `close' the trap.
-+trap 'exit_status=$?
-+ # Save into config.log some information that might help in debugging.
-+ {
-+ echo
-+
-+ cat <<\_ASBOX
-+## ---------------- ##
-+## Cache variables. ##
-+## ---------------- ##
-+_ASBOX
-+ echo
-+ # The following way of writing the cache mishandles newlines in values,
-+{
-+ (set) 2>&1 |
-+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
-+ *ac_space=\ *)
-+ sed -n \
-+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
-+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
-+ ;;
-+ *)
-+ sed -n \
-+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
-+ ;;
-+ esac;
-+}
-+ echo
-+
-+ cat <<\_ASBOX
-+## ----------------- ##
-+## Output variables. ##
-+## ----------------- ##
-+_ASBOX
-+ echo
-+ for ac_var in $ac_subst_vars
-+ do
-+ eval ac_val=$`echo $ac_var`
-+ echo "$ac_var='"'"'$ac_val'"'"'"
-+ done | sort
-+ echo
-+
-+ if test -n "$ac_subst_files"; then
-+ cat <<\_ASBOX
-+## ------------- ##
-+## Output files. ##
-+## ------------- ##
-+_ASBOX
-+ echo
-+ for ac_var in $ac_subst_files
-+ do
-+ eval ac_val=$`echo $ac_var`
-+ echo "$ac_var='"'"'$ac_val'"'"'"
-+ done | sort
-+ echo
-+ fi
-+
-+ if test -s confdefs.h; then
-+ cat <<\_ASBOX
-+## ----------- ##
-+## confdefs.h. ##
-+## ----------- ##
-+_ASBOX
-+ echo
-+ sed "/^$/d" confdefs.h | sort
-+ echo
-+ fi
-+ test "$ac_signal" != 0 &&
-+ echo "$as_me: caught signal $ac_signal"
-+ echo "$as_me: exit $exit_status"
-+ } >&5
-+ rm -f core *.core &&
-+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
-+ exit $exit_status
-+ ' 0
-+for ac_signal in 1 2 13 15; do
-+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-+done
-+ac_signal=0
-
-+# confdefs.h avoids OS command line length limits that DEFS can exceed.
-+rm -rf conftest* confdefs.h
-+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-+echo >confdefs.h
-+
-+# Predefined preprocessor variables.
-+
-+cat >>confdefs.h <<_ACEOF
-+#define PACKAGE_NAME "$PACKAGE_NAME"
-+_ACEOF
-+
-+
-+cat >>confdefs.h <<_ACEOF
-+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-+_ACEOF
-+
-+
-+cat >>confdefs.h <<_ACEOF
-+#define PACKAGE_VERSION "$PACKAGE_VERSION"
-+_ACEOF
-+
-+
-+cat >>confdefs.h <<_ACEOF
-+#define PACKAGE_STRING "$PACKAGE_STRING"
-+_ACEOF
-+
-+
-+cat >>confdefs.h <<_ACEOF
-+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-+_ACEOF
-+
-+
-+# Let the site file select an alternate cache file if it wants to.
- # Prefer explicitly selected file to automatically selected ones.
- if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
-@@ -502,39 +1222,103 @@
- fi
- for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
-- echo "loading site script $ac_site_file"
-+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-+echo "$as_me: loading site script $ac_site_file" >&6;}
-+ sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
- fi
- done
-
- if test -r "$cache_file"; then
-- echo "loading cache $cache_file"
-- . $cache_file
-+ # Some versions of bash will fail to source /dev/null (special
-+ # files actually), so we avoid doing that.
-+ if test -f "$cache_file"; then
-+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-+echo "$as_me: loading cache $cache_file" >&6;}
-+ case $cache_file in
-+ [\\/]* | ?:[\\/]* ) . $cache_file;;
-+ *) . ./$cache_file;;
-+ esac
-+ fi
- else
-- echo "creating cache $cache_file"
-- > $cache_file
-+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-+echo "$as_me: creating cache $cache_file" >&6;}
-+ >$cache_file
-+fi
-+
-+# Check that the precious variables saved in the cache have kept the same
-+# value.
-+ac_cache_corrupted=false
-+for ac_var in `(set) 2>&1 |
-+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
-+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
-+ eval ac_new_set=\$ac_env_${ac_var}_set
-+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
-+ eval ac_new_val="\$ac_env_${ac_var}_value"
-+ case $ac_old_set,$ac_new_set in
-+ set,)
-+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-+ ac_cache_corrupted=: ;;
-+ ,set)
-+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-+ ac_cache_corrupted=: ;;
-+ ,);;
-+ *)
-+ if test "x$ac_old_val" != "x$ac_new_val"; then
-+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
-+echo "$as_me: former value: $ac_old_val" >&2;}
-+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
-+echo "$as_me: current value: $ac_new_val" >&2;}
-+ ac_cache_corrupted=:
-+ fi;;
-+ esac
-+ # Pass precious variables to config.status.
-+ if test "$ac_new_set" = set; then
-+ case $ac_new_val in
-+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
-+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-+ *) ac_arg=$ac_var=$ac_new_val ;;
-+ esac
-+ case " $ac_configure_args " in
-+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
-+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-+ esac
-+ fi
-+done
-+if $ac_cache_corrupted; then
-+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
-+ { (exit 1); exit 1; }; }
- fi
-
- ac_ext=c
--# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
- ac_cpp='$CPP $CPPFLAGS'
--ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
--ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
--cross_compiling=$ac_cv_prog_cc_cross
--
--ac_exeext=
--ac_objext=o
--if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
-- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
-- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
-- ac_n= ac_c='
--' ac_t=' '
-- else
-- ac_n=-n ac_c= ac_t=
-- fi
--else
-- ac_n= ac_c='\c' ac_t=
--fi
-+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-+ac_compiler_gnu=$ac_cv_c_compiler_gnu
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-
-
- ac_aux_dir=
-@@ -547,14 +1331,20 @@
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
-+ elif test -f $ac_dir/shtool; then
-+ ac_aux_dir=$ac_dir
-+ ac_install_sh="$ac_aux_dir/shtool install -c"
-+ break
- fi
- done
- if test -z "$ac_aux_dir"; then
-- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
--fi
--ac_config_guess=$ac_aux_dir/config.guess
--ac_config_sub=$ac_aux_dir/config.sub
--ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
-+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
-+ { (exit 1); exit 1; }; }
-+fi
-+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
-
- # Find a good install program. We prefer a C program (faster),
- # so one script is as good as another. But avoid the broken or
-@@ -563,65 +1353,80 @@
- # SunOS /usr/etc/install
- # IRIX /sbin/install
- # AIX /bin/install
-+# AmigaOS /C/install, which installs bootblocks on floppy discs
- # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
- # AFS /usr/afsws/bin/install, which mishandles nonexistent args
- # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-+# OS/2's system install, which has a completely different semantic
- # ./install, which can be erroneously created by make from ./install.sh.
--echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
--echo "configure:572: checking for a BSD compatible install" >&5
-+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
- if test -z "$INSTALL"; then
--if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+if test "${ac_cv_path_install+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
-- for ac_dir in $PATH; do
-- # Account for people who put trailing slashes in PATH elements.
-- case "$ac_dir/" in
-- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
-- *)
-- # OSF1 and SCO ODT 3.0 have their own names for install.
-- # Don't use installbsd from OSF since it installs stuff as root
-- # by default.
-- for ac_prog in ginstall scoinst install; do
-- if test -f $ac_dir/$ac_prog; then
-+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ # Account for people who put trailing slashes in PATH elements.
-+case $as_dir/ in
-+ ./ | .// | /cC/* | \
-+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
-+ /usr/ucb/* ) ;;
-+ *)
-+ # OSF1 and SCO ODT 3.0 have their own names for install.
-+ # Don't use installbsd from OSF since it installs stuff as root
-+ # by default.
-+ for ac_prog in ginstall scoinst install; do
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
- if test $ac_prog = install &&
-- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
-+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
-+ elif test $ac_prog = install &&
-+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-+ # program-specific install script used by HP pwplus--don't use.
-+ :
- else
-- ac_cv_path_install="$ac_dir/$ac_prog -c"
-- break 2
-+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-+ break 3
- fi
- fi
- done
-- ;;
-- esac
-- done
-- IFS="$ac_save_IFS"
-+ done
-+ ;;
-+esac
-+done
-+
-
- fi
- if test "${ac_cv_path_install+set}" = set; then
-- INSTALL="$ac_cv_path_install"
-+ INSTALL=$ac_cv_path_install
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
-- INSTALL="$ac_install_sh"
-+ INSTALL=$ac_install_sh
- fi
- fi
--echo "$ac_t""$INSTALL" 1>&6
-+echo "$as_me:$LINENO: result: $INSTALL" >&5
-+echo "${ECHO_T}$INSTALL" >&6
-
- # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
- # It thinks the first close brace ends the variable substitution.
- test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
--test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
- test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
--echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
--echo "configure:625: checking whether build environment is sane" >&5
-+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
-+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
- # Just in case
- sleep 1
- echo timestamp > conftestfile
-@@ -643,8 +1448,11 @@
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
-- { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
--alias in your environment" 1>&2; exit 1; }
-+ { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
-+alias in your environment" >&5
-+echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
-+alias in your environment" >&2;}
-+ { (exit 1); exit 1; }; }
- fi
-
- test "$2" = conftestfile
-@@ -653,54 +1461,54 @@
- # Ok.
- :
- else
-- { echo "configure: error: newly created file is older than distributed files!
--Check your system clock" 1>&2; exit 1; }
-+ { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
-+Check your system clock" >&5
-+echo "$as_me: error: newly created file is older than distributed files!
-+Check your system clock" >&2;}
-+ { (exit 1); exit 1; }; }
- fi
- rm -f conftest*
--echo "$ac_t""yes" 1>&6
--if test "$program_transform_name" = s,x,x,; then
-- program_transform_name=
--else
-- # Double any \ or $. echo might interpret backslashes.
-- cat <<\EOF_SED > conftestsed
--s,\\,\\\\,g; s,\$,$$,g
--EOF_SED
-- program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
-- rm -f conftestsed
--fi
-+echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
- test "$program_prefix" != NONE &&
-- program_transform_name="s,^,${program_prefix},; $program_transform_name"
-+ program_transform_name="s,^,$program_prefix,;$program_transform_name"
- # Use a double $ so make ignores it.
- test "$program_suffix" != NONE &&
-- program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
--
--# sed with no file args requires a program.
--test "$program_transform_name" = "" && program_transform_name="s,x,x,"
--
--echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
--echo "configure:682: checking whether ${MAKE-make} sets \${MAKE}" >&5
--set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ program_transform_name="s,\$,$program_suffix,;$program_transform_name"
-+# Double any \ or $. echo might interpret backslashes.
-+# By default was `s,x,x', remove it if useless.
-+cat <<\_ACEOF >conftest.sed
-+s/[\\$]/&&/g;s/;s,x,x,$//
-+_ACEOF
-+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
-+rm conftest.sed
-+
-+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
-+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
-+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- cat > conftestmake <<\EOF
-+ cat >conftest.make <<\_ACEOF
- all:
-- @echo 'ac_maketemp="${MAKE}"'
--EOF
-+ @echo 'ac_maketemp="$(MAKE)"'
-+_ACEOF
- # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
--eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
- if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
- else
- eval ac_cv_prog_make_${ac_make}_set=no
- fi
--rm -f conftestmake
-+rm -f conftest.make
- fi
- if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
- SET_MAKE=
- else
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- SET_MAKE="MAKE=${MAKE-make}"
- fi
-
-@@ -710,75 +1518,87 @@
- VERSION=0.65.0
-
- if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
-- { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
-+ { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
-+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
-+ { (exit 1); exit 1; }; }
- fi
-
-
-
- missing_dir=`cd $ac_aux_dir && pwd`
--echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
--echo "configure:721: checking for working aclocal" >&5
-+echo "$as_me:$LINENO: checking for working aclocal" >&5
-+echo $ECHO_N "checking for working aclocal... $ECHO_C" >&6
- # Run test in a subshell; some versions of sh will print an error if
- # an executable is not found, even if stderr is redirected.
- # Redirect stdin to placate older versions of autoconf. Sigh.
- if (aclocal --version) < /dev/null > /dev/null 2>&1; then
- ACLOCAL=aclocal
-- echo "$ac_t""found" 1>&6
-+ echo "$as_me:$LINENO: result: found" >&5
-+echo "${ECHO_T}found" >&6
- else
- ACLOCAL="$missing_dir/missing aclocal"
-- echo "$ac_t""missing" 1>&6
-+ echo "$as_me:$LINENO: result: missing" >&5
-+echo "${ECHO_T}missing" >&6
- fi
-
--echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
--echo "configure:734: checking for working autoconf" >&5
-+echo "$as_me:$LINENO: checking for working autoconf" >&5
-+echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6
- # Run test in a subshell; some versions of sh will print an error if
- # an executable is not found, even if stderr is redirected.
- # Redirect stdin to placate older versions of autoconf. Sigh.
- if (autoconf --version) < /dev/null > /dev/null 2>&1; then
- AUTOCONF=autoconf
-- echo "$ac_t""found" 1>&6
-+ echo "$as_me:$LINENO: result: found" >&5
-+echo "${ECHO_T}found" >&6
- else
- AUTOCONF="$missing_dir/missing autoconf"
-- echo "$ac_t""missing" 1>&6
-+ echo "$as_me:$LINENO: result: missing" >&5
-+echo "${ECHO_T}missing" >&6
- fi
-
--echo $ac_n "checking for working automake""... $ac_c" 1>&6
--echo "configure:747: checking for working automake" >&5
-+echo "$as_me:$LINENO: checking for working automake" >&5
-+echo $ECHO_N "checking for working automake... $ECHO_C" >&6
- # Run test in a subshell; some versions of sh will print an error if
- # an executable is not found, even if stderr is redirected.
- # Redirect stdin to placate older versions of autoconf. Sigh.
- if (automake --version) < /dev/null > /dev/null 2>&1; then
- AUTOMAKE=automake
-- echo "$ac_t""found" 1>&6
-+ echo "$as_me:$LINENO: result: found" >&5
-+echo "${ECHO_T}found" >&6
- else
- AUTOMAKE="$missing_dir/missing automake"
-- echo "$ac_t""missing" 1>&6
-+ echo "$as_me:$LINENO: result: missing" >&5
-+echo "${ECHO_T}missing" >&6
- fi
-
--echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
--echo "configure:760: checking for working autoheader" >&5
-+echo "$as_me:$LINENO: checking for working autoheader" >&5
-+echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6
- # Run test in a subshell; some versions of sh will print an error if
- # an executable is not found, even if stderr is redirected.
- # Redirect stdin to placate older versions of autoconf. Sigh.
- if (autoheader --version) < /dev/null > /dev/null 2>&1; then
- AUTOHEADER=autoheader
-- echo "$ac_t""found" 1>&6
-+ echo "$as_me:$LINENO: result: found" >&5
-+echo "${ECHO_T}found" >&6
- else
- AUTOHEADER="$missing_dir/missing autoheader"
-- echo "$ac_t""missing" 1>&6
-+ echo "$as_me:$LINENO: result: missing" >&5
-+echo "${ECHO_T}missing" >&6
- fi
-
--echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
--echo "configure:773: checking for working makeinfo" >&5
-+echo "$as_me:$LINENO: checking for working makeinfo" >&5
-+echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6
- # Run test in a subshell; some versions of sh will print an error if
- # an executable is not found, even if stderr is redirected.
- # Redirect stdin to placate older versions of autoconf. Sigh.
- if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
- MAKEINFO=makeinfo
-- echo "$ac_t""found" 1>&6
-+ echo "$as_me:$LINENO: result: found" >&5
-+echo "${ECHO_T}found" >&6
- else
- MAKEINFO="$missing_dir/missing makeinfo"
-- echo "$ac_t""missing" 1>&6
-+ echo "$as_me:$LINENO: result: missing" >&5
-+echo "${ECHO_T}missing" >&6
- fi
-
-
-@@ -786,214 +1606,657 @@
- test x$prefix = "xNONE" && prefix="$ac_default_prefix"
-
-
--# Extract the first word of "gcc", so it can be a program name with args.
--set dummy gcc; ac_word=$2
--echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
--echo "configure:793: checking for $ac_word" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ac_ext=c
-+ac_cpp='$CPP $CPPFLAGS'
-+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-+ac_compiler_gnu=$ac_cv_c_compiler_gnu
-+if test -n "$ac_tool_prefix"; then
-+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-+set dummy ${ac_tool_prefix}gcc; ac_word=$2
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_CC+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
- else
-- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
-- ac_dummy="$PATH"
-- for ac_dir in $ac_dummy; do
-- test -z "$ac_dir" && ac_dir=.
-- if test -f $ac_dir/$ac_word; then
-- ac_cv_prog_CC="gcc"
-- break
-- fi
-- done
-- IFS="$ac_save_ifs"
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
-+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+ break 2
-+ fi
-+done
-+done
-+
- fi
- fi
--CC="$ac_cv_prog_CC"
-+CC=$ac_cv_prog_CC
- if test -n "$CC"; then
-- echo "$ac_t""$CC" 1>&6
-+ echo "$as_me:$LINENO: result: $CC" >&5
-+echo "${ECHO_T}$CC" >&6
- else
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- fi
-
--if test -z "$CC"; then
-- # Extract the first word of "cc", so it can be a program name with args.
--set dummy cc; ac_word=$2
--echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
--echo "configure:823: checking for $ac_word" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+fi
-+if test -z "$ac_cv_prog_CC"; then
-+ ac_ct_CC=$CC
-+ # Extract the first word of "gcc", so it can be a program name with args.
-+set dummy gcc; ac_word=$2
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- if test -n "$CC"; then
-- ac_cv_prog_CC="$CC" # Let the user override the test.
-+ if test -n "$ac_ct_CC"; then
-+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
- else
-- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
-- ac_prog_rejected=no
-- ac_dummy="$PATH"
-- for ac_dir in $ac_dummy; do
-- test -z "$ac_dir" && ac_dir=.
-- if test -f $ac_dir/$ac_word; then
-- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
-- ac_prog_rejected=yes
-- continue
-- fi
-- ac_cv_prog_CC="cc"
-- break
-- fi
-- done
-- IFS="$ac_save_ifs"
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+ ac_cv_prog_ac_ct_CC="gcc"
-+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+ break 2
-+ fi
-+done
-+done
-+
-+fi
-+fi
-+ac_ct_CC=$ac_cv_prog_ac_ct_CC
-+if test -n "$ac_ct_CC"; then
-+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-+echo "${ECHO_T}$ac_ct_CC" >&6
-+else
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
-+fi
-+
-+ CC=$ac_ct_CC
-+else
-+ CC="$ac_cv_prog_CC"
-+fi
-+
-+if test -z "$CC"; then
-+ if test -n "$ac_tool_prefix"; then
-+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-+set dummy ${ac_tool_prefix}cc; ac_word=$2
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_CC+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ if test -n "$CC"; then
-+ ac_cv_prog_CC="$CC" # Let the user override the test.
-+else
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+ ac_cv_prog_CC="${ac_tool_prefix}cc"
-+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+ break 2
-+ fi
-+done
-+done
-+
-+fi
-+fi
-+CC=$ac_cv_prog_CC
-+if test -n "$CC"; then
-+ echo "$as_me:$LINENO: result: $CC" >&5
-+echo "${ECHO_T}$CC" >&6
-+else
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
-+fi
-+
-+fi
-+if test -z "$ac_cv_prog_CC"; then
-+ ac_ct_CC=$CC
-+ # Extract the first word of "cc", so it can be a program name with args.
-+set dummy cc; ac_word=$2
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ if test -n "$ac_ct_CC"; then
-+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-+else
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+ ac_cv_prog_ac_ct_CC="cc"
-+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+ break 2
-+ fi
-+done
-+done
-+
-+fi
-+fi
-+ac_ct_CC=$ac_cv_prog_ac_ct_CC
-+if test -n "$ac_ct_CC"; then
-+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-+echo "${ECHO_T}$ac_ct_CC" >&6
-+else
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
-+fi
-+
-+ CC=$ac_ct_CC
-+else
-+ CC="$ac_cv_prog_CC"
-+fi
-+
-+fi
-+if test -z "$CC"; then
-+ # Extract the first word of "cc", so it can be a program name with args.
-+set dummy cc; ac_word=$2
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_CC+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ if test -n "$CC"; then
-+ ac_cv_prog_CC="$CC" # Let the user override the test.
-+else
-+ ac_prog_rejected=no
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-+ ac_prog_rejected=yes
-+ continue
-+ fi
-+ ac_cv_prog_CC="cc"
-+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+ break 2
-+ fi
-+done
-+done
-+
- if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
-- if test $# -gt 0; then
-+ if test $# != 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
-- set dummy "$ac_dir/$ac_word" "$@"
-- shift
-- ac_cv_prog_CC="$@"
-+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
- fi
- fi
- fi
- fi
--CC="$ac_cv_prog_CC"
-+CC=$ac_cv_prog_CC
- if test -n "$CC"; then
-- echo "$ac_t""$CC" 1>&6
-+ echo "$as_me:$LINENO: result: $CC" >&5
-+echo "${ECHO_T}$CC" >&6
- else
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- fi
-
-- if test -z "$CC"; then
-- case "`uname -s`" in
-- *win32* | *WIN32*)
-- # Extract the first word of "cl", so it can be a program name with args.
--set dummy cl; ac_word=$2
--echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
--echo "configure:874: checking for $ac_word" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+fi
-+if test -z "$CC"; then
-+ if test -n "$ac_tool_prefix"; then
-+ for ac_prog in cl
-+ do
-+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_CC+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
- else
-- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
-- ac_dummy="$PATH"
-- for ac_dir in $ac_dummy; do
-- test -z "$ac_dir" && ac_dir=.
-- if test -f $ac_dir/$ac_word; then
-- ac_cv_prog_CC="cl"
-- break
-- fi
-- done
-- IFS="$ac_save_ifs"
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+ break 2
-+ fi
-+done
-+done
-+
- fi
- fi
--CC="$ac_cv_prog_CC"
-+CC=$ac_cv_prog_CC
- if test -n "$CC"; then
-- echo "$ac_t""$CC" 1>&6
-+ echo "$as_me:$LINENO: result: $CC" >&5
-+echo "${ECHO_T}$CC" >&6
- else
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- fi
-- ;;
-- esac
-+
-+ test -n "$CC" && break
-+ done
-+fi
-+if test -z "$CC"; then
-+ ac_ct_CC=$CC
-+ for ac_prog in cl
-+do
-+ # Extract the first word of "$ac_prog", so it can be a program name with args.
-+set dummy $ac_prog; ac_word=$2
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ if test -n "$ac_ct_CC"; then
-+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-+else
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+ ac_cv_prog_ac_ct_CC="$ac_prog"
-+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+ break 2
- fi
-- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-+done
-+done
-+
-+fi
-+fi
-+ac_ct_CC=$ac_cv_prog_ac_ct_CC
-+if test -n "$ac_ct_CC"; then
-+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-+echo "${ECHO_T}$ac_ct_CC" >&6
-+else
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- fi
-
--echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
--echo "configure:906: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-+ test -n "$ac_ct_CC" && break
-+done
-
--ac_ext=c
--# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
--ac_cpp='$CPP $CPPFLAGS'
--ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
--ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
--cross_compiling=$ac_cv_prog_cc_cross
-+ CC=$ac_ct_CC
-+fi
-
--cat > conftest.$ac_ext << EOF
-+fi
-
--#line 917 "configure"
--#include "confdefs.h"
-
--main(){return(0);}
--EOF
--if { (eval echo configure:922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- ac_cv_prog_cc_works=yes
-- # If we can't run a trivial program, we are probably using a cross compiler.
-- if (./conftest; exit) 2>/dev/null; then
-- ac_cv_prog_cc_cross=no
-- else
-- ac_cv_prog_cc_cross=yes
-- fi
-+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-+See \`config.log' for more details." >&5
-+echo "$as_me: error: no acceptable C compiler found in \$PATH
-+See \`config.log' for more details." >&2;}
-+ { (exit 1); exit 1; }; }
-+
-+# Provide some information about the compiler.
-+echo "$as_me:$LINENO:" \
-+ "checking for C compiler version" >&5
-+ac_compiler=`set X $ac_compile; echo $2`
-+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
-+ (eval $ac_compiler --version </dev/null >&5) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }
-+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
-+ (eval $ac_compiler -v </dev/null >&5) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }
-+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
-+ (eval $ac_compiler -V </dev/null >&5) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }
-+
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+int
-+main ()
-+{
-+
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+ac_clean_files_save=$ac_clean_files
-+ac_clean_files="$ac_clean_files a.out a.exe b.out"
-+# Try to create an executable without -o first, disregard a.out.
-+# It will help us diagnose broken compilers, and finding out an intuition
-+# of exeext.
-+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
-+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
-+ (eval $ac_link_default) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; then
-+ # Find the output, starting from the most likely. This scheme is
-+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-+# resort.
-+
-+# Be careful to initialize this variable, since it used to be cached.
-+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-+ac_cv_exeext=
-+# b.out is created by i960 compilers.
-+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
-+do
-+ test -f "$ac_file" || continue
-+ case $ac_file in
-+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
-+ ;;
-+ conftest.$ac_ext )
-+ # This is the source file.
-+ ;;
-+ [ab].out )
-+ # We found the default executable, but exeext='' is most
-+ # certainly right.
-+ break;;
-+ *.* )
-+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-+ # FIXME: I believe we export ac_cv_exeext for Libtool,
-+ # but it would be cool to find out if it's true. Does anybody
-+ # maintain Libtool? --akim.
-+ export ac_cv_exeext
-+ break;;
-+ * )
-+ break;;
-+ esac
-+done
- else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- ac_cv_prog_cc_works=no
--fi
--rm -fr conftest*
--ac_ext=c
--# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
--ac_cpp='$CPP $CPPFLAGS'
--ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
--ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
--cross_compiling=$ac_cv_prog_cc_cross
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-
--echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
--if test $ac_cv_prog_cc_works = no; then
-- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-+See \`config.log' for more details." >&5
-+echo "$as_me: error: C compiler cannot create executables
-+See \`config.log' for more details." >&2;}
-+ { (exit 77); exit 77; }; }
-+fi
-+
-+ac_exeext=$ac_cv_exeext
-+echo "$as_me:$LINENO: result: $ac_file" >&5
-+echo "${ECHO_T}$ac_file" >&6
-+
-+# Check the compiler produces executables we can run. If not, either
-+# the compiler is broken, or we cross compile.
-+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
-+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-+# If not cross compiling, check that we can run a simple program.
-+if test "$cross_compiling" != yes; then
-+ if { ac_try='./$ac_file'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ cross_compiling=no
-+ else
-+ if test "$cross_compiling" = maybe; then
-+ cross_compiling=yes
-+ else
-+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-+If you meant to cross compile, use \`--host'.
-+See \`config.log' for more details." >&5
-+echo "$as_me: error: cannot run C compiled programs.
-+If you meant to cross compile, use \`--host'.
-+See \`config.log' for more details." >&2;}
-+ { (exit 1); exit 1; }; }
-+ fi
-+ fi
- fi
--echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
--echo "configure:948: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
--echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
--cross_compiling=$ac_cv_prog_cc_cross
-+echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
-
--echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
--echo "configure:953: checking whether we are using GNU C" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+rm -f a.out a.exe conftest$ac_cv_exeext b.out
-+ac_clean_files=$ac_clean_files_save
-+# Check the compiler produces executables we can run. If not, either
-+# the compiler is broken, or we cross compile.
-+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-+echo "$as_me:$LINENO: result: $cross_compiling" >&5
-+echo "${ECHO_T}$cross_compiling" >&6
-+
-+echo "$as_me:$LINENO: checking for suffix of executables" >&5
-+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; then
-+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
-+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-+# work properly (i.e., refer to `conftest.exe'), while it won't with
-+# `rm'.
-+for ac_file in conftest.exe conftest conftest.*; do
-+ test -f "$ac_file" || continue
-+ case $ac_file in
-+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
-+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-+ export ac_cv_exeext
-+ break;;
-+ * ) break;;
-+ esac
-+done
- else
-- cat > conftest.c <<EOF
--#ifdef __GNUC__
-- yes;
--#endif
--EOF
--if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:962: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
-- ac_cv_prog_gcc=yes
-+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-+See \`config.log' for more details." >&5
-+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-+See \`config.log' for more details." >&2;}
-+ { (exit 1); exit 1; }; }
-+fi
-+
-+rm -f conftest$ac_cv_exeext
-+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-+echo "${ECHO_T}$ac_cv_exeext" >&6
-+
-+rm -f conftest.$ac_ext
-+EXEEXT=$ac_cv_exeext
-+ac_exeext=$EXEEXT
-+echo "$as_me:$LINENO: checking for suffix of object files" >&5
-+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
-+if test "${ac_cv_objext+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+int
-+main ()
-+{
-+
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.o conftest.obj
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; then
-+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
-+ case $ac_file in
-+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
-+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
-+ break;;
-+ esac
-+done
- else
-- ac_cv_prog_gcc=no
--fi
--fi
--
--echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-
--if test $ac_cv_prog_gcc = yes; then
-- GCC=yes
--else
-- GCC=
--fi
-+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-+See \`config.log' for more details." >&5
-+echo "$as_me: error: cannot compute suffix of object files: cannot compile
-+See \`config.log' for more details." >&2;}
-+ { (exit 1); exit 1; }; }
-+fi
-+
-+rm -f conftest.$ac_cv_objext conftest.$ac_ext
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-+echo "${ECHO_T}$ac_cv_objext" >&6
-+OBJEXT=$ac_cv_objext
-+ac_objext=$OBJEXT
-+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
-+if test "${ac_cv_c_compiler_gnu+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+int
-+main ()
-+{
-+#ifndef __GNUC__
-+ choke me
-+#endif
-
--ac_test_CFLAGS="${CFLAGS+set}"
--ac_save_CFLAGS="$CFLAGS"
--CFLAGS=
--echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
--echo "configure:981: checking whether ${CC-cc} accepts -g" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- echo 'void f(){}' > conftest.c
--if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_compiler_gnu=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_compiler_gnu=no
-+fi
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-+ac_cv_c_compiler_gnu=$ac_compiler_gnu
-+
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
-+GCC=`test $ac_compiler_gnu = yes && echo yes`
-+ac_test_CFLAGS=${CFLAGS+set}
-+ac_save_CFLAGS=$CFLAGS
-+CFLAGS="-g"
-+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
-+if test "${ac_cv_prog_cc_g+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+int
-+main ()
-+{
-+
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
- ac_cv_prog_cc_g=yes
- else
-- ac_cv_prog_cc_g=no
--fi
--rm -f conftest*
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-
-+ac_cv_prog_cc_g=no
- fi
--
--echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
- if test "$ac_test_CFLAGS" = set; then
-- CFLAGS="$ac_save_CFLAGS"
-+ CFLAGS=$ac_save_CFLAGS
- elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
-@@ -1007,136 +2270,494 @@
- CFLAGS=
- fi
- fi
--
--for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
-+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-+if test "${ac_cv_prog_cc_stdc+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ ac_cv_prog_cc_stdc=no
-+ac_save_CC=$CC
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <stdarg.h>
-+#include <stdio.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-+struct buf { int x; };
-+FILE * (*rcsopen) (struct buf *, struct stat *, int);
-+static char *e (p, i)
-+ char **p;
-+ int i;
-+{
-+ return p[i];
-+}
-+static char *f (char * (*g) (char **, int), char **p, ...)
-+{
-+ char *s;
-+ va_list v;
-+ va_start (v,p);
-+ s = g (p, va_arg (v,int));
-+ va_end (v);
-+ return s;
-+}
-+
-+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
-+ function prototypes and stuff, but not '\xHH' hex character constants.
-+ These don't provoke an error unfortunately, instead are silently treated
-+ as 'x'. The following induces an error, until -std1 is added to get
-+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
-+ array size at least. It's necessary to write '\x00'==0 to get something
-+ that's true only with -std1. */
-+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-+
-+int test (int i, double x);
-+struct s1 {int (*f) (int a);};
-+struct s2 {int (*f) (double a);};
-+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-+int argc;
-+char **argv;
-+int
-+main ()
-+{
-+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+# Don't try gcc -ansi; that turns off useful extensions and
-+# breaks some systems' header files.
-+# AIX -qlanglvl=ansi
-+# Ultrix and OSF/1 -std1
-+# HP-UX 10.20 and later -Ae
-+# HP-UX older versions -Aa -D_HPUX_SOURCE
-+# SVR4 -Xc -D__EXTENSIONS__
-+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
- do
--# Extract the first word of "$ac_prog", so it can be a program name with args.
--set dummy $ac_prog; ac_word=$2
--echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
--echo "configure:1017: checking for $ac_word" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ CC="$ac_save_CC $ac_arg"
-+ rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_prog_cc_stdc=$ac_arg
-+break
- else
-- if test -n "$CXX"; then
-- ac_cv_prog_CXX="$CXX" # Let the user override the test.
--else
-- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
-- ac_dummy="$PATH"
-- for ac_dir in $ac_dummy; do
-- test -z "$ac_dir" && ac_dir=.
-- if test -f $ac_dir/$ac_word; then
-- ac_cv_prog_CXX="$ac_prog"
-- break
-- fi
-- done
-- IFS="$ac_save_ifs"
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
- fi
-+rm -f conftest.err conftest.$ac_objext
-+done
-+rm -f conftest.$ac_ext conftest.$ac_objext
-+CC=$ac_save_CC
-+
- fi
--CXX="$ac_cv_prog_CXX"
--if test -n "$CXX"; then
-- echo "$ac_t""$CXX" 1>&6
-+
-+case "x$ac_cv_prog_cc_stdc" in
-+ x|xno)
-+ echo "$as_me:$LINENO: result: none needed" >&5
-+echo "${ECHO_T}none needed" >&6 ;;
-+ *)
-+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
-+ CC="$CC $ac_cv_prog_cc_stdc" ;;
-+esac
-+
-+# Some people use a C++ compiler to compile C. Since we use `exit',
-+# in C++ we need to declare it. In case someone uses the same compiler
-+# for both compiling C and C++ we need to have the C++ compiler decide
-+# the declaration of exit, since it's the most demanding environment.
-+cat >conftest.$ac_ext <<_ACEOF
-+#ifndef __cplusplus
-+ choke me
-+#endif
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ for ac_declaration in \
-+ '' \
-+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
-+ 'extern "C" void std::exit (int); using std::exit;' \
-+ 'extern "C" void exit (int) throw ();' \
-+ 'extern "C" void exit (int);' \
-+ 'void exit (int);'
-+do
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+$ac_declaration
-+#include <stdlib.h>
-+int
-+main ()
-+{
-+exit (42);
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ :
- else
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+continue
- fi
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+$ac_declaration
-+int
-+main ()
-+{
-+exit (42);
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ break
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-
--test -n "$CXX" && break
-+fi
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- done
--test -n "$CXX" || CXX="gcc"
-+rm -f conftest*
-+if test -n "$ac_declaration"; then
-+ echo '#ifdef __cplusplus' >>confdefs.h
-+ echo $ac_declaration >>confdefs.h
-+ echo '#endif' >>confdefs.h
-+fi
-
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-
--echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
--echo "configure:1049: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
-+fi
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-+ac_ext=c
-+ac_cpp='$CPP $CPPFLAGS'
-+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-+ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
--ac_ext=C
--# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-+ac_ext=cc
- ac_cpp='$CXXCPP $CPPFLAGS'
--ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
--ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
--cross_compiling=$ac_cv_prog_cxx_cross
--
--cat > conftest.$ac_ext << EOF
--
--#line 1060 "configure"
--#include "confdefs.h"
--
--int main(){return(0);}
--EOF
--if { (eval echo configure:1065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- ac_cv_prog_cxx_works=yes
-- # If we can't run a trivial program, we are probably using a cross compiler.
-- if (./conftest; exit) 2>/dev/null; then
-- ac_cv_prog_cxx_cross=no
-- else
-- ac_cv_prog_cxx_cross=yes
-+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-+if test -n "$ac_tool_prefix"; then
-+ for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
-+ do
-+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_CXX+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ if test -n "$CXX"; then
-+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
-+else
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
-+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+ break 2
- fi
-+done
-+done
-+
-+fi
-+fi
-+CXX=$ac_cv_prog_CXX
-+if test -n "$CXX"; then
-+ echo "$as_me:$LINENO: result: $CXX" >&5
-+echo "${ECHO_T}$CXX" >&6
- else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- ac_cv_prog_cxx_works=no
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- fi
--rm -fr conftest*
--ac_ext=c
--# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
--ac_cpp='$CPP $CPPFLAGS'
--ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
--ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
--cross_compiling=$ac_cv_prog_cc_cross
-
--echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6
--if test $ac_cv_prog_cxx_works = no; then
-- { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
-+ test -n "$CXX" && break
-+ done
- fi
--echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
--echo "configure:1091: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
--echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
--cross_compiling=$ac_cv_prog_cxx_cross
--
--echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
--echo "configure:1096: checking whether we are using GNU C++" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+if test -z "$CXX"; then
-+ ac_ct_CXX=$CXX
-+ for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
-+do
-+ # Extract the first word of "$ac_prog", so it can be a program name with args.
-+set dummy $ac_prog; ac_word=$2
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- cat > conftest.C <<EOF
--#ifdef __GNUC__
-- yes;
--#endif
--EOF
--if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1105: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
-- ac_cv_prog_gxx=yes
-+ if test -n "$ac_ct_CXX"; then
-+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
- else
-- ac_cv_prog_gxx=no
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+ ac_cv_prog_ac_ct_CXX="$ac_prog"
-+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+ break 2
-+ fi
-+done
-+done
-+
- fi
- fi
-+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
-+if test -n "$ac_ct_CXX"; then
-+ echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
-+echo "${ECHO_T}$ac_ct_CXX" >&6
-+else
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
-+fi
-
--echo "$ac_t""$ac_cv_prog_gxx" 1>&6
-+ test -n "$ac_ct_CXX" && break
-+done
-+test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
-
--if test $ac_cv_prog_gxx = yes; then
-- GXX=yes
--else
-- GXX=
-+ CXX=$ac_ct_CXX
- fi
-
--ac_test_CXXFLAGS="${CXXFLAGS+set}"
--ac_save_CXXFLAGS="$CXXFLAGS"
--CXXFLAGS=
--echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
--echo "configure:1124: checking whether ${CXX-g++} accepts -g" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- echo 'void f(){}' > conftest.cc
--if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
-+
-+# Provide some information about the compiler.
-+echo "$as_me:$LINENO:" \
-+ "checking for C++ compiler version" >&5
-+ac_compiler=`set X $ac_compile; echo $2`
-+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
-+ (eval $ac_compiler --version </dev/null >&5) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }
-+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
-+ (eval $ac_compiler -v </dev/null >&5) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }
-+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
-+ (eval $ac_compiler -V </dev/null >&5) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }
-+
-+echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
-+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
-+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+int
-+main ()
-+{
-+#ifndef __GNUC__
-+ choke me
-+#endif
-+
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_compiler_gnu=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_compiler_gnu=no
-+fi
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
-+
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
-+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
-+GXX=`test $ac_compiler_gnu = yes && echo yes`
-+ac_test_CXXFLAGS=${CXXFLAGS+set}
-+ac_save_CXXFLAGS=$CXXFLAGS
-+CXXFLAGS="-g"
-+echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
-+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
-+if test "${ac_cv_prog_cxx_g+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+int
-+main ()
-+{
-+
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
- ac_cv_prog_cxx_g=yes
- else
-- ac_cv_prog_cxx_g=no
--fi
--rm -f conftest*
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-
-+ac_cv_prog_cxx_g=no
- fi
--
--echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
-+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
- if test "$ac_test_CXXFLAGS" = set; then
-- CXXFLAGS="$ac_save_CXXFLAGS"
-+ CXXFLAGS=$ac_save_CXXFLAGS
- elif test $ac_cv_prog_cxx_g = yes; then
- if test "$GXX" = yes; then
- CXXFLAGS="-g -O2"
-@@ -1150,6 +2771,115 @@
- CXXFLAGS=
- fi
- fi
-+for ac_declaration in \
-+ '' \
-+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
-+ 'extern "C" void std::exit (int); using std::exit;' \
-+ 'extern "C" void exit (int) throw ();' \
-+ 'extern "C" void exit (int);' \
-+ 'void exit (int);'
-+do
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+$ac_declaration
-+#include <stdlib.h>
-+int
-+main ()
-+{
-+exit (42);
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ :
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+continue
-+fi
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+$ac_declaration
-+int
-+main ()
-+{
-+exit (42);
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ break
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+fi
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-+done
-+rm -f conftest*
-+if test -n "$ac_declaration"; then
-+ echo '#ifdef __cplusplus' >>confdefs.h
-+ echo $ac_declaration >>confdefs.h
-+ echo '#endif' >>confdefs.h
-+fi
-+
-+ac_ext=c
-+ac_cpp='$CPP $CPPFLAGS'
-+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-+ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
- # Find a good install program. We prefer a C program (faster),
- # so one script is as good as another. But avoid the broken or
-@@ -1158,505 +2888,1513 @@
- # SunOS /usr/etc/install
- # IRIX /sbin/install
- # AIX /bin/install
-+# AmigaOS /C/install, which installs bootblocks on floppy discs
- # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
- # AFS /usr/afsws/bin/install, which mishandles nonexistent args
- # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-+# OS/2's system install, which has a completely different semantic
- # ./install, which can be erroneously created by make from ./install.sh.
--echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
--echo "configure:1167: checking for a BSD compatible install" >&5
-+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
- if test -z "$INSTALL"; then
--if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+if test "${ac_cv_path_install+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
-- for ac_dir in $PATH; do
-- # Account for people who put trailing slashes in PATH elements.
-- case "$ac_dir/" in
-- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
-- *)
-- # OSF1 and SCO ODT 3.0 have their own names for install.
-- # Don't use installbsd from OSF since it installs stuff as root
-- # by default.
-- for ac_prog in ginstall scoinst install; do
-- if test -f $ac_dir/$ac_prog; then
-+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ # Account for people who put trailing slashes in PATH elements.
-+case $as_dir/ in
-+ ./ | .// | /cC/* | \
-+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
-+ /usr/ucb/* ) ;;
-+ *)
-+ # OSF1 and SCO ODT 3.0 have their own names for install.
-+ # Don't use installbsd from OSF since it installs stuff as root
-+ # by default.
-+ for ac_prog in ginstall scoinst install; do
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
- if test $ac_prog = install &&
-- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
-+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
-+ elif test $ac_prog = install &&
-+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-+ # program-specific install script used by HP pwplus--don't use.
-+ :
- else
-- ac_cv_path_install="$ac_dir/$ac_prog -c"
-- break 2
-+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-+ break 3
- fi
- fi
- done
-- ;;
-- esac
-- done
-- IFS="$ac_save_IFS"
-+ done
-+ ;;
-+esac
-+done
-+
-
- fi
- if test "${ac_cv_path_install+set}" = set; then
-- INSTALL="$ac_cv_path_install"
-+ INSTALL=$ac_cv_path_install
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
-- INSTALL="$ac_install_sh"
-+ INSTALL=$ac_install_sh
- fi
- fi
--echo "$ac_t""$INSTALL" 1>&6
-+echo "$as_me:$LINENO: result: $INSTALL" >&5
-+echo "${ECHO_T}$INSTALL" >&6
-
- # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
- # It thinks the first close brace ends the variable substitution.
- test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
--test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
- test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
- for ac_prog in sed
- do
--# Extract the first word of "$ac_prog", so it can be a program name with args.
-+ # Extract the first word of "$ac_prog", so it can be a program name with args.
- set dummy $ac_prog; ac_word=$2
--echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
--echo "configure:1225: checking for $ac_word" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_regex_cmd'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_regex_cmd+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
- if test -n "$regex_cmd"; then
- ac_cv_prog_regex_cmd="$regex_cmd" # Let the user override the test.
- else
-- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
-- ac_dummy="$PATH"
-- for ac_dir in $ac_dummy; do
-- test -z "$ac_dir" && ac_dir=.
-- if test -f $ac_dir/$ac_word; then
-- ac_cv_prog_regex_cmd="$ac_prog"
-- break
-- fi
-- done
-- IFS="$ac_save_ifs"
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+ ac_cv_prog_regex_cmd="$ac_prog"
-+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+ break 2
-+ fi
-+done
-+done
-+
- fi
- fi
--regex_cmd="$ac_cv_prog_regex_cmd"
-+regex_cmd=$ac_cv_prog_regex_cmd
- if test -n "$regex_cmd"; then
-- echo "$ac_t""$regex_cmd" 1>&6
-+ echo "$as_me:$LINENO: result: $regex_cmd" >&5
-+echo "${ECHO_T}$regex_cmd" >&6
- else
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- fi
-
--test -n "$regex_cmd" && break
-+ test -n "$regex_cmd" && break
- done
-
- if test x$regex_cmd = "x"; then
-- { echo "configure: error: error. sed is required to build the default menu file." 1>&2; exit 1; }
-+ { { echo "$as_me:$LINENO: error: error. sed is required to build the default menu file." >&5
-+echo "$as_me: error: error. sed is required to build the default menu file." >&2;}
-+ { (exit 1); exit 1; }; }
- fi
-
--echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
--echo "configure:1259: checking how to run the C preprocessor" >&5
-+
-+ac_ext=c
-+ac_cpp='$CPP $CPPFLAGS'
-+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-+ac_compiler_gnu=$ac_cv_c_compiler_gnu
-+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
- # On Suns, sometimes $CPP names a directory.
- if test -n "$CPP" && test -d "$CPP"; then
- CPP=
- fi
- if test -z "$CPP"; then
--if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ if test "${ac_cv_prog_CPP+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- # This must be in double quotes, not single quotes, because CPP may get
-- # substituted into the Makefile and "${CC-cc}" will confuse make.
-- CPP="${CC-cc} -E"
-+ # Double quotes because CPP needs to be expanded
-+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-+ do
-+ ac_preproc_ok=false
-+for ac_c_preproc_warn_flag in '' yes
-+do
-+ # Use a header file that comes with gcc, so configuring glibc
-+ # with a fresh cross-compiler works.
-+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-+ # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
-- # not just through cpp.
-- cat > conftest.$ac_ext <<EOF
--#line 1274 "configure"
--#include "confdefs.h"
--#include <assert.h>
--Syntax Error
--EOF
--ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
--{ (eval echo configure:1280: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
--ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
--if test -z "$ac_err"; then
-+ # not just through cpp. "Syntax error" is here to catch this case.
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#ifdef __STDC__
-+# include <limits.h>
-+#else
-+# include <assert.h>
-+#endif
-+ Syntax error
-+_ACEOF
-+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } >/dev/null; then
-+ if test -s conftest.err; then
-+ ac_cpp_err=$ac_c_preproc_warn_flag
-+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-+ else
-+ ac_cpp_err=
-+ fi
-+else
-+ ac_cpp_err=yes
-+fi
-+if test -z "$ac_cpp_err"; then
- :
- else
-- echo "$ac_err" >&5
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- CPP="${CC-cc} -E -traditional-cpp"
-- cat > conftest.$ac_ext <<EOF
--#line 1291 "configure"
--#include "confdefs.h"
--#include <assert.h>
--Syntax Error
--EOF
--ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
--{ (eval echo configure:1297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
--ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
--if test -z "$ac_err"; then
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ # Broken: fails on valid input.
-+continue
-+fi
-+rm -f conftest.err conftest.$ac_ext
-+
-+ # OK, works on sane cases. Now check whether non-existent headers
-+ # can be detected and how.
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <ac_nonexistent.h>
-+_ACEOF
-+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } >/dev/null; then
-+ if test -s conftest.err; then
-+ ac_cpp_err=$ac_c_preproc_warn_flag
-+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-+ else
-+ ac_cpp_err=
-+ fi
-+else
-+ ac_cpp_err=yes
-+fi
-+if test -z "$ac_cpp_err"; then
-+ # Broken: success on invalid input.
-+continue
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ # Passes both tests.
-+ac_preproc_ok=:
-+break
-+fi
-+rm -f conftest.err conftest.$ac_ext
-+
-+done
-+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-+rm -f conftest.err conftest.$ac_ext
-+if $ac_preproc_ok; then
-+ break
-+fi
-+
-+ done
-+ ac_cv_prog_CPP=$CPP
-+
-+fi
-+ CPP=$ac_cv_prog_CPP
-+else
-+ ac_cv_prog_CPP=$CPP
-+fi
-+echo "$as_me:$LINENO: result: $CPP" >&5
-+echo "${ECHO_T}$CPP" >&6
-+ac_preproc_ok=false
-+for ac_c_preproc_warn_flag in '' yes
-+do
-+ # Use a header file that comes with gcc, so configuring glibc
-+ # with a fresh cross-compiler works.
-+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-+ # <limits.h> exists even on freestanding compilers.
-+ # On the NeXT, cc -E runs the code through the compiler's parser,
-+ # not just through cpp. "Syntax error" is here to catch this case.
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#ifdef __STDC__
-+# include <limits.h>
-+#else
-+# include <assert.h>
-+#endif
-+ Syntax error
-+_ACEOF
-+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } >/dev/null; then
-+ if test -s conftest.err; then
-+ ac_cpp_err=$ac_c_preproc_warn_flag
-+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-+ else
-+ ac_cpp_err=
-+ fi
-+else
-+ ac_cpp_err=yes
-+fi
-+if test -z "$ac_cpp_err"; then
-+ :
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ # Broken: fails on valid input.
-+continue
-+fi
-+rm -f conftest.err conftest.$ac_ext
-+
-+ # OK, works on sane cases. Now check whether non-existent headers
-+ # can be detected and how.
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <ac_nonexistent.h>
-+_ACEOF
-+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } >/dev/null; then
-+ if test -s conftest.err; then
-+ ac_cpp_err=$ac_c_preproc_warn_flag
-+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-+ else
-+ ac_cpp_err=
-+ fi
-+else
-+ ac_cpp_err=yes
-+fi
-+if test -z "$ac_cpp_err"; then
-+ # Broken: success on invalid input.
-+continue
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ # Passes both tests.
-+ac_preproc_ok=:
-+break
-+fi
-+rm -f conftest.err conftest.$ac_ext
-+
-+done
-+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-+rm -f conftest.err conftest.$ac_ext
-+if $ac_preproc_ok; then
- :
- else
-- echo "$ac_err" >&5
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- CPP="${CC-cc} -nologo -E"
-- cat > conftest.$ac_ext <<EOF
--#line 1308 "configure"
--#include "confdefs.h"
--#include <assert.h>
--Syntax Error
--EOF
--ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
--{ (eval echo configure:1314: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
--ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
--if test -z "$ac_err"; then
-+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-+See \`config.log' for more details." >&5
-+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-+See \`config.log' for more details." >&2;}
-+ { (exit 1); exit 1; }; }
-+fi
-+
-+ac_ext=c
-+ac_cpp='$CPP $CPPFLAGS'
-+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-+ac_compiler_gnu=$ac_cv_c_compiler_gnu
-+
-+
-+echo "$as_me:$LINENO: checking for egrep" >&5
-+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-+if test "${ac_cv_prog_egrep+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
-+ then ac_cv_prog_egrep='grep -E'
-+ else ac_cv_prog_egrep='egrep'
-+ fi
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
-+ EGREP=$ac_cv_prog_egrep
-+
-+
-+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-+if test "${ac_cv_header_stdc+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <stdlib.h>
-+#include <stdarg.h>
-+#include <string.h>
-+#include <float.h>
-+
-+int
-+main ()
-+{
-+
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_header_stdc=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_header_stdc=no
-+fi
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-+
-+if test $ac_cv_header_stdc = yes; then
-+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <string.h>
-+
-+_ACEOF
-+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-+ $EGREP "memchr" >/dev/null 2>&1; then
- :
- else
-- echo "$ac_err" >&5
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- CPP=/lib/cpp
-+ ac_cv_header_stdc=no
- fi
- rm -f conftest*
-+
- fi
--rm -f conftest*
-+
-+if test $ac_cv_header_stdc = yes; then
-+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <stdlib.h>
-+
-+_ACEOF
-+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-+ $EGREP "free" >/dev/null 2>&1; then
-+ :
-+else
-+ ac_cv_header_stdc=no
- fi
- rm -f conftest*
-- ac_cv_prog_CPP="$CPP"
-+
- fi
-- CPP="$ac_cv_prog_CPP"
-+
-+if test $ac_cv_header_stdc = yes; then
-+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-+ if test "$cross_compiling" = yes; then
-+ :
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <ctype.h>
-+#if ((' ' & 0x0FF) == 0x020)
-+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-+#else
-+# define ISLOWER(c) \
-+ (('a' <= (c) && (c) <= 'i') \
-+ || ('j' <= (c) && (c) <= 'r') \
-+ || ('s' <= (c) && (c) <= 'z'))
-+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-+#endif
-+
-+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-+int
-+main ()
-+{
-+ int i;
-+ for (i = 0; i < 256; i++)
-+ if (XOR (islower (i), ISLOWER (i))
-+ || toupper (i) != TOUPPER (i))
-+ exit(2);
-+ exit (0);
-+}
-+_ACEOF
-+rm -f conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ :
- else
-- ac_cv_prog_CPP="$CPP"
-+ echo "$as_me: program exited with status $ac_status" >&5
-+echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+( exit $ac_status )
-+ac_cv_header_stdc=no
-+fi
-+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-+fi
-+fi
- fi
--echo "$ac_t""$CPP" 1>&6
-+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-+echo "${ECHO_T}$ac_cv_header_stdc" >&6
-+if test $ac_cv_header_stdc = yes; then
-+
-+cat >>confdefs.h <<\_ACEOF
-+#define STDC_HEADERS 1
-+_ACEOF
-
--for ac_hdr in ctype.h dirent.h fcntl.h libgen.h locale.h nl_types.h process.h signal.h stdarg.h stdio.h stdlib.h string.h time.h unistd.h sys/param.h sys/select.h sys/signal.h sys/stat.h sys/time.h sys/types.h sys/wait.h
--do
--ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
--echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
--echo "configure:1342: checking for $ac_hdr" >&5
--if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- cat > conftest.$ac_ext <<EOF
--#line 1347 "configure"
--#include "confdefs.h"
--#include <$ac_hdr>
--EOF
--ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
--{ (eval echo configure:1352: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
--ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
--if test -z "$ac_err"; then
-- rm -rf conftest*
-- eval "ac_cv_header_$ac_safe=yes"
--else
-- echo "$ac_err" >&5
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_header_$ac_safe=no"
- fi
--rm -f conftest*
-+
-+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-+ inttypes.h stdint.h unistd.h
-+do
-+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-+echo "$as_me:$LINENO: checking for $ac_header" >&5
-+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-+if eval "test \"\${$as_ac_Header+set}\" = set"; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+$ac_includes_default
-+
-+#include <$ac_header>
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ eval "$as_ac_Header=yes"
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+eval "$as_ac_Header=no"
-+fi
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-+fi
-+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-+if test `eval echo '${'$as_ac_Header'}'` = yes; then
-+ cat >>confdefs.h <<_ACEOF
-+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-+_ACEOF
-+
-+fi
-+
-+done
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+for ac_header in ctype.h dirent.h fcntl.h libgen.h locale.h nl_types.h process.h signal.h stdarg.h stdio.h stdlib.h string.h time.h unistd.h sys/param.h sys/select.h sys/signal.h sys/stat.h sys/time.h sys/types.h sys/wait.h
-+do
-+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-+if eval "test \"\${$as_ac_Header+set}\" = set"; then
-+ echo "$as_me:$LINENO: checking for $ac_header" >&5
-+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-+if eval "test \"\${$as_ac_Header+set}\" = set"; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+fi
-+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-+else
-+ # Is the header compilable?
-+echo "$as_me:$LINENO: checking $ac_header usability" >&5
-+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+$ac_includes_default
-+#include <$ac_header>
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_header_compiler=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_header_compiler=no
-+fi
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-+echo "${ECHO_T}$ac_header_compiler" >&6
-+
-+# Is the header present?
-+echo "$as_me:$LINENO: checking $ac_header presence" >&5
-+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <$ac_header>
-+_ACEOF
-+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } >/dev/null; then
-+ if test -s conftest.err; then
-+ ac_cpp_err=$ac_c_preproc_warn_flag
-+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-+ else
-+ ac_cpp_err=
-+ fi
-+else
-+ ac_cpp_err=yes
- fi
--if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-- cat >> confdefs.h <<EOF
--#define $ac_tr_hdr 1
--EOF
--
--else
-- echo "$ac_t""no" 1>&6
-+if test -z "$ac_cpp_err"; then
-+ ac_header_preproc=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ ac_header_preproc=no
-+fi
-+rm -f conftest.err conftest.$ac_ext
-+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-+echo "${ECHO_T}$ac_header_preproc" >&6
-+
-+# So? What about this header?
-+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-+ yes:no: )
-+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-+ ac_header_preproc=yes
-+ ;;
-+ no:yes:* )
-+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
-+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
-+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-+ (
-+ cat <<\_ASBOX
-+## ------------------------------------------ ##
-+## Report this to the AC_PACKAGE_NAME lists. ##
-+## ------------------------------------------ ##
-+_ASBOX
-+ ) |
-+ sed "s/^/$as_me: WARNING: /" >&2
-+ ;;
-+esac
-+echo "$as_me:$LINENO: checking for $ac_header" >&5
-+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-+if eval "test \"\${$as_ac_Header+set}\" = set"; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ eval "$as_ac_Header=\$ac_header_preproc"
-+fi
-+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-+
-+fi
-+if test `eval echo '${'$as_ac_Header'}'` = yes; then
-+ cat >>confdefs.h <<_ACEOF
-+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-+_ACEOF
-+
- fi
-+
- done
-
--echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
--echo "configure:1379: checking whether time.h and sys/time.h may both be included" >&5
--if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- cat > conftest.$ac_ext <<EOF
--#line 1384 "configure"
--#include "confdefs.h"
-+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
-+if test "${ac_cv_header_time+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
- #include <sys/types.h>
- #include <sys/time.h>
- #include <time.h>
--int main() {
--struct tm *tp;
--; return 0; }
--EOF
--if { (eval echo configure:1393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-- rm -rf conftest*
-+
-+int
-+main ()
-+{
-+if ((struct tm *) 0)
-+return 0;
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
- ac_cv_header_time=yes
- else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- ac_cv_header_time=no
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_header_time=no
- fi
--rm -f conftest*
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
--
--echo "$ac_t""$ac_cv_header_time" 1>&6
-+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-+echo "${ECHO_T}$ac_cv_header_time" >&6
- if test $ac_cv_header_time = yes; then
-- cat >> confdefs.h <<\EOF
-+
-+cat >>confdefs.h <<\_ACEOF
- #define TIME_WITH_SYS_TIME 1
--EOF
-+_ACEOF
-
- fi
-
-
-+
- for ac_func in basename
- do
--echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
--echo "configure:1417: checking for $ac_func" >&5
--if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- cat > conftest.$ac_ext <<EOF
--#line 1422 "configure"
--#include "confdefs.h"
-+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-+echo "$as_me:$LINENO: checking for $ac_func" >&5
-+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-+if eval "test \"\${$as_ac_var+set}\" = set"; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
-+#define $ac_func innocuous_$ac_func
-+
- /* System header to define __stub macros and hopefully few prototypes,
-- which can conflict with char $ac_func(); below. */
--#include <assert.h>
-+ which can conflict with char $ac_func (); below.
-+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-+ <limits.h> exists even on freestanding compilers. */
-+
-+#ifdef __STDC__
-+# include <limits.h>
-+#else
-+# include <assert.h>
-+#endif
-+
-+#undef $ac_func
-+
- /* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+{
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char $ac_func ();
-+/* The GNU C library defines this for functions which it implements
-+ to always fail with ENOSYS. Some functions are actually named
-+ something starting with __ and the normal name is an alias. */
-+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-+choke me
-+#else
-+char (*f) () = $ac_func;
-+#endif
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+int
-+main ()
-+{
-+return f != $ac_func;
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ eval "$as_ac_var=yes"
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+eval "$as_ac_var=no"
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+fi
-+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-+if test `eval echo '${'$as_ac_var'}'` = yes; then
-+ cat >>confdefs.h <<_ACEOF
-+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-+_ACEOF
-+
-+else
-+ echo "$as_me:$LINENO: checking for basename in -lgen" >&5
-+echo $ECHO_N "checking for basename in -lgen... $ECHO_C" >&6
-+if test "${ac_cv_lib_gen_basename+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ ac_check_lib_save_LIBS=$LIBS
-+LIBS="-lgen $LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char basename ();
-+int
-+main ()
-+{
-+basename ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_gen_basename=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_gen_basename=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_gen_basename" >&5
-+echo "${ECHO_T}$ac_cv_lib_gen_basename" >&6
-+if test $ac_cv_lib_gen_basename = yes; then
-+ cat >>confdefs.h <<\_ACEOF
-+#define HAVE_BASENAME 1
-+_ACEOF
-+ LIBS="$LIBS -lgen"
-+fi
-+
-+fi
-+done
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+for ac_func in getpid setlocale sigaction strftime strcasestr snprintf vsnprintf catopen catgets catclose
-+do
-+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-+echo "$as_me:$LINENO: checking for $ac_func" >&5
-+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-+if eval "test \"\${$as_ac_var+set}\" = set"; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
-+#define $ac_func innocuous_$ac_func
-+
-+/* System header to define __stub macros and hopefully few prototypes,
-+ which can conflict with char $ac_func (); below.
-+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-+ <limits.h> exists even on freestanding compilers. */
-+
-+#ifdef __STDC__
-+# include <limits.h>
-+#else
-+# include <assert.h>
-+#endif
-+
-+#undef $ac_func
-+
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+{
-+#endif
- /* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char $ac_func();
-+ builtin and then its argument prototype would still apply. */
-+char $ac_func ();
-+/* The GNU C library defines this for functions which it implements
-+ to always fail with ENOSYS. Some functions are actually named
-+ something starting with __ and the normal name is an alias. */
-+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-+choke me
-+#else
-+char (*f) () = $ac_func;
-+#endif
-+#ifdef __cplusplus
-+}
-+#endif
-
--int main() {
-+int
-+main ()
-+{
-+return f != $ac_func;
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ eval "$as_ac_var=yes"
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+eval "$as_ac_var=no"
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+fi
-+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-+if test `eval echo '${'$as_ac_var'}'` = yes; then
-+ cat >>confdefs.h <<_ACEOF
-+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-+_ACEOF
-+
-+fi
-+done
-+
-+echo "$as_me:$LINENO: checking for t_open in -lnsl" >&5
-+echo $ECHO_N "checking for t_open in -lnsl... $ECHO_C" >&6
-+if test "${ac_cv_lib_nsl_t_open+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ ac_check_lib_save_LIBS=$LIBS
-+LIBS="-lnsl $LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char t_open ();
-+int
-+main ()
-+{
-+t_open ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_nsl_t_open=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_nsl_t_open=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_t_open" >&5
-+echo "${ECHO_T}$ac_cv_lib_nsl_t_open" >&6
-+if test $ac_cv_lib_nsl_t_open = yes; then
-+ LIBS="$LIBS -lnsl"
-+fi
-+
-+echo "$as_me:$LINENO: checking for socket in -lsocket" >&5
-+echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6
-+if test "${ac_cv_lib_socket_socket+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ ac_check_lib_save_LIBS=$LIBS
-+LIBS="-lsocket $LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char socket ();
-+int
-+main ()
-+{
-+socket ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_socket_socket=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_socket_socket=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5
-+echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6
-+if test $ac_cv_lib_socket_socket = yes; then
-+ LIBS="$LIBS -lsocket"
-+fi
-+
-+
-+echo "$as_me:$LINENO: checking for X" >&5
-+echo $ECHO_N "checking for X... $ECHO_C" >&6
-+
-+ac_path_x_has_been_run=yes
-+
-+# Check whether --with-x or --without-x was given.
-+if test "${with_x+set}" = set; then
-+ withval="$with_x"
-+
-+fi;
-+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
-+if test "x$with_x" = xno; then
-+ # The user explicitly disabled X.
-+ have_x=disabled
-+else
-+ if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
-+ # Both variables are already set.
-+ have_x=yes
-+ else
-+ if test "${ac_cv_have_x+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ # One or both of the vars are not set, and there is no cached value.
-+ac_x_includes=no ac_x_libraries=no
-+rm -fr conftest.dir
-+if mkdir conftest.dir; then
-+ cd conftest.dir
-+ # Make sure to not put "make" in the Imakefile rules, since we grep it out.
-+ cat >Imakefile <<'_ACEOF'
-+acfindx:
-+ @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
-+_ACEOF
-+ if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
-+ # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-+ eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
-+ # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
-+ for ac_extension in a so sl; do
-+ if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
-+ test -f $ac_im_libdir/libX11.$ac_extension; then
-+ ac_im_usrlibdir=$ac_im_libdir; break
-+ fi
-+ done
-+ # Screen out bogus values from the imake configuration. They are
-+ # bogus both because they are the default anyway, and because
-+ # using them would break gcc on systems where it needs fixed includes.
-+ case $ac_im_incroot in
-+ /usr/include) ;;
-+ *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
-+ esac
-+ case $ac_im_usrlibdir in
-+ /usr/lib | /lib) ;;
-+ *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
-+ esac
-+ fi
-+ cd ..
-+ rm -fr conftest.dir
-+fi
-
--/* The GNU C library defines this for functions which it implements
-- to always fail with ENOSYS. Some functions are actually named
-- something starting with __ and the normal name is an alias. */
--#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
--choke me
--#else
--$ac_func();
--#endif
-+# Standard set of common directories for X headers.
-+# Check X11 before X11Rn because it is often a symlink to the current release.
-+ac_x_header_dirs='
-+/usr/X11/include
-+/usr/X11R6/include
-+/usr/X11R5/include
-+/usr/X11R4/include
-+
-+/usr/include/X11
-+/usr/include/X11R6
-+/usr/include/X11R5
-+/usr/include/X11R4
-+
-+/usr/local/X11/include
-+/usr/local/X11R6/include
-+/usr/local/X11R5/include
-+/usr/local/X11R4/include
-+
-+/usr/local/include/X11
-+/usr/local/include/X11R6
-+/usr/local/include/X11R5
-+/usr/local/include/X11R4
-+
-+/usr/X386/include
-+/usr/x386/include
-+/usr/XFree86/include/X11
-+
-+/usr/include
-+/usr/local/include
-+/usr/unsupported/include
-+/usr/athena/include
-+/usr/local/x11r5/include
-+/usr/lpp/Xamples/include
-
--; return 0; }
--EOF
--if { (eval echo configure:1445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_func_$ac_func=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_func_$ac_func=no"
--fi
--rm -f conftest*
--fi
-+/usr/openwin/include
-+/usr/openwin/share/include'
-
--if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-- cat >> confdefs.h <<EOF
--#define $ac_tr_func 1
--EOF
--
--else
-- echo "$ac_t""no" 1>&6
--echo $ac_n "checking for basename in -lgen""... $ac_c" 1>&6
--echo "configure:1467: checking for basename in -lgen" >&5
--ac_lib_var=`echo gen'_'basename | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+if test "$ac_x_includes" = no; then
-+ # Guess where to find include files, by looking for a specified header file.
-+ # First, try using that file with no special directory specified.
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <X11/Intrinsic.h>
-+_ACEOF
-+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } >/dev/null; then
-+ if test -s conftest.err; then
-+ ac_cpp_err=$ac_c_preproc_warn_flag
-+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-+ else
-+ ac_cpp_err=
-+ fi
- else
-- ac_save_LIBS="$LIBS"
--LIBS="-lgen $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 1475 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char basename();
--
--int main() {
--basename()
--; return 0; }
--EOF
--if { (eval echo configure:1486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
-+ ac_cpp_err=yes
- fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
--
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-- cat >> confdefs.h <<\EOF
--#define HAVE_BASENAME 1
--EOF
-- LIBS="$LIBS -lgen"
-+if test -z "$ac_cpp_err"; then
-+ # We can compile using X headers with no special include directory.
-+ac_x_includes=
- else
-- echo "$ac_t""no" 1>&6
--fi
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-
--fi
-+ for ac_dir in $ac_x_header_dirs; do
-+ if test -r "$ac_dir/X11/Intrinsic.h"; then
-+ ac_x_includes=$ac_dir
-+ break
-+ fi
- done
--
--for ac_func in getpid setlocale sigaction strftime strcasestr snprintf vsnprintf catopen catgets catclose
--do
--echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
--echo "configure:1515: checking for $ac_func" >&5
--if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- cat > conftest.$ac_ext <<EOF
--#line 1520 "configure"
--#include "confdefs.h"
--/* System header to define __stub macros and hopefully few prototypes,
-- which can conflict with char $ac_func(); below. */
--#include <assert.h>
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char $ac_func();
--
--int main() {
--
--/* The GNU C library defines this for functions which it implements
-- to always fail with ENOSYS. Some functions are actually named
-- something starting with __ and the normal name is an alias. */
--#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
--choke me
--#else
--$ac_func();
--#endif
--
--; return 0; }
--EOF
--if { (eval echo configure:1543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_func_$ac_func=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_func_$ac_func=no"
--fi
--rm -f conftest*
- fi
-+rm -f conftest.err conftest.$ac_ext
-+fi # $ac_x_includes = no
-
--if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-- cat >> confdefs.h <<EOF
--#define $ac_tr_func 1
--EOF
--
-+if test "$ac_x_libraries" = no; then
-+ # Check for the libraries.
-+ # See if we find them without any special options.
-+ # Don't add to $LIBS permanently.
-+ ac_save_LIBS=$LIBS
-+ LIBS="-lXt $LIBS"
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <X11/Intrinsic.h>
-+int
-+main ()
-+{
-+XtMalloc (0)
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ LIBS=$ac_save_LIBS
-+# We can link X programs with no special library path.
-+ac_x_libraries=
- else
-- echo "$ac_t""no" 1>&6
--fi
--done
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-
--echo $ac_n "checking for t_open in -lnsl""... $ac_c" 1>&6
--echo "configure:1568: checking for t_open in -lnsl" >&5
--ac_lib_var=`echo nsl'_'t_open | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- ac_save_LIBS="$LIBS"
--LIBS="-lnsl $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 1576 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char t_open();
--
--int main() {
--t_open()
--; return 0; }
--EOF
--if { (eval echo configure:1587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
-+LIBS=$ac_save_LIBS
-+for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
-+do
-+ # Don't even attempt the hair of trying to link an X program!
-+ for ac_extension in a so sl; do
-+ if test -r $ac_dir/libXt.$ac_extension; then
-+ ac_x_libraries=$ac_dir
-+ break 2
-+ fi
-+ done
-+done
- fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+fi # $ac_x_libraries = no
-
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-- LIBS="$LIBS -lnsl"
-+if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
-+ # Didn't find X anywhere. Cache the known absence of X.
-+ ac_cv_have_x="have_x=no"
- else
-- echo "$ac_t""no" 1>&6
-+ # Record where we found X for the cache.
-+ ac_cv_have_x="have_x=yes \
-+ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
- fi
--
--echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
--echo "configure:1608: checking for socket in -lsocket" >&5
--ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- ac_save_LIBS="$LIBS"
--LIBS="-lsocket $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 1616 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char socket();
--
--int main() {
--socket()
--; return 0; }
--EOF
--if { (eval echo configure:1627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
- fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
-
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-- LIBS="$LIBS -lsocket"
-+ fi
-+ eval "$ac_cv_have_x"
-+fi # $with_x != no
-+
-+if test "$have_x" != yes; then
-+ echo "$as_me:$LINENO: result: $have_x" >&5
-+echo "${ECHO_T}$have_x" >&6
-+ no_x=yes
- else
-- echo "$ac_t""no" 1>&6
-+ # If each of the values was on the command line, it overrides each guess.
-+ test "x$x_includes" = xNONE && x_includes=$ac_x_includes
-+ test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
-+ # Update the cache value to reflect the command line values.
-+ ac_cv_have_x="have_x=yes \
-+ ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
-+ # It might be that x_includes is empty (headers are found in the
-+ # standard search path. Then output the corresponding message
-+ ac_out_x_includes=$x_includes
-+ test "x$x_includes" = x && ac_out_x_includes="in standard search path"
-+ echo "$as_me:$LINENO: result: libraries $x_libraries, headers $ac_out_x_includes" >&5
-+echo "${ECHO_T}libraries $x_libraries, headers $ac_out_x_includes" >&6
- fi
-
-
--# If we find X, set shell vars x_includes and x_libraries to the
--# paths, otherwise set no_x=yes.
--# Uses ac_ vars as temps to allow command line to override cache and checks.
--# --without-x overrides everything else, but does not touch the cache.
--echo $ac_n "checking for X""... $ac_c" 1>&6
--echo "configure:1653: checking for X" >&5
-+if test "x$ac_path_x_has_been_run" != xyes; then
-+ echo "$as_me:$LINENO: checking for X" >&5
-+echo $ECHO_N "checking for X... $ECHO_C" >&6
-+
-+ac_path_x_has_been_run=yes
-
- # Check whether --with-x or --without-x was given.
- if test "${with_x+set}" = set; then
- withval="$with_x"
-- :
--fi
-
-+fi;
- # $have_x is `yes', `no', `disabled', or empty when we do not yet know.
- if test "x$with_x" = xno; then
- # The user explicitly disabled X.
-@@ -1666,207 +4404,209 @@
- # Both variables are already set.
- have_x=yes
- else
--if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ if test "${ac_cv_have_x+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
- # One or both of the vars are not set, and there is no cached value.
--ac_x_includes=NO ac_x_libraries=NO
--rm -fr conftestdir
--if mkdir conftestdir; then
-- cd conftestdir
-+ac_x_includes=no ac_x_libraries=no
-+rm -fr conftest.dir
-+if mkdir conftest.dir; then
-+ cd conftest.dir
- # Make sure to not put "make" in the Imakefile rules, since we grep it out.
-- cat > Imakefile <<'EOF'
-+ cat >Imakefile <<'_ACEOF'
- acfindx:
- @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
--EOF
-+_ACEOF
- if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
- # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
- eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
- # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
- for ac_extension in a so sl; do
- if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
-- test -f $ac_im_libdir/libX11.$ac_extension; then
-- ac_im_usrlibdir=$ac_im_libdir; break
-+ test -f $ac_im_libdir/libX11.$ac_extension; then
-+ ac_im_usrlibdir=$ac_im_libdir; break
- fi
- done
- # Screen out bogus values from the imake configuration. They are
- # bogus both because they are the default anyway, and because
- # using them would break gcc on systems where it needs fixed includes.
-- case "$ac_im_incroot" in
-+ case $ac_im_incroot in
- /usr/include) ;;
-- *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
-+ *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
- esac
-- case "$ac_im_usrlibdir" in
-+ case $ac_im_usrlibdir in
- /usr/lib | /lib) ;;
-- *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
-+ *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
- esac
- fi
- cd ..
-- rm -fr conftestdir
-+ rm -fr conftest.dir
- fi
-
--if test "$ac_x_includes" = NO; then
-- # Guess where to find include files, by looking for this one X11 .h file.
-- test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
-+# Standard set of common directories for X headers.
-+# Check X11 before X11Rn because it is often a symlink to the current release.
-+ac_x_header_dirs='
-+/usr/X11/include
-+/usr/X11R6/include
-+/usr/X11R5/include
-+/usr/X11R4/include
-+
-+/usr/include/X11
-+/usr/include/X11R6
-+/usr/include/X11R5
-+/usr/include/X11R4
-+
-+/usr/local/X11/include
-+/usr/local/X11R6/include
-+/usr/local/X11R5/include
-+/usr/local/X11R4/include
-+
-+/usr/local/include/X11
-+/usr/local/include/X11R6
-+/usr/local/include/X11R5
-+/usr/local/include/X11R4
-+
-+/usr/X386/include
-+/usr/x386/include
-+/usr/XFree86/include/X11
-+
-+/usr/include
-+/usr/local/include
-+/usr/unsupported/include
-+/usr/athena/include
-+/usr/local/x11r5/include
-+/usr/lpp/Xamples/include
-+
-+/usr/openwin/include
-+/usr/openwin/share/include'
-
-+if test "$ac_x_includes" = no; then
-+ # Guess where to find include files, by looking for a specified header file.
- # First, try using that file with no special directory specified.
--cat > conftest.$ac_ext <<EOF
--#line 1715 "configure"
--#include "confdefs.h"
--#include <$x_direct_test_include>
--EOF
--ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
--{ (eval echo configure:1720: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
--ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
--if test -z "$ac_err"; then
-- rm -rf conftest*
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <X11/Intrinsic.h>
-+_ACEOF
-+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } >/dev/null; then
-+ if test -s conftest.err; then
-+ ac_cpp_err=$ac_c_preproc_warn_flag
-+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-+ else
-+ ac_cpp_err=
-+ fi
-+else
-+ ac_cpp_err=yes
-+fi
-+if test -z "$ac_cpp_err"; then
- # We can compile using X headers with no special include directory.
- ac_x_includes=
- else
-- echo "$ac_err" >&5
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- # Look for the header file in a standard set of common directories.
--# Check X11 before X11Rn because it is often a symlink to the current release.
-- for ac_dir in \
-- /usr/X11/include \
-- /usr/X11R6/include \
-- /usr/X11R5/include \
-- /usr/X11R4/include \
-- \
-- /usr/include/X11 \
-- /usr/include/X11R6 \
-- /usr/include/X11R5 \
-- /usr/include/X11R4 \
-- \
-- /usr/local/X11/include \
-- /usr/local/X11R6/include \
-- /usr/local/X11R5/include \
-- /usr/local/X11R4/include \
-- \
-- /usr/local/include/X11 \
-- /usr/local/include/X11R6 \
-- /usr/local/include/X11R5 \
-- /usr/local/include/X11R4 \
-- \
-- /usr/X386/include \
-- /usr/x386/include \
-- /usr/XFree86/include/X11 \
-- \
-- /usr/include \
-- /usr/local/include \
-- /usr/unsupported/include \
-- /usr/athena/include \
-- /usr/local/x11r5/include \
-- /usr/lpp/Xamples/include \
-- \
-- /usr/openwin/include \
-- /usr/openwin/share/include \
-- ; \
-- do
-- if test -r "$ac_dir/$x_direct_test_include"; then
-- ac_x_includes=$ac_dir
-- break
-- fi
-- done
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ for ac_dir in $ac_x_header_dirs; do
-+ if test -r "$ac_dir/X11/Intrinsic.h"; then
-+ ac_x_includes=$ac_dir
-+ break
-+ fi
-+done
- fi
--rm -f conftest*
--fi # $ac_x_includes = NO
-+rm -f conftest.err conftest.$ac_ext
-+fi # $ac_x_includes = no
-
--if test "$ac_x_libraries" = NO; then
-+if test "$ac_x_libraries" = no; then
- # Check for the libraries.
--
-- test -z "$x_direct_test_library" && x_direct_test_library=Xt
-- test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
--
- # See if we find them without any special options.
- # Don't add to $LIBS permanently.
-- ac_save_LIBS="$LIBS"
-- LIBS="-l$x_direct_test_library $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 1789 "configure"
--#include "confdefs.h"
--
--int main() {
--${x_direct_test_function}()
--; return 0; }
--EOF
--if { (eval echo configure:1796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- LIBS="$ac_save_LIBS"
-+ ac_save_LIBS=$LIBS
-+ LIBS="-lXt $LIBS"
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <X11/Intrinsic.h>
-+int
-+main ()
-+{
-+XtMalloc (0)
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ LIBS=$ac_save_LIBS
- # We can link X programs with no special library path.
- ac_x_libraries=
- else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- LIBS="$ac_save_LIBS"
--# First see if replacing the include by lib works.
--# Check X11 before X11Rn because it is often a symlink to the current release.
--for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
-- /usr/X11/lib \
-- /usr/X11R6/lib \
-- /usr/X11R5/lib \
-- /usr/X11R4/lib \
-- \
-- /usr/lib/X11 \
-- /usr/lib/X11R6 \
-- /usr/lib/X11R5 \
-- /usr/lib/X11R4 \
-- \
-- /usr/local/X11/lib \
-- /usr/local/X11R6/lib \
-- /usr/local/X11R5/lib \
-- /usr/local/X11R4/lib \
-- \
-- /usr/local/lib/X11 \
-- /usr/local/lib/X11R6 \
-- /usr/local/lib/X11R5 \
-- /usr/local/lib/X11R4 \
-- \
-- /usr/X386/lib \
-- /usr/x386/lib \
-- /usr/XFree86/lib/X11 \
-- \
-- /usr/lib \
-- /usr/local/lib \
-- /usr/unsupported/lib \
-- /usr/athena/lib \
-- /usr/local/x11r5/lib \
-- /usr/lpp/Xamples/lib \
-- /lib/usr/lib/X11 \
-- \
-- /usr/openwin/lib \
-- /usr/openwin/share/lib \
-- ; \
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+LIBS=$ac_save_LIBS
-+for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
- do
-+ # Don't even attempt the hair of trying to link an X program!
- for ac_extension in a so sl; do
-- if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
-+ if test -r $ac_dir/libXt.$ac_extension; then
- ac_x_libraries=$ac_dir
- break 2
- fi
- done
- done
- fi
--rm -f conftest*
--fi # $ac_x_libraries = NO
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+fi # $ac_x_libraries = no
-
--if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
-+if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
- # Didn't find X anywhere. Cache the known absence of X.
- ac_cv_have_x="have_x=no"
- else
- # Record where we found X for the cache.
- ac_cv_have_x="have_x=yes \
-- ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
-+ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
- fi
- fi
-+
- fi
- eval "$ac_cv_have_x"
- fi # $with_x != no
-
- if test "$have_x" != yes; then
-- echo "$ac_t""$have_x" 1>&6
-+ echo "$as_me:$LINENO: result: $have_x" >&5
-+echo "${ECHO_T}$have_x" >&6
- no_x=yes
- else
- # If each of the values was on the command line, it overrides each guess.
-@@ -1875,14 +4615,21 @@
- # Update the cache value to reflect the command line values.
- ac_cv_have_x="have_x=yes \
- ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
-- echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
-+ # It might be that x_includes is empty (headers are found in the
-+ # standard search path. Then output the corresponding message
-+ ac_out_x_includes=$x_includes
-+ test "x$x_includes" = x && ac_out_x_includes="in standard search path"
-+ echo "$as_me:$LINENO: result: libraries $x_libraries, headers $ac_out_x_includes" >&5
-+echo "${ECHO_T}libraries $x_libraries, headers $ac_out_x_includes" >&6
- fi
-
-+fi
- if test "$no_x" = yes; then
- # Not all programs may use this symbol, but it does not hurt to define it.
-- cat >> confdefs.h <<\EOF
-+
-+cat >>confdefs.h <<\_ACEOF
- #define X_DISPLAY_MISSING 1
--EOF
-+_ACEOF
-
- X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
- else
-@@ -1895,60 +4642,117 @@
- X_LIBS="$X_LIBS -L$x_libraries"
- # For Solaris; some versions of Sun CC require a space after -R and
- # others require no space. Words are not sufficient . . . .
-- case "`(uname -sr) 2>/dev/null`" in
-+ case `(uname -sr) 2>/dev/null` in
- "SunOS 5"*)
-- echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
--echo "configure:1902: checking whether -R must be followed by a space" >&5
-- ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
-- cat > conftest.$ac_ext <<EOF
--#line 1905 "configure"
--#include "confdefs.h"
--
--int main() {
--
--; return 0; }
--EOF
--if { (eval echo configure:1912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-+ echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5
-+echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6
-+ ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+int
-+main ()
-+{
-+
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
- ac_R_nospace=yes
- else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- ac_R_nospace=no
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_R_nospace=no
- fi
--rm -f conftest*
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
- if test $ac_R_nospace = yes; then
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- X_LIBS="$X_LIBS -R$x_libraries"
- else
- LIBS="$ac_xsave_LIBS -R $x_libraries"
-- cat > conftest.$ac_ext <<EOF
--#line 1928 "configure"
--#include "confdefs.h"
--
--int main() {
--
--; return 0; }
--EOF
--if { (eval echo configure:1935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+int
-+main ()
-+{
-+
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
- ac_R_space=yes
- else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- ac_R_space=no
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_R_space=no
- fi
--rm -f conftest*
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
- if test $ac_R_space = yes; then
-- echo "$ac_t""yes" 1>&6
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
- X_LIBS="$X_LIBS -R $x_libraries"
- else
-- echo "$ac_t""neither works" 1>&6
-+ echo "$as_me:$LINENO: result: neither works" >&5
-+echo "${ECHO_T}neither works" >&6
- fi
- fi
-- LIBS="$ac_xsave_LIBS"
-+ LIBS=$ac_xsave_LIBS
- esac
- fi
-
-@@ -1959,527 +4763,1010 @@
- if test "$ISC" = yes; then
- X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
- else
-- # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
-- # libraries were built with DECnet support. And karl@cs.umb.edu says
-+ # Martyn Johnson says this is needed for Ultrix, if the X
-+ # libraries were built with DECnet support. And Karl Berry says
- # the Alpha needs dnet_stub (dnet does not exist).
-- echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
--echo "configure:1967: checking for dnet_ntoa in -ldnet" >&5
--ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char XOpenDisplay ();
-+int
-+main ()
-+{
-+XOpenDisplay ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ :
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5
-+echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6
-+if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- ac_save_LIBS="$LIBS"
-+ ac_check_lib_save_LIBS=$LIBS
- LIBS="-ldnet $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 1975 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char dnet_ntoa();
--
--int main() {
--dnet_ntoa()
--; return 0; }
--EOF
--if { (eval echo configure:1986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
--fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char dnet_ntoa ();
-+int
-+main ()
-+{
-+dnet_ntoa ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_dnet_dnet_ntoa=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_dnet_dnet_ntoa=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
-+echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6
-+if test $ac_cv_lib_dnet_dnet_ntoa = yes; then
- X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
--else
-- echo "$ac_t""no" 1>&6
- fi
-
- if test $ac_cv_lib_dnet_dnet_ntoa = no; then
-- echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
--echo "configure:2008: checking for dnet_ntoa in -ldnet_stub" >&5
--ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5
-+echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6
-+if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- ac_save_LIBS="$LIBS"
-+ ac_check_lib_save_LIBS=$LIBS
- LIBS="-ldnet_stub $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 2016 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char dnet_ntoa();
--
--int main() {
--dnet_ntoa()
--; return 0; }
--EOF
--if { (eval echo configure:2027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
--fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char dnet_ntoa ();
-+int
-+main ()
-+{
-+dnet_ntoa ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_dnet_stub_dnet_ntoa=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_dnet_stub_dnet_ntoa=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
-+echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6
-+if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then
- X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
--else
-- echo "$ac_t""no" 1>&6
- fi
-
- fi
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+ LIBS="$ac_xsave_LIBS"
-
- # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
- # to get the SysV transport functions.
-- # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4)
-+ # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4)
- # needs -lnsl.
- # The nsl library prevents programs from opening the X display
-- # on Irix 5.2, according to dickey@clark.net.
-- echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
--echo "configure:2056: checking for gethostbyname" >&5
--if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- cat > conftest.$ac_ext <<EOF
--#line 2061 "configure"
--#include "confdefs.h"
-+ # on Irix 5.2, according to T.E. Dickey.
-+ # The functions gethostbyname, getservbyname, and inet_addr are
-+ # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
-+ echo "$as_me:$LINENO: checking for gethostbyname" >&5
-+echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
-+if test "${ac_cv_func_gethostbyname+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+/* Define gethostbyname to an innocuous variant, in case <limits.h> declares gethostbyname.
-+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
-+#define gethostbyname innocuous_gethostbyname
-+
- /* System header to define __stub macros and hopefully few prototypes,
-- which can conflict with char gethostbyname(); below. */
--#include <assert.h>
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char gethostbyname();
-+ which can conflict with char gethostbyname (); below.
-+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-+ <limits.h> exists even on freestanding compilers. */
-
--int main() {
-+#ifdef __STDC__
-+# include <limits.h>
-+#else
-+# include <assert.h>
-+#endif
-
-+#undef gethostbyname
-+
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+{
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char gethostbyname ();
- /* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
- #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
- choke me
- #else
--gethostbyname();
-+char (*f) () = gethostbyname;
-+#endif
-+#ifdef __cplusplus
-+}
- #endif
-
--; return 0; }
--EOF
--if { (eval echo configure:2084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_func_gethostbyname=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_func_gethostbyname=no"
--fi
--rm -f conftest*
--fi
-+int
-+main ()
-+{
-+return f != gethostbyname;
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_func_gethostbyname=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-
--if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-- :
--else
-- echo "$ac_t""no" 1>&6
-+ac_cv_func_gethostbyname=no
- fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5
-+echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6
-
- if test $ac_cv_func_gethostbyname = no; then
-- echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
--echo "configure:2105: checking for gethostbyname in -lnsl" >&5
--ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
-+echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
-+if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- ac_save_LIBS="$LIBS"
-+ ac_check_lib_save_LIBS=$LIBS
- LIBS="-lnsl $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 2113 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char gethostbyname();
--
--int main() {
--gethostbyname()
--; return 0; }
--EOF
--if { (eval echo configure:2124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
--fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char gethostbyname ();
-+int
-+main ()
-+{
-+gethostbyname ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_nsl_gethostbyname=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_nsl_gethostbyname=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
-+echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
-+if test $ac_cv_lib_nsl_gethostbyname = yes; then
- X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
--else
-- echo "$ac_t""no" 1>&6
- fi
-
-+ if test $ac_cv_lib_nsl_gethostbyname = no; then
-+ echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5
-+echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6
-+if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ ac_check_lib_save_LIBS=$LIBS
-+LIBS="-lbsd $LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char gethostbyname ();
-+int
-+main ()
-+{
-+gethostbyname ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_bsd_gethostbyname=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_bsd_gethostbyname=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5
-+echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6
-+if test $ac_cv_lib_bsd_gethostbyname = yes; then
-+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
-+fi
-+
-+ fi
- fi
-
- # lieder@skyler.mavd.honeywell.com says without -lsocket,
- # socket/setsockopt and other routines are undefined under SCO ODT
- # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
-- # on later versions), says simon@lia.di.epfl.ch: it contains
-- # gethostby* variants that don't use the nameserver (or something).
-- # -lsocket must be given before -lnsl if both are needed.
-- # We assume that if connect needs -lnsl, so does gethostbyname.
-- echo $ac_n "checking for connect""... $ac_c" 1>&6
--echo "configure:2154: checking for connect" >&5
--if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- cat > conftest.$ac_ext <<EOF
--#line 2159 "configure"
--#include "confdefs.h"
-+ # on later versions), says Simon Leinen: it contains gethostby*
-+ # variants that don't use the name server (or something). -lsocket
-+ # must be given before -lnsl if both are needed. We assume that
-+ # if connect needs -lnsl, so does gethostbyname.
-+ echo "$as_me:$LINENO: checking for connect" >&5
-+echo $ECHO_N "checking for connect... $ECHO_C" >&6
-+if test "${ac_cv_func_connect+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+/* Define connect to an innocuous variant, in case <limits.h> declares connect.
-+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
-+#define connect innocuous_connect
-+
- /* System header to define __stub macros and hopefully few prototypes,
-- which can conflict with char connect(); below. */
--#include <assert.h>
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char connect();
-+ which can conflict with char connect (); below.
-+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-+ <limits.h> exists even on freestanding compilers. */
-+
-+#ifdef __STDC__
-+# include <limits.h>
-+#else
-+# include <assert.h>
-+#endif
-
--int main() {
-+#undef connect
-
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+{
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char connect ();
- /* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
- #if defined (__stub_connect) || defined (__stub___connect)
- choke me
- #else
--connect();
-+char (*f) () = connect;
-+#endif
-+#ifdef __cplusplus
-+}
- #endif
-
--; return 0; }
--EOF
--if { (eval echo configure:2182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_func_connect=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_func_connect=no"
--fi
--rm -f conftest*
--fi
-+int
-+main ()
-+{
-+return f != connect;
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_func_connect=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-
--if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-- :
--else
-- echo "$ac_t""no" 1>&6
-+ac_cv_func_connect=no
- fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5
-+echo "${ECHO_T}$ac_cv_func_connect" >&6
-
- if test $ac_cv_func_connect = no; then
-- echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
--echo "configure:2203: checking for connect in -lsocket" >&5
--ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ echo "$as_me:$LINENO: checking for connect in -lsocket" >&5
-+echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6
-+if test "${ac_cv_lib_socket_connect+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- ac_save_LIBS="$LIBS"
-+ ac_check_lib_save_LIBS=$LIBS
- LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 2211 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char connect();
--
--int main() {
--connect()
--; return 0; }
--EOF
--if { (eval echo configure:2222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
--fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char connect ();
-+int
-+main ()
-+{
-+connect ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_socket_connect=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_socket_connect=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5
-+echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6
-+if test $ac_cv_lib_socket_connect = yes; then
- X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
--else
-- echo "$ac_t""no" 1>&6
- fi
-
- fi
-
-- # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
-- echo $ac_n "checking for remove""... $ac_c" 1>&6
--echo "configure:2246: checking for remove" >&5
--if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- cat > conftest.$ac_ext <<EOF
--#line 2251 "configure"
--#include "confdefs.h"
-+ # Guillermo Gomez says -lposix is necessary on A/UX.
-+ echo "$as_me:$LINENO: checking for remove" >&5
-+echo $ECHO_N "checking for remove... $ECHO_C" >&6
-+if test "${ac_cv_func_remove+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+/* Define remove to an innocuous variant, in case <limits.h> declares remove.
-+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
-+#define remove innocuous_remove
-+
- /* System header to define __stub macros and hopefully few prototypes,
-- which can conflict with char remove(); below. */
--#include <assert.h>
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char remove();
-+ which can conflict with char remove (); below.
-+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-+ <limits.h> exists even on freestanding compilers. */
-
--int main() {
-+#ifdef __STDC__
-+# include <limits.h>
-+#else
-+# include <assert.h>
-+#endif
-
-+#undef remove
-+
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+{
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char remove ();
- /* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
- #if defined (__stub_remove) || defined (__stub___remove)
- choke me
- #else
--remove();
-+char (*f) () = remove;
-+#endif
-+#ifdef __cplusplus
-+}
- #endif
-
--; return 0; }
--EOF
--if { (eval echo configure:2274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_func_remove=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_func_remove=no"
--fi
--rm -f conftest*
--fi
-+int
-+main ()
-+{
-+return f != remove;
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_func_remove=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-
--if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-- :
--else
-- echo "$ac_t""no" 1>&6
-+ac_cv_func_remove=no
- fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5
-+echo "${ECHO_T}$ac_cv_func_remove" >&6
-
- if test $ac_cv_func_remove = no; then
-- echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
--echo "configure:2295: checking for remove in -lposix" >&5
--ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ echo "$as_me:$LINENO: checking for remove in -lposix" >&5
-+echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6
-+if test "${ac_cv_lib_posix_remove+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- ac_save_LIBS="$LIBS"
-+ ac_check_lib_save_LIBS=$LIBS
- LIBS="-lposix $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 2303 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char remove();
--
--int main() {
--remove()
--; return 0; }
--EOF
--if { (eval echo configure:2314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
--fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char remove ();
-+int
-+main ()
-+{
-+remove ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_posix_remove=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_posix_remove=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5
-+echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6
-+if test $ac_cv_lib_posix_remove = yes; then
- X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
--else
-- echo "$ac_t""no" 1>&6
- fi
-
- fi
-
- # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
-- echo $ac_n "checking for shmat""... $ac_c" 1>&6
--echo "configure:2338: checking for shmat" >&5
--if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- cat > conftest.$ac_ext <<EOF
--#line 2343 "configure"
--#include "confdefs.h"
-+ echo "$as_me:$LINENO: checking for shmat" >&5
-+echo $ECHO_N "checking for shmat... $ECHO_C" >&6
-+if test "${ac_cv_func_shmat+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+/* Define shmat to an innocuous variant, in case <limits.h> declares shmat.
-+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
-+#define shmat innocuous_shmat
-+
- /* System header to define __stub macros and hopefully few prototypes,
-- which can conflict with char shmat(); below. */
--#include <assert.h>
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char shmat();
-+ which can conflict with char shmat (); below.
-+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-+ <limits.h> exists even on freestanding compilers. */
-+
-+#ifdef __STDC__
-+# include <limits.h>
-+#else
-+# include <assert.h>
-+#endif
-
--int main() {
-+#undef shmat
-
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+{
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char shmat ();
- /* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
- #if defined (__stub_shmat) || defined (__stub___shmat)
- choke me
- #else
--shmat();
-+char (*f) () = shmat;
-+#endif
-+#ifdef __cplusplus
-+}
- #endif
-
--; return 0; }
--EOF
--if { (eval echo configure:2366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_func_shmat=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_func_shmat=no"
--fi
--rm -f conftest*
--fi
-+int
-+main ()
-+{
-+return f != shmat;
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_func_shmat=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-
--if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-- :
--else
-- echo "$ac_t""no" 1>&6
-+ac_cv_func_shmat=no
- fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5
-+echo "${ECHO_T}$ac_cv_func_shmat" >&6
-
- if test $ac_cv_func_shmat = no; then
-- echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
--echo "configure:2387: checking for shmat in -lipc" >&5
--ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ echo "$as_me:$LINENO: checking for shmat in -lipc" >&5
-+echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6
-+if test "${ac_cv_lib_ipc_shmat+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- ac_save_LIBS="$LIBS"
-+ ac_check_lib_save_LIBS=$LIBS
- LIBS="-lipc $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 2395 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char shmat();
--
--int main() {
--shmat()
--; return 0; }
--EOF
--if { (eval echo configure:2406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
--fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char shmat ();
-+int
-+main ()
-+{
-+shmat ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_ipc_shmat=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_ipc_shmat=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5
-+echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6
-+if test $ac_cv_lib_ipc_shmat = yes; then
- X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
--else
-- echo "$ac_t""no" 1>&6
- fi
-
- fi
- fi
-
- # Check for libraries that X11R6 Xt/Xaw programs need.
-- ac_save_LDFLAGS="$LDFLAGS"
-+ ac_save_LDFLAGS=$LDFLAGS
- test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
- # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
- # check for ICE first), but we must link in the order -lSM -lICE or
- # we get undefined symbols. So assume we have SM if we have ICE.
- # These have to be linked with before -lX11, unlike the other
- # libraries we check for below, so use a different variable.
-- # --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
-- echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
--echo "configure:2439: checking for IceConnectionNumber in -lICE" >&5
--ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ # John Interrante, Karl Berry
-+ echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5
-+echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6
-+if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- ac_save_LIBS="$LIBS"
--LIBS="-lICE $X_EXTRA_LIBS $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 2447 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char IceConnectionNumber();
--
--int main() {
--IceConnectionNumber()
--; return 0; }
--EOF
--if { (eval echo configure:2458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
--fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
-+ ac_check_lib_save_LIBS=$LIBS
-+LIBS="-lICE $X_EXTRA_LIBS $LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char IceConnectionNumber ();
-+int
-+main ()
-+{
-+IceConnectionNumber ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_ICE_IceConnectionNumber=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_ICE_IceConnectionNumber=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
-+echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6
-+if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then
- X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
--else
-- echo "$ac_t""no" 1>&6
- fi
-
-- LDFLAGS="$ac_save_LDFLAGS"
-+ LDFLAGS=$ac_save_LDFLAGS
-
- fi
-
-
--test x$no_x = "xyes" && { echo "configure: error: Blackbox requires the X Window System libraries and headers." 1>&2; exit 1; }
-+test x$no_x = "xyes" && { { echo "$as_me:$LINENO: error: Blackbox requires the X Window System libraries and headers." >&5
-+echo "$as_me: error: Blackbox requires the X Window System libraries and headers." >&2;}
-+ { (exit 1); exit 1; }; }
-
- test x$x_includes = "x" && x_includes="/usr/include"
- test x$x_libraries = "x" && x_libraries="/usr/lib"
-@@ -2489,71 +5776,107 @@
- LIBS="$LIBS $X_LIBS"
- LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
-
--echo $ac_n "checking for GCC""... $ac_c" 1>&6
--echo "configure:2494: checking for GCC" >&5
-+echo "$as_me:$LINENO: checking for GCC" >&5
-+echo $ECHO_N "checking for GCC... $ECHO_C" >&6
- if test x$GCC = "xyes"; then
-- echo "$ac_t""yes" 1>&6
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
- CXXFLAGS="${CXXFLAGS} -Wall -W -pedantic"
- else
-- echo "$ac_t""no, trying other compilers" 1>&6
-- echo $ac_n "checking for MIPSpro""... $ac_c" 1>&6
--echo "configure:2501: checking for MIPSpro" >&5
-+ echo "$as_me:$LINENO: result: no, trying other compilers" >&5
-+echo "${ECHO_T}no, trying other compilers" >&6
-+ echo "$as_me:$LINENO: checking for MIPSpro" >&5
-+echo $ECHO_N "checking for MIPSpro... $ECHO_C" >&6
- mips_pro_ver=`$CC -version 2>&1 | grep -i mipspro | cut -f4 -d ' '`
- if test "x$mips_pro_ver" = "x"; then
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- else
-- echo "$ac_t""yes, version $mips_pro_ver." 1>&6
-- echo $ac_n "checking for -LANG:std in CXXFLAGS""... $ac_c" 1>&6
--echo "configure:2508: checking for -LANG:std in CXXFLAGS" >&5
-+ echo "$as_me:$LINENO: result: yes, version $mips_pro_ver." >&5
-+echo "${ECHO_T}yes, version $mips_pro_ver." >&6
-+ echo "$as_me:$LINENO: checking for -LANG:std in CXXFLAGS" >&5
-+echo $ECHO_N "checking for -LANG:std in CXXFLAGS... $ECHO_C" >&6
- lang_std_not_set=`echo $CXXFLAGS | grep "\-LANG:std"`
- if test "x$lang_std_not_set" = "x"; then
-- echo "$ac_t""not set, setting." 1>&6
-+ echo "$as_me:$LINENO: result: not set, setting." >&5
-+echo "${ECHO_T}not set, setting." >&6
- CXXFLAGS="${CXXFLAGS} -LANG:std"
- else
-- echo "$ac_t""already set." 1>&6
-+ echo "$as_me:$LINENO: result: already set." >&5
-+echo "${ECHO_T}already set." >&6
- fi
-- fi
-+ fi
- fi
-
--echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6
--echo "configure:2520: checking for XOpenDisplay in -lX11" >&5
--ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+echo "$as_me:$LINENO: checking for XOpenDisplay in -lX11" >&5
-+echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6
-+if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- ac_save_LIBS="$LIBS"
-+ ac_check_lib_save_LIBS=$LIBS
- LIBS="-lX11 $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 2528 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char XOpenDisplay();
--
--int main() {
--XOpenDisplay()
--; return 0; }
--EOF
--if { (eval echo configure:2539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
--fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char XOpenDisplay ();
-+int
-+main ()
-+{
-+XOpenDisplay ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_X11_XOpenDisplay=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_X11_XOpenDisplay=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XOpenDisplay" >&5
-+echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6
-+if test $ac_cv_lib_X11_XOpenDisplay = yes; then
- LIBS="$LIBS -lX11"
- else
-- echo "$ac_t""no" 1>&6
--{ echo "configure: error: Could not find XOpenDisplay in -lX11." 1>&2; exit 1; }
-+ { { echo "$as_me:$LINENO: error: Could not find XOpenDisplay in -lX11." >&5
-+echo "$as_me: error: Could not find XOpenDisplay in -lX11." >&2;}
-+ { (exit 1); exit 1; }; }
-
- fi
-
-@@ -2563,227 +5886,469 @@
- Xext_lib=""
-
- SHAPE=""
--echo $ac_n "checking whether to build support for the XShape extension""... $ac_c" 1>&6
--echo "configure:2568: checking whether to build support for the XShape extension" >&5
-+echo "$as_me:$LINENO: checking whether to build support for the XShape extension" >&5
-+echo $ECHO_N "checking whether to build support for the XShape extension... $ECHO_C" >&6
- # Check whether --enable-shape or --disable-shape was given.
- if test "${enable_shape+set}" = set; then
- enableval="$enable_shape"
-- :
--fi
-
-+fi;
-
- : ${enableval="yes"}
- if test x$enableval = "xyes"; then
-- echo "$ac_t""yes" 1>&6
-- echo $ac_n "checking for XShapeCombineShape in -lXext""... $ac_c" 1>&6
--echo "configure:2580: checking for XShapeCombineShape in -lXext" >&5
--ac_lib_var=`echo Xext'_'XShapeCombineShape | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
-+ echo "$as_me:$LINENO: checking for XShapeCombineShape in -lXext" >&5
-+echo $ECHO_N "checking for XShapeCombineShape in -lXext... $ECHO_C" >&6
-+if test "${ac_cv_lib_Xext_XShapeCombineShape+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- ac_save_LIBS="$LIBS"
-+ ac_check_lib_save_LIBS=$LIBS
- LIBS="-lXext $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 2588 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char XShapeCombineShape();
--
--int main() {
--XShapeCombineShape()
--; return 0; }
--EOF
--if { (eval echo configure:2599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
--fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-- echo $ac_n "checking for X11/extensions/shape.h""... $ac_c" 1>&6
--echo "configure:2615: checking for X11/extensions/shape.h" >&5
-- cat > conftest.$ac_ext <<EOF
--#line 2617 "configure"
--#include "confdefs.h"
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char XShapeCombineShape ();
-+int
-+main ()
-+{
-+XShapeCombineShape ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_Xext_XShapeCombineShape=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_Xext_XShapeCombineShape=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XShapeCombineShape" >&5
-+echo "${ECHO_T}$ac_cv_lib_Xext_XShapeCombineShape" >&6
-+if test $ac_cv_lib_Xext_XShapeCombineShape = yes; then
-+ echo "$as_me:$LINENO: checking for X11/extensions/shape.h" >&5
-+echo $ECHO_N "checking for X11/extensions/shape.h... $ECHO_C" >&6
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
- #include <X11/Xlib.h>
- #include <X11/Xutil.h>
- #include <X11/extensions/shape.h>
-
--int main() {
-+int
-+main ()
-+{
- long foo = ShapeSet
--; return 0; }
--EOF
--if { (eval echo configure:2627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- echo "$ac_t""yes" 1>&6
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
- SHAPE="-DSHAPE"; Xext_lib="-lXext"
- else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- echo "$ac_t""no" 1>&6
--
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
-+
- fi
--rm -f conftest*
--
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+
-+fi
-+
- else
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
-+fi
-+
-+
-+LIBS="$LIBS $Xext_lib"
-+
-+LIBS="$LIBS $X_EXTRA_LIBS"
-+
-+Xext_lib=""
-+
-+XINERAMA=""
-+echo "$as_me:$LINENO: checking whether to build support for the Xinerama extension" >&5
-+echo $ECHO_N "checking whether to build support for the Xinerama extension... $ECHO_C" >&6
-+# Check whether --enable-xinerama or --disable-xinerama was given.
-+if test "${enable_xinerama+set}" = set; then
-+ enableval="$enable_xinerama"
-+
-+fi;
-+
-+: ${enableval="yes"}
-+if test x$enableval = "xyes"; then
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
-+ echo "$as_me:$LINENO: checking for XineramaQueryScreens in -lXinerama" >&5
-+echo $ECHO_N "checking for XineramaQueryScreens in -lXinerama... $ECHO_C" >&6
-+if test "${ac_cv_lib_Xinerama_XineramaQueryScreens+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ ac_check_lib_save_LIBS=$LIBS
-+LIBS="-lXinerama $LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char XineramaQueryScreens ();
-+int
-+main ()
-+{
-+XineramaQueryScreens ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_Xinerama_XineramaQueryScreens=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_Xinerama_XineramaQueryScreens=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_Xinerama_XineramaQueryScreens" >&5
-+echo "${ECHO_T}$ac_cv_lib_Xinerama_XineramaQueryScreens" >&6
-+if test $ac_cv_lib_Xinerama_XineramaQueryScreens = yes; then
-+ echo "$as_me:$LINENO: checking for X11/extensions/Xinerama.h" >&5
-+echo $ECHO_N "checking for X11/extensions/Xinerama.h... $ECHO_C" >&6
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-+#include <X11/Xlib.h>
-+#include <X11/Xutil.h>
-+#include <X11/extensions/Xinerama.h>
-+
-+int
-+main ()
-+{
-+XineramaScreenInfo* s = 0
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
-+ XINERAMA="-DXINERAMA"; Xext_lib="-lXext -lXinerama"
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
-+
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+
- fi
-
- else
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- fi
-
-
- LIBS="$LIBS $Xext_lib"
-
- ORDEREDPSEUDO=""
--echo $ac_n "checking whether to include Pseudocolor ordered dithering code""... $ac_c" 1>&6
--echo "configure:2653: checking whether to include Pseudocolor ordered dithering code" >&5
-+echo "$as_me:$LINENO: checking whether to include Pseudocolor ordered dithering code" >&5
-+echo $ECHO_N "checking whether to include Pseudocolor ordered dithering code... $ECHO_C" >&6
- # Check whether --enable-ordered-pseudo or --disable-ordered-pseudo was given.
- if test "${enable_ordered_pseudo+set}" = set; then
- enableval="$enable_ordered_pseudo"
- if test x$enableval = "xyes"; then
-- echo "$ac_t""yes" 1>&6
-- ORDEREDPSEUDO="-DORDEREDPSEUDO"
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
-+ ORDEREDPSEUDO="-DORDEREDPSEUDO"
- else
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- fi
- else
-- echo "$ac_t""no" 1>&6
--
--fi
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
-
-+fi;
-
-
- DEBUG=""
--echo $ac_n "checking whether to include verbose debugging code""... $ac_c" 1>&6
--echo "configure:2672: checking whether to include verbose debugging code" >&5
-+echo "$as_me:$LINENO: checking whether to include verbose debugging code" >&5
-+echo $ECHO_N "checking whether to include verbose debugging code... $ECHO_C" >&6
- # Check whether --enable-debug or --disable-debug was given.
- if test "${enable_debug+set}" = set; then
- enableval="$enable_debug"
- if test x$enableval = "xyes"; then
-- echo "$ac_t""yes" 1>&6
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
- if test x$GCC = "xyes"; then
- DEBUG="-DDEBUG -fno-inline -g"
- else
- DEBUG="-DDEBUG"
- fi
- else
-- echo "$ac_t""no" 1>&6
-- DEBUG="-DNDEBUG"
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
-+ DEBUG="-DNDEBUG"
- fi
- else
-- echo "$ac_t""no" 1>&6
-- DEBUG="-DNDEBUG"
--
--fi
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
-+ DEBUG="-DNDEBUG"
-
-+fi;
-
-
- NLS=""
--echo $ac_n "checking whether to include NLS support""... $ac_c" 1>&6
--echo "configure:2697: checking whether to include NLS support" >&5
-+echo "$as_me:$LINENO: checking whether to include NLS support" >&5
-+echo $ECHO_N "checking whether to include NLS support... $ECHO_C" >&6
- # Check whether --enable-nls or --disable-nls was given.
- if test "${enable_nls+set}" = set; then
- enableval="$enable_nls"
- if test x$enableval = "xyes"; then
-- echo "$ac_t""yes" 1>&6
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
- NLS="-DNLS"
- else
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- fi
- else
-- echo "$ac_t""yes" 1>&6
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
- NLS="-DNLS"
-
--fi
--
-+fi;
-
-
--echo $ac_n "checking for setlocale in -lxpg4""... $ac_c" 1>&6
--echo "configure:2716: checking for setlocale in -lxpg4" >&5
--ac_lib_var=`echo xpg4'_'setlocale | sed 'y%./+-%__p_%'`
--if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+echo "$as_me:$LINENO: checking for setlocale in -lxpg4" >&5
-+echo $ECHO_N "checking for setlocale in -lxpg4... $ECHO_C" >&6
-+if test "${ac_cv_lib_xpg4_setlocale+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-- ac_save_LIBS="$LIBS"
-+ ac_check_lib_save_LIBS=$LIBS
- LIBS="-lxpg4 $LIBS"
--cat > conftest.$ac_ext <<EOF
--#line 2724 "configure"
--#include "confdefs.h"
--/* Override any gcc2 internal prototype to avoid an error. */
--/* We use char because int might match the return type of a gcc2
-- builtin and then its argument prototype would still apply. */
--char setlocale();
--
--int main() {
--setlocale()
--; return 0; }
--EOF
--if { (eval echo configure:2735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=yes"
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- eval "ac_cv_lib_$ac_lib_var=no"
--fi
--rm -f conftest*
--LIBS="$ac_save_LIBS"
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
-
--fi
--if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-- echo "$ac_t""yes" 1>&6
-+/* Override any gcc2 internal prototype to avoid an error. */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char setlocale ();
-+int
-+main ()
-+{
-+setlocale ();
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+ (eval $ac_link) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest$ac_exeext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
-+ ac_cv_lib_xpg4_setlocale=yes
-+else
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_lib_xpg4_setlocale=no
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+ conftest$ac_exeext conftest.$ac_ext
-+LIBS=$ac_check_lib_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_lib_xpg4_setlocale" >&5
-+echo "${ECHO_T}$ac_cv_lib_xpg4_setlocale" >&6
-+if test $ac_cv_lib_xpg4_setlocale = yes; then
- LIBS="$LIBS -lxpg4"
--else
-- echo "$ac_t""no" 1>&6
- fi
-
-
- for ac_prog in gencat
- do
--# Extract the first word of "$ac_prog", so it can be a program name with args.
-+ # Extract the first word of "$ac_prog", so it can be a program name with args.
- set dummy $ac_prog; ac_word=$2
--echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
--echo "configure:2761: checking for $ac_word" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_gencat_cmd'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_gencat_cmd+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
- else
- if test -n "$gencat_cmd"; then
- ac_cv_prog_gencat_cmd="$gencat_cmd" # Let the user override the test.
- else
-- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
-- ac_dummy="$PATH"
-- for ac_dir in $ac_dummy; do
-- test -z "$ac_dir" && ac_dir=.
-- if test -f $ac_dir/$ac_word; then
-- ac_cv_prog_gencat_cmd="$ac_prog"
-- break
-- fi
-- done
-- IFS="$ac_save_ifs"
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for ac_exec_ext in '' $ac_executable_extensions; do
-+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+ ac_cv_prog_gencat_cmd="$ac_prog"
-+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+ break 2
-+ fi
-+done
-+done
-+
- fi
- fi
--gencat_cmd="$ac_cv_prog_gencat_cmd"
-+gencat_cmd=$ac_cv_prog_gencat_cmd
- if test -n "$gencat_cmd"; then
-- echo "$ac_t""$gencat_cmd" 1>&6
-+ echo "$as_me:$LINENO: result: $gencat_cmd" >&5
-+echo "${ECHO_T}$gencat_cmd" >&6
- else
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- fi
-
--test -n "$gencat_cmd" && break
-+ test -n "$gencat_cmd" && break
- done
-
- if test x$gencat_cmd = "x"; then
-@@ -2792,37 +6357,42 @@
-
-
- TIMEDCACHE=""
--echo $ac_n "checking whether to use the new timed pixmap cache""... $ac_c" 1>&6
--echo "configure:2797: checking whether to use the new timed pixmap cache" >&5
-+echo "$as_me:$LINENO: checking whether to use the new timed pixmap cache" >&5
-+echo $ECHO_N "checking whether to use the new timed pixmap cache... $ECHO_C" >&6
- # Check whether --enable-timed-cache or --disable-timed-cache was given.
- if test "${enable_timed_cache+set}" = set; then
- enableval="$enable_timed_cache"
- if test x$enableval = "xyes"; then
-- echo "$ac_t""yes" 1>&6
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
- TIMEDCACHE="-DTIMEDCACHE"
- else
-- echo "$ac_t""no" 1>&6
-+ echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
- fi
- else
-- echo "$ac_t""yes" 1>&6
-+ echo "$as_me:$LINENO: result: yes" >&5
-+echo "${ECHO_T}yes" >&6
- TIMEDCACHE="-DTIMEDCACHE"
-
--fi
--
-+fi;
-
-
--echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
--echo "configure:2816: checking return type of signal handlers" >&5
--if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- cat > conftest.$ac_ext <<EOF
--#line 2821 "configure"
--#include "confdefs.h"
-+echo "$as_me:$LINENO: checking return type of signal handlers" >&5
-+echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
-+if test "${ac_cv_type_signal+set}" = set; then
-+ echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+ cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h. */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h. */
- #include <sys/types.h>
- #include <signal.h>
- #ifdef signal
--#undef signal
-+# undef signal
- #endif
- #ifdef __cplusplus
- extern "C" void (*signal (int, void (*)(int)))(int);
-@@ -2830,41 +6400,65 @@
- void (*signal ()) ();
- #endif
-
--int main() {
-+int
-+main ()
-+{
- int i;
--; return 0; }
--EOF
--if { (eval echo configure:2838: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-- rm -rf conftest*
-+ ;
-+ return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext
-+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-+ (eval $ac_compile) 2>conftest.er1
-+ ac_status=$?
-+ grep -v '^ *+' conftest.er1 >conftest.err
-+ rm -f conftest.er1
-+ cat conftest.err >&5
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); } &&
-+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; } &&
-+ { ac_try='test -s conftest.$ac_objext'
-+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+ (eval $ac_try) 2>&5
-+ ac_status=$?
-+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+ (exit $ac_status); }; }; then
- ac_cv_type_signal=void
- else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- ac_cv_type_signal=int
-+ echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+ac_cv_type_signal=int
- fi
--rm -f conftest*
-+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
-+echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
-+echo "${ECHO_T}$ac_cv_type_signal" >&6
-
--echo "$ac_t""$ac_cv_type_signal" 1>&6
--cat >> confdefs.h <<EOF
-+cat >>confdefs.h <<_ACEOF
- #define RETSIGTYPE $ac_cv_type_signal
--EOF
-+_ACEOF
-
-
-
--echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
--echo "configure:2858: checking whether to enable maintainer-specific portions of Makefiles" >&5
-+echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
-+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
- # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
- if test "${enable_maintainer_mode+set}" = set; then
- enableval="$enable_maintainer_mode"
- USE_MAINTAINER_MODE=$enableval
- else
- USE_MAINTAINER_MODE=no
--fi
-+fi;
-+ echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
-+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6
-
-- echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
--
-
- if test $USE_MAINTAINER_MODE = yes; then
- MAINTAINER_MODE_TRUE=
-@@ -2874,460 +6468,1332 @@
- MAINTAINER_MODE_FALSE=
- fi
- MAINT=$MAINTAINER_MODE_TRUE
--
-
-
--echo "$ac_t""" 1>&6
--echo "$ac_t"" $PACKAGE version $VERSION configured successfully." 1>&6
--echo "$ac_t""" 1>&6
--echo "$ac_t""Using '$prefix' for installation." 1>&6
--echo "$ac_t""Using '$CXX' for C++ compiler." 1>&6
--echo "$ac_t""Building with '$CXXFLAGS' for C++ compiler flags." 1>&6
--echo "$ac_t""Building with '$LIBS' for linker flags." 1>&6
--echo "$ac_t""" 1>&6
-
-+echo "$as_me:$LINENO: result: " >&5
-+echo "${ECHO_T}" >&6
-+echo "$as_me:$LINENO: result: $PACKAGE version $VERSION configured successfully." >&5
-+echo "${ECHO_T} $PACKAGE version $VERSION configured successfully." >&6
-+echo "$as_me:$LINENO: result: " >&5
-+echo "${ECHO_T}" >&6
-+echo "$as_me:$LINENO: result: Using '$prefix' for installation." >&5
-+echo "${ECHO_T}Using '$prefix' for installation." >&6
-+echo "$as_me:$LINENO: result: Using '$CXX' for C++ compiler." >&5
-+echo "${ECHO_T}Using '$CXX' for C++ compiler." >&6
-+echo "$as_me:$LINENO: result: Building with '$CXXFLAGS' for C++ compiler flags." >&5
-+echo "${ECHO_T}Building with '$CXXFLAGS' for C++ compiler flags." >&6
-+echo "$as_me:$LINENO: result: Building with '$LIBS' for linker flags." >&5
-+echo "${ECHO_T}Building with '$LIBS' for linker flags." >&6
-+echo "$as_me:$LINENO: result: " >&5
-+echo "${ECHO_T}" >&6
-
-
-+ ac_config_headers="$ac_config_headers config.h"
-
--trap '' 1 2 15
--cat > confcache <<\EOF
-+ ac_config_commands="$ac_config_commands default-1"
-+
-+ ac_config_files="$ac_config_files Makefile src/Makefile util/Makefile data/Makefile data/styles/Makefile doc/Makefile nls/Makefile nls/C/Makefile nls/da_DK/Makefile nls/de_DE/Makefile nls/es_AR/Makefile nls/es_ES/Makefile nls/fr_FR/Makefile nls/hu_HU/Makefile nls/it_IT/Makefile nls/ja_JP/Makefile nls/ko_KR/Makefile nls/lv_LV/Makefile nls/nl_NL/Makefile nls/no_NO/Makefile nls/pl_PL/Makefile nls/pt_BR/Makefile nls/ro_RO/Makefile nls/ru_RU/Makefile nls/sk_SK/Makefile nls/sl_SI/Makefile nls/sv_SE/Makefile nls/uk_UA/Makefile nls/zh_CN/Makefile nls/zh_TW/Makefile version.h"
-+cat >confcache <<\_ACEOF
- # This file is a shell script that caches the results of configure
- # tests run on this system so they can be shared between configure
--# scripts and configure runs. It is not useful on other systems.
--# If it contains results you don't want to keep, you may remove or edit it.
-+# scripts and configure runs, see configure's option --config-cache.
-+# It is not useful on other systems. If it contains results you don't
-+# want to keep, you may remove or edit it.
- #
--# By default, configure uses ./config.cache as the cache file,
--# creating it if it does not exist already. You can give configure
--# the --cache-file=FILE option to use a different cache file; that is
--# what configure does when it calls configure scripts in
--# subdirectories, so they share the cache.
--# Giving --cache-file=/dev/null disables caching, for debugging configure.
--# config.status only pays attention to the cache file if you give it the
--# --recheck option to rerun configure.
-+# config.status only pays attention to the cache file if you give it
-+# the --recheck option to rerun configure.
- #
--EOF
-+# `ac_cv_env_foo' variables (set or unset) will be overridden when
-+# loading this file, other *unset* `ac_cv_foo' will be assigned the
-+# following values.
-+
-+_ACEOF
-+
- # The following way of writing the cache mishandles newlines in values,
- # but we know of no workaround that is simple, portable, and efficient.
- # So, don't put newlines in cache variables' values.
- # Ultrix sh set writes to stderr and can't be redirected directly,
- # and sets the high bit in the cache file unless we assign to the vars.
--(set) 2>&1 |
-- case `(ac_space=' '; set | grep ac_space) 2>&1` in
-- *ac_space=\ *)
-- # `set' does not quote correctly, so add quotes (double-quote substitution
-- # turns \\\\ into \\, and sed turns \\ into \).
-- sed -n \
-- -e "s/'/'\\\\''/g" \
-- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
-- ;;
-- *)
-- # `set' quotes correctly as required by POSIX, so do not add quotes.
-- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
-- ;;
-- esac >> confcache
--if cmp -s $cache_file confcache; then
-- :
--else
-+{
-+ (set) 2>&1 |
-+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
-+ *ac_space=\ *)
-+ # `set' does not quote correctly, so add quotes (double-quote
-+ # substitution turns \\\\ into \\, and sed turns \\ into \).
-+ sed -n \
-+ "s/'/'\\\\''/g;
-+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
-+ ;;
-+ *)
-+ # `set' quotes correctly as required by POSIX, so do not add quotes.
-+ sed -n \
-+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
-+ ;;
-+ esac;
-+} |
-+ sed '
-+ t clear
-+ : clear
-+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
-+ t end
-+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
-+ : end' >>confcache
-+if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
-- echo "updating cache $cache_file"
-- cat confcache > $cache_file
-+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
-+ cat confcache >$cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
- fi
- rm -f confcache
-
--trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
--
- test "x$prefix" = xNONE && prefix=$ac_default_prefix
- # Let make expand exec_prefix.
- test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
--# Any assignment to VPATH causes Sun make to only execute
--# the first set of double-colon rules, so remove it if not needed.
--# If there is a colon in the path, we need to keep it.
-+# VPATH may cause trouble with some makes, so we remove $(srcdir),
-+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-+# trailing colons and then remove the whole line if VPATH becomes empty
-+# (actually we leave an empty line to preserve line numbers).
- if test "x$srcdir" = x.; then
-- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
-+s/:*\$(srcdir):*/:/;
-+s/:*\${srcdir}:*/:/;
-+s/:*@srcdir@:*/:/;
-+s/^\([^=]*=[ ]*\):*/\1/;
-+s/:*$//;
-+s/^[^=]*=[ ]*$//;
-+}'
- fi
-
--trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
--
- DEFS=-DHAVE_CONFIG_H
-
--# Without the "./", some shells look in PATH for config.status.
--: ${CONFIG_STATUS=./config.status}
-+ac_libobjs=
-+ac_ltlibobjs=
-+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
-+ # 1. Remove the extension, and $U if already installed.
-+ ac_i=`echo "$ac_i" |
-+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
-+ # 2. Add them.
-+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
-+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
-+done
-+LIBOBJS=$ac_libobjs
-
--echo creating $CONFIG_STATUS
--rm -f $CONFIG_STATUS
--cat > $CONFIG_STATUS <<EOF
--#! /bin/sh
--# Generated automatically by configure.
-+LTLIBOBJS=$ac_ltlibobjs
-+
-+
-+
-+: ${CONFIG_STATUS=./config.status}
-+ac_clean_files_save=$ac_clean_files
-+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-+echo "$as_me: creating $CONFIG_STATUS" >&6;}
-+cat >$CONFIG_STATUS <<_ACEOF
-+#! $SHELL
-+# Generated by $as_me.
- # Run this file to recreate the current configuration.
--# This directory was configured as follows,
--# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
--#
--# $0 $ac_configure_args
--#
- # Compiler output produced by configure, useful for debugging
--# configure, is in ./config.log if it exists.
-+# configure, is in config.log if it exists.
-
--ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
--for ac_option
-+debug=false
-+ac_cs_recheck=false
-+ac_cs_silent=false
-+SHELL=\${CONFIG_SHELL-$SHELL}
-+_ACEOF
-+
-+cat >>$CONFIG_STATUS <<\_ACEOF
-+## --------------------- ##
-+## M4sh Initialization. ##
-+## --------------------- ##
-+
-+# Be Bourne compatible
-+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-+ emulate sh
-+ NULLCMD=:
-+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-+ # is contrary to our usage. Disable this feature.
-+ alias -g '${1+"$@"}'='"$@"'
-+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-+ set -o posix
-+fi
-+DUALCASE=1; export DUALCASE # for MKS sh
-+
-+# Support unset when possible.
-+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-+ as_unset=unset
-+else
-+ as_unset=false
-+fi
-+
-+
-+# Work around bugs in pre-3.0 UWIN ksh.
-+$as_unset ENV MAIL MAILPATH
-+PS1='$ '
-+PS2='> '
-+PS4='+ '
-+
-+# NLS nuisances.
-+for as_var in \
-+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-+ LC_TELEPHONE LC_TIME
-+do
-+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-+ eval $as_var=C; export $as_var
-+ else
-+ $as_unset $as_var
-+ fi
-+done
-+
-+# Required to use basename.
-+if expr a : '\(a\)' >/dev/null 2>&1; then
-+ as_expr=expr
-+else
-+ as_expr=false
-+fi
-+
-+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
-+ as_basename=basename
-+else
-+ as_basename=false
-+fi
-+
-+
-+# Name of the executable.
-+as_me=`$as_basename "$0" ||
-+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-+ X"$0" : 'X\(//\)$' \| \
-+ X"$0" : 'X\(/\)$' \| \
-+ . : '\(.\)' 2>/dev/null ||
-+echo X/"$0" |
-+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-+ /^X\/\(\/\/\)$/{ s//\1/; q; }
-+ /^X\/\(\/\).*/{ s//\1/; q; }
-+ s/.*/./; q'`
-+
-+
-+# PATH needs CR, and LINENO needs CR and PATH.
-+# Avoid depending upon Character Ranges.
-+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-+as_cr_digits='0123456789'
-+as_cr_alnum=$as_cr_Letters$as_cr_digits
-+
-+# The user is always right.
-+if test "${PATH_SEPARATOR+set}" != set; then
-+ echo "#! /bin/sh" >conf$$.sh
-+ echo "exit 0" >>conf$$.sh
-+ chmod +x conf$$.sh
-+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-+ PATH_SEPARATOR=';'
-+ else
-+ PATH_SEPARATOR=:
-+ fi
-+ rm -f conf$$.sh
-+fi
-+
-+
-+ as_lineno_1=$LINENO
-+ as_lineno_2=$LINENO
-+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-+ test "x$as_lineno_1" != "x$as_lineno_2" &&
-+ test "x$as_lineno_3" = "x$as_lineno_2" || {
-+ # Find who we are. Look in the path if we contain no path at all
-+ # relative or not.
-+ case $0 in
-+ *[\\/]* ) as_myself=$0 ;;
-+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-+done
-+
-+ ;;
-+ esac
-+ # We did not find ourselves, most probably we were run as `sh COMMAND'
-+ # in which case we are not to be found in the path.
-+ if test "x$as_myself" = x; then
-+ as_myself=$0
-+ fi
-+ if test ! -f "$as_myself"; then
-+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
-+ { (exit 1); exit 1; }; }
-+ fi
-+ case $CONFIG_SHELL in
-+ '')
-+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-+do
-+ IFS=$as_save_IFS
-+ test -z "$as_dir" && as_dir=.
-+ for as_base in sh bash ksh sh5; do
-+ case $as_dir in
-+ /*)
-+ if ("$as_dir/$as_base" -c '
-+ as_lineno_1=$LINENO
-+ as_lineno_2=$LINENO
-+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-+ test "x$as_lineno_1" != "x$as_lineno_2" &&
-+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
-+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-+ CONFIG_SHELL=$as_dir/$as_base
-+ export CONFIG_SHELL
-+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
-+ fi;;
-+ esac
-+ done
-+done
-+;;
-+ esac
-+
-+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-+ # uniformly replaced by the line number. The first 'sed' inserts a
-+ # line-number line before each line; the second 'sed' does the real
-+ # work. The second script uses 'N' to pair each line-number line
-+ # with the numbered line, and appends trailing '-' during
-+ # substitution so that $LINENO is not a special case at line end.
-+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
-+ sed '=' <$as_myself |
-+ sed '
-+ N
-+ s,$,-,
-+ : loop
-+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
-+ t loop
-+ s,-$,,
-+ s,^['$as_cr_digits']*\n,,
-+ ' >$as_me.lineno &&
-+ chmod +x $as_me.lineno ||
-+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
-+ { (exit 1); exit 1; }; }
-+
-+ # Don't try to exec as it changes $[0], causing all sort of problems
-+ # (the dirname of $[0] is not the place where we might find the
-+ # original and so on. Autoconf is especially sensible to this).
-+ . ./$as_me.lineno
-+ # Exit status is that of the last command.
-+ exit
-+}
-+
-+
-+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
-+ *c*,-n*) ECHO_N= ECHO_C='
-+' ECHO_T=' ' ;;
-+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
-+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-+esac
-+
-+if expr a : '\(a\)' >/dev/null 2>&1; then
-+ as_expr=expr
-+else
-+ as_expr=false
-+fi
-+
-+rm -f conf$$ conf$$.exe conf$$.file
-+echo >conf$$.file
-+if ln -s conf$$.file conf$$ 2>/dev/null; then
-+ # We could just check for DJGPP; but this test a) works b) is more generic
-+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
-+ if test -f conf$$.exe; then
-+ # Don't use ln at all; we don't have any links
-+ as_ln_s='cp -p'
-+ else
-+ as_ln_s='ln -s'
-+ fi
-+elif ln conf$$.file conf$$ 2>/dev/null; then
-+ as_ln_s=ln
-+else
-+ as_ln_s='cp -p'
-+fi
-+rm -f conf$$ conf$$.exe conf$$.file
-+
-+if mkdir -p . 2>/dev/null; then
-+ as_mkdir_p=:
-+else
-+ test -d ./-p && rmdir ./-p
-+ as_mkdir_p=false
-+fi
-+
-+as_executable_p="test -f"
-+
-+# Sed expression to map a string onto a valid CPP name.
-+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-+
-+# Sed expression to map a string onto a valid variable name.
-+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-+
-+
-+# IFS
-+# We need space, tab and new line, in precisely that order.
-+as_nl='
-+'
-+IFS=" $as_nl"
-+
-+# CDPATH.
-+$as_unset CDPATH
-+
-+exec 6>&1
-+
-+# Open the log real soon, to keep \$[0] and so on meaningful, and to
-+# report actual input values of CONFIG_FILES etc. instead of their
-+# values after options handling. Logging --version etc. is OK.
-+exec 5>>config.log
-+{
-+ echo
-+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-+## Running $as_me. ##
-+_ASBOX
-+} >&5
-+cat >&5 <<_CSEOF
-+
-+This file was extended by $as_me, which was
-+generated by GNU Autoconf 2.59. Invocation command line was
-+
-+ CONFIG_FILES = $CONFIG_FILES
-+ CONFIG_HEADERS = $CONFIG_HEADERS
-+ CONFIG_LINKS = $CONFIG_LINKS
-+ CONFIG_COMMANDS = $CONFIG_COMMANDS
-+ $ $0 $@
-+
-+_CSEOF
-+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-+echo >&5
-+_ACEOF
-+
-+# Files that config.status was made for.
-+if test -n "$ac_config_files"; then
-+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-+fi
-+
-+if test -n "$ac_config_headers"; then
-+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-+fi
-+
-+if test -n "$ac_config_links"; then
-+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-+fi
-+
-+if test -n "$ac_config_commands"; then
-+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-+fi
-+
-+cat >>$CONFIG_STATUS <<\_ACEOF
-+
-+ac_cs_usage="\
-+\`$as_me' instantiates files from templates according to the
-+current configuration.
-+
-+Usage: $0 [OPTIONS] [FILE]...
-+
-+ -h, --help print this help, then exit
-+ -V, --version print version number, then exit
-+ -q, --quiet do not print progress messages
-+ -d, --debug don't remove temporary files
-+ --recheck update $as_me by reconfiguring in the same conditions
-+ --file=FILE[:TEMPLATE]
-+ instantiate the configuration file FILE
-+ --header=FILE[:TEMPLATE]
-+ instantiate the configuration header FILE
-+
-+Configuration files:
-+$config_files
-+
-+Configuration headers:
-+$config_headers
-+
-+Configuration commands:
-+$config_commands
-+
-+Report bugs to <bug-autoconf@gnu.org>."
-+_ACEOF
-+
-+cat >>$CONFIG_STATUS <<_ACEOF
-+ac_cs_version="\\
-+config.status
-+configured by $0, generated by GNU Autoconf 2.59,
-+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
-+
-+Copyright (C) 2003 Free Software Foundation, Inc.
-+This config.status script is free software; the Free Software Foundation
-+gives unlimited permission to copy, distribute and modify it."
-+srcdir=$srcdir
-+INSTALL="$INSTALL"
-+_ACEOF
-+
-+cat >>$CONFIG_STATUS <<\_ACEOF
-+# If no file are specified by the user, then we need to provide default
-+# value. By we need to know if files were specified by the user.
-+ac_need_defaults=:
-+while test $# != 0
- do
-- case "\$ac_option" in
-+ case $1 in
-+ --*=*)
-+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
-+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
-+ ac_shift=:
-+ ;;
-+ -*)
-+ ac_option=$1
-+ ac_optarg=$2
-+ ac_shift=shift
-+ ;;
-+ *) # This is not an option, so the user has probably given explicit
-+ # arguments.
-+ ac_option=$1
-+ ac_need_defaults=false;;
-+ esac
-+
-+ case $ac_option in
-+ # Handling of the options.
-+_ACEOF
-+cat >>$CONFIG_STATUS <<\_ACEOF
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
-- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-- echo "$CONFIG_STATUS generated by autoconf version 2.13"
-- exit 0 ;;
-- -help | --help | --hel | --he | --h)
-- echo "\$ac_cs_usage"; exit 0 ;;
-- *) echo "\$ac_cs_usage"; exit 1 ;;
-+ ac_cs_recheck=: ;;
-+ --version | --vers* | -V )
-+ echo "$ac_cs_version"; exit 0 ;;
-+ --he | --h)
-+ # Conflict between --help and --header
-+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
-+Try \`$0 --help' for more information." >&5
-+echo "$as_me: error: ambiguous option: $1
-+Try \`$0 --help' for more information." >&2;}
-+ { (exit 1); exit 1; }; };;
-+ --help | --hel | -h )
-+ echo "$ac_cs_usage"; exit 0 ;;
-+ --debug | --d* | -d )
-+ debug=: ;;
-+ --file | --fil | --fi | --f )
-+ $ac_shift
-+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
-+ ac_need_defaults=false;;
-+ --header | --heade | --head | --hea )
-+ $ac_shift
-+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
-+ ac_need_defaults=false;;
-+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
-+ ac_cs_silent=: ;;
-+
-+ # This is an error.
-+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-+Try \`$0 --help' for more information." >&5
-+echo "$as_me: error: unrecognized option: $1
-+Try \`$0 --help' for more information." >&2;}
-+ { (exit 1); exit 1; }; } ;;
-+
-+ *) ac_config_targets="$ac_config_targets $1" ;;
-+
- esac
-+ shift
- done
-
--ac_given_srcdir=$srcdir
--ac_given_INSTALL="$INSTALL"
-+ac_configure_extra_args=
-
--trap 'rm -fr `echo "Makefile
--src/Makefile
--util/Makefile
--data/Makefile
--data/styles/Makefile
--doc/Makefile
--nls/Makefile
--nls/C/Makefile
--nls/da_DK/Makefile
--nls/de_DE/Makefile
--nls/es_AR/Makefile
--nls/es_ES/Makefile
--nls/fr_FR/Makefile
--nls/hu_HU/Makefile
--nls/it_IT/Makefile
--nls/ja_JP/Makefile
--nls/ko_KR/Makefile
--nls/lv_LV/Makefile
--nls/nl_NL/Makefile
--nls/no_NO/Makefile
--nls/pl_PL/Makefile
--nls/pt_BR/Makefile
--nls/ro_RO/Makefile
--nls/ru_RU/Makefile
--nls/sk_SK/Makefile
--nls/sl_SI/Makefile
--nls/sv_SE/Makefile
--nls/uk_UA/Makefile
--nls/zh_CN/Makefile
--nls/zh_TW/Makefile
--version.h config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
--EOF
--cat >> $CONFIG_STATUS <<EOF
--
--# Protect against being on the right side of a sed subst in config.status.
--sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
-- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
--$ac_vpsub
--$extrasub
--s%@SHELL@%$SHELL%g
--s%@CFLAGS@%$CFLAGS%g
--s%@CPPFLAGS@%$CPPFLAGS%g
--s%@CXXFLAGS@%$CXXFLAGS%g
--s%@FFLAGS@%$FFLAGS%g
--s%@DEFS@%$DEFS%g
--s%@LDFLAGS@%$LDFLAGS%g
--s%@LIBS@%$LIBS%g
--s%@exec_prefix@%$exec_prefix%g
--s%@prefix@%$prefix%g
--s%@program_transform_name@%$program_transform_name%g
--s%@bindir@%$bindir%g
--s%@sbindir@%$sbindir%g
--s%@libexecdir@%$libexecdir%g
--s%@datadir@%$datadir%g
--s%@sysconfdir@%$sysconfdir%g
--s%@sharedstatedir@%$sharedstatedir%g
--s%@localstatedir@%$localstatedir%g
--s%@libdir@%$libdir%g
--s%@includedir@%$includedir%g
--s%@oldincludedir@%$oldincludedir%g
--s%@infodir@%$infodir%g
--s%@mandir@%$mandir%g
--s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
--s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
--s%@INSTALL_DATA@%$INSTALL_DATA%g
--s%@PACKAGE@%$PACKAGE%g
--s%@VERSION@%$VERSION%g
--s%@ACLOCAL@%$ACLOCAL%g
--s%@AUTOCONF@%$AUTOCONF%g
--s%@AUTOMAKE@%$AUTOMAKE%g
--s%@AUTOHEADER@%$AUTOHEADER%g
--s%@MAKEINFO@%$MAKEINFO%g
--s%@SET_MAKE@%$SET_MAKE%g
--s%@CC@%$CC%g
--s%@CXX@%$CXX%g
--s%@regex_cmd@%$regex_cmd%g
--s%@CPP@%$CPP%g
--s%@X_CFLAGS@%$X_CFLAGS%g
--s%@X_PRE_LIBS@%$X_PRE_LIBS%g
--s%@X_LIBS@%$X_LIBS%g
--s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
--s%@SHAPE@%$SHAPE%g
--s%@ORDEREDPSEUDO@%$ORDEREDPSEUDO%g
--s%@DEBUG@%$DEBUG%g
--s%@NLS@%$NLS%g
--s%@gencat_cmd@%$gencat_cmd%g
--s%@TIMEDCACHE@%$TIMEDCACHE%g
--s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
--s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
--s%@MAINT@%$MAINT%g
-+if $ac_cs_silent; then
-+ exec 6>/dev/null
-+ ac_configure_extra_args="$ac_configure_extra_args --silent"
-+fi
-+
-+_ACEOF
-+cat >>$CONFIG_STATUS <<_ACEOF
-+if \$ac_cs_recheck; then
-+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
-+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-+fi
-+
-+_ACEOF
-+
-+cat >>$CONFIG_STATUS <<_ACEOF
-+#
-+# INIT-COMMANDS section.
-+#
-+
-+
-+
-+_ACEOF
-+
-+
-+
-+cat >>$CONFIG_STATUS <<\_ACEOF
-+for ac_config_target in $ac_config_targets
-+do
-+ case "$ac_config_target" in
-+ # Handling of arguments.
-+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-+ "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
-+ "util/Makefile" ) CONFIG_FILES="$CONFIG_FILES util/Makefile" ;;
-+ "data/Makefile" ) CONFIG_FILES="$CONFIG_FILES data/Makefile" ;;
-+ "data/styles/Makefile" ) CONFIG_FILES="$CONFIG_FILES data/styles/Makefile" ;;
-+ "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
-+ "nls/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/Makefile" ;;
-+ "nls/C/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/C/Makefile" ;;
-+ "nls/da_DK/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/da_DK/Makefile" ;;
-+ "nls/de_DE/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/de_DE/Makefile" ;;
-+ "nls/es_AR/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/es_AR/Makefile" ;;
-+ "nls/es_ES/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/es_ES/Makefile" ;;
-+ "nls/fr_FR/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/fr_FR/Makefile" ;;
-+ "nls/hu_HU/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/hu_HU/Makefile" ;;
-+ "nls/it_IT/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/it_IT/Makefile" ;;
-+ "nls/ja_JP/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/ja_JP/Makefile" ;;
-+ "nls/ko_KR/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/ko_KR/Makefile" ;;
-+ "nls/lv_LV/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/lv_LV/Makefile" ;;
-+ "nls/nl_NL/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/nl_NL/Makefile" ;;
-+ "nls/no_NO/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/no_NO/Makefile" ;;
-+ "nls/pl_PL/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/pl_PL/Makefile" ;;
-+ "nls/pt_BR/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/pt_BR/Makefile" ;;
-+ "nls/ro_RO/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/ro_RO/Makefile" ;;
-+ "nls/ru_RU/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/ru_RU/Makefile" ;;
-+ "nls/sk_SK/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/sk_SK/Makefile" ;;
-+ "nls/sl_SI/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/sl_SI/Makefile" ;;
-+ "nls/sv_SE/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/sv_SE/Makefile" ;;
-+ "nls/uk_UA/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/uk_UA/Makefile" ;;
-+ "nls/zh_CN/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/zh_CN/Makefile" ;;
-+ "nls/zh_TW/Makefile" ) CONFIG_FILES="$CONFIG_FILES nls/zh_TW/Makefile" ;;
-+ "version.h" ) CONFIG_FILES="$CONFIG_FILES version.h" ;;
-+ "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
-+ "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
-+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
-+ { (exit 1); exit 1; }; };;
-+ esac
-+done
-+
-+# If the user did not use the arguments to specify the items to instantiate,
-+# then the envvar interface is used. Set only those that are not.
-+# We use the long form for the default assignment because of an extremely
-+# bizarre bug on SunOS 4.1.3.
-+if $ac_need_defaults; then
-+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
-+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
-+fi
-+
-+# Have a temporary directory for convenience. Make it in the build tree
-+# simply because there is no reason to put it here, and in addition,
-+# creating and moving files from /tmp can sometimes cause problems.
-+# Create a temporary directory, and hook for its removal unless debugging.
-+$debug ||
-+{
-+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
-+ trap '{ (exit 1); exit 1; }' 1 2 13 15
-+}
-+
-+# Create a (secure) tmp directory for tmp files.
-+
-+{
-+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
-+ test -n "$tmp" && test -d "$tmp"
-+} ||
-+{
-+ tmp=./confstat$$-$RANDOM
-+ (umask 077 && mkdir $tmp)
-+} ||
-+{
-+ echo "$me: cannot create a temporary directory in ." >&2
-+ { (exit 1); exit 1; }
-+}
-+
-+_ACEOF
-+
-+cat >>$CONFIG_STATUS <<_ACEOF
-+
-+#
-+# CONFIG_FILES section.
-+#
-
-+# No need to generate the scripts if there are no CONFIG_FILES.
-+# This happens for instance when ./config.status config.h
-+if test -n "\$CONFIG_FILES"; then
-+ # Protect against being on the right side of a sed subst in config.status.
-+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
-+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-+s,@SHELL@,$SHELL,;t t
-+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-+s,@exec_prefix@,$exec_prefix,;t t
-+s,@prefix@,$prefix,;t t
-+s,@program_transform_name@,$program_transform_name,;t t
-+s,@bindir@,$bindir,;t t
-+s,@sbindir@,$sbindir,;t t
-+s,@libexecdir@,$libexecdir,;t t
-+s,@datadir@,$datadir,;t t
-+s,@sysconfdir@,$sysconfdir,;t t
-+s,@sharedstatedir@,$sharedstatedir,;t t
-+s,@localstatedir@,$localstatedir,;t t
-+s,@libdir@,$libdir,;t t
-+s,@includedir@,$includedir,;t t
-+s,@oldincludedir@,$oldincludedir,;t t
-+s,@infodir@,$infodir,;t t
-+s,@mandir@,$mandir,;t t
-+s,@build_alias@,$build_alias,;t t
-+s,@host_alias@,$host_alias,;t t
-+s,@target_alias@,$target_alias,;t t
-+s,@DEFS@,$DEFS,;t t
-+s,@ECHO_C@,$ECHO_C,;t t
-+s,@ECHO_N@,$ECHO_N,;t t
-+s,@ECHO_T@,$ECHO_T,;t t
-+s,@LIBS@,$LIBS,;t t
-+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
-+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
-+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
-+s,@PACKAGE@,$PACKAGE,;t t
-+s,@VERSION@,$VERSION,;t t
-+s,@ACLOCAL@,$ACLOCAL,;t t
-+s,@AUTOCONF@,$AUTOCONF,;t t
-+s,@AUTOMAKE@,$AUTOMAKE,;t t
-+s,@AUTOHEADER@,$AUTOHEADER,;t t
-+s,@MAKEINFO@,$MAKEINFO,;t t
-+s,@SET_MAKE@,$SET_MAKE,;t t
-+s,@CC@,$CC,;t t
-+s,@CFLAGS@,$CFLAGS,;t t
-+s,@LDFLAGS@,$LDFLAGS,;t t
-+s,@CPPFLAGS@,$CPPFLAGS,;t t
-+s,@ac_ct_CC@,$ac_ct_CC,;t t
-+s,@EXEEXT@,$EXEEXT,;t t
-+s,@OBJEXT@,$OBJEXT,;t t
-+s,@CXX@,$CXX,;t t
-+s,@CXXFLAGS@,$CXXFLAGS,;t t
-+s,@ac_ct_CXX@,$ac_ct_CXX,;t t
-+s,@regex_cmd@,$regex_cmd,;t t
-+s,@CPP@,$CPP,;t t
-+s,@EGREP@,$EGREP,;t t
-+s,@X_CFLAGS@,$X_CFLAGS,;t t
-+s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t
-+s,@X_LIBS@,$X_LIBS,;t t
-+s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t
-+s,@SHAPE@,$SHAPE,;t t
-+s,@XINERAMA@,$XINERAMA,;t t
-+s,@ORDEREDPSEUDO@,$ORDEREDPSEUDO,;t t
-+s,@DEBUG@,$DEBUG,;t t
-+s,@NLS@,$NLS,;t t
-+s,@gencat_cmd@,$gencat_cmd,;t t
-+s,@TIMEDCACHE@,$TIMEDCACHE,;t t
-+s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t
-+s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t
-+s,@MAINT@,$MAINT,;t t
-+s,@LIBOBJS@,$LIBOBJS,;t t
-+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
- CEOF
--EOF
-
--cat >> $CONFIG_STATUS <<\EOF
-+_ACEOF
-
--# Split the substitutions into bite-sized pieces for seds with
--# small command number limits, like on Digital OSF/1 and HP-UX.
--ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
--ac_file=1 # Number of current file.
--ac_beg=1 # First line for current file.
--ac_end=$ac_max_sed_cmds # Line after last line for current file.
--ac_more_lines=:
--ac_sed_cmds=""
--while $ac_more_lines; do
-- if test $ac_beg -gt 1; then
-- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
-- else
-- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
-- fi
-- if test ! -s conftest.s$ac_file; then
-- ac_more_lines=false
-- rm -f conftest.s$ac_file
-- else
-- if test -z "$ac_sed_cmds"; then
-- ac_sed_cmds="sed -f conftest.s$ac_file"
-+ cat >>$CONFIG_STATUS <<\_ACEOF
-+ # Split the substitutions into bite-sized pieces for seds with
-+ # small command number limits, like on Digital OSF/1 and HP-UX.
-+ ac_max_sed_lines=48
-+ ac_sed_frag=1 # Number of current file.
-+ ac_beg=1 # First line for current file.
-+ ac_end=$ac_max_sed_lines # Line after last line for current file.
-+ ac_more_lines=:
-+ ac_sed_cmds=
-+ while $ac_more_lines; do
-+ if test $ac_beg -gt 1; then
-+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
-+ else
-+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
-+ fi
-+ if test ! -s $tmp/subs.frag; then
-+ ac_more_lines=false
- else
-- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
-+ # The purpose of the label and of the branching condition is to
-+ # speed up the sed processing (if there are no `@' at all, there
-+ # is no need to browse any of the substitutions).
-+ # These are the two extra sed commands mentioned above.
-+ (echo ':t
-+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
-+ if test -z "$ac_sed_cmds"; then
-+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
-+ else
-+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
-+ fi
-+ ac_sed_frag=`expr $ac_sed_frag + 1`
-+ ac_beg=$ac_end
-+ ac_end=`expr $ac_end + $ac_max_sed_lines`
- fi
-- ac_file=`expr $ac_file + 1`
-- ac_beg=$ac_end
-- ac_end=`expr $ac_end + $ac_max_sed_cmds`
-- fi
--done
--if test -z "$ac_sed_cmds"; then
-- ac_sed_cmds=cat
--fi
--EOF
--
--cat >> $CONFIG_STATUS <<EOF
--
--CONFIG_FILES=\${CONFIG_FILES-"Makefile
--src/Makefile
--util/Makefile
--data/Makefile
--data/styles/Makefile
--doc/Makefile
--nls/Makefile
--nls/C/Makefile
--nls/da_DK/Makefile
--nls/de_DE/Makefile
--nls/es_AR/Makefile
--nls/es_ES/Makefile
--nls/fr_FR/Makefile
--nls/hu_HU/Makefile
--nls/it_IT/Makefile
--nls/ja_JP/Makefile
--nls/ko_KR/Makefile
--nls/lv_LV/Makefile
--nls/nl_NL/Makefile
--nls/no_NO/Makefile
--nls/pl_PL/Makefile
--nls/pt_BR/Makefile
--nls/ro_RO/Makefile
--nls/ru_RU/Makefile
--nls/sk_SK/Makefile
--nls/sl_SI/Makefile
--nls/sv_SE/Makefile
--nls/uk_UA/Makefile
--nls/zh_CN/Makefile
--nls/zh_TW/Makefile
--version.h"}
--EOF
--cat >> $CONFIG_STATUS <<\EOF
--for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
-+ done
-+ if test -z "$ac_sed_cmds"; then
-+ ac_sed_cmds=cat
-+ fi
-+fi # test -n "$CONFIG_FILES"
-+
-+_ACEOF
-+cat >>$CONFIG_STATUS <<\_ACEOF
-+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-- case "$ac_file" in
-- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
-- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-- *) ac_file_in="${ac_file}.in" ;;
-+ case $ac_file in
-+ - | *:- | *:-:* ) # input from stdin
-+ cat >$tmp/stdin
-+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-+ * ) ac_file_in=$ac_file.in ;;
- esac
-
-- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
--
-- # Remove last slash and all that follows it. Not all systems have dirname.
-- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
-- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-- # The file is in a subdirectory.
-- test ! -d "$ac_dir" && mkdir "$ac_dir"
-- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
-- # A "../" for each directory in $ac_dir_suffix.
-- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
-- else
-- ac_dir_suffix= ac_dots=
-- fi
--
-- case "$ac_given_srcdir" in
-- .) srcdir=.
-- if test -z "$ac_dots"; then top_srcdir=.
-- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
-- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
-+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
-+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-+ X"$ac_file" : 'X\(//\)[^/]' \| \
-+ X"$ac_file" : 'X\(//\)$' \| \
-+ X"$ac_file" : 'X\(/\)' \| \
-+ . : '\(.\)' 2>/dev/null ||
-+echo X"$ac_file" |
-+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-+ /^X\(\/\/\)$/{ s//\1/; q; }
-+ /^X\(\/\).*/{ s//\1/; q; }
-+ s/.*/./; q'`
-+ { if $as_mkdir_p; then
-+ mkdir -p "$ac_dir"
-+ else
-+ as_dir="$ac_dir"
-+ as_dirs=
-+ while test ! -d "$as_dir"; do
-+ as_dirs="$as_dir $as_dirs"
-+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
-+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-+ X"$as_dir" : 'X\(//\)[^/]' \| \
-+ X"$as_dir" : 'X\(//\)$' \| \
-+ X"$as_dir" : 'X\(/\)' \| \
-+ . : '\(.\)' 2>/dev/null ||
-+echo X"$as_dir" |
-+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-+ /^X\(\/\/\)$/{ s//\1/; q; }
-+ /^X\(\/\).*/{ s//\1/; q; }
-+ s/.*/./; q'`
-+ done
-+ test ! -n "$as_dirs" || mkdir $as_dirs
-+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
-+ { (exit 1); exit 1; }; }; }
-+
-+ ac_builddir=.
-+
-+if test "$ac_dir" != .; then
-+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-+ # A "../" for each directory in $ac_dir_suffix.
-+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-+else
-+ ac_dir_suffix= ac_top_builddir=
-+fi
-+
-+case $srcdir in
-+ .) # No --srcdir option. We are building in place.
-+ ac_srcdir=.
-+ if test -z "$ac_top_builddir"; then
-+ ac_top_srcdir=.
-+ else
-+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-+ fi ;;
-+ [\\/]* | ?:[\\/]* ) # Absolute path.
-+ ac_srcdir=$srcdir$ac_dir_suffix;
-+ ac_top_srcdir=$srcdir ;;
- *) # Relative path.
-- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
-- top_srcdir="$ac_dots$ac_given_srcdir" ;;
-+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
-+esac
-+
-+# Do not use `cd foo && pwd` to compute absolute paths, because
-+# the directories may not exist.
-+case `pwd` in
-+.) ac_abs_builddir="$ac_dir";;
-+*)
-+ case "$ac_dir" in
-+ .) ac_abs_builddir=`pwd`;;
-+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
-+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
-+ esac;;
-+esac
-+case $ac_abs_builddir in
-+.) ac_abs_top_builddir=${ac_top_builddir}.;;
-+*)
-+ case ${ac_top_builddir}. in
-+ .) ac_abs_top_builddir=$ac_abs_builddir;;
-+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
-+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
-+ esac;;
-+esac
-+case $ac_abs_builddir in
-+.) ac_abs_srcdir=$ac_srcdir;;
-+*)
-+ case $ac_srcdir in
-+ .) ac_abs_srcdir=$ac_abs_builddir;;
-+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
-+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
-+ esac;;
-+esac
-+case $ac_abs_builddir in
-+.) ac_abs_top_srcdir=$ac_top_srcdir;;
-+*)
-+ case $ac_top_srcdir in
-+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
-+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
-+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
-+ esac;;
-+esac
-+
-+
-+ case $INSTALL in
-+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
-+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
- esac
-
-- case "$ac_given_INSTALL" in
-- [/$]*) INSTALL="$ac_given_INSTALL" ;;
-- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
-- esac
-+ # Let's still pretend it is `configure' which instantiates (i.e., don't
-+ # use $as_me), people would be surprised to read:
-+ # /* config.h. Generated by config.status. */
-+ if test x"$ac_file" = x-; then
-+ configure_input=
-+ else
-+ configure_input="$ac_file. "
-+ fi
-+ configure_input=$configure_input"Generated from `echo $ac_file_in |
-+ sed 's,.*/,,'` by configure."
-
-- echo creating "$ac_file"
-- rm -f "$ac_file"
-- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
-- case "$ac_file" in
-- *Makefile*) ac_comsub="1i\\
--# $configure_input" ;;
-- *) ac_comsub= ;;
-- esac
-+ # First look for the input files in the build tree, otherwise in the
-+ # src tree.
-+ ac_file_inputs=`IFS=:
-+ for f in $ac_file_in; do
-+ case $f in
-+ -) echo $tmp/stdin ;;
-+ [\\/$]*)
-+ # Absolute (can't be DOS-style, as IFS=:)
-+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-+echo "$as_me: error: cannot find input file: $f" >&2;}
-+ { (exit 1); exit 1; }; }
-+ echo "$f";;
-+ *) # Relative
-+ if test -f "$f"; then
-+ # Build tree
-+ echo "$f"
-+ elif test -f "$srcdir/$f"; then
-+ # Source tree
-+ echo "$srcdir/$f"
-+ else
-+ # /dev/null tree
-+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-+echo "$as_me: error: cannot find input file: $f" >&2;}
-+ { (exit 1); exit 1; }; }
-+ fi;;
-+ esac
-+ done` || { (exit 1); exit 1; }
-+
-+ if test x"$ac_file" != x-; then
-+ { echo "$as_me:$LINENO: creating $ac_file" >&5
-+echo "$as_me: creating $ac_file" >&6;}
-+ rm -f "$ac_file"
-+ fi
-+_ACEOF
-+cat >>$CONFIG_STATUS <<_ACEOF
-+ sed "$ac_vpsub
-+$extrasub
-+_ACEOF
-+cat >>$CONFIG_STATUS <<\_ACEOF
-+:t
-+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-+s,@configure_input@,$configure_input,;t t
-+s,@srcdir@,$ac_srcdir,;t t
-+s,@abs_srcdir@,$ac_abs_srcdir,;t t
-+s,@top_srcdir@,$ac_top_srcdir,;t t
-+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-+s,@builddir@,$ac_builddir,;t t
-+s,@abs_builddir@,$ac_abs_builddir,;t t
-+s,@top_builddir@,$ac_top_builddir,;t t
-+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-+s,@INSTALL@,$ac_INSTALL,;t t
-+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
-+ rm -f $tmp/stdin
-+ if test x"$ac_file" != x-; then
-+ mv $tmp/out $ac_file
-+ else
-+ cat $tmp/out
-+ rm -f $tmp/out
-+ fi
-+
-+done
-+_ACEOF
-+cat >>$CONFIG_STATUS <<\_ACEOF
-
-- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
-- sed -e "$ac_comsub
--s%@configure_input@%$configure_input%g
--s%@srcdir@%$srcdir%g
--s%@top_srcdir@%$top_srcdir%g
--s%@INSTALL@%$INSTALL%g
--" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
--fi; done
--rm -f conftest.s*
-+#
-+# CONFIG_HEADER section.
-+#
-
- # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
- # NAME is the cpp macro being defined and VALUE is the value it is being given.
- #
- # ac_d sets the value in "#define NAME VALUE" lines.
--ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
--ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
--ac_dC='\3'
--ac_dD='%g'
--# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
--ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
--ac_uB='\([ ]\)%\1#\2define\3'
-+ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-+ac_dB='[ ].*$,\1#\2'
-+ac_dC=' '
-+ac_dD=',;t'
-+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-+ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-+ac_uB='$,\1#\2define\3'
- ac_uC=' '
--ac_uD='\4%g'
--# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
--ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
--ac_eB='$%\1#\2define\3'
--ac_eC=' '
--ac_eD='%g'
--
--if test "${CONFIG_HEADERS+set}" != set; then
--EOF
--cat >> $CONFIG_STATUS <<EOF
-- CONFIG_HEADERS="config.h"
--EOF
--cat >> $CONFIG_STATUS <<\EOF
--fi
--for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
-+ac_uD=',;t'
-+
-+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-- case "$ac_file" in
-- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
-- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-- *) ac_file_in="${ac_file}.in" ;;
-+ case $ac_file in
-+ - | *:- | *:-:* ) # input from stdin
-+ cat >$tmp/stdin
-+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-+ * ) ac_file_in=$ac_file.in ;;
- esac
-
-- echo creating $ac_file
-+ test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
-+echo "$as_me: creating $ac_file" >&6;}
-
-- rm -f conftest.frag conftest.in conftest.out
-- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
-- cat $ac_file_inputs > conftest.in
--
--EOF
--
--# Transform confdefs.h into a sed script conftest.vals that substitutes
--# the proper values into config.h.in to produce config.h. And first:
--# Protect against being on the right side of a sed subst in config.status.
--# Protect against being in an unquoted here document in config.status.
--rm -f conftest.vals
--cat > conftest.hdr <<\EOF
--s/[\\&%]/\\&/g
--s%[\\$`]%\\&%g
--s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
--s%ac_d%ac_u%gp
--s%ac_u%ac_e%gp
--EOF
--sed -n -f conftest.hdr confdefs.h > conftest.vals
--rm -f conftest.hdr
-+ # First look for the input files in the build tree, otherwise in the
-+ # src tree.
-+ ac_file_inputs=`IFS=:
-+ for f in $ac_file_in; do
-+ case $f in
-+ -) echo $tmp/stdin ;;
-+ [\\/$]*)
-+ # Absolute (can't be DOS-style, as IFS=:)
-+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-+echo "$as_me: error: cannot find input file: $f" >&2;}
-+ { (exit 1); exit 1; }; }
-+ # Do quote $f, to prevent DOS paths from being IFS'd.
-+ echo "$f";;
-+ *) # Relative
-+ if test -f "$f"; then
-+ # Build tree
-+ echo "$f"
-+ elif test -f "$srcdir/$f"; then
-+ # Source tree
-+ echo "$srcdir/$f"
-+ else
-+ # /dev/null tree
-+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-+echo "$as_me: error: cannot find input file: $f" >&2;}
-+ { (exit 1); exit 1; }; }
-+ fi;;
-+ esac
-+ done` || { (exit 1); exit 1; }
-+ # Remove the trailing spaces.
-+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
-+
-+_ACEOF
-+
-+# Transform confdefs.h into two sed scripts, `conftest.defines' and
-+# `conftest.undefs', that substitutes the proper values into
-+# config.h.in to produce config.h. The first handles `#define'
-+# templates, and the second `#undef' templates.
-+# And first: Protect against being on the right side of a sed subst in
-+# config.status. Protect against being in an unquoted here document
-+# in config.status.
-+rm -f conftest.defines conftest.undefs
-+# Using a here document instead of a string reduces the quoting nightmare.
-+# Putting comments in sed scripts is not portable.
-+#
-+# `end' is used to avoid that the second main sed command (meant for
-+# 0-ary CPP macros) applies to n-ary macro definitions.
-+# See the Autoconf documentation for `clear'.
-+cat >confdef2sed.sed <<\_ACEOF
-+s/[\\&,]/\\&/g
-+s,[\\$`],\\&,g
-+t clear
-+: clear
-+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
-+t end
-+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
-+: end
-+_ACEOF
-+# If some macros were called several times there might be several times
-+# the same #defines, which is useless. Nevertheless, we may not want to
-+# sort them, since we want the *last* AC-DEFINE to be honored.
-+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
-+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
-+rm -f confdef2sed.sed
-
- # This sed command replaces #undef with comments. This is necessary, for
- # example, in the case of _POSIX_SOURCE, which is predefined and required
- # on some systems where configure will not decide to define it.
--cat >> conftest.vals <<\EOF
--s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
--EOF
--
--# Break up conftest.vals because some shells have a limit on
--# the size of here documents, and old seds have small limits too.
--
-+cat >>conftest.undefs <<\_ACEOF
-+s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
-+_ACEOF
-+
-+# Break up conftest.defines because some shells have a limit on the size
-+# of here documents, and old seds have small limits too (100 cmds).
-+echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
-+echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
-+echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
-+echo ' :' >>$CONFIG_STATUS
- rm -f conftest.tail
--while :
-+while grep . conftest.defines >/dev/null
- do
-- ac_lines=`grep -c . conftest.vals`
-- # grep -c gives empty output for an empty file on some AIX systems.
-- if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
-- # Write a limited-size here document to conftest.frag.
-- echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
-- sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
-+ # Write a limited-size here document to $tmp/defines.sed.
-+ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
-+ # Speed up: don't consider the non `#define' lines.
-+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
-+ # Work around the forget-to-reset-the-flag bug.
-+ echo 't clr' >>$CONFIG_STATUS
-+ echo ': clr' >>$CONFIG_STATUS
-+ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
- echo 'CEOF
-- sed -f conftest.frag conftest.in > conftest.out
-- rm -f conftest.in
-- mv conftest.out conftest.in
--' >> $CONFIG_STATUS
-- sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
-- rm -f conftest.vals
-- mv conftest.tail conftest.vals
--done
--rm -f conftest.vals
--
--cat >> $CONFIG_STATUS <<\EOF
-- rm -f conftest.frag conftest.h
-- echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
-- cat conftest.in >> conftest.h
-- rm -f conftest.in
-- if cmp -s $ac_file conftest.h 2>/dev/null; then
-- echo "$ac_file is unchanged"
-- rm -f conftest.h
-- else
-- # Remove last slash and all that follows it. Not all systems have dirname.
-- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
-- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-- # The file is in a subdirectory.
-- test ! -d "$ac_dir" && mkdir "$ac_dir"
-- fi
-- rm -f $ac_file
-- mv conftest.h $ac_file
-+ sed -f $tmp/defines.sed $tmp/in >$tmp/out
-+ rm -f $tmp/in
-+ mv $tmp/out $tmp/in
-+' >>$CONFIG_STATUS
-+ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
-+ rm -f conftest.defines
-+ mv conftest.tail conftest.defines
-+done
-+rm -f conftest.defines
-+echo ' fi # grep' >>$CONFIG_STATUS
-+echo >>$CONFIG_STATUS
-+
-+# Break up conftest.undefs because some shells have a limit on the size
-+# of here documents, and old seds have small limits too (100 cmds).
-+echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
-+rm -f conftest.tail
-+while grep . conftest.undefs >/dev/null
-+do
-+ # Write a limited-size here document to $tmp/undefs.sed.
-+ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
-+ # Speed up: don't consider the non `#undef'
-+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
-+ # Work around the forget-to-reset-the-flag bug.
-+ echo 't clr' >>$CONFIG_STATUS
-+ echo ': clr' >>$CONFIG_STATUS
-+ sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
-+ echo 'CEOF
-+ sed -f $tmp/undefs.sed $tmp/in >$tmp/out
-+ rm -f $tmp/in
-+ mv $tmp/out $tmp/in
-+' >>$CONFIG_STATUS
-+ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
-+ rm -f conftest.undefs
-+ mv conftest.tail conftest.undefs
-+done
-+rm -f conftest.undefs
-+
-+cat >>$CONFIG_STATUS <<\_ACEOF
-+ # Let's still pretend it is `configure' which instantiates (i.e., don't
-+ # use $as_me), people would be surprised to read:
-+ # /* config.h. Generated by config.status. */
-+ if test x"$ac_file" = x-; then
-+ echo "/* Generated by configure. */" >$tmp/config.h
-+ else
-+ echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
- fi
--fi; done
-+ cat $tmp/in >>$tmp/config.h
-+ rm -f $tmp/in
-+ if test x"$ac_file" != x-; then
-+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
-+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
-+echo "$as_me: $ac_file is unchanged" >&6;}
-+ else
-+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-+ X"$ac_file" : 'X\(//\)[^/]' \| \
-+ X"$ac_file" : 'X\(//\)$' \| \
-+ X"$ac_file" : 'X\(/\)' \| \
-+ . : '\(.\)' 2>/dev/null ||
-+echo X"$ac_file" |
-+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-+ /^X\(\/\/\)$/{ s//\1/; q; }
-+ /^X\(\/\).*/{ s//\1/; q; }
-+ s/.*/./; q'`
-+ { if $as_mkdir_p; then
-+ mkdir -p "$ac_dir"
-+ else
-+ as_dir="$ac_dir"
-+ as_dirs=
-+ while test ! -d "$as_dir"; do
-+ as_dirs="$as_dir $as_dirs"
-+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
-+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-+ X"$as_dir" : 'X\(//\)[^/]' \| \
-+ X"$as_dir" : 'X\(//\)$' \| \
-+ X"$as_dir" : 'X\(/\)' \| \
-+ . : '\(.\)' 2>/dev/null ||
-+echo X"$as_dir" |
-+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-+ /^X\(\/\/\)$/{ s//\1/; q; }
-+ /^X\(\/\).*/{ s//\1/; q; }
-+ s/.*/./; q'`
-+ done
-+ test ! -n "$as_dirs" || mkdir $as_dirs
-+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
-+ { (exit 1); exit 1; }; }; }
-
--EOF
--cat >> $CONFIG_STATUS <<EOF
-+ rm -f $ac_file
-+ mv $tmp/config.h $ac_file
-+ fi
-+ else
-+ cat $tmp/config.h
-+ rm -f $tmp/config.h
-+ fi
-+done
-+_ACEOF
-+cat >>$CONFIG_STATUS <<\_ACEOF
-
-+#
-+# CONFIG_COMMANDS section.
-+#
-+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
-+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
-+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
-+ ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
-+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-+ X"$ac_dest" : 'X\(//\)[^/]' \| \
-+ X"$ac_dest" : 'X\(//\)$' \| \
-+ X"$ac_dest" : 'X\(/\)' \| \
-+ . : '\(.\)' 2>/dev/null ||
-+echo X"$ac_dest" |
-+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-+ /^X\(\/\/\)$/{ s//\1/; q; }
-+ /^X\(\/\).*/{ s//\1/; q; }
-+ s/.*/./; q'`
-+ { if $as_mkdir_p; then
-+ mkdir -p "$ac_dir"
-+ else
-+ as_dir="$ac_dir"
-+ as_dirs=
-+ while test ! -d "$as_dir"; do
-+ as_dirs="$as_dir $as_dirs"
-+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
-+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-+ X"$as_dir" : 'X\(//\)[^/]' \| \
-+ X"$as_dir" : 'X\(//\)$' \| \
-+ X"$as_dir" : 'X\(/\)' \| \
-+ . : '\(.\)' 2>/dev/null ||
-+echo X"$as_dir" |
-+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-+ /^X\(\/\/\)$/{ s//\1/; q; }
-+ /^X\(\/\).*/{ s//\1/; q; }
-+ s/.*/./; q'`
-+ done
-+ test ! -n "$as_dirs" || mkdir $as_dirs
-+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
-+ { (exit 1); exit 1; }; }; }
-+
-+ ac_builddir=.
-+
-+if test "$ac_dir" != .; then
-+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-+ # A "../" for each directory in $ac_dir_suffix.
-+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-+else
-+ ac_dir_suffix= ac_top_builddir=
-+fi
-+
-+case $srcdir in
-+ .) # No --srcdir option. We are building in place.
-+ ac_srcdir=.
-+ if test -z "$ac_top_builddir"; then
-+ ac_top_srcdir=.
-+ else
-+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-+ fi ;;
-+ [\\/]* | ?:[\\/]* ) # Absolute path.
-+ ac_srcdir=$srcdir$ac_dir_suffix;
-+ ac_top_srcdir=$srcdir ;;
-+ *) # Relative path.
-+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
-+esac
-+
-+# Do not use `cd foo && pwd` to compute absolute paths, because
-+# the directories may not exist.
-+case `pwd` in
-+.) ac_abs_builddir="$ac_dir";;
-+*)
-+ case "$ac_dir" in
-+ .) ac_abs_builddir=`pwd`;;
-+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
-+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
-+ esac;;
-+esac
-+case $ac_abs_builddir in
-+.) ac_abs_top_builddir=${ac_top_builddir}.;;
-+*)
-+ case ${ac_top_builddir}. in
-+ .) ac_abs_top_builddir=$ac_abs_builddir;;
-+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
-+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
-+ esac;;
-+esac
-+case $ac_abs_builddir in
-+.) ac_abs_srcdir=$ac_srcdir;;
-+*)
-+ case $ac_srcdir in
-+ .) ac_abs_srcdir=$ac_abs_builddir;;
-+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
-+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
-+ esac;;
-+esac
-+case $ac_abs_builddir in
-+.) ac_abs_top_srcdir=$ac_top_srcdir;;
-+*)
-+ case $ac_top_srcdir in
-+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
-+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
-+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
-+ esac;;
-+esac
-+
-+
-+ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
-+echo "$as_me: executing $ac_dest commands" >&6;}
-+ case $ac_dest in
-+ default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;;
-+ esac
-+done
-+_ACEOF
-
--EOF
--cat >> $CONFIG_STATUS <<\EOF
--test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
-+cat >>$CONFIG_STATUS <<\_ACEOF
-
--exit 0
--EOF
-+{ (exit 0); exit 0; }
-+_ACEOF
- chmod +x $CONFIG_STATUS
--rm -fr confdefs* $ac_clean_files
--test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-+ac_clean_files=$ac_clean_files_save
-+
-+
-+# configure is writing to config.log, and then calls config.status.
-+# config.status does its own redirection, appending to config.log.
-+# Unfortunately, on DOS this fails, as config.log is still kept open
-+# by configure, so config.status won't be able to write to it; its
-+# output is simply discarded. So we exec the FD to /dev/null,
-+# effectively closing config.log, so it can be properly (re)opened and
-+# appended to by config.status. When coming back to configure, we
-+# need to make the FD available again.
-+if test "$no_create" != yes; then
-+ ac_cs_success=:
-+ ac_config_status_args=
-+ test "$silent" = yes &&
-+ ac_config_status_args="$ac_config_status_args --quiet"
-+ exec 5>/dev/null
-+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
-+ exec 5>>config.log
-+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
-+ # would make configure fail if this is the last instruction.
-+ $ac_cs_success || { (exit 1); exit 1; }
-+fi
-
---- blackbox-0.65.0.orig/configure.in
-+++ blackbox-0.65.0/configure.in
-@@ -106,6 +106,38 @@
-
- LIBS="$LIBS $Xext_lib"
-
-+LIBS="$LIBS $X_EXTRA_LIBS"
-+
-+Xext_lib=""
-+
-+dnl Check for Xinerama extension support and proper library files.
-+XINERAMA=""
-+AC_MSG_CHECKING([whether to build support for the Xinerama extension])
-+AC_ARG_ENABLE(
-+ xinerama, [ --enable-xinerama enable support of the xinerama extension [default=yes]])
-+
-+: ${enableval="yes"}
-+if test x$enableval = "xyes"; then
-+ AC_MSG_RESULT([yes])
-+ AC_CHECK_LIB(Xinerama, XineramaQueryScreens,
-+ AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
-+ AC_TRY_LINK(
-+#include <X11/Xlib.h>
-+#include <X11/Xutil.h>
-+#include <X11/extensions/Xinerama.h>
-+, XineramaScreenInfo* s = 0,
-+ AC_MSG_RESULT([yes])
-+ XINERAMA="-DXINERAMA"; Xext_lib="-lXext -lXinerama",
-+ AC_MSG_RESULT([no])
-+ )
-+ )
-+else
-+ AC_MSG_RESULT([no])
-+fi
-+AC_SUBST(XINERAMA)
-+
-+LIBS="$LIBS $Xext_lib"
-+
- dnl Check for ordered 8bpp dithering
- ORDEREDPSEUDO=""
- AC_MSG_CHECKING([whether to include Pseudocolor ordered dithering code])
---- blackbox-0.65.0.orig/doc/blackbox.1.in
-+++ blackbox-0.65.0/doc/blackbox.1.in
-@@ -786,6 +786,13 @@
- .EX
- .B Default is False.
- .EE
-+.TP 3
-+.BI "session.screen<num>.slit.xineramaPlacement" " [True|False]"
-+Determines whether Xinerama inforation should be used to
-+avoid placing the slit in non-viewable regions of the display.
-+.EX
-+.B Default is True.
-+.EE
- .\"
- .\" ***** MENU CONFIGURABLE FROM MAIN MENU *****
- .\"
-@@ -845,6 +852,24 @@
- .B Default is TopToBottom.
- .EE
- .TP 3
-+.BI "session.screen<num>.xineramaPlacement" " [True|False]"
-+Use Xinerama information when deciding where to place windows.
-+.EX
-+.B Default is True.
-+.EE
-+.TP 3
-+.BI "session.screen<num>.xineramaMenus" " [True|False]"
-+Use Xinerama information to avoid menus spanning screen boundaries.
-+.EX
-+.B Default is True.
-+.EE
-+.TP 3
-+.BI "session.screen<num>.xineramaMaximize" " [True|False]"
-+Maximize windows to fill one screen when Xineramam is in use.
-+.EX
-+.B Default is True.
-+.EE
-+.TP 3
- .BI "session.imageDither" " [True|False]"
- This setting is only used when running in low
- color modes. Image Dithering helps to show an
-@@ -951,6 +976,19 @@
- .EX
- .B Default is False.
- .EE
-+.TP 3
-+.BI "session.screen<num>.toolbar.xineramaPlacement" " [True|False]"
-+Use Xinerama information to prevent toolbar from being split
-+across screens.
-+.EX
-+.B Default is True.
-+.EE
-+.TP 3
-+.BI "session.screen<num>.toolbar.xineramaScreen" " [integer]"
-+Xinerama screen number in which to place the toolbar.
-+.EX
-+.B Default is -1 (auto).
-+.EE
- .\"
- .\" ***** CONFIGURABLE IN BLACKBOXRC ONLY *****
- .\"
---- blackbox-0.65.0.orig/nls/C/Configmenu.m
-+++ blackbox-0.65.0/nls/C/Configmenu.m
-@@ -40,3 +40,13 @@
- # Top to Bottom
- $ #BottomTop
- # Bottom to Top
-+$ #XineramaOptions
-+# Xinerama Options
-+$ #XineramaPlacement
-+# Window Placement
-+$ #XineramaMaximize
-+# Window Maximizing
-+$ #XineramaToolbar
-+# Toolbar Placement
-+$ #XineramaMenus
-+# Menu Placement
---- blackbox-0.65.0.orig/nls/C/Toolbar.m
-+++ blackbox-0.65.0/nls/C/Toolbar.m
-@@ -20,3 +20,7 @@
- # Edit current workspace name
- $ #ToolbarPlacement
- # Toolbar Placement
-+$ #ScreenTop
-+# Screen %d Top
-+$ #ScreenBottom
-+# Screen %d Bottom
---- blackbox-0.65.0.orig/nls/convert.awk
-+++ blackbox-0.65.0/nls/convert.awk
-@@ -4,6 +4,8 @@
-
- if (major > 1)
- printf "\n" > output
-+ else if (codeset)
-+ printf "$ codeset=%s\n", codeset > output
- printf "$set %d %s\n", major, $3 > output
-
- if (header) {
---- blackbox-0.65.0.orig/nls/da_DK/Makefile.am
-+++ blackbox-0.65.0/nls/da_DK/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/da_DK/Makefile.in
-+++ blackbox-0.65.0/nls/da_DK/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/de_DE/Makefile.am
-+++ blackbox-0.65.0/nls/de_DE/Makefile.am
-@@ -26,7 +26,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/de_DE/Makefile.in
-+++ blackbox-0.65.0/nls/de_DE/Makefile.in
-@@ -200,7 +200,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/es_ES/Makefile.am
-+++ blackbox-0.65.0/nls/es_ES/Makefile.am
-@@ -28,7 +28,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/es_ES/Makefile.in
-+++ blackbox-0.65.0/nls/es_ES/Makefile.in
-@@ -202,7 +202,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/fr_FR/Makefile.am
-+++ blackbox-0.65.0/nls/fr_FR/Makefile.am
-@@ -26,7 +26,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/fr_FR/Makefile.in
-+++ blackbox-0.65.0/nls/fr_FR/Makefile.in
-@@ -200,7 +200,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/hu_HU/Makefile.am
-+++ blackbox-0.65.0/nls/hu_HU/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-2 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/hu_HU/Makefile.in
-+++ blackbox-0.65.0/nls/hu_HU/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-2 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/it_IT/Makefile.am
-+++ blackbox-0.65.0/nls/it_IT/Makefile.am
-@@ -26,7 +26,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/it_IT/Makefile.in
-+++ blackbox-0.65.0/nls/it_IT/Makefile.in
-@@ -200,7 +200,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/ja_JP/Makefile.am
-+++ blackbox-0.65.0/nls/ja_JP/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=eucJP output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/ja_JP/Makefile.in
-+++ blackbox-0.65.0/nls/ja_JP/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=eucJP output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/ko_KR/Makefile.am
-+++ blackbox-0.65.0/nls/ko_KR/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=eucKR output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/ko_KR/Makefile.in
-+++ blackbox-0.65.0/nls/ko_KR/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=eucKR output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/nl_NL/Makefile.am
-+++ blackbox-0.65.0/nls/nl_NL/Makefile.am
-@@ -26,7 +26,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/nl_NL/Makefile.in
-+++ blackbox-0.65.0/nls/nl_NL/Makefile.in
-@@ -200,7 +200,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/no_NO/Makefile.am
-+++ blackbox-0.65.0/nls/no_NO/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/no_NO/Makefile.in
-+++ blackbox-0.65.0/nls/no_NO/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/pt_BR/Makefile.am
-+++ blackbox-0.65.0/nls/pt_BR/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/pt_BR/Makefile.in
-+++ blackbox-0.65.0/nls/pt_BR/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/ru_RU/Makefile.am
-+++ blackbox-0.65.0/nls/ru_RU/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=KOI8-R output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/ru_RU/Makefile.in
-+++ blackbox-0.65.0/nls/ru_RU/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=KOI8-R output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/sl_SI/Makefile.am
-+++ blackbox-0.65.0/nls/sl_SI/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-2 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/sl_SI/Makefile.in
-+++ blackbox-0.65.0/nls/sl_SI/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-2 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/sv_SE/Makefile.am
-+++ blackbox-0.65.0/nls/sv_SE/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/sv_SE/Makefile.in
-+++ blackbox-0.65.0/nls/sv_SE/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/uk_UA/Makefile.am
-+++ blackbox-0.65.0/nls/uk_UA/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=KOI8-U output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/uk_UA/Makefile.in
-+++ blackbox-0.65.0/nls/uk_UA/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=KOI8-U output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/zh_CN/Makefile.am
-+++ blackbox-0.65.0/nls/zh_CN/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=GB2312 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/zh_CN/Makefile.in
-+++ blackbox-0.65.0/nls/zh_CN/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=GB2312 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/zh_TW/Makefile.am
-+++ blackbox-0.65.0/nls/zh_TW/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=BIG5 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/zh_TW/Makefile.in
-+++ blackbox-0.65.0/nls/zh_TW/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=BIG5 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/es_AR/Makefile.am
-+++ blackbox-0.65.0/nls/es_AR/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/es_AR/Makefile.in
-+++ blackbox-0.65.0/nls/es_AR/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-1 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/pl_PL/Makefile.in
-+++ blackbox-0.65.0/nls/pl_PL/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-2 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/pl_PL/Makefile.am
-+++ blackbox-0.65.0/nls/pl_PL/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-2 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/sk_SK/Makefile.am
-+++ blackbox-0.65.0/nls/sk_SK/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk convert=ISO-8859-2 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/sk_SK/Makefile.in
-+++ blackbox-0.65.0/nls/sk_SK/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-2 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/lv_LV/Makefile.am
-+++ blackbox-0.65.0/nls/lv_LV/Makefile.am
-@@ -23,7 +23,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-13 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/nls/lv_LV/Makefile.in
-+++ blackbox-0.65.0/nls/lv_LV/Makefile.in
-@@ -197,7 +197,7 @@
-
- Translation.m: $(MFILES)
- @if test x$(NLSTEST) = "x-DNLS"; then \
-- awk -f @srcdir@/../convert.awk output=Translation.m $(MFILES); \
-+ awk -f @srcdir@/../convert.awk codeset=ISO-8859-13 output=Translation.m $(MFILES); \
- fi
-
- blackbox.cat: Translation.m
---- blackbox-0.65.0.orig/src/BaseDisplay.cc
-+++ blackbox-0.65.0/src/BaseDisplay.cc
-@@ -86,6 +86,7 @@
- #include "GCCache.hh"
- #include "Timer.hh"
- #include "Util.hh"
-+#include "Xinerama.hh"
-
-
- // X error handler to handle any and all X errors while the application is
-@@ -400,9 +401,8 @@
- }
-
-
--ScreenInfo::ScreenInfo(BaseDisplay *d, unsigned int num) {
-- basedisplay = d;
-- screen_number = num;
-+ScreenInfo::ScreenInfo(BaseDisplay *d, unsigned int num)
-+ : basedisplay(d), screen_number(num), xinerama_info(0) {
-
- root_window = RootWindow(basedisplay->getXDisplay(), screen_number);
-
-@@ -465,4 +465,12 @@
-
- display_string = string("DISPLAY=") + default_string + '.' +
- itostring(static_cast<unsigned long>(screen_number));
-+
-+#ifdef XINERAMA
-+ xinerama_info = new XineramaInfo(this);
-+ if (! xinerama_info->haveXinerama()) {
-+ delete xinerama_info;
-+ xinerama_info = 0;
-+ }
-+#endif
- }
---- blackbox-0.65.0.orig/src/BaseDisplay.hh
-+++ blackbox-0.65.0/src/BaseDisplay.hh
-@@ -35,6 +35,7 @@
- // forward declaration
- class BaseDisplay;
- class BGCCache;
-+class XineramaInfo;
-
- #include "Timer.hh"
- #include "Util.hh"
-@@ -51,11 +52,14 @@
- std::string display_string;
- Rect rect;
-
-+ XineramaInfo* xinerama_info;
-+
- public:
- ScreenInfo(BaseDisplay *d, unsigned int num);
-
- inline BaseDisplay *getBaseDisplay(void) const { return basedisplay; }
- inline Visual *getVisual(void) const { return visual; }
-+ inline XineramaInfo *getXineramaInfo(void) const { return xinerama_info; }
- inline Window getRootWindow(void) const { return root_window; }
- inline Colormap getColormap(void) const { return colormap; }
- inline int getDepth(void) const { return depth; }
---- blackbox-0.65.0.orig/src/Basemenu.cc
-+++ blackbox-0.65.0/src/Basemenu.cc
-@@ -49,6 +49,7 @@
- #include "Image.hh"
- #include "Screen.hh"
- #include "Util.hh"
-+#include "Xinerama.hh"
-
- using std::string;
- using std::min;
-@@ -478,6 +479,29 @@
- drawSubmenu(which_sub);
- }
-
-+void Basemenu::moveInScreen(int screen_x, int screen_y, int dx, int dy) {
-+ int x = screen_x + dx;
-+ int y = screen_y + dy;
-+
-+ Rect rect = screen->getRect();
-+ if (screen->getXineramaInfo() && screen->doXineramaMenus()) {
-+ XineramaScreen xinerama = screen->getXineramaInfo()->
-+ screenContaining(screen_x, screen_y);
-+ if (xinerama.isValid()) {
-+ rect = xinerama.getRect();
-+ }
-+ }
-+
-+ if (x < rect.left()) x = rect.left();
-+ if (y < rect.top()) y = rect.top();
-+
-+ if (x + static_cast<signed>(getWidth()) > rect.right())
-+ x = rect.right() - getWidth() - screen->getBorderWidth();
-+ if (y + static_cast<signed>(getHeight()) > rect.bottom())
-+ y = rect.bottom() - getHeight() - screen->getBorderWidth();
-+
-+ move(x,y);
-+}
-
- void Basemenu::redrawTitle(void) {
- const char *text = (! menu.label.empty()) ? getLabel() :
-@@ -559,16 +583,24 @@
- y = (((shifted) ? menu.y_shift : menu.y) +
- menu.height - submenu->menu.height);
-
-- if ((x + submenu->getWidth()) > screen->getWidth())
-+ Rect rect = screen->getRect();
-+ if (screen->getXineramaInfo() && screen->doXineramaMenus()) {
-+ XineramaScreen scr =
-+ screen->getXineramaInfo()->screenContaining(menu.x, menu.y);
-+ if (scr.isValid())
-+ rect = scr.getRect();
-+ }
-+
-+ if ((x + static_cast<signed>(submenu->getWidth())) > rect.right())
- x = ((shifted) ? menu.x_shift : menu.x) -
- submenu->getWidth() - screen->getBorderWidth();
-
-- if (x < 0) x = 0;
-+ if (x < rect.left()) x = rect.left();
-
-- if ((y + submenu->getHeight()) > screen->getHeight())
-- y = screen->getHeight() - submenu->getHeight() -
-+ if ((y + static_cast<signed>(submenu->getHeight())) > rect.bottom())
-+ y = rect.bottom() - submenu->getHeight() -
- (screen->getBorderWidth() * 2);
-- if (y < 0) y = 0;
-+ if (y < rect.top()) y = rect.top();
-
- submenu->move(x, y);
- if (! moving) drawItem(index, True);
-@@ -961,22 +993,32 @@
-
- void Basemenu::enterNotifyEvent(XCrossingEvent *ce) {
- if (ce->window == menu.frame) {
-+
-+ Rect rect = screen->getRect();
-+#if 0
-+ if (screen->getXineramaInfo() && screen->doXineramaMenus()) {
-+ XineramaScreen xin_scr =
-+ screen->getXineramaInfo()->screenContaining(menu.x, menu.y);
-+ if (xin_scr.isValid()) {
-+ rect = xin_scr.getRect();
-+ }
-+ }
-+#endif
-+
- menu.x_shift = menu.x, menu.y_shift = menu.y;
-- if (menu.x + menu.width > screen->getWidth()) {
-- menu.x_shift = screen->getWidth() - menu.width -
-- screen->getBorderWidth();
-+ if (menu.x + static_cast<signed>(menu.width) > rect.right()) {
-+ menu.x_shift = rect.right() - menu.width - screen->getBorderWidth();
- shifted = True;
-- } else if (menu.x < 0) {
-- menu.x_shift = -screen->getBorderWidth();
-+ } else if (menu.x < rect.left()) {
-+ menu.x_shift = rect.left() - screen->getBorderWidth();
- shifted = True;
- }
-
-- if (menu.y + menu.height > screen->getHeight()) {
-- menu.y_shift = screen->getHeight() - menu.height -
-- screen->getBorderWidth();
-+ if (menu.y + static_cast<signed>(menu.height) > rect.bottom()) {
-+ menu.y_shift = rect.bottom() - menu.height - screen->getBorderWidth();
- shifted = True;
-- } else if (menu.y + static_cast<signed>(menu.title_h) < 0) {
-- menu.y_shift = -screen->getBorderWidth();
-+ } else if (menu.y + static_cast<signed>(menu.title_h) < rect.top()) {
-+ menu.y_shift = rect.top() - screen->getBorderWidth();
- shifted = True;
- }
-
---- blackbox-0.65.0.orig/src/Basemenu.hh
-+++ blackbox-0.65.0/src/Basemenu.hh
-@@ -129,6 +129,7 @@
- void reconfigure(void);
- void setLabel(const std::string& label);
- void move(int x, int y);
-+ void moveInScreen(int screen_x, int screen_y, int dx = 0, int dy = 0);
- void update(void);
- void setItemSelected(int index, bool sel);
- void setItemEnabled(int index, bool enable);
---- blackbox-0.65.0.orig/src/Configmenu.cc
-+++ blackbox-0.65.0/src/Configmenu.cc
-@@ -36,13 +36,21 @@
- setLabel(i18n(ConfigmenuSet, ConfigmenuConfigOptions, "Config options"));
- setInternalMenu();
-
-+ int position = 2;
- focusmenu = new Focusmenu(this);
- placementmenu = new Placementmenu(this);
-+ xineramamenu = 0;
-
- insert(i18n(ConfigmenuSet, ConfigmenuFocusModel,
- "Focus Model"), focusmenu);
- insert(i18n(ConfigmenuSet, ConfigmenuWindowPlacement,
- "Window Placement"), placementmenu);
-+ if (scr->getXineramaInfo()) {
-+ xineramamenu = new XineramaMenu(this);
-+ insert(i18n(ConfigmenuSet, ConfigmenuXineramaOptions,
-+ "Xinerama Options"), xineramamenu);
-+ position++;
-+ }
- insert(i18n(ConfigmenuSet, ConfigmenuImageDithering,
- "Image Dithering"), 1);
- insert(i18n(ConfigmenuSet, ConfigmenuOpaqueMove,
-@@ -57,18 +65,19 @@
- "Disable Bindings with Scroll Lock"), 6);
- update();
-
-- setItemSelected(2, getScreen()->getImageControl()->doDither());
-- setItemSelected(3, getScreen()->doOpaqueMove());
-- setItemSelected(4, getScreen()->doFullMax());
-- setItemSelected(5, getScreen()->doFocusNew());
-- setItemSelected(6, getScreen()->doFocusLast());
-- setItemSelected(7, getScreen()->allowScrollLock());
-+ setItemSelected(position++, getScreen()->getImageControl()->doDither());
-+ setItemSelected(position++, getScreen()->doOpaqueMove());
-+ setItemSelected(position++, getScreen()->doFullMax());
-+ setItemSelected(position++, getScreen()->doFocusNew());
-+ setItemSelected(position++, getScreen()->doFocusLast());
-+ setItemSelected(position++, getScreen()->allowScrollLock());
- }
-
-
- Configmenu::~Configmenu(void) {
- delete focusmenu;
- delete placementmenu;
-+ delete xineramamenu;
- }
-
-
-@@ -132,7 +141,8 @@
- void Configmenu::reconfigure(void) {
- focusmenu->reconfigure();
- placementmenu->reconfigure();
--
-+ if (xineramamenu)
-+ xineramamenu->reconfigure();
- Basemenu::reconfigure();
- }
-
-@@ -319,3 +329,59 @@
-
- reconfigure();
- }
-+
-+
-+Configmenu::XineramaMenu::XineramaMenu(Configmenu* cm)
-+ : Basemenu(cm->getScreen()) {
-+ setLabel(i18n(ConfigmenuSet, ConfigmenuXineramaOptions, "Xinerama Options"));
-+ setInternalMenu();
-+
-+ insert(i18n(ConfigmenuSet, ConfigmenuXineramaPlacement, "Window Placement"),
-+ ConfigmenuXineramaPlacement);
-+ insert(i18n(ConfigmenuSet, ConfigmenuXineramaMaximize, "Window Maximizing"),
-+ ConfigmenuXineramaMaximize);
-+ insert(i18n(ConfigmenuSet, ConfigmenuXineramaToolbar, "Toolbar Placement"),
-+ ConfigmenuXineramaToolbar);
-+ insert(i18n(ConfigmenuSet, ConfigmenuXineramaMenus, "Menu Placement"),
-+ ConfigmenuXineramaMenus);
-+ update();
-+
-+ setItemSelected(0, getScreen()->doXineramaPlacement());
-+ setItemSelected(1, getScreen()->doXineramaMaximize());
-+ setItemSelected(2, getScreen()->doXineramaToolbar());
-+ setItemSelected(3, getScreen()->doXineramaMenus());
-+}
-+
-+
-+void Configmenu::XineramaMenu::itemSelected(int button, unsigned int index) {
-+ if (button != 1)
-+ return;
-+
-+ switch (find(index)->function()) {
-+
-+ case ConfigmenuXineramaPlacement : {
-+ getScreen()->saveXineramaPlacement(! getScreen()->doXineramaPlacement());
-+ setItemSelected(index, getScreen()->doXineramaPlacement());
-+ break;
-+ }
-+
-+ case ConfigmenuXineramaMaximize : {
-+ getScreen()->saveXineramaMaximize(! getScreen()->doXineramaMaximize());
-+ setItemSelected(index, getScreen()->doXineramaMaximize());
-+ break;
-+ }
-+
-+ case ConfigmenuXineramaToolbar : {
-+ getScreen()->saveXineramaToolbar(! getScreen()->doXineramaToolbar());
-+ setItemSelected(index, getScreen()->doXineramaToolbar());
-+ getScreen()->getToolbar()->reconfigure();
-+ break;
-+ }
-+
-+ case ConfigmenuXineramaMenus : {
-+ getScreen()->saveXineramaMenus(! getScreen()->doXineramaMenus());
-+ setItemSelected(index, getScreen()->doXineramaMenus());
-+ break;
-+ }
-+ }
-+}
---- blackbox-0.65.0.orig/src/Configmenu.hh
-+++ blackbox-0.65.0/src/Configmenu.hh
-@@ -58,8 +58,21 @@
- virtual void reconfigure(void);
- };
-
-+ class XineramaMenu : public Basemenu {
-+ private:
-+ XineramaMenu(const XineramaMenu&);
-+ XineramaMenu& operator=(const XineramaMenu&);
-+
-+ protected:
-+ virtual void itemSelected(int button, unsigned int index);
-+
-+ public:
-+ XineramaMenu(Configmenu *cm);
-+ };
-+
- Focusmenu *focusmenu;
- Placementmenu *placementmenu;
-+ XineramaMenu* xineramamenu;
-
- friend class Focusmenu;
- friend class Placementmenu;
-@@ -76,6 +89,7 @@
-
- inline Basemenu *getFocusmenu(void) { return focusmenu; }
- inline Basemenu *getPlacementmenu(void) { return placementmenu; }
-+ inline Basemenu *getXineramamenu(void) { return xineramamenu; }
-
- void reconfigure(void);
- };
---- blackbox-0.65.0.orig/src/Makefile.in
-+++ blackbox-0.65.0/src/Makefile.in
-@@ -87,6 +87,7 @@
- ORDEREDPSEUDO = @ORDEREDPSEUDO@
- PACKAGE = @PACKAGE@
- SHAPE = @SHAPE@
-+XINERAMA = @XINERAMA@
- TIMEDCACHE = @TIMEDCACHE@
- VERSION = @VERSION@
- gencat_cmd = @gencat_cmd@
-@@ -95,7 +96,7 @@
- DEFAULT_MENU = $(pkgdatadir)/menu
- DEFAULT_STYLE = $(pkgdatadir)/styles/Results
-
--CPPFLAGS = @CPPFLAGS@ @SHAPE@ @ORDEREDPSEUDO@ @DEBUG@ @NLS@ @TIMEDCACHE@ -DLOCALEPATH=\"$(pkgdatadir)/nls\" -DDEFAULTMENU=\"$(DEFAULT_MENU)\" -DDEFAULTSTYLE=\"$(DEFAULT_STYLE)\"
-+CPPFLAGS = @CPPFLAGS@ @SHAPE@ @XINERAMA@ @ORDEREDPSEUDO@ @DEBUG@ @NLS@ @TIMEDCACHE@ -DLOCALEPATH=\"$(pkgdatadir)/nls\" -DDEFAULTMENU=\"$(DEFAULT_MENU)\" -DDEFAULTSTYLE=\"$(DEFAULT_STYLE)\"
-
-
- bin_PROGRAMS = blackbox
-@@ -119,7 +120,8 @@
- blackbox_OBJECTS = BaseDisplay.o Basemenu.o Clientmenu.o Color.o \
- Configmenu.o GCCache.o Iconmenu.o Image.o ImageControl.o Netizen.o \
- Rootmenu.o Screen.o Slit.o Texture.o Timer.o Toolbar.o Util.o Window.o \
--Windowmenu.o Workspace.o Workspacemenu.o blackbox.o i18n.o main.o
-+Windowmenu.o Workspace.o Workspacemenu.o Xinerama.o \
-+blackbox.o i18n.o main.o
- blackbox_LDADD = $(LDADD)
- blackbox_DEPENDENCIES =
- blackbox_LDFLAGS =
-@@ -321,11 +323,11 @@
-
- BaseDisplay.o: BaseDisplay.cc ../config.h i18n.hh \
- ../nls/blackbox-nls.hh BaseDisplay.hh Timer.hh GCCache.hh Color.hh \
-- Util.hh
-+ Util.hh Xinerama.hh
- Basemenu.o: Basemenu.cc ../config.h i18n.hh ../nls/blackbox-nls.hh \
- blackbox.hh BaseDisplay.hh Timer.hh Basemenu.hh GCCache.hh Color.hh \
- Image.hh Screen.hh Texture.hh Util.hh Configmenu.hh Iconmenu.hh \
-- Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh
-+ Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh Xinerama.hh
- Clientmenu.o: Clientmenu.cc ../config.h blackbox.hh i18n.hh \
- ../nls/blackbox-nls.hh BaseDisplay.hh Timer.hh Clientmenu.hh \
- Basemenu.hh Screen.hh Color.hh Texture.hh Util.hh Configmenu.hh \
-@@ -375,13 +377,13 @@
- blackbox.hh BaseDisplay.hh Timer.hh Clientmenu.hh Basemenu.hh \
- GCCache.hh Color.hh Iconmenu.hh Image.hh Rootmenu.hh Screen.hh \
- Texture.hh Util.hh Configmenu.hh Netizen.hh Workspace.hh \
-- Workspacemenu.hh Toolbar.hh Window.hh Windowmenu.hh Slit.hh
-+ Workspacemenu.hh Toolbar.hh Window.hh Windowmenu.hh Slit.hh Xinerama.hh
- Util.o: Util.cc ../config.h Util.hh
- Window.o: Window.cc ../config.h i18n.hh ../nls/blackbox-nls.hh \
- blackbox.hh BaseDisplay.hh Timer.hh GCCache.hh Color.hh Iconmenu.hh \
- Basemenu.hh Image.hh Screen.hh Texture.hh Util.hh Configmenu.hh \
- Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh Toolbar.hh \
-- Window.hh Windowmenu.hh Slit.hh
-+ Window.hh Windowmenu.hh Slit.hh Xinerama.hh
- Windowmenu.o: Windowmenu.cc ../config.h i18n.hh ../nls/blackbox-nls.hh \
- blackbox.hh BaseDisplay.hh Timer.hh Screen.hh Color.hh Texture.hh \
- Util.hh Configmenu.hh Basemenu.hh Iconmenu.hh Netizen.hh Rootmenu.hh \
-@@ -390,11 +392,12 @@
- blackbox.hh BaseDisplay.hh Timer.hh Clientmenu.hh Basemenu.hh \
- Netizen.hh Screen.hh Color.hh Texture.hh Util.hh Configmenu.hh \
- Iconmenu.hh Rootmenu.hh Workspace.hh Workspacemenu.hh Toolbar.hh \
-- Window.hh Windowmenu.hh
-+ Window.hh Windowmenu.hh Xinerama.hh
- Workspacemenu.o: Workspacemenu.cc ../config.h i18n.hh \
- ../nls/blackbox-nls.hh blackbox.hh BaseDisplay.hh Timer.hh Screen.hh \
- Color.hh Texture.hh Util.hh Configmenu.hh Basemenu.hh Iconmenu.hh \
- Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh Toolbar.hh
-+Xinerama.o: Xinerama.cc ../config.h Util.hh Xinerama.hh
- blackbox.o: blackbox.cc ../config.h i18n.hh ../nls/blackbox-nls.hh \
- blackbox.hh BaseDisplay.hh Timer.hh Basemenu.hh Clientmenu.hh \
- GCCache.hh Color.hh Image.hh Rootmenu.hh Screen.hh Texture.hh Util.hh \
---- blackbox-0.65.0.orig/src/Screen.cc
-+++ blackbox-0.65.0/src/Screen.cc
-@@ -998,6 +998,9 @@
-
- *(session_stack + i++) = configmenu->getFocusmenu()->getWindowID();
- *(session_stack + i++) = configmenu->getPlacementmenu()->getWindowID();
-+ if (configmenu->getXineramamenu())
-+ *(session_stack + i++) = configmenu->getXineramamenu()->getWindowID();
-+
- *(session_stack + i++) = configmenu->getWindowID();
-
- *(session_stack + i++) = slit->getMenu()->getDirectionmenu()->getWindowID();
-@@ -1704,38 +1707,18 @@
- if (rootmenu->isVisible())
- rootmenu->hide();
- } else if (xbutton->button == 2) {
-- int mx = xbutton->x_root - (workspacemenu->getWidth() / 2);
-- int my = xbutton->y_root - (workspacemenu->getTitleHeight() / 2);
--
-- if (mx < 0) mx = 0;
-- if (my < 0) my = 0;
--
-- if (mx + workspacemenu->getWidth() > getWidth())
-- mx = getWidth() - workspacemenu->getWidth() - getBorderWidth();
--
-- if (my + workspacemenu->getHeight() > getHeight())
-- my = getHeight() - workspacemenu->getHeight() - getBorderWidth();
--
-- workspacemenu->move(mx, my);
-+ workspacemenu->moveInScreen(xbutton->x_root, xbutton->y_root,
-+ -static_cast<signed>(workspacemenu->getWidth()) / 2,
-+ -static_cast<signed>(workspacemenu->getTitleHeight()) / 2);
-
- if (! workspacemenu->isVisible()) {
- workspacemenu->removeParent();
- workspacemenu->show();
- }
- } else if (xbutton->button == 3) {
-- int mx = xbutton->x_root - (rootmenu->getWidth() / 2);
-- int my = xbutton->y_root - (rootmenu->getTitleHeight() / 2);
--
-- if (mx < 0) mx = 0;
-- if (my < 0) my = 0;
--
-- if (mx + rootmenu->getWidth() > getWidth())
-- mx = getWidth() - rootmenu->getWidth() - getBorderWidth();
--
-- if (my + rootmenu->getHeight() > getHeight())
-- my = getHeight() - rootmenu->getHeight() - getBorderWidth();
--
-- rootmenu->move(mx, my);
-+ rootmenu->moveInScreen(xbutton->x_root, xbutton->y_root,
-+ -static_cast<signed>(rootmenu->getWidth()) / 2,
-+ -static_cast<signed>(rootmenu->getTitleHeight()) / 2);
-
- if (! rootmenu->isVisible()) {
- blackbox->checkMenu();
---- blackbox-0.65.0.orig/src/Screen.hh
-+++ blackbox-0.65.0/src/Screen.hh
-@@ -149,15 +149,16 @@
-
- bool toolbar_on_top, toolbar_auto_hide, sloppy_focus, auto_raise,
- auto_edge_balance, image_dither, ordered_dither, opaque_move, full_max,
-- focus_new, focus_last, click_raise, allow_scroll_lock;
-+ focus_new, focus_last, click_raise, allow_scroll_lock,
-+ xinerama_placement, xinerama_maximize, xinerama_menus, xinerama_toolbar;
- BColor border_color;
- XrmDatabase stylerc;
-
- unsigned int workspaces;
- int toolbar_placement, toolbar_width_percent, placement_policy,
-- edge_snap_threshold, row_direction, col_direction;
-+ edge_snap_threshold, row_direction, col_direction, toolbar_xin_screen;
-
-- bool slit_on_top, slit_auto_hide;
-+ bool slit_on_top, slit_auto_hide, xinerama_slit;
- int slit_placement, slit_direction;
-
- unsigned int handle_width, bevel_width, frame_width, border_width;
-@@ -224,6 +225,16 @@
- inline bool doFocusNew(void) const { return resource.focus_new; }
- inline bool doFocusLast(void) const { return resource.focus_last; }
- inline bool allowScrollLock(void) const { return resource.allow_scroll_lock;}
-+ inline bool doXineramaPlacement(void) const
-+ { return resource.xinerama_placement; }
-+ inline bool doXineramaMaximize(void) const
-+ { return resource.xinerama_maximize; }
-+ inline bool doXineramaMenus(void) const
-+ { return resource.xinerama_menus; }
-+ inline bool doXineramaToolbar(void) const
-+ { return resource.xinerama_toolbar; }
-+ inline bool doXineramaSlit(void) const
-+ { return resource.xinerama_slit; }
-
- inline const GC &getOpGC(void) const { return opGC; }
-
-@@ -281,6 +292,8 @@
- { return resource.row_direction; }
- inline int getColPlacementDirection(void) const
- { return resource.col_direction; }
-+ inline int getXineramaToolbarScreen(void) const
-+ { return resource.toolbar_xin_screen; }
-
- inline void setRootColormapInstalled(bool r) { root_colormap_installed = r; }
- inline void saveSloppyFocus(bool s) { resource.sloppy_focus = s; }
-@@ -295,6 +308,8 @@
- inline void savePlacementPolicy(int p) { resource.placement_policy = p; }
- inline void saveRowPlacementDirection(int d) { resource.row_direction = d; }
- inline void saveColPlacementDirection(int d) { resource.col_direction = d; }
-+ inline void saveXineramaToolbarScreen(int s)
-+ { resource.toolbar_xin_screen = s;}
- inline void saveEdgeSnapThreshold(int t)
- { resource.edge_snap_threshold = t; }
- inline void saveImageDither(bool d) { resource.image_dither = d; }
-@@ -303,6 +318,13 @@
- inline void saveFocusNew(bool f) { resource.focus_new = f; }
- inline void saveFocusLast(bool f) { resource.focus_last = f; }
- inline void saveAllowScrollLock(bool a) { resource.allow_scroll_lock = a; }
-+ inline void saveXineramaPlacement(bool p) { resource.xinerama_placement = p; }
-+ inline void saveXineramaMaximize(bool m) { resource.xinerama_maximize = m; }
-+ inline void saveXineramaMenus(bool m) { resource.xinerama_menus = m; }
-+ inline void saveXineramaToolbar(bool t) { resource.xinerama_toolbar = t; }
-+ inline void saveXinaramaToolbarScreen(int s)
-+ { resource.toolbar_xin_screen = s; }
-+ inline void saveXineramaSlit(bool s) { resource.xinerama_slit = s; }
-
- inline void iconUpdate(void) { iconmenu->update(); }
-
---- blackbox-0.65.0.orig/src/Slit.cc
-+++ blackbox-0.65.0/src/Slit.cc
-@@ -35,6 +35,7 @@
- #include "Screen.hh"
- #include "Slit.hh"
- #include "Toolbar.hh"
-+#include "Xinerama.hh"
-
-
- Slit::Slit(BScreen *scr) {
-@@ -481,6 +482,29 @@
-
- frame.rect.setPos(x, y);
-
-+ if (screen->getXineramaInfo() && screen->doXineramaSlit()) {
-+ XineramaScreen scr = screen->getXineramaInfo()->screenContaining(frame.rect);
-+ if (!scr.isValid()) {
-+ scr = screen->getXineramaInfo()->getClosestScreen(x,y);
-+ }
-+
-+ if (scr.isValid() && (scr.getRect() & frame.rect) != frame.rect) {
-+ int w = static_cast<signed>(frame.rect.width());
-+ if (x < scr.getRect().left())
-+ x = scr.getRect().left();
-+ else if (x + w > scr.getRect().right())
-+ x = scr.getRect().right() - w;
-+
-+ int h = static_cast<signed>(frame.rect.height());
-+ if (y < scr.getRect().top())
-+ y = scr.getRect().top();
-+ else if (y + h > scr.getRect().bottom())
-+ y = scr.getRect().bottom() - h;
-+
-+ frame.rect.setPos(x, y);
-+ }
-+ }
-+
- // we have to add the border to the rect as it is not accounted for
- Rect tbar_rect = screen->getToolbar()->getRect();
- tbar_rect.setSize(tbar_rect.width() + (screen->getBorderWidth() * 2),
-@@ -536,22 +560,9 @@
- XLowerWindow(display, frame.window);
- } else if (e->button == Button3) {
- if (! slitmenu->isVisible()) {
-- int x, y;
--
-- x = e->x_root - (slitmenu->getWidth() / 2);
-- y = e->y_root - (slitmenu->getHeight() / 2);
--
-- if (x < 0)
-- x = 0;
-- else if (x + slitmenu->getWidth() > screen->getWidth())
-- x = screen->getWidth() - slitmenu->getWidth();
--
-- if (y < 0)
-- y = 0;
-- else if (y + slitmenu->getHeight() > screen->getHeight())
-- y = screen->getHeight() - slitmenu->getHeight();
--
-- slitmenu->move(x, y);
-+ slitmenu->moveInScreen(e->x_root, e->y_root,
-+ -static_cast<signed>(slitmenu->getWidth()) / 2,
-+ -static_cast<signed>(slitmenu->getHeight()) / 2);
- slitmenu->show();
- } else {
- slitmenu->hide();
---- blackbox-0.65.0.orig/src/Timer.hh
-+++ blackbox-0.65.0/src/Timer.hh
-@@ -98,9 +98,9 @@
- ~_timer_queue(void) {}
-
- void release(const _Tp& value) {
-- c.erase(std::remove(c.begin(), c.end(), value), c.end());
-+ this->c.erase(std::remove(this->c.begin(), this->c.end(), value), this->c.end());
- // after removing the item we need to make the heap again
-- std::make_heap(c.begin(), c.end(), comp);
-+ std::make_heap(this->c.begin(), this->c.end(), this->comp);
- }
- bool empty(void) const { return _Base::empty(); }
- size_t size(void) const { return _Base::size(); }
---- blackbox-0.65.0.orig/src/Toolbar.cc
-+++ blackbox-0.65.0/src/Toolbar.cc
-@@ -62,6 +62,7 @@
- #include "Clientmenu.hh"
- #include "Workspacemenu.hh"
- #include "Slit.hh"
-+#include "Xinerama.hh"
-
-
- static long aMinuteFromNow(void) {
-@@ -198,8 +199,56 @@
-
-
- void Toolbar::reconfigure(void) {
-+ Rect rect = screen->getRect();
-+
-+ if (screen->getXineramaInfo() && screen->doXineramaToolbar()) {
-+
-+ XineramaScreen xinerama =
-+ screen->getXineramaInfo()->getScreen(screen->getXineramaToolbarScreen());
-+
-+ if (! xinerama.isValid()) {
-+
-+ XineramaList list;
-+ switch (screen->getToolbarPlacement()) {
-+ case TopLeft:
-+ case TopRight:
-+ case TopCenter:
-+ screen->getXineramaInfo()->getTopScreens(list);
-+ break;
-+ case BottomLeft:
-+ case BottomRight:
-+ case BottomCenter:
-+ default:
-+ screen->getXineramaInfo()->getBottomScreens(list);
-+ break;
-+ }
-+
-+ switch (screen->getToolbarPlacement()) {
-+ case TopLeft:
-+ case BottomLeft:
-+ xinerama = *list.begin();
-+ break;
-+ case TopRight:
-+ case BottomRight:
-+ xinerama = *list.rbegin();
-+ break;
-+ case TopCenter:
-+ case BottomCenter:
-+ default: {
-+ XineramaList::iterator itr = list.begin();
-+ for (int count = list.size()/2; count--; ++itr);
-+ xinerama = *itr;
-+ break;
-+ }
-+ }
-+ screen->saveXineramaToolbarScreen(xinerama.getScreenNumber());
-+ } // end if (invalid xinerama screen)
-+
-+ rect = xinerama.getRect();
-+ } // end if (xinerama)
-+
- unsigned int height = 0,
-- width = (screen->getWidth() * screen->getToolbarWidthPercent()) / 100;
-+ width = (rect.width() * screen->getToolbarWidthPercent()) / 100;
-
- if (i18n.multibyte())
- height = screen->getToolbarStyle()->fontset_extents->max_ink_extent.height;
-@@ -218,18 +267,25 @@
- int x, y;
- switch (screen->getToolbarPlacement()) {
- case TopLeft:
-+ case BottomLeft:
-+ x = rect.left();
-+ break;
- case TopRight:
-- case TopCenter:
-- if (screen->getToolbarPlacement() == TopLeft)
-- x = 0;
-- else if (screen->getToolbarPlacement() == TopRight)
-- x = screen->getWidth() - frame.rect.width()
-+ case BottomRight:
-+ x = rect.left() + rect.width() - frame.rect.width()
- - (screen->getBorderWidth() * 2);
-- else
-- x = (screen->getWidth() - frame.rect.width()) / 2;
--
-- y = 0;
--
-+ break;
-+ case TopCenter:
-+ case BottomCenter:
-+ default:
-+ x = rect.left() + (rect.width() - frame.rect.width()) / 2;
-+ break;
-+ }
-+ switch (screen->getToolbarPlacement()) {
-+ case TopLeft:
-+ case TopRight:
-+ case TopCenter:
-+ y = rect.top();
- frame.x_hidden = x;
- frame.y_hidden = screen->getBevelWidth() - screen->getBorderWidth()
- - frame.rect.height();
-@@ -239,19 +295,11 @@
- case BottomRight:
- case BottomCenter:
- default:
-- if (screen->getToolbarPlacement() == BottomLeft)
-- x = 0;
-- else if (screen->getToolbarPlacement() == BottomRight)
-- x = screen->getWidth() - frame.rect.width()
-- - (screen->getBorderWidth() * 2);
-- else
-- x = (screen->getWidth() - frame.rect.width()) / 2;
--
-- y = screen->getHeight() - frame.rect.height()
-+ y = rect.bottom() - frame.rect.height()
- - (screen->getBorderWidth() * 2);
-
- frame.x_hidden = x;
-- frame.y_hidden = screen->getHeight() - screen->getBevelWidth()
-+ frame.y_hidden = rect.bottom() - screen->getBevelWidth()
- - screen->getBorderWidth();
- break;
- }
-@@ -758,22 +806,9 @@
- if (toolbarmenu->isVisible()) {
- toolbarmenu->hide();
- } else {
-- int x, y;
--
-- x = be->x_root - (toolbarmenu->getWidth() / 2);
-- y = be->y_root - (toolbarmenu->getHeight() / 2);
--
-- if (x < 0)
-- x = 0;
-- else if (x + toolbarmenu->getWidth() > screen->getWidth())
-- x = screen->getWidth() - toolbarmenu->getWidth();
--
-- if (y < 0)
-- y = 0;
-- else if (y + toolbarmenu->getHeight() > screen->getHeight())
-- y = screen->getHeight() - toolbarmenu->getHeight();
--
-- toolbarmenu->move(x, y);
-+ toolbarmenu->moveInScreen(be->x_root, be->y_root,
-+ -static_cast<signed>(toolbarmenu->getWidth()) / 2,
-+ -static_cast<signed>(toolbarmenu->getHeight()) / 2);
- toolbarmenu->show();
- }
- }
-@@ -1069,21 +1104,88 @@
- : Basemenu(tm->toolbar->screen) {
- setLabel(i18n(ToolbarSet, ToolbarToolbarPlacement, "Toolbar Placement"));
- setInternalMenu();
-- setMinimumSublevels(3);
-+ reconfigure();
-+}
-
-- insert(i18n(CommonSet, CommonPlacementTopLeft, "Top Left"),
-- Toolbar::TopLeft);
-- insert(i18n(CommonSet, CommonPlacementBottomLeft, "Bottom Left"),
-- Toolbar::BottomLeft);
-- insert(i18n(CommonSet, CommonPlacementTopCenter, "Top Center"),
-- Toolbar::TopCenter);
-- insert(i18n(CommonSet, CommonPlacementBottomCenter, "Bottom Center"),
-- Toolbar::BottomCenter);
-- insert(i18n(CommonSet, CommonPlacementTopRight, "Top Right"),
-- Toolbar::TopRight);
-- insert(i18n(CommonSet, CommonPlacementBottomRight, "Bottom Right"),
-- Toolbar::BottomRight);
-+void Toolbarmenu::Placementmenu::reconfigure(void)
-+{
-+ for (int count = getCount(); count > 0; count = remove(count-1));
-+
-+ if (getScreen()->getXineramaInfo() && getScreen()->doXineramaToolbar()) {
-+ char buffer[256];
-+ XineramaList top_list, bottom_list;
-+ getScreen()->getXineramaInfo()->getTopScreens(top_list);
-+ getScreen()->getXineramaInfo()->getBottomScreens(bottom_list);
-+ int width = std::max(top_list.size(),bottom_list.size()) + 2;
-+ setMinimumSublevels(width);
-+
-+ XineramaList::const_iterator top = top_list.begin();
-+ XineramaList::const_iterator bottom = bottom_list.begin();
-+
-+ insert(i18n(CommonSet, CommonPlacementTopLeft, "Top Left"),
-+ handleFromPlacement(Toolbar::TopLeft, top->getScreenNumber()));
-+ insert(i18n(CommonSet, CommonPlacementBottomLeft, "Bottom Left"),
-+ handleFromPlacement(Toolbar::BottomLeft, bottom->getScreenNumber()));
-+
-+ for (int count = width - 2; count--; ) {
-+ if (top != top_list.end()) {
-+ sprintf(buffer,
-+ i18n(ToolbarSet, ToolbarScreenTop, "Screen %d Top"),
-+ top->getScreenNumber());
-+ insert(buffer,
-+ handleFromPlacement(Toolbar::TopCenter,top->getScreenNumber()));
-+ ++top;
-+ }
-+ else {
-+ insert("",-2);
-+ }
-+
-+ if (bottom != bottom_list.end()) {
-+ sprintf(buffer,
-+ i18n(ToolbarSet, ToolbarScreenBottom, "Screen %d Bottom"),
-+ bottom->getScreenNumber());
-+ insert(buffer,
-+ handleFromPlacement(Toolbar::BottomCenter,bottom->getScreenNumber()));
-+ ++bottom;
-+ }
-+ else {
-+ insert("",-2);
-+ }
-+ }
-+
-+ int last_scr = top_list.rbegin()->getScreenNumber();
-+ insert(i18n(CommonSet, CommonPlacementTopRight, "Top Right"),
-+ handleFromPlacement(Toolbar::TopRight, last_scr));
-+ last_scr = bottom_list.rbegin()->getScreenNumber();
-+ insert(i18n(CommonSet, CommonPlacementBottomRight, "Bottom Right"),
-+ handleFromPlacement(Toolbar::BottomRight, last_scr));
-+
-+ update();
-+
-+ for (int index = 0; index < static_cast<signed>(getCount()); index++) {
-+ if (find(index)->function() == -2) {
-+ setItemEnabled(index, false);
-+ }
-+ }
-+ }
-+ else {
-+ setMinimumSublevels(3);
-+
-+ insert(i18n(CommonSet, CommonPlacementTopLeft, "Top Left"),
-+ Toolbar::TopLeft);
-+ insert(i18n(CommonSet, CommonPlacementBottomLeft, "Bottom Left"),
-+ Toolbar::BottomLeft);
-+ insert(i18n(CommonSet, CommonPlacementTopCenter, "Top Center"),
-+ Toolbar::TopCenter);
-+ insert(i18n(CommonSet, CommonPlacementBottomCenter, "Bottom Center"),
-+ Toolbar::BottomCenter);
-+ insert(i18n(CommonSet, CommonPlacementTopRight, "Top Right"),
-+ Toolbar::TopRight);
-+ insert(i18n(CommonSet, CommonPlacementBottomRight, "Bottom Right"),
-+ Toolbar::BottomRight);
-+ }
- update();
-+ Basemenu::reconfigure();
- }
-
-
-@@ -1094,7 +1196,14 @@
- BasemenuItem *item = find(index);
- if (! item) return;
-
-- getScreen()->saveToolbarPlacement(item->function());
-+ int placement = Placementmenu::placementFromHandle(item->function());
-+ getScreen()->saveToolbarPlacement(placement);
-+
-+ if (getScreen()->getXineramaInfo() && getScreen()->doXineramaToolbar()) {
-+ int xinerama = Placementmenu::xineramaFromHandle(item->function());
-+ getScreen()->saveXineramaToolbarScreen(xinerama);
-+ }
-+
- hide();
- getScreen()->getToolbar()->reconfigure();
-
---- blackbox-0.65.0.orig/src/Toolbar.hh
-+++ blackbox-0.65.0/src/Toolbar.hh
-@@ -47,6 +47,15 @@
-
- public:
- Placementmenu(Toolbarmenu *tm);
-+
-+ inline static int handleFromPlacement(int placement, int xinerama_screen)
-+ { return ((xinerama_screen+1) << 3) | placement; }
-+ inline static int placementFromHandle(int handle)
-+ { return handle & 0x7; }
-+ inline static int xineramaFromHandle(int handle)
-+ { return (handle >> 3)-1; }
-+
-+ void reconfigure(void);
- };
-
- Toolbar *toolbar;
---- blackbox-0.65.0.orig/src/Util.hh
-+++ blackbox-0.65.0/src/Util.hh
-@@ -29,6 +29,14 @@
-
- #include <string>
-
-+struct Point {
-+ inline Point(void) : x(0), y(0) {}
-+ inline Point(int set_x, int set_y) : x(set_x), y(set_y) {}
-+ inline void set(int set_x, int set_y)
-+ { x = set_x; y = set_y; }
-+ int x, y;
-+};
-+
- class Rect {
- public:
- inline Rect(void) : _x1(0), _y1(0), _x2(0), _y2(0) { }
-@@ -51,6 +59,7 @@
-
- inline unsigned int width(void) const { return _x2 - _x1 + 1; }
- inline unsigned int height(void) const { return _y2 - _y1 + 1; }
-+ inline int area(void) const { return width() * height(); }
- void setWidth(unsigned int __w);
- void setHeight(unsigned int __h);
- void setSize(unsigned int __w, unsigned int __h);
-@@ -71,6 +80,9 @@
- inline bool valid(void) const { return _x2 > _x1 && _y2 > _y1; }
-
- bool intersects(const Rect &a) const;
-+
-+ inline bool contains( int x, int y ) const
-+ { return (x >= _x1) && (x <= _x2) && (y >= _y1) && (y <= _y2); }
-
- private:
- int _x1, _y1, _x2, _y2;
---- blackbox-0.65.0.orig/src/Window.cc
-+++ blackbox-0.65.0/src/Window.cc
-@@ -44,6 +44,8 @@
- #endif // HAVE_STDLIB_H
- }
-
-+#include <cassert>
-+
- #include "i18n.hh"
- #include "blackbox.hh"
- #include "GCCache.hh"
-@@ -55,6 +57,7 @@
- #include "Window.hh"
- #include "Windowmenu.hh"
- #include "Workspace.hh"
-+#include "Xinerama.hh"
-
-
- /*
-@@ -208,8 +211,16 @@
- client.normal_hint_flags & (PPosition|USPosition)) {
- applyGravity(frame.rect);
-
-- if (blackbox->isStartup() || client.rect.intersects(screen->getRect()))
-+ if (blackbox->isStartup()) {
-+ place_window = False;
-+ }
-+ else if (s->getXineramaInfo() && s->doXineramaPlacement()) {
-+ if (s->getXineramaInfo()->screenContaining(client.rect).isValid())
-+ place_window = False;
-+ }
-+ else if (client.rect.intersects(screen->getRect())) {
- place_window = False;
-+ }
- }
-
- /*
-@@ -1626,7 +1637,13 @@
- blackbox_attrib.premax_h =
- client.rect.height() + frame.margin.top + frame.margin.bottom;
-
-- const Rect &screen_area = screen->availableArea();
-+ Rect screen_area = screen->availableArea();
-+ if (screen->getXineramaInfo() && screen->doXineramaMaximize()) {
-+ XineramaScreen xinerama
-+ = screen->getXineramaInfo()->screenContaining(frame.rect);
-+ if (xinerama.isValid())
-+ screen_area &= xinerama.getRect();
-+ }
- frame.changing = screen_area;
-
- switch(button) {
-@@ -3288,6 +3305,7 @@
- do {
- if (multibyte) {
- XRectangle ink, logical;
-+ if (text_len>100) text_len=100;
- XmbTextExtents(fontset, text, text_len, &ink, &logical);
- length = logical.width;
- } else {
---- blackbox-0.65.0.orig/src/Workspace.cc
-+++ blackbox-0.65.0/src/Workspace.cc
-@@ -55,13 +55,12 @@
- #include "Window.hh"
- #include "Workspace.hh"
- #include "Windowmenu.hh"
-+#include "Xinerama.hh"
-
-
- Workspace::Workspace(BScreen *scrn, unsigned int i) {
- screen = scrn;
-
-- cascade_x = cascade_y = 32;
--
- id = i;
-
- clientmenu = new Clientmenu(this);
-@@ -123,9 +122,6 @@
- for (; it != end; ++it, ++i)
- (*it)->setWindowNumber(i);
-
-- if (i == 0)
-- cascade_x = cascade_y = 32;
--
- return i;
- }
-
-@@ -548,8 +544,19 @@
-
- bool Workspace::smartPlacement(Rect& win, const Rect& availableArea) {
- rectList spaces;
-- spaces.push_back(availableArea); //initially the entire screen is free
-
-+ // If xinerama info, initialize spaces to available xinerama screens
-+ if (screen->getXineramaInfo() && screen->doXineramaPlacement()) {
-+ const XineramaList& list = screen->getXineramaInfo()->getScreens();
-+ for (XineramaList::const_iterator itr = list.begin();
-+ itr != list.end(); ++itr) {
-+ spaces.push_back(availableArea & itr->getRect());
-+ }
-+ }
-+ else {
-+ spaces.push_back(availableArea); //initially the entire screen is free
-+ }
-+
- //Find Free Spaces
- BlackboxWindowList::const_iterator wit = windowList.begin(),
- end = windowList.end();
-@@ -621,17 +628,45 @@
- }
-
-
--bool Workspace::cascadePlacement(Rect &win, const Rect &availableArea) {
-- if (cascade_x > (availableArea.width() / 2) ||
-- cascade_y > (availableArea.height() / 2))
-- cascade_x = cascade_y = 32;
--
-- if (cascade_x == 32) {
-- cascade_x += availableArea.x();
-- cascade_y += availableArea.y();
-- }
--
-- win.setPos(cascade_x, cascade_y);
-+bool Workspace::cascadePlacement(Rect &win, Rect availableArea, int offset) {
-+
-+ // Place window in whichever xinerama screen contains the
-+ // pointer.
-+ int xinerama_screen = 0;
-+ if (screen->getXineramaInfo() && screen->doXineramaPlacement()) {
-+ int ptr_x, ptr_y, x, y;
-+ Window c, r;
-+ unsigned int m;
-+ XQueryPointer(screen->getBaseDisplay()->getXDisplay(),
-+ screen->getRootWindow(),
-+ &r, &c, &ptr_x, &ptr_y, &x, &y, &m);
-+ XineramaScreen xinerama =
-+ screen->getXineramaInfo()->screenContaining(ptr_x, ptr_y);
-+ if (! xinerama.isValid())
-+ xinerama = *(screen->getXineramaInfo()->getScreens().begin());
-+ xinerama_screen = xinerama.getScreenNumber();
-+ availableArea &= xinerama.getRect();
-+ }
-+
-+ if (cascade_points.count(xinerama_screen) == 0) {
-+ cascade_points[xinerama_screen] = Point(32,32);
-+ }
-+ Point& pos = cascade_points[xinerama_screen];
-+
-+ if (pos.x < (availableArea.left() + 32) ||
-+ pos.y < (availableArea.top() + 32) ||
-+ pos.x > (availableArea.left() + (int)availableArea.width() / 2) ||
-+ pos.y > (availableArea.top() + (int)availableArea.height() / 2))
-+ pos.x = pos.y = 32;
-+
-+ if (pos.x == 32) {
-+ pos.x += availableArea.x();
-+ pos.y += availableArea.y();
-+ }
-+
-+ win.setPos(pos.x, pos.y);
-+ pos.x += offset;
-+ pos.y += offset;
-
- return True;
- }
-@@ -653,9 +688,8 @@
- } // switch
-
- if (placed == False) {
-- cascadePlacement(new_win, availableArea);
-- cascade_x += win->getTitleHeight() + (screen->getBorderWidth() * 2);
-- cascade_y += win->getTitleHeight() + (screen->getBorderWidth() * 2);
-+ cascadePlacement(new_win, availableArea,
-+ win->getTitleHeight() + (screen->getBorderWidth() * 2));
- }
-
- if (new_win.right() > availableArea.right())
---- blackbox-0.65.0.orig/src/Workspace.hh
-+++ blackbox-0.65.0/src/Workspace.hh
-@@ -51,7 +51,7 @@
-
- std::string name;
- unsigned int id;
-- unsigned int cascade_x, cascade_y;
-+ std::map<int,Point> cascade_points;
-
- Workspace(const Workspace&);
- Workspace& operator=(const Workspace&);
-@@ -62,7 +62,7 @@
- StackVector::iterator &stack);
-
- void placeWindow(BlackboxWindow *win);
-- bool cascadePlacement(Rect& win, const Rect& availableArea);
-+ bool cascadePlacement(Rect& win, Rect availableArea, int offset);
- bool smartPlacement(Rect& win, const Rect& availableArea);
-
- public:
---- blackbox-0.65.0.orig/src/blackbox.cc
-+++ blackbox-0.65.0/src/blackbox.cc
-@@ -1094,6 +1094,26 @@
- screen_number, placement);
- XrmPutLineResource(&new_blackboxrc, rc_string);
-
-+ // write out xinerama settings
-+ sprintf(rc_string, "session.screen%d.xineramaPlacement: %s",
-+ screen_number, screen->doXineramaPlacement() ? "True" : "False");
-+ XrmPutLineResource(&new_blackboxrc, rc_string);
-+ sprintf(rc_string, "session.screen%d.xineramaMaximize: %s",
-+ screen_number, screen->doXineramaMaximize() ? "True" : "False");
-+ XrmPutLineResource(&new_blackboxrc, rc_string);
-+ sprintf(rc_string, "session.screen%d.xineramaMenuPlacement: %s",
-+ screen_number, screen->doXineramaMenus() ? "True" : "False");
-+ XrmPutLineResource(&new_blackboxrc, rc_string);
-+ sprintf(rc_string, "session.screen%d.slit.xineramaPlacement: %s",
-+ screen_number, screen->doXineramaSlit() ? "True" : "False");
-+ XrmPutLineResource(&new_blackboxrc, rc_string);
-+ sprintf(rc_string, "session.screen%d.toolbar.xineramaPlacement: %s",
-+ screen_number, screen->doXineramaToolbar() ? "True" : "False");
-+ XrmPutLineResource(&new_blackboxrc, rc_string);
-+ sprintf(rc_string, "session.screen%d.toolbar.xineramaScreen: %d",
-+ screen_number, screen->getXineramaToolbarScreen());
-+ XrmPutLineResource(&new_blackboxrc, rc_string);
-+
- load_rc(screen);
-
- // these are static, but may not be saved in the users .blackboxrc,
-@@ -1215,7 +1235,6 @@
- }
- }
-
--
- void Blackbox::load_rc(BScreen *screen) {
- XrmDatabase database = (XrmDatabase) 0;
-
-@@ -1492,6 +1511,50 @@
- ! strncasecmp("true", value.addr, value.size)) {
- screen->saveOpaqueMove(True);
- }
-+
-+ // load xinerama settings
-+ sprintf(name_lookup, "session.screen%d.xineramaPlacement", screen_number);
-+ sprintf(class_lookup, "Session.Screen%d.XineramaPlacement", screen_number);
-+ screen->saveXineramaPlacement(true);
-+ if ((XrmGetResource(database,name_lookup,class_lookup,&value_type,&value))
-+ && ! strncasecmp("false", value.addr, value.size)) {
-+ screen->saveXineramaPlacement(false);
-+ }
-+ sprintf(name_lookup, "session.screen%d.xineramaMaximize", screen_number);
-+ sprintf(class_lookup, "Session.Screen%d.XineramaMaximize", screen_number);
-+ screen->saveXineramaMaximize(true);
-+ if ((XrmGetResource(database,name_lookup,class_lookup,&value_type,&value))
-+ && ! strncasecmp("false", value.addr, value.size)) {
-+ screen->saveXineramaMaximize(false);
-+ }
-+ sprintf(name_lookup, "session.screen%d.xineramaMenuPlacement", screen_number);
-+ sprintf(class_lookup, "Session.Screen%d.XineramaMenuPlacement", screen_number);
-+ screen->saveXineramaMenus(true);
-+ if ((XrmGetResource(database,name_lookup,class_lookup,&value_type,&value))
-+ && ! strncasecmp("false", value.addr, value.size)) {
-+ screen->saveXineramaMenus(false);
-+ }
-+ sprintf(name_lookup, "session.screen%d.slit.xineramaPlacement", screen_number);
-+ sprintf(class_lookup, "Session.Screen%d.Slit.XineramaPlacement", screen_number);
-+ screen->saveXineramaSlit(true);
-+ if ((XrmGetResource(database,name_lookup,class_lookup,&value_type,&value))
-+ && ! strncasecmp("false", value.addr, value.size)) {
-+ screen->saveXineramaSlit(false);
-+ }
-+ sprintf(name_lookup, "session.screen%d.toolbar.xineramaPlacement", screen_number);
-+ sprintf(class_lookup, "Session.Screen%d.Toolbar.XineramaPlacement", screen_number);
-+ screen->saveXineramaToolbar(true);
-+ if ((XrmGetResource(database,name_lookup,class_lookup,&value_type,&value))
-+ && ! strncasecmp("false", value.addr, value.size)) {
-+ screen->saveXineramaToolbar(false);
-+ }
-+ sprintf(name_lookup, "session.screen%d.toolbar.xineramaScreen", screen_number);
-+ sprintf(class_lookup, "Session.Screen%d.Toolbar.XineramaScreen", screen_number);
-+ screen->saveXineramaToolbarScreen(-1);
-+ if ((XrmGetResource(database,name_lookup,class_lookup,&value_type,&value))
-+ && sscanf(value.addr, "%d", &int_value) == 1) {
-+ screen->saveXineramaToolbarScreen(int_value);
-+ }
-
- XrmDestroyDatabase(database);
- }
---- blackbox-0.65.0.orig/src/Xinerama.cc
-+++ blackbox-0.65.0/src/Xinerama.cc
-@@ -0,0 +1,153 @@
-+// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
-+// Xinerama.cc for Blackbox - an X11 Window manager
-+// Copyright (c) 2002 Jason Kraftcheck <kraftche@cae.wisc.edu>
-+//
-+// Permission is hereby granted, free of charge, to any person obtaining a
-+// copy of this software and associated documentation files (the "Software"),
-+// to deal in the Software without restriction, including without limitation
-+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
-+// and/or sell copies of the Software, and to permit persons to whom the
-+// Software is furnished to do so, subject to the following conditions:
-+//
-+// The above copyright notice and this permission notice shall be included in
-+// all copies or substantial portions of the Software.
-+//
-+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-+// DEALINGS IN THE SOFTWARE.
-+
-+
-+extern "C" {
-+#include <X11/Xlib.h>
-+#ifdef XINERAMA
-+# include <X11/extensions/Xinerama.h>
-+#endif
-+}
-+
-+#include "Xinerama.hh"
-+#include "BaseDisplay.hh"
-+
-+bool XineramaInfo::update(void)
-+{
-+ screen_list.clear();
-+
-+#ifdef XINERAMA
-+ int count;
-+ XineramaScreenInfo* xinerama_list = XineramaQueryScreens(
-+ screen_info->getBaseDisplay()->getXDisplay(), &count );
-+ if (xinerama_list) {
-+ if (count > 1) {
-+ for( int i = 0; i < count; i++ ) {
-+ const XineramaScreenInfo& scr = xinerama_list[i];
-+ screen_list.push_back( XineramaScreen( scr.screen_number,
-+ Rect( scr.x_org, scr.y_org, scr.width, scr.height ) ) );
-+ }
-+ }
-+ XFree(xinerama_list);
-+ }
-+#endif
-+
-+ return haveXinerama();
-+}
-+
-+XineramaScreen XineramaInfo::screenContaining( int x, int y ) const
-+{
-+ XineramaList::const_iterator itr = getScreens().begin(),
-+ end = getScreens().end();
-+
-+ for ( ; itr != end; ++itr) {
-+ if (itr->getRect().contains(x,y))
-+ return *itr;
-+ };
-+
-+ return XineramaScreen();
-+}
-+
-+XineramaScreen XineramaInfo::screenContaining( const Rect& rect ) const
-+{
-+ XineramaScreen result;
-+ int area = 0;
-+ XineramaList::const_iterator itr = getScreens().begin(),
-+ end = getScreens().end();
-+ for ( ; itr != end; ++itr) {
-+ if (itr->getRect().intersects(rect)) {
-+ int a = (itr->getRect() & rect).area();
-+ if (a > area) {
-+ result = *itr;
-+ area = a;
-+ }
-+ }
-+ }
-+ return result;
-+}
-+
-+
-+XineramaScreen XineramaInfo::getScreen( int x_screen_number ) const
-+{
-+ XineramaList::const_iterator itr = getScreens().begin(),
-+ end = getScreens().end();
-+ for ( ; itr != end; ++itr) {
-+ if (itr->getScreenNumber() == x_screen_number)
-+ return *itr;
-+ }
-+
-+ return XineramaScreen();
-+}
-+
-+
-+void XineramaInfo::getTopBottom( XineramaList& result, bool top ) const
-+{
-+ for (XineramaList::const_iterator in_itr = screen_list.begin();
-+ in_itr != screen_list.end(); ++in_itr) {
-+
-+ XineramaList::iterator out_itr = result.begin();
-+ while (out_itr != result.end() &&
-+ in_itr->getRect().left() >= out_itr->getRect().right())
-+ ++out_itr;
-+
-+ if (out_itr == result.end()) {
-+ result.push_back(*in_itr);
-+ }
-+ else if (in_itr->getRect().right() <= out_itr->getRect().left()) {
-+ result.insert(out_itr,*in_itr);
-+ }
-+ else if ((!top && in_itr->getRect().bottom() > out_itr->getRect().bottom()) ||
-+ ( top && in_itr->getRect().top() < out_itr->getRect().top())) {
-+ *out_itr = *in_itr;
-+ }
-+ }
-+}
-+
-+XineramaScreen XineramaInfo::getClosestScreen( int x, int y ) const
-+{
-+ if (getScreens().empty())
-+ return XineramaScreen();
-+
-+ XineramaList::const_iterator itr = screen_list.begin();
-+ XineramaScreen result(*itr);
-+ unsigned long dist_sqr = distanceSquared(itr->getRect(),x,y);
-+ ++itr;
-+
-+ for ( ; itr != screen_list.end(); ++itr) {
-+ unsigned long ds = distanceSquared(itr->getRect(), x, y);
-+ if (ds < dist_sqr) {
-+ dist_sqr = ds;
-+ result = *itr;
-+ }
-+ }
-+
-+ return result;
-+}
-+
-+unsigned long XineramaInfo::distanceSquared(const Rect& rect,int x,int y)
-+{
-+ unsigned long x_dist = (x < rect.left() ) ? rect.left() - x :
-+ (x > rect.right() ) ? x - rect.right() : 0;
-+ unsigned long y_dist = (y < rect.top() ) ? rect.top() - y :
-+ (y > rect.bottom()) ? y - rect.bottom() : 0;
-+ return x_dist * x_dist + y_dist * y_dist;
-+}
---- blackbox-0.65.0.orig/src/Xinerama.hh
-+++ blackbox-0.65.0/src/Xinerama.hh
-@@ -0,0 +1,93 @@
-+// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
-+// Xinerama.hh for Blackbox - an X11 Window manager
-+// Copyright (c) 2002 Jason Kraftcheck <kraftche@cae.wisc.edu>
-+//
-+// Permission is hereby granted, free of charge, to any person obtaining a
-+// copy of this software and associated documentation files (the "Software"),
-+// to deal in the Software without restriction, including without limitation
-+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
-+// and/or sell copies of the Software, and to permit persons to whom the
-+// Software is furnished to do so, subject to the following conditions:
-+//
-+// The above copyright notice and this permission notice shall be included in
-+// all copies or substantial portions of the Software.
-+//
-+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-+// DEALINGS IN THE SOFTWARE.
-+
-+#ifndef __Xinerama_hh
-+#define __Xinerama_hh
-+
-+#include <list>
-+
-+#include "Util.hh"
-+
-+class XineramaScreen;
-+class ScreenInfo;
-+
-+typedef std::list<XineramaScreen> XineramaList;
-+
-+class XineramaScreen {
-+private:
-+ int x_screen;
-+ Rect rect;
-+
-+public:
-+ inline XineramaScreen( int screen_number, const Rect& box )
-+ : x_screen(screen_number), rect(box) { }
-+
-+ inline XineramaScreen(void)
-+ : x_screen(-1) { }
-+
-+ inline const Rect& getRect(void) const { return rect; }
-+ inline int getScreenNumber(void) const { return x_screen; }
-+
-+ inline bool operator==( const XineramaScreen& other ) const
-+ { return x_screen == other.x_screen; }
-+
-+ inline bool operator!=( const XineramaScreen& other ) const
-+ { return x_screen != other.x_screen; }
-+
-+ inline bool isValid(void) const { return x_screen >= 0; }
-+};
-+
-+class XineramaInfo {
-+private:
-+ XineramaList screen_list;
-+ ScreenInfo* screen_info;
-+
-+protected:
-+ void getTopBottom( XineramaList& result_list, bool top ) const;
-+
-+ static unsigned long distanceSquared( const Rect& rect, int x, int y );
-+
-+public:
-+ inline XineramaInfo( ScreenInfo* screen ) : screen_info(screen)
-+ { update(); }
-+
-+ inline bool haveXinerama(void) const
-+ { return !screen_list.empty(); }
-+
-+ inline const XineramaList& getScreens(void) const
-+ { return screen_list; }
-+
-+ bool update(void);
-+
-+ XineramaScreen screenContaining( int x, int y ) const;
-+ XineramaScreen screenContaining( const Rect& rect ) const;
-+ XineramaScreen getScreen( int x_screen_number ) const;
-+ XineramaScreen getClosestScreen( int x, int y ) const;
-+
-+ inline void getTopScreens( XineramaList& result_list ) const
-+ { getTopBottom( result_list, true ); }
-+
-+ inline void getBottomScreens( XineramaList& result_list ) const
-+ { getTopBottom( result_list, false ); }
-+};
-+
-+#endif
---- blackbox-0.65.0.orig/util/Makefile.in
-+++ blackbox-0.65.0/util/Makefile.in
-@@ -79,7 +79,7 @@
- bin_PROGRAMS = bsetroot
-
- bsetroot_SOURCES = bsetroot.cc
--bsetroot_LDADD = ../src/BaseDisplay.o ../src/Color.o ../src/GCCache.o ../src/Texture.o ../src/Timer.o ../src/Image.o ../src/ImageControl.o ../src/i18n.o ../src/Util.o
-+bsetroot_LDADD = ../src/BaseDisplay.o ../src/Color.o ../src/GCCache.o ../src/Texture.o ../src/Timer.o ../src/Image.o ../src/ImageControl.o ../src/i18n.o ../src/Util.o ../src/Xinerama.o
-
- MAINTAINERCLEANFILES = Makefile.in
- mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
---- blackbox-0.65.0.orig/debian/changelog
-+++ blackbox-0.65.0/debian/changelog
-@@ -0,0 +1,188 @@
-+blackbox (0.65.0-5) unstable; urgency=high
-+
-+ * Fixed FTBFS with the missing build dependency on autoconf.
-+ (closes: #291133)
-+
-+ -- Bruno Barrera C. <bruno@debian.org> Tue, 18 Jan 2005 20:22:45 -0300
-+
-+blackbox (0.65.0-4) unstable; urgency=low
-+
-+ * Fixed the string length problem. (closes: #178001)
-+ * Added Xinerama support. (closes: #277517)
-+
-+ -- Bruno Barrera C. <bruno@debian.org> Mon, 17 Jan 2005 23:27:56 -0300
-+
-+blackbox (0.65.0-3) unstable; urgency=low
-+
-+ * Fixed FTBFS with gcc-3.4 (closes: #266642)
-+ * debian/postinst now checks for the correct files to be removed
-+ (blackbox-menu instead Blackbox-menu)
-+
-+ -- Bruno Barrera C. <bruno.barrera@igloo.cl> Fri, 20 Aug 2004 21:44:55 -0400
-+
-+blackbox (0.65.0-2) unstable; urgency=low
-+
-+ * New Maintainer (closes: #259585)
-+ * Corrected menu-method coding (closes: #251237)
-+ * Added a blackbox.desktop file. (closes: #257423)
-+ * Completed the debian/copyright file.
-+
-+ -- Bruno Barrera C. <bruno.barrera@igloo.cl> Fri, 16 Jul 2004 18:26:04 -0400
-+
-+blackbox (0.65.0-1.2) unstable; urgency=low
-+
-+ * Non Maintainer Upload
-+ * Patch by Matt Kraai to solve FTBFS: Closes: #208814.
-+
-+ -- Jesus Climent <jesus.climent@hispalinux.es> Wed, 15 Oct 2003 15:38:53 +0300
-+
-+blackbox (0.65.0-1.1) unstable; urgency=low
-+
-+ * Non Maintainer Upload
-+ * Include <cassert> in src/Window.cc (Closes: #196245)
-+
-+ -- David Pashley <david@davidpashley.com> Tue, 15 Jul 2003 16:36:04 +0200
-+
-+blackbox (0.65.0-1) unstable; urgency=low
-+
-+ * new upstream release
-+ * now has man pages for all binaries, closes: #93427
-+ * newer version of bsetbg behaves much better, closes: #109606
-+ * tilde expansion in blackboxrc and menus is now supported, closes: #139330
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Wed, 18 Sep 2002 11:02:00 -0700
-+
-+blackbox (0.65.0-0.pre1) unstable; urgency=low
-+
-+ * temporary deb
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Fri, 6 Sep 2002 19:33:37 -0700
-+
-+blackbox (0.62.1-1) unstable; urgency=low
-+
-+ * new upstream release
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Wed, 30 Jan 2002 22:17:06 -0800
-+
-+blackbox (0.62.0-1) unstable; urgency=low
-+
-+ * new upstream
-+ * I am now the upstream (-:
-+ * upstream fixes these, Closes: #72254, #103909, #116767
-+ * Documented update-menu and blackbox behaviour (closes: #117386)
-+ * Added README.menu and .style (closes: #81008)
-+ * removed empty dir (closes: #78777)
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Sat, 19 Jan 2002 11:22:06 -0800
-+
-+blackbox (0.61.1-1.1) unstable; urgency=low
-+
-+ * NMU
-+ * Fix unsafe temp files in bsetbg. Closes: #102126
-+ * Add class key as needed, printf is a macro as of gcc 3.0. Closes: #105452
-+
-+ -- LaMont Jones <lamont@smallone.fc.hp.com> Sun, 15 Jul 2001 23:29:46 -0600
-+
-+blackbox (0.61.1-1) unstable; urgency=low
-+
-+ * New upstream release
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Mon, 9 Oct 2000 10:10:31 -0700
-+
-+blackbox (0.61.0-3) unstable; urgency=low
-+
-+ * Changed menu-method to call x-terminal-emulator instead of xterm
-+ * Closes: #71981
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Wed, 20 Sep 2000 11:41:45 -0700
-+
-+blackbox (0.61.0-2) unstable; urgency=low
-+
-+ * removed echo from the postinst
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Thu, 31 Aug 2000 11:35:39 -0700
-+
-+blackbox (0.61.0-1) unstable; urgency=low
-+
-+ * New upstream
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Fri, 18 Aug 2000 13:29:31 -0700
-+
-+blackbox (0.61.0.20000806-1) unstable; urgency=low
-+
-+ * New upstream
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Mon, 7 Aug 2000 10:19:22 -0700
-+
-+blackbox (0.61.0.20000726-2) unstable; urgency=low
-+
-+ * Oops, forgot to re-run autofriends
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Wed, 26 Jul 2000 16:39:15 -0700
-+
-+blackbox (0.61.0.20000726-1) unstable; urgency=low
-+
-+ * New upstream beta
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Wed, 26 Jul 2000 13:10:07 -0700
-+
-+blackbox (0.60.3-5) unstable; urgency=low
-+
-+ * Fix for improper quoting of rootCommand
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Thu, 20 Jul 2000 21:41:11 -0700
-+
-+blackbox (0.60.3-4) unstable; urgency=low
-+
-+ * Bug fix release
-+ * added a CXXFLAGS setting to the rules file. This makes blackbox smaller
-+ and faster.
-+ * Closes: #45298, #55305, #61552, #64615, #64773, #64851, #64969
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Tue, 18 Jul 2000 13:01:43 -0700
-+
-+blackbox (0.60.3-3) unstable; urgency=low
-+
-+ * Oops, left the stylesmenu file
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Sat, 27 May 2000 19:40:41 -0700
-+
-+blackbox (0.60.3-2) unstable; urgency=low
-+
-+ * Oops, left a call to update-bbstyles
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Fri, 26 May 2000 16:12:27 -0700
-+
-+blackbox (0.60.3-1) unstable; urgency=low
-+
-+ * New upstream release
-+ * Changed user style menu to look in ~/.blackbox/styles to match
-+ current practice among style authors
-+ * Cleaned up menu-method script and thus the resulting menu file it
-+ generates
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Fri, 26 May 2000 12:08:34 -0700
-+
-+blackbox (0.60.2-2) unstable; urgency=low
-+
-+ * Removed update-styles
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Thu, 25 May 2000 14:02:15 -0700
-+
-+blackbox (0.60.2-1) unstable; urgency=low
-+
-+ * New upstream release
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Thu, 25 May 2000 12:55:42 -0700
-+
-+blackbox (0.60.0.alpha-2) unstable; urgency=low
-+
-+ * New maintainer
-+
-+ -- Sean 'Shaleh' Perry <shaleh@debian.org> Thu, 25 May 2000 11:50:49 -0700
-+
-+blackbox (0.60.0.alpha-1) unstable; urgency=low
-+
-+ * The Alpha release.
-+
-+ -- Brent A. Fulgham <bfulgham@debian.org> Sat, 22 April 2000 13:32:08 -0800
---- blackbox-0.65.0.orig/debian/conffiles
-+++ blackbox-0.65.0/debian/conffiles
-@@ -0,0 +1 @@
-+/etc/menu-methods/blackbox
---- blackbox-0.65.0.orig/debian/control
-+++ blackbox-0.65.0/debian/control
-@@ -0,0 +1,26 @@
-+Source: blackbox
-+Section: x11
-+Priority: optional
-+Build-Depends: autoconf, xlibs-dev, debhelper
-+Maintainer: Bruno Barrera C. <bruno@debian.org>
-+Standards-Version: 3.5.0
-+
-+Package: blackbox
-+Architecture: any
-+Depends: ${shlibs:Depends}
-+Provides: x-window-manager
-+Suggests: menu (>=1.5)
-+Description: Window manager for X
-+ This is a window manager for X. It is similar in many respects to
-+ such popular packages as Window Maker, Enlightenment, and FVWM2. You
-+ might be interested in this package if you are tired of window managers
-+ that are a heavy drain on your system resources, but you still want
-+ an attractive and modern-looking interface.
-+ .
-+ The best part of all is that this program is coded in C++, so it
-+ is even more attractive "under the hood" than it is in service -- no
-+ small feat.
-+ .
-+ If none of this sounds familiar to you, or you want your computer to
-+ look like Microsoft Windows or Apple's OS X, you probably don't want
-+ this package.
---- blackbox-0.65.0.orig/debian/copyright
-+++ blackbox-0.65.0/debian/copyright
-@@ -0,0 +1,37 @@
-+This package was debianized by Brent A. Fulgham bfulgham@debian.org on
-+Thu, 15 Oct 1998 18:17:09 -0700.
-+
-+It was downloaded from http://sf.net/projects/blackboxwm
-+
-+Upstream Authors: Sean 'Shaleh' Perry <shaleh@debian.org>
-+ Brad Hughes <bhughes@trolltech.com>
-+ Jeff Raven <jraven@psu.edu>
-+
-+Copyright:
-+
-+The Regents of the University of California.
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without
-+modification, are permitted provided that the following conditions
-+are met:
-+1. Redistributions of source code must retain the above copyright
-+ notice, this list of conditions and the following disclaimer.
-+2. Redistributions in binary form must reproduce the above copyright
-+ notice, this list of conditions and the following disclaimer in the
-+ documentation and/or other materials provided with the distribution.
-+3. Neither the name of the University nor the names of its contributors
-+ may be used to endorse or promote products derived from this software
-+ without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS `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 REGENTS OR CONTRIBUTORS 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.
---- blackbox-0.65.0.orig/debian/dirs
-+++ blackbox-0.65.0/debian/dirs
-@@ -0,0 +1,10 @@
-+etc/menu-methods
-+etc/X11/blackbox
-+usr/bin
-+usr/share/man/man1
-+usr/share/doc
-+usr/share/doc/blackbox
-+usr/share/blackbox
-+usr/share/blackbox/styles
-+usr/share/blackbox/nls
-+usr/share/xsessions
---- blackbox-0.65.0.orig/debian/docs
-+++ blackbox-0.65.0/debian/docs
-@@ -0,0 +1 @@
-+AUTHORS README README.bsetbg data/README.menu data/README.style
---- blackbox-0.65.0.orig/debian/menu
-+++ blackbox-0.65.0/debian/menu
-@@ -0,0 +1,24 @@
-+?package(blackbox):needs="wm" \
-+ section="WindowManagers" title="Blackbox" \
-+ command="/usr/bin/blackbox"
-+?package(blackbox):needs="blackbox" \
-+ section="WindowManagers" title="Exit" \
-+ command="exit"
-+?package(blackbox):needs="blackbox" \
-+ section="WindowManagers" title="Reconfigure" \
-+ command="reconfig"
-+?package(blackbox):needs="blackbox" \
-+ section="WindowManagers" title="Restart" \
-+ command="restart"
-+?package(blackbox):needs="blackbox" \
-+ section="Blackbox/Styles" title="/usr/share/blackbox/styles" \
-+ command="stylesdir"
-+?package(blackbox):needs="blackbox" \
-+ section="Blackbox/Styles" title="~/.blackbox/styles" \
-+ command="stylesdir"
-+?package(blackbox):needs="blackbox" \
-+ section="Blackbox" title="Workspaces" \
-+ command="workspaces"
-+?package(blackbox):needs="blackbox" \
-+ section="Blackbox" title="Configuration" \
-+ command="config"
---- blackbox-0.65.0.orig/debian/menu-method
-+++ blackbox-0.65.0/debian/menu-method
-@@ -0,0 +1,27 @@
-+#!/usr/sbin/install-menu
-+#
-+# Generates blackbox menus for all registered applications.
-+
-+!include menu.h
-+compat="menu-1"
-+outputencoding="LOCALE"
-+
-+genmenu="blackbox-menu"
-+rootprefix="/etc/X11/blackbox/"
-+userprefix=".blackbox/"
-+treewalk="M)"
-+
-+supported
-+ x11= nstring(level(), " ") "[exec] (" esc(title(), "()") ") {" esc($command, "()") "}\n"
-+ wm= nstring(level(), " ") "[restart] (" esc(title(), "()") ") {" esc($command, "()") "}\n"
-+ text= nstring(level(), " ") "[exec] (" esc(title(), "()") ") {" esc(term(), "()") "}\n"
-+blackbox= nstring(level(), " ") "[" esc($command, "()") "] (" esc(title(), "()") ")\n"
-+endsupported
-+
-+preoutput= \
-+ "# Automatically generated file. Do not edit (see /usr/share/doc/menu/README)\n\n[begin] (Debian)\n"
-+
-+startmenu= ""
-+submenutitle= nstring(level(), " ") "[submenu] (" esc(title(),"()") ") {" esc($longtitle,"()") "}\n"
-+endmenu= nstring(level(), " ") "[end]\n"
-+
---- blackbox-0.65.0.orig/debian/postinst
-+++ blackbox-0.65.0/debian/postinst
-@@ -0,0 +1,49 @@
-+#!/bin/sh
-+#
-+# Blackbox postinst
-+#
-+# Shamelessly ripped off of Marcelo Magallon's script
-+# by Brent Fulgham <bfulgham@debian.org>
-+#
-+set -e
-+
-+WMentry="/usr/bin/blackbox"
-+
-+add_wm_entry ()
-+{
-+ update-alternatives --install /usr/bin/x-window-manager x-window-manager $WMentry 50 \
-+ --slave /usr/share/man/man1/x-window-manager.1.gz x-window-manager.1.gz /usr/share/man/man1/blackbox.1.gz
-+}
-+
-+case "$1" in
-+ configure)
-+ if [ "$2" ] && dpkg --compare-versions $2 le 0.51.3-12; then
-+ update-alternatives --remove x-window-manager /etc/X11/window-managers
-+ fi
-+
-+ add_wm_entry
-+
-+ # clean up after eaarlier debs
-+ if [ -f /usr/share/blackbox/styles/stylesmenu ]; then
-+ rm /usr/share/blackbox/styles/stylesmenu
-+ fi
-+
-+ if [ -f /etc/X11/blackbox/blackbox-menu ]; then
-+ rm /etc/X11/blackbox/blackbox-menu
-+ fi
-+
-+ if [ -x /usr/sbin/wm-menu-config ]; then
-+ wm-menu-config blackbox on;
-+ fi
-+ ;;
-+
-+ abort-upgrade|abort-deconfigure|abort-remove)
-+ # how did we get here? Force a non-zero exit code
-+ exit 1
-+ ;;
-+
-+ *)
-+ ;;
-+esac
-+
-+#DEBHELPER#
---- blackbox-0.65.0.orig/debian/postrm
-+++ blackbox-0.65.0/debian/postrm
-@@ -0,0 +1,24 @@
-+#!/bin/sh
-+set -e
-+
-+Blackbox_entry="/usr/bin/blackbox"
-+
-+case "$1" in
-+ purge)
-+ rm -rf /etc/X11/blackbox
-+ ;;
-+ remove)
-+ if [ -x /usr/sbin/wm-menu-config ]; then
-+ wm-menu-config blackbox off
-+ fi
-+
-+ if [ -x /usr/sbin/register-window-manager ] ; then
-+ register-window-manager --remove $Blackbox_entry
-+ fi
-+
-+ ;;
-+ *)
-+ ;;
-+esac
-+
-+#DEBHELPER#
---- blackbox-0.65.0.orig/debian/rules
-+++ blackbox-0.65.0/debian/rules
-@@ -0,0 +1,71 @@
-+#!/usr/bin/make -f
-+# MAde with the aid of dh_make, by Craig Small
-+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
-+# Some lines taken from debmake, by Cristoph Lameter.
-+
-+# Uncomment this to turn on verbose mode.
-+#export DH_VERBOSE=1
-+
-+PACKAGE=blackbox
-+
-+build: build-stamp
-+build-stamp:
-+ dh_testdir
-+ autoconf
-+ CXXFLAGS="-O2 -fno-rtti -fno-exceptions -fno-check-new" ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc/X11/blackbox
-+
-+ # Add here commands to compile the package.
-+ $(MAKE) DEFAULT_MENU=/etc/X11/blackbox/blackbox-menu
-+
-+ touch build-stamp
-+
-+clean:
-+ dh_testdir
-+ dh_testroot
-+ rm -f build-stamp install-stamp config.log
-+
-+ # Add here commands to clean up after the build process.
-+ -$(MAKE) distclean
-+
-+ dh_clean
-+
-+
-+install: install-stamp
-+install-stamp: build-stamp
-+ dh_testdir
-+ dh_testroot
-+ dh_clean -k
-+ dh_installdirs
-+
-+ # Add here commands to install the package into debian/tmp.
-+ $(MAKE) install DESTDIR=`pwd`/debian/tmp
-+ # make install places a menu here, but we don't want it
-+ rm -f `pwd`/debian/tmp/usr/share/blackbox/menu
-+ cp debian/blackbox.desktop `pwd`/debian/tmp/usr/share/xsessions/
-+ touch install-stamp
-+
-+# Build architecture-independent files here.
-+binary-indep: build install
-+# We have nothing to do by default.
-+
-+# Build architecture-dependent files here.
-+binary-arch: build install
-+ dh_testdir
-+ dh_testroot
-+ dh_installdocs
-+ dh_installmenu
-+ dh_installchangelogs ChangeLog
-+ dh_strip
-+ dh_compress
-+ dh_fixperms
-+ dh_installdeb
-+ dh_shlibdeps
-+ dh_gencontrol
-+ dh_md5sums
-+ dh_builddeb
-+
-+source diff:
-+ @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-+
-+binary: binary-indep binary-arch
-+.PHONY: build clean binary-indep binary-arch binary
---- blackbox-0.65.0.orig/debian/prerm
-+++ blackbox-0.65.0/debian/prerm
-@@ -0,0 +1,13 @@
-+#!/bin/sh
-+set -e
-+
-+case "$1" in
-+ remove)
-+ update-alternatives --remove x-window-manager /usr/bin/blackbox
-+ ;;
-+ *)
-+ ;;
-+esac
-+
-+#DEBHELPER#
-+
---- blackbox-0.65.0.orig/debian/README.debian
-+++ blackbox-0.65.0/debian/README.debian
-@@ -0,0 +1,9 @@
-+User menus:
-+
-+When update-menus is run as a user it will create ~/.blackbox-menu. You then
-+need to exit blackbox if it is running and edit ~/.blackboxrc. Change the
-+line:
-+
-+session.menuFile: /etc/X11/blackbox/blackbox-menu
-+
-+to point to the new file.
---- blackbox-0.65.0.orig/debian/blackbox.desktop
-+++ blackbox-0.65.0/debian/blackbox.desktop
-@@ -0,0 +1,12 @@
-+[Desktop Entry]
-+Encoding=UTF-8
-+Name=Blackbox
-+Comment=Highly configurable and low resource X11 Window manager
-+Exec=blackbox
-+Terminal=False
-+TryExec=blackbox
-+Type=Application
-+
-+[Window Manager]
-+SessionManaged=true
-+
diff --git a/source/xap/blackbox/xinitrc.blackbox b/source/xap/blackbox/xinitrc.blackbox
index e5822118b..fbe0997be 100644
--- a/source/xap/blackbox/xinitrc.blackbox
+++ b/source/xap/blackbox/xinitrc.blackbox
@@ -3,8 +3,8 @@
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
-sysresources=/usr/lib/X11/xinit/.Xresources
-sysmodmap=/usr/lib/X11/xinit/.Xmodmap
+sysresources=/etc/X11/xinit/.Xresources
+sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
diff --git a/source/xap/blueman/blueman-open b/source/xap/blueman/blueman-open
new file mode 100644
index 000000000..0cfa688fa
--- /dev/null
+++ b/source/xap/blueman/blueman-open
@@ -0,0 +1,114 @@
+#!/bin/sh
+# Blueman Mount Script for Slackware
+# by Zarren Spry & Robby Workman
+# Based on http://kde-apps.org/content/show.php/kde4+bluetooth+files+open?content=108869
+
+# Set to 0 if you want more debugging messages
+DEBUG=1
+
+device_addr="$1"
+device_name="$(hcitool name $device_addr)"
+own_name="$(basename $0)"
+basedir="${basedir:-$HOME/obexfs}"
+mountpoint="${basedir}/${device_addr}"
+browser=${browser:-"xdg-open"}
+
+# If we're running in kde, use kdialog
+if [ "$KDE_FULL_SESSION" = "true" ]; then
+ if which kdialog 1>/dev/null 2>/dev/null; then
+ messagetype="kdialog"
+ fi
+# If not, then see if libnotify is available
+# Even if it is, there may not be a notification daemon running, but there's
+# no good way to check for this, so oh well...
+elif which notify-send 1>/dev/null 2>/dev/null; then
+ messagetype="libnotify"
+# If no libnotify, then use kdialog if it's installed
+elif which kdialog 1>/dev/null 2>/dev/null; then
+ messagetype="kdialog"
+# If all else fails, just don't do notifications
+else
+ messagetype=""
+fi
+
+# Mount function
+mount_device ()
+{
+ [ ! -z $DEBUG ] && logger -i -t $own_name "Attempting to mount device $device_name to $mountpoint..."
+ [ ! -z $DEBUG ] && logger -i -t $own_name "Execute: obexfs -b $device_addr $mountpoint"
+
+ mkdir -p $mountpoint
+ obexfs -b $device_addr $mountpoint 2>&1
+
+ if [ $? != 0 ]; then
+ MSG_TXT="Failed to mount $device_name to $mountpoint. $dbg_msg"
+ FAILZOR=definitely
+ if [ ! -z $DEBUG ]; then
+ logger -i -t $own_name "Failed to mount $device_name to $mountpoint."
+ fi
+ else
+ MSG_TXT="Successfully mounted $device_name to $mountpoint"
+ if [ ! -z $DEBUG ]; then
+ logger -i -t $own_name "Successfully mounted $device_name to $mountpoint."
+ fi
+ fi
+
+ if [ $messagetype == "kdialog" ]; then
+ kdialog --passivepopup "$MSG_TXT" 2
+ elif [ $messagetype == "libnotify" ]; then
+ notify-send --expire-time=20000 --icon=blueman "$MSG_TXT"
+ fi
+
+ [ "$FAILZOR" = "definitely" ] && exit 1
+
+ [ ! -z $DEBUG ] && logger -i -t $own_name "Opening $mountpoint with $browser..."
+ $browser $mountpoint 2>&1
+
+}
+
+# Unmount function
+umount_device ()
+{
+ if grep -qw $mountpoint /proc/mounts 2>/dev/null ; then
+ [ ! -z $DEBUG ] && logger -i -t $own_name \
+ "$mountpoint has something mounted on it already - unmounting it..."
+
+ fusermount -u $mountpoint 1>/dev/null 2>/dev/null
+
+ if [ $? != 0 ]; then
+ [ ! -z $DEBUG ] && logger -i -t $own_name "Failed to unmount $mountpoint with fusermount..."
+ umount -f $mountpoint 1>/dev/null 2>/dev/null
+ if [ $? != 0 ]; then
+ [ ! -z $DEBUG ] && \
+ logger -i -t $own_name \
+ "Failed to unmount $mountpoint with umount - try it manually as root and then start over."
+ FAILZOR=definitely
+ MSG_TXT="Failed to unmount $mountpoint with fusermount and umount - try it as root first."
+ else
+ break
+ fi
+ else
+ [ ! -z $DEBUG ] && logger -i -t $own_name "Successfully unmounted $device_name."
+ fi
+ else
+ [ ! -z $DEBUG ] && logger -i -t $own_name "$mountpoint has nothing mounted on it - continuing..."
+ fi
+
+ if [ $messagetype == "kdialog" ]; then
+ kdialog --passivepopup "$MSG_TXT" 3
+ elif [ $messagetype == "libnotify" ]; then
+ notify-send --expire-time=20000 --icon=blueman "$MSG_TXT"
+ fi
+ [ "$FAILZOR" = "definitely" ] && exit 1
+}
+
+MSG_TXT="Attempting to mount $device_name - please wait..."
+if [ $messagetype == "kdialog" ]; then
+ kdialog --passivepopup "$MSG_TXT" 4
+elif [ $messagetype == "libnotify" ]; then
+ notify-send --expire-time=20000 --icon=blueman "$MSG_TXT"
+fi
+
+umount_device
+mount_device
+
diff --git a/source/xap/blueman/blueman-use_blueman-open_for_obexfs.diff b/source/xap/blueman/blueman-use_blueman-open_for_obexfs.diff
new file mode 100644
index 000000000..542ee6e5d
--- /dev/null
+++ b/source/xap/blueman/blueman-use_blueman-open_for_obexfs.diff
@@ -0,0 +1,12 @@
+diff -Nur blueman-1.21.orig/blueman/Constants.py.in blueman-1.21/blueman/Constants.py.in
+--- blueman-1.21.orig/blueman/Constants.py.in 2009-09-20 05:01:26.000000000 -0500
++++ blueman-1.21/blueman/Constants.py.in 2009-12-13 16:26:29.643850538 -0600
+@@ -10,7 +10,7 @@
+ POLKIT = "@polkit_val@" == "yes"
+ HAL_ENABLED = "@hal_en@" == "yes"
+
+-DEF_BROWSE_COMMAND = "nautilus --browser obex://[%d]"
++DEF_BROWSE_COMMAND = "/usr/libexec/blueman-open %d"
+
+ import os
+ import gettext
diff --git a/source/xap/blueman/blueman.SlackBuild b/source/xap/blueman/blueman.SlackBuild
new file mode 100755
index 000000000..bdb134e0f
--- /dev/null
+++ b/source/xap/blueman/blueman.SlackBuild
@@ -0,0 +1,142 @@
+#!/bin/sh
+
+# Slackware build script for blueman
+
+# Copyright 2009 Robby Workman, Northport, Alabama, USA
+# Copyright 2010 Patrick 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=blueman
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-1}
+POLKIT_OPTION=" --disable-polkit "
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$PKGNAM
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+cd $TMP
+rm -rf $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1
+cd $PKGNAM-$VERSION
+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 {} \;
+
+# Address a couple of bugs that have been fixed in the bzr repo
+zcat $CWD/no_hide_applet.diff.gz | patch -p0 --verbose || exit 1
+zcat $CWD/fix_on_off_loop.diff.gz | patch -p0 --verbose || exit 1
+
+# Use blueman-open, a modified version of this, to browse obexfs shares:
+# http://www.kde-apps.org/content/show.php/kde4+bluetooth+files+open?content=108869
+zcat $CWD/blueman-use_blueman-open_for_obexfs.diff.gz | patch -p1 || exit 1
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PKGNAM-$VERSION \
+ --disable-static \
+ --with-dhcp-config=/etc/dhcpd.conf \
+ --enable-hal \
+ $POLKIT_OPTION \
+ --build=$ARCH-slackware-linux
+
+make $NUMJOBS || make || exit 1
+make install DESTDIR=$PKG || exit 1
+
+if echo $POLKIT_OPTION | grep -q '\--disable-polkit' ; then
+ # Remove unneeded junk
+ rm -rf $PKG/usr/share/polkit-1
+fi
+
+# Add the blueman-open script to /usr/libexec for browsing obexfs shares
+# I don't want to put this in PATH and have someone accidentally run it
+mkdir -p $PKG/usr/libexec
+cat $CWD/blueman-open > $PKG/usr/libexec/blueman-open
+chmod 0755 $PKG/usr/libexec/blueman-open
+
+( cd $PKG
+ find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \
+ xargs strip --strip-unneeded 2> /dev/null || true
+ find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \
+ xargs strip --strip-unneeded 2> /dev/null || true
+)
+
+( cd $PKG/usr/man
+ find . -type f -exec gzip -9 {} \;
+ for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+)
+
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a \
+ AUTHORS COPYING* INSTALL NEWS README* \
+ $PKG/usr/doc/$PKGNAM-$VERSION
+
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -p -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/xap/blueman/doinst.sh b/source/xap/blueman/doinst.sh
new file mode 100644
index 000000000..17b18ef35
--- /dev/null
+++ b/source/xap/blueman/doinst.sh
@@ -0,0 +1,23 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
+fi
+
+if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
+ if [ -x /usr/bin/gtk-update-icon-cache ]; then
+ /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1
+ fi
+fi
+
diff --git a/source/xap/blueman/fix_on_off_loop.diff b/source/xap/blueman/fix_on_off_loop.diff
new file mode 100644
index 000000000..ac11c1351
--- /dev/null
+++ b/source/xap/blueman/fix_on_off_loop.diff
@@ -0,0 +1,58 @@
+revno: 602
+committer: walmis
+timestamp: Sun 2009-10-25 15:49:33 +0000
+message:
+ fix bluetooth on/off loop
+
+=== modified file 'blueman/plugins/applet/PowerManager.py'
+--- blueman/plugins/applet/PowerManager.py 2009-10-25 15:16:14 +0000
++++ blueman/plugins/applet/PowerManager.py 2009-10-25 15:49:33 +0000
+@@ -66,22 +66,6 @@
+ dprint("adapter powered on while in off state, turning bluetooth on")
+ self.bluetooth_off = False
+
+-
+- def on_manager_state_changed(self, state):
+- if state:
+- adapters = self.Applet.Manager.ListAdapters()
+- for adapter in adapters:
+- props = adapter.GetProperties()
+- if not props["Powered"]:
+- self.bluetooth_off = True
+- if self.state_change_deferred != -1:
+- break
+- else:
+- return
+-
+- if self.state_change_deferred != -1:
+- self.bluetooth_off = self.state_change_deferred
+- self.state_change_deferred = -1
+
+ def on_bluetooth_toggled(self):
+ self.bluetooth_off = not self.bluetooth_off
+@@ -97,9 +81,17 @@
+
+ return pixbuf
+
++ def process_deferred(self):
++ if self.state_change_deferred != -1:
++ dprint("Setting deferred status")
++ self.bluetooth_off = self.state_change_deferred
++ self.state_change_deferred = -1
++
+ def on_adapter_added(self, path):
+ adapter = Bluez.Adapter(path)
+ def on_ready():
++ self.process_deferred()
++
+ if self.bluetooth_off:
+ adapter.SetProperty("Powered", False)
+ else:
+@@ -134,6 +126,7 @@
+ self.__dict__[key] = value
+
+ if not self.Applet.Manager:
++ dprint("deferring status change")
+ self.state_change_deferred = value
+ return
+
diff --git a/source/xap/blueman/no_hide_applet.diff b/source/xap/blueman/no_hide_applet.diff
new file mode 100644
index 000000000..a57a2b8f9
--- /dev/null
+++ b/source/xap/blueman/no_hide_applet.diff
@@ -0,0 +1,30 @@
+revno: 647
+committer: Valmantas Palikša <walmis@balticum-tv.lt>
+branch nick: trunk
+timestamp: Wed 2009-12-02 21:31:16 +0200
+message:
+ don't force hide the applet if bluez manager is not initialized
+
+=== modified file 'blueman/plugins/applet/StatusIcon.py'
+--- blueman/plugins/applet/StatusIcon.py 2009-10-27 16:10:53 +0000
++++ blueman/plugins/applet/StatusIcon.py 2009-12-02 19:31:16 +0000
+@@ -55,15 +55,16 @@
+ self.Query()
+
+ def Query(self):
+- if not self.Applet.Manager:
+- self.props.visible = False
+- return
+
+ rets = self.Applet.Plugins.Run("on_query_status_icon_visibility")
+ if not StatusIcon.FORCE_HIDE in rets:
+ if StatusIcon.FORCE_SHOW in rets:
+ self.props.visible = True
+ else:
++ if not self.Applet.Manager:
++ self.props.visible = False
++ return
++
+ try:
+ if self.Applet.Manager.ListAdapters() == []:
+ self.props.visible = False
diff --git a/source/xap/blueman/slack-desc b/source/xap/blueman/slack-desc
new file mode 100644
index 000000000..d9b80088d
--- /dev/null
+++ b/source/xap/blueman/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------------------------------------------------------|
+blueman: Blueman (Graphical Bluetooth Manager)
+blueman:
+blueman: Blueman is a GTK+ Bluetooth Manager for tasks such as:
+blueman:
+blueman: - Connecting to 3G/EDGE/GPRS via DUN profile.
+blueman: - Connecting to/Creating bluetooth networks
+blueman: - Connecting to input and audio devices
+blueman: - Sending/Receiving/Browsing files via OBEX
+blueman: - Pairing
+blueman:
+blueman: Homepage: http://blueman-project.org
diff --git a/source/xap/electricsheep/electricsheep.SlackBuild b/source/xap/electricsheep/electricsheep.SlackBuild
index 1ed540cdd..69ab99d02 100755
--- a/source/xap/electricsheep/electricsheep.SlackBuild
+++ b/source/xap/electricsheep/electricsheep.SlackBuild
@@ -34,8 +34,17 @@
PRGNAM=electricsheep
VERSION=${VERSION:-20090306}
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-3}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
# Where do we look for sources?
SRCDIR=$(cd $(dirname $0); pwd)
@@ -116,6 +125,9 @@ case "$ARCH" in
armel) SLKCFLAGS="-O2 -march=armv4t"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
+ *) SLKCFLAGS="-O2"
+ SLKLDFLAGS=""; LIBDIRSUFFIX=""
+ ;;
esac
# Create working directories:
diff --git a/source/xap/fluxbox/fluxbox.SlackBuild b/source/xap/fluxbox/fluxbox.SlackBuild
index bb0f03639..9685e3f6a 100755
--- a/source/xap/fluxbox/fluxbox.SlackBuild
+++ b/source/xap/fluxbox/fluxbox.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,22 +22,38 @@
VERSION=1.1.1
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
NUMJOBS=${NUMJOBS:-" -j7 "}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
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"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-fluxbox
+
rm -rf $PKG
mkdir -p $TMP $PKG
diff --git a/source/xap/fluxbox/xinitrc.fluxbox b/source/xap/fluxbox/xinitrc.fluxbox
index d04675a98..593875db4 100644
--- a/source/xap/fluxbox/xinitrc.fluxbox
+++ b/source/xap/fluxbox/xinitrc.fluxbox
@@ -3,8 +3,8 @@
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
-sysresources=/usr/lib/X11/xinit/.Xresources
-sysmodmap=/usr/lib/X11/xinit/.Xmodmap
+sysresources=/etc/X11/xinit/.Xresources
+sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
diff --git a/source/xap/geeqie/doinst.sh b/source/xap/geeqie/doinst.sh
new file mode 100644
index 000000000..c9177adda
--- /dev/null
+++ b/source/xap/geeqie/doinst.sh
@@ -0,0 +1,7 @@
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database usr/share/applications >/dev/null 2>&1
+fi
+#if [ -x /usr/bin/gtk-update-icon-cache ]; then
+# /usr/bin/gtk-update-icon-cache -f -t usr/share/icons/hicolor > /dev/null 2>&1
+#fi
+
diff --git a/source/xap/gqview/gqview.SlackBuild b/source/xap/geeqie/geeqie.SlackBuild
index 74e0a3a97..55b0b69d6 100755
--- a/source/xap/gqview/gqview.SlackBuild
+++ b/source/xap/geeqie/geeqie.SlackBuild
@@ -1,7 +1,6 @@
#!/bin/sh
-# Copyright 2006 Robby Workman (http://rlworkman.net)
-# Copyright 2007, 2009 Patrick Volkerding, Sebeka, MN, USA
+# Copyright 2010 Patrick Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -24,11 +23,21 @@
# Modified by the SlackBuilds.org project
-PRGNAM=gqview
-VERSION=2.1.5
-ARCH=${ARCH:-x86_64}
+PKGNAM=geeqie
+VERSION=1.0
+BUILD=${BUILD:-1}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-BUILD=${BUILD:-2}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
@@ -38,18 +47,20 @@ elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
+else
+ SLKCFLAGS="-O2"
fi
CWD=$(pwd)
TMP=${TMP:-/tmp}
-PKG=$TMP/package-$PRGNAM
+PKG=$TMP/package-$PKGNAM
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
-rm -rf $PRGNAM-$VERSION
-tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 || exit 1
-cd $PRGNAM-$VERSION || exit 1
+rm -rf $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1
+cd $PKGNAM-$VERSION || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -66,18 +77,25 @@ CXXFLAGS="$SLKCFLAGS" \
--mandir=/usr/man \
--program-prefix="" \
--program-suffix="" \
- --build=i486-slackware-linux
+ --build=$ARCH-slackware-linux
make $NUMJOBS || make || exit 1
make install-strip DESTDIR=$PKG || exit 1
-mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
-cp -a \
- AUTHORS COPYING ChangeLog INSTALL NEWS README TODO \
- $PKG/usr/doc/$PRGNAM-$VERSION
-cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
-mv $PKG/usr/share/doc/$PRGNAM-$VERSION/* $PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+mv $PKG/usr/share/doc/$PKGNAM-$VERSION/* $PKG/usr/doc/$PKGNAM-$VERSION
rm -r $PKG/usr/share/doc
+cp -a \
+ AUTHORS COPYING* INSTALL NEWS README* TODO \
+ $PKG/usr/doc/$PKGNAM-$VERSION
+
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
# Compress and if needed symlink the man pages:
if [ -d $PKG/usr/man ]; then
@@ -99,5 +117,5 @@ cat $CWD/slack-desc > $PKG/install/slack-desc
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
cd $PKG
-/sbin/makepkg -l y -c n $TMP/$PRGNAM-$VERSION-$ARCH-$BUILD.txz
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
diff --git a/source/xap/gqview/slack-desc b/source/xap/geeqie/slack-desc
index d6a6ceab4..cadbd7745 100644
--- a/source/xap/gqview/slack-desc
+++ b/source/xap/geeqie/slack-desc
@@ -6,14 +6,15 @@
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
-gqview: gqview (GQview Image Browser)
-gqview:
-gqview: GQview is an image browser that features single-click access to view
-gqview: images and move around the directory tree.
-gqview:
-gqview: Homepage: http://gqview.sourceforge.net/
-gqview:
-gqview:
-gqview:
-gqview:
-gqview:
+geeqie: geeqie (Geeqie image viewer)
+geeqie:
+geeqie: Geeqie is an interactive GTK based image viewer that supports multiple
+geeqie: image formats, zooming, panning, thumbnails, and sorting images into
+geeqie: collections.
+geeqie:
+geeqie: Homepage: http://geeqie.sourceforge.net
+geeqie:
+geeqie:
+geeqie:
+geeqie:
+geeqie:
diff --git a/source/xap/gimp/gimp.SlackBuild b/source/xap/gimp/gimp.SlackBuild
index ef001a681..377f519ca 100755
--- a/source/xap/gimp/gimp.SlackBuild
+++ b/source/xap/gimp/gimp.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,10 +21,19 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-VERSION=2.6.6
-ARCH=${ARCH:-x86_64}
+VERSION=2.6.8
BUILD=${BUILD:-2}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
CWD=$(pwd)
@@ -46,8 +55,11 @@ fi
cd $TMP
rm -rf gimp-$VERSION
-tar xvf $CWD/gimp-$VERSION.tar.bz2 || exit 1
+tar xvf $CWD/gimp-$VERSION.tar.?z* || exit 1
cd gimp-$VERSION || exit 1
+
+zcat $CWD/gimp.png14.diff.gz | patch -p1 --verbose || exit 1
+
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -94,6 +106,14 @@ cp -a \
done
)
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
diff --git a/source/xap/gimp/gimp.png14.diff b/source/xap/gimp/gimp.png14.diff
new file mode 100644
index 000000000..5af06d6e3
--- /dev/null
+++ b/source/xap/gimp/gimp.png14.diff
@@ -0,0 +1,19 @@
+--- ./plug-ins/file-ico/ico-load.c.orig 2009-07-20 15:20:51.000000000 -0500
++++ ./plug-ins/file-ico/ico-load.c 2010-02-15 22:54:44.000000000 -0600
+@@ -287,14 +287,14 @@
+ switch (color_type)
+ {
+ case PNG_COLOR_TYPE_GRAY:
+- png_set_gray_1_2_4_to_8 (png_ptr);
++ png_set_expand_gray_1_2_4_to_8 (png_ptr);
+ if ( bit_depth == 16 )
+ png_set_strip_16 (png_ptr);
+ png_set_gray_to_rgb (png_ptr);
+ png_set_add_alpha (png_ptr, 0xff, PNG_FILLER_AFTER);
+ break;
+ case PNG_COLOR_TYPE_GRAY_ALPHA:
+- png_set_gray_1_2_4_to_8 (png_ptr);
++ png_set_expand_gray_1_2_4_to_8 (png_ptr);
+ if ( bit_depth == 16 )
+ png_set_strip_16 (png_ptr);
+ png_set_gray_to_rgb (png_ptr);
diff --git a/source/xap/gkrellm/gkrellm.SlackBuild b/source/xap/gkrellm/gkrellm.SlackBuild
index 222f2567e..f5243b755 100755
--- a/source/xap/gkrellm/gkrellm.SlackBuild
+++ b/source/xap/gkrellm/gkrellm.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,11 +20,20 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-VERSION=2.3.2
-PKGVER=2.3.2
-ARCH=${ARCH:-x86_64}
+VERSION=2.3.4
+PKGVER=2.3.4
BUILD=${BUILD:-1}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
if [ "$ARCH" = "x86_64" ]; then
LIBDIRSUFFIX="64"
else
@@ -82,6 +91,14 @@ cp -a \
COPYRIGHT CREDITS INSTALL README Themes.html \
$PKG/usr/doc/gkrellm-$VERSION
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/gkrellm-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
gzip -9 $PKG/usr/man/man?/*.?
mkdir -p $PKG/install
@@ -105,9 +122,17 @@ cp gkrellm-countdown.so $PKG/usr/lib${LIBDIRSUFFIX}/gkrellm2/plugins
mkdir -p $PKG/usr/doc/gkrellm-countdown-$COUNTDOWN
cp -a \
- COPYING ChangeLog README \
+ COPYING README \
$PKG/usr/doc/gkrellm-countdown-$COUNTDOWN
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/gkrellm-countdown-$COUNTDOWN)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
# 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
diff --git a/source/xap/gnuchess/eboard.assert.diff b/source/xap/gnuchess/eboard.assert.diff
new file mode 100644
index 000000000..182359318
--- /dev/null
+++ b/source/xap/gnuchess/eboard.assert.diff
@@ -0,0 +1,41 @@
+--- ./ntext.cc.orig 2008-02-22 09:51:22.000000000 -0600
++++ ./ntext.cc 2010-02-19 21:53:58.000000000 -0600
+@@ -33,6 +33,7 @@
+ #include <gtk/gtkselection.h>
+ #include "ntext.h"
+ #include "global.h"
++#include <assert.h>
+
+ NLine::NLine() {
+ Text = NULL;
+@@ -238,23 +239,27 @@
+ int i;
+ NLine *nl;
+ char *p;
++ char *s;
+
+ if (len < 0) {
+ discardExcess();
+ return;
+ }
+
+- p = strchr(text, '\n');
++ s = strdup(text);
++ assert(s != NULL);
++ p = strchr(s, '\n');
+ if (p!=NULL) {
+ *p = 0;
+- i = strlen(text);
+- nl = new NLine(text, color);
++ i = strlen(s);
++ nl = new NLine(s, color);
+ *p = '\n';
+ lines.push_back(nl);
+ formatLine(lines.size()-1);
+ append(&p[1], len-(i+1), color);
+ return;
+ }
++ free (s);
+
+ // if search for \n failed, this is a single line
+ nl = new NLine(text, color);
diff --git a/source/xap/gnuchess/gnuchess.SlackBuild b/source/xap/gnuchess/gnuchess.SlackBuild
index 2b236ae40..99cb5c067 100755
--- a/source/xap/gnuchess/gnuchess.SlackBuild
+++ b/source/xap/gnuchess/gnuchess.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -23,10 +23,19 @@
VERGNUCHESS=5.07
VERSJENG=11.2
-VEREBOARD=1.0.3
-VERXBOARD=4.2.7
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-4}
+VEREBOARD=1.1.1
+VERXBOARD=4.4.2
+BUILD=${BUILD:-5}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -36,6 +45,8 @@ elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
+else
+ SLKCFLAGS="-O2"
fi
CWD=$(pwd)
@@ -52,6 +63,7 @@ tar xvf $CWD/gnuchess-$VERGNUCHESS.tar.bz2 || exit 1
cd gnuchess-$VERGNUCHESS || exit 1
# make gnuchess compile with gcc4
zcat $CWD/gnuchess.gcc4_fix.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
+zcat $CWD/gnuchess.getline.glibc.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -101,6 +113,7 @@ cd $TMP
rm -rf eboard-$VEREBOARD
tar xvf $CWD/eboard-$VEREBOARD.tar.bz2 || exit 1
cd eboard-$VEREBOARD || exit 1
+zcat $CWD/eboard.assert.diff.gz | patch -p1 --verbose || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -122,7 +135,7 @@ cp -a \
### XBoard
cd $TMP
rm -rf xboard-$VERXBOARD
-tar xvf $CWD/xboard-$VERXBOARD.tar.bz2 || exit 1
+tar xvf $CWD/xboard-$VERXBOARD.tar.?z* || exit 1
cd xboard-$VERXBOARD || exit 1
chown -R root:root .
find . \
@@ -132,10 +145,10 @@ find . \
-exec chmod 644 {} \;
# --infodir is fubar.
-zcat $CWD/xboard.infodir.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
+#zcat $CWD/xboard.infodir.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
# Taken from Debian to fix CVE-2004-2552
# FOR WHICH THERE IS NO ATTACK VECTOR!!!
-zcat $CWD/xboard.buffer_overflow_fix.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
+#zcat $CWD/xboard.buffer_overflow_fix.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
diff --git a/source/xap/gnuchess/gnuchess.getline.glibc.diff b/source/xap/gnuchess/gnuchess.getline.glibc.diff
new file mode 100644
index 000000000..51a45df1d
--- /dev/null
+++ b/source/xap/gnuchess/gnuchess.getline.glibc.diff
@@ -0,0 +1,39 @@
+--- ./src/input.c.orig 2010-02-19 21:34:10.000000000 -0600
++++ ./src/input.c 2010-02-19 21:36:33.000000000 -0600
+@@ -127,7 +127,7 @@
+ (RealGameCnt+1)/2 + 1 );
+ }
+ pthread_mutex_lock(&input_mutex);
+- getline(prompt);
++ chess_getline(prompt);
+ input_status = INPUT_AVAILABLE;
+ pthread_cond_signal(&input_cond);
+ pthread_mutex_unlock(&input_mutex);
+@@ -173,13 +173,13 @@
+ {
+ #ifdef HAVE_LIBREADLINE
+ if (isatty(STDIN_FILENO)) {
+- getline = getline_readline;
++ chess_getline = getline_readline;
+ using_history();
+ } else {
+- getline = getline_standard;
++ chess_getline = getline_standard;
+ }
+ #else
+- getline = getline_standard;
++ chess_getline = getline_standard;
+ #endif
+ /* Start input thread */
+ pthread_create(&input_thread, NULL, input_func, NULL);
+--- ./src/common.h.orig 2003-06-30 06:28:38.000000000 -0500
++++ ./src/common.h 2010-02-19 21:35:33.000000000 -0600
+@@ -745,7 +745,7 @@
+ * Input routine, initialized to one of the specific
+ * input routines. The given argument is the prompt.
+ */
+-void (*getline) (char *);
++void (*chess_getline) (char *);
+
+ #define MAXSTR 128
+ extern char inputstr[MAXSTR];
diff --git a/source/xap/gnuchess/xboard.buffer_overflow_fix.diff b/source/xap/gnuchess/xboard.buffer_overflow_fix.diff
deleted file mode 100644
index f36d36bad..000000000
--- a/source/xap/gnuchess/xboard.buffer_overflow_fix.diff
+++ /dev/null
@@ -1,95 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 09_fix_-icshost_buffer_overflow.dpatch by Florian Ernst <florian@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Of minor importance, though, as there is probably no attack vector
-## DP: See bug#343560
-
-@DPATCH@
-diff -urNad xboard-4.2.7~/backend.c xboard-4.2.7/backend.c
---- xboard-4.2.7~/backend.c 2003-11-28 10:37:36.000000000 +0100
-+++ xboard-4.2.7/backend.c 2005-12-16 22:19:16.000000000 +0100
-@@ -692,7 +692,7 @@
- sprintf(buf, "Could not open comm port %s",
- appData.icsCommPort);
- } else {
-- sprintf(buf, "Could not connect to host %s, port %s",
-+ snprintf(buf, sizeof(buf), "Could not connect to host %s, port %s",
- appData.icsHost, appData.icsPort);
- }
- DisplayFatalError(buf, err, 1);
-@@ -869,18 +869,18 @@
- } else if (*appData.gateway != NULLCHAR) {
- if (*appData.remoteShell == NULLCHAR) {
- /* Use the rcmd protocol to run telnet program on a gateway host */
-- sprintf(buf, "%s %s %s",
-+ snprintf(buf, sizeof(buf), "%s %s %s",
- appData.telnetProgram, appData.icsHost, appData.icsPort);
- return OpenRcmd(appData.gateway, appData.remoteUser, buf, &icsPR);
-
- } else {
- /* Use the rsh program to run telnet program on a gateway host */
- if (*appData.remoteUser == NULLCHAR) {
-- sprintf(buf, "%s %s %s %s %s", appData.remoteShell,
-+ snprintf(buf, sizeof(buf), "%s %s %s %s %s", appData.remoteShell,
- appData.gateway, appData.telnetProgram,
- appData.icsHost, appData.icsPort);
- } else {
-- sprintf(buf, "%s %s -l %s %s %s %s",
-+ snprintf(buf, sizeof(buf), "%s %s -l %s %s %s %s",
- appData.remoteShell, appData.gateway,
- appData.remoteUser, appData.telnetProgram,
- appData.icsHost, appData.icsPort);
-@@ -1684,7 +1684,7 @@
-
- if (loggedOn && !have_set_title && ics_handle[0] != NULLCHAR) {
- char buf[MSG_SIZ];
-- sprintf(buf, "%s@%s", ics_handle, appData.icsHost);
-+ snprintf(buf, sizeof(buf), "%s@%s", ics_handle, appData.icsHost);
- DisplayIcsInteractionTitle(buf);
- have_set_title = TRUE;
- }
-@@ -4882,7 +4882,7 @@
- SendToProgram(buf, cps);
- }
- if (cps->sendICS) {
-- sprintf(buf, "ics %s\n", appData.icsActive ? appData.icsHost : "-");
-+ snprintf(buf, sizeof(buf), "ics %s\n", appData.icsActive ? appData.icsHost : "-");
- SendToProgram(buf, cps);
- }
- cps->maybeThinking = FALSE;
-diff -urNad xboard-4.2.7~/xboard.c xboard-4.2.7/xboard.c
---- xboard-4.2.7~/xboard.c 2003-11-19 09:42:18.000000000 +0100
-+++ xboard-4.2.7/xboard.c 2005-12-16 22:19:16.000000000 +0100
-@@ -6734,8 +6734,8 @@
- strcpy(icon, text);
- strcpy(title, text);
- } else if (appData.icsActive) {
-- sprintf(icon, "%s", appData.icsHost);
-- sprintf(title, "%s: %s", programName, appData.icsHost);
-+ snprintf(icon, sizeof(icon), "%s", appData.icsHost);
-+ snprintf(title, sizeof(title), "%s: %s", programName, appData.icsHost);
- } else if (appData.cmailGameName[0] != NULLCHAR) {
- sprintf(icon, "%s", "CMail");
- sprintf(title, "%s: %s", programName, "CMail");
-@@ -6804,7 +6804,7 @@
- } else {
- fprintf(stderr, "%s: %s: %s\n",
- programName, message, strerror(error));
-- sprintf(buf, "%s: %s", message, strerror(error));
-+ snprintf(buf, sizeof(buf), "%s: %s", message, strerror(error));
- message = buf;
- }
- if (appData.popupExitMessage && boardWidget && XtIsRealized(boardWidget)) {
-@@ -7488,9 +7488,9 @@
- char cmdLine[MSG_SIZ];
-
- if (port[0] == NULLCHAR) {
-- sprintf(cmdLine, "%s %s", appData.telnetProgram, host);
-+ snprintf(cmdLine, sizeof(cmdLine), "%s %s", appData.telnetProgram, host);
- } else {
-- sprintf(cmdLine, "%s %s %s", appData.telnetProgram, host, port);
-+ snprintf(cmdLine, sizeof(cmdLine), "%s %s %s", appData.telnetProgram, host, port);
- }
- return StartChildProcess(cmdLine, "", pr);
- }
diff --git a/source/xap/gnuchess/xboard.infodir.diff b/source/xap/gnuchess/xboard.infodir.diff
deleted file mode 100644
index 5c18bb026..000000000
--- a/source/xap/gnuchess/xboard.infodir.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./Makefile.in.orig 2003-11-28 13:12:57.000000000 -0800
-+++ ./Makefile.in 2004-06-26 15:47:07.000000000 -0700
-@@ -21,7 +21,7 @@
- # Yuck; the autoconf generated configure script sets an infodir variable
- # and provides a command-line flag to change it, but the default is
- # /usr/info instead of /usr/share/info.
--infodir = $(prefix)/share/info
-+infodir = /usr/info
-
- CC = @CC@
- CFLAGS = @CFLAGS@ @CPPFLAGS@ -DINFODIR=\"$(infodir)\"
diff --git a/source/xap/gnuplot/gnuplot.SlackBuild b/source/xap/gnuplot/gnuplot.SlackBuild
index f154e16d8..180336830 100755
--- a/source/xap/gnuplot/gnuplot.SlackBuild
+++ b/source/xap/gnuplot/gnuplot.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,11 +21,21 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-VERSION=4.2.5
-ARCH=${ARCH:-x86_64}
-NUMJOBS=${NUMJOBS:-" -j7 "}
+VERSION=4.2.6
BUILD=${BUILD:-1}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
@@ -35,6 +45,9 @@ elif [ "$ARCH" = "s390" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
CWD=$(pwd)
diff --git a/source/xap/gqview/doinst.sh b/source/xap/gqview/doinst.sh
deleted file mode 100644
index 31da22647..000000000
--- a/source/xap/gqview/doinst.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-if [ -x /usr/bin/update-desktop-database ]; then
- /usr/bin/update-desktop-database usr/share/applications >/dev/null 2>&1
-fi
-if [ -x /usr/bin/gtk-update-icon-cache ]; then
- /usr/bin/gtk-update-icon-cache -f -t usr/share/icons/hicolor > /dev/null 2>&1
-fi
-
diff --git a/source/xap/gucharmap/gucharmap.SlackBuild b/source/xap/gucharmap/gucharmap.SlackBuild
index 36f526148..f95766621 100755
--- a/source/xap/gucharmap/gucharmap.SlackBuild
+++ b/source/xap/gucharmap/gucharmap.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,10 +21,19 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-VERSION=${VERSION:-2.26.2}
-ARCH=${ARCH:-x86_64}
+VERSION=${VERSION:-$(echo gucharmap-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-1}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
if [ "$ARCH" = "i486" ]; then
@@ -36,6 +45,9 @@ elif [ "$ARCH" = "s390" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
CWD=$(pwd)
@@ -84,6 +96,14 @@ cp -a \
COPYING* NEWS README TODO \
$PKG/usr/doc/gucharmap-$VERSION
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
diff --git a/source/xap/gv/gv.SlackBuild b/source/xap/gv/gv.SlackBuild
index d28abd8ed..b30eb321c 100755
--- a/source/xap/gv/gv.SlackBuild
+++ b/source/xap/gv/gv.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2006, 2007, 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2006, 2007, 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,10 +22,19 @@
PKGNAM=gv
-VERSION=${VERSION:-3.6.7}
-ARCH=${ARCH:-x86_64}
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-1}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
CWD=$(pwd)
@@ -40,6 +49,8 @@ elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
+else
+ SLKCFLAGS="-O2"
fi
cd $TMP
@@ -101,11 +112,18 @@ fi
# Add a documentation directory:
mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
cp -a \
- AUTHORS COPYING INSTALL NEWS README \
+ AUTHORS COPYING* INSTALL NEWS README* \
$PKG/usr/doc/${PKGNAM}-$VERSION
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
mkdir -p $PKG/install
-#zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
diff --git a/source/xap/imagemagick/imagemagick.SlackBuild b/source/xap/imagemagick/imagemagick.SlackBuild
index cfa074977..eb285daf4 100755
--- a/source/xap/imagemagick/imagemagick.SlackBuild
+++ b/source/xap/imagemagick/imagemagick.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,11 +20,35 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-ARCH=${ARCH:-x86_64}
-NUMJOBS=${NUMJOBS:-" -j7 "}
BUILD=${BUILD:-1}
+# NOTE: This is to cope with ImageMagick version numbers such as 5.4.7-4,
+# which occur fairly often (but not always). If these numbers are all the same,
+# then this is not one of those versions.
+
+# This is a bit messy, so we'll explain it well. :-)
+
+# This is the base version number, which is needed to cd into the source tree
+BASEVER=6.5.9-6
+
+# This is the version number used in the source tarball filename
+FILEVER=6.5.9-6
+
+# This is the version number used in the package, where a version number cannot
+# contain a '-'
+PKGVER=6.5.9_6
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
@@ -35,6 +59,9 @@ elif [ "$ARCH" = "s390" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
CWD=$(pwd)
@@ -43,22 +70,6 @@ PKG=$TMP/package-imagemagick
rm -rf $PKG
mkdir -p $TMP $PKG
-# NOTE: This is to cope with ImageMagick version numbers such as 5.4.7-4,
-# which occur fairly often (but not always). If these numbers are all the same,
-# then this is not one of those versions.
-
-# This is a bit messy, so we'll explain it well. :-)
-
-# This is the base version number, which is needed to cd into the source tree
-BASEVER=6.5.3-3
-
-# This is the version number used in the source tarball filename
-FILEVER=6.5.3-3
-
-# This is the version number used in the package, where a version number cannot
-# contain a '-'
-PKGVER=6.5.3_3
-
# --with-x or not --with-x, that is the question. It seems many other
# distributions don't compile with X support, but it's been traditional
# here. I am moving the prefix to /usr (instead of /usr/X11R6) though,
@@ -132,6 +143,14 @@ cp -a \
AUTHORS LICENSE NEWS NOTICE Platforms.txt QuickStart.txt README.txt \
$PKG/usr/doc/Imag*
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
diff --git a/source/xap/mozilla-firefox/mozilla-firefox.SlackBuild b/source/xap/mozilla-firefox/mozilla-firefox.SlackBuild
index 22dfb33bd..4de240384 100755
--- a/source/xap/mozilla-firefox/mozilla-firefox.SlackBuild
+++ b/source/xap/mozilla-firefox/mozilla-firefox.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -26,11 +26,19 @@
# This is a source build script. Unfortunately, there is no official
# binary tarball available for x86_64
-VERSION=${VERSION:-3.5.2}
-ARCH=${ARCH:-x86_64}
+VERSION=$(basename $(ls firefox-*.tar.bz2 | cut -d - -f 2 | rev | cut -f 3- -d . | rev) .source)
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
BUILD=${BUILD:-1}
-MOZVERS=${MOZVERS:-1.9.1}
+MOZVERS=${MOZVERS:-1.9.2}
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -61,7 +69,7 @@ mkdir -p $TMP $PKG/usr/lib${LIBDIRSUFFIX}
cd $TMP
rm -rf mozilla-$MOZVERS
-tar xvf $CWD/firefox-$VERSION-source.tar.bz2 || exit 1
+tar xvf $CWD/firefox-$VERSION.source.tar.bz2 || exit 1
cd mozilla-$MOZVERS || exit 1
# Fix a long standing bug that's prevented staying current on GTK+.
diff --git a/source/xap/mozilla-thunderbird/mimeTypes.rdf b/source/xap/mozilla-thunderbird/mimeTypes.rdf
new file mode 100644
index 000000000..366df44bc
--- /dev/null
+++ b/source/xap/mozilla-thunderbird/mimeTypes.rdf
@@ -0,0 +1,113 @@
+<?xml version="1.0"?>
+
+<!--
+ This file is used as a persistent data store for helper application
+ information about both MIME type and protocol scheme helpers.
+
+ The root of the data are the two containers
+ <RDF:Seq about="urn:mimetypes:root"/> and <RDF:Seq about="urn:schemes:root"/>.
+
+ These contain one <RDF:li/> entry per MIME type/protocol. Each <RDF:li/> entry
+ corresponds to a "urn:<class>:<type>" resource, where <class> is either
+ "mimetype" or "scheme" and <type> is either a MIME type in "major/minor" format
+ or a scheme. For example, for HTML we would have "urn:mimetype:text/html",
+ while for mailto: we would have "urn:scheme:mailto".
+
+ Typically, this resource will be in the <RDF:Description/> node which has the
+ corresponding "about" attribute.
+
+ Each "urn:<class>:<type>" resource can have the following properties:
+
+ NC:Value - the MIME type or scheme string
+ NC:editable - a "true" or "false" depending on whether this entry is
+ editable
+ NC:description - a description of the type ("HTML Document" for text/html)
+ NC:fileExtensions - for MIME types, there will be one of these properties
+ per extension that corresponds to this MIME type,
+ each one having a single extension as its value.
+ NC:handlerProp - the way the type should be handled. This corresponds to a
+ "urn:<class>:handler:<type>" resource. Eg, the way HTML is
+ handled would be stored in the
+ "urn:mimetype:handler:text/html" resource.
+
+ Each "urn:<class>:handler:<type>" resource can have the following properties:
+
+ NC:useSystemDefault - "true" if we should handle per default OS setting,
+ "false" or not set otherwise
+ NC:saveToDisk - "true" if the data should be saved to disk, "false" or not
+ set otherwise.
+ (Note - if both of these are false, that means "open in helper app")
+ NC:alwaysAsk - "true" if the user should always be prompted before handling
+ data of this type, false otherwise.
+ NC:externalApplication - the preferred helper application to use for this
+ type. This corresponds to a
+ "urn:<class>:externalApplication:<type>" resource.
+ NC:possibleApplication - a helper application that can be used for this type.
+ Since there can be multiple possible applications,
+ there can be multiple assertions in the graph with
+ this property for a given handler resource.
+
+ Each "urn:<class>:externalApplication:<type>" resource, and each resource
+ that represents a possible application, can have the following property:
+
+ NC:prettyName - the "pretty name" of the application ("Acrobat Reader" for
+ /usr/bin/acroread, eg).
+
+ If the resource represents a local application, then it can have the following
+ property:
+
+ NC:path - the path to the application on the local filesystem, for example
+ /usr/bin/test or C:\windows\system32\cmd.exe.
+
+ If the resource represents a web application, then it can have the following
+ property:
+
+ NC:uriTemplate - a URI pointing to the web application to which the type
+ should be handed off, with %s in the template representing
+ the place where the content should be inserted. For example,
+ here is a URI template for a service that lets you email
+ an address in a mailto: link:
+ http://www.example.com/sendmail?link=%s
+-->
+
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:NC="http://home.netscape.com/NC-rdf#">
+
+ <RDF:Description about="urn:mimetypes">
+ <NC:MIME-types>
+ <RDF:Seq about="urn:mimetypes:root">
+ </RDF:Seq>
+ </NC:MIME-types>
+ </RDF:Description>
+
+ <RDF:Description RDF:about="urn:scheme:handler:http"
+ NC:alwaysAsk="false">
+ <NC:externalApplication RDF:resource="urn:scheme:externalApplication:http"/>
+ </RDF:Description>
+ <RDF:Description RDF:about="urn:scheme:externalApplication:http"
+ NC:prettyName="firefox"
+ NC:path="/usr/bin/firefox" />
+ <RDF:Description RDF:about="urn:schemes">
+ <NC:Protocol-Schemes RDF:resource="urn:schemes:root"/>
+ </RDF:Description>
+ <RDF:Description RDF:about="urn:scheme:http"
+ NC:value="http">
+ <NC:handlerProp RDF:resource="urn:scheme:handler:http"/>
+ </RDF:Description>
+
+ <RDF:Description RDF:about="urn:scheme:handler:https"
+ NC:alwaysAsk="false">
+ <NC:externalApplication RDF:resource="urn:scheme:externalApplication:https"/>
+ </RDF:Description>
+ <RDF:Description RDF:about="urn:scheme:externalApplication:https"
+ NC:prettyName="firefox"
+ NC:path="/usr/bin/firefox" />
+ <RDF:Description RDF:about="urn:schemes">
+ <NC:Protocol-Schemes RDF:resource="urn:schemes:root"/>
+ </RDF:Description>
+ <RDF:Description RDF:about="urn:scheme:https"
+ NC:value="https">
+ <NC:handlerProp RDF:resource="urn:scheme:handler:https"/>
+ </RDF:Description>
+
+</RDF:RDF>
diff --git a/source/xap/mozilla-thunderbird/mozilla-thunderbird-firefox.diff b/source/xap/mozilla-thunderbird/mozilla-thunderbird-firefox.diff
deleted file mode 100644
index fdf20963d..000000000
--- a/source/xap/mozilla-thunderbird/mozilla-thunderbird-firefox.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./defaults/pref/all-thunderbird.js.orig 2005-10-25 22:03:39.000000000 -0500
-+++ ./defaults/pref/all-thunderbird.js 2005-12-09 16:22:00.000000000 -0600
-@@ -440,3 +440,8 @@
-
- // prevent status-bar spoofing even if people are foolish enough to turn on JS
- pref("dom.disable_window_status_change", true);
-+
-+// Use Firefox as the default for http:// and https:// links
-+pref("network.protocol-handler.app.http", "/usr/bin/firefox");
-+pref("network.protocol-handler.app.https", "/usr/bin/firefox");
-+
diff --git a/source/xap/mozilla-thunderbird/mozilla-thunderbird.SlackBuild b/source/xap/mozilla-thunderbird/mozilla-thunderbird.SlackBuild
index 9872927db..0a521dd70 100755
--- a/source/xap/mozilla-thunderbird/mozilla-thunderbird.SlackBuild
+++ b/source/xap/mozilla-thunderbird/mozilla-thunderbird.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -23,21 +23,42 @@
# Thanks to the folks at the Mozilla Foundation for permission to
# distribute this, and for all the great work! :-)
-VERSION=2.0.0.23
-ARCH=${ARCH:-x86_64}
+# This is a source build script. Unfortunately, there is no official
+# binary tarball available for x86_64
+
+VERSION=$(basename $(ls thunderbird-*.tar.bz2 | cut -d - -f 2 | rev | cut -f 3- -d . | rev) .source)
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
BUILD=${BUILD:-1}
+MOZVERS=${MOZVERS:-1.9.1}
+
NUMJOBS=${NUMJOBS:-" -j7 "}
+# Try to be gentle to the compiler, no optimizations:
if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-Os -march=i486 -mcpu=i686"
+ SLKCFLAGS="-O"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
- SLKCFLAGS="-Os"
+ SLKCFLAGS="-O"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
- SLKCFLAGS="-Os -fPIC"
+ SLKCFLAGS="-O -fPIC"
LIBDIRSUFFIX="64"
+elif [ "$ARCH" = "arm" ]; then
+ SLKCFLAGS="-O2 -march=armv4 -mtune=xscale"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "armel" ]; then
+ SLKCFLAGS="-O2 -march=armv4t"
+ LIBDIRSUFFIX=""
fi
CWD=$(pwd)
@@ -45,12 +66,23 @@ TMP=${TMP:-/tmp}
PKG=$TMP/package-mozilla-thunderbird
rm -rf $PKG
-mkdir -p $TMP $PKG
+mkdir -p $TMP $PKG/usr/lib${LIBDIRSUFFIX}
cd $TMP
-rm -rf mozilla
-tar xvf $CWD/thunderbird-$VERSION-source.tar.bz2 || exit 1
-cd mozilla || exit 1
+rm -rf comm-$MOZVERS
+tar xvf $CWD/thunderbird-$VERSION.source.tar.bz2 || exit 1
+cd comm-$MOZVERS || exit 1
+
+# Fix a long standing bug that's prevented staying current on GTK+.
+# Thanks to the BLFS folks. :-)
+cat << EOF >> mozilla/layout/build/Makefile.in
+
+ifdef MOZ_ENABLE_CANVAS
+EXTRA_DSO_LDOPTS += \$(XLDFLAGS) -lX11 -lXrender
+endif
+
+EOF
+
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -60,7 +92,7 @@ find . \
export MOZILLA_OFFICIAL="1" &&
export BUILD_OFFICIAL="1" &&
-export MOZ_CO_PROJECT="mail" &&
+export MOZ_PHOENIX="1" &&
export CFLAGS="$SLKCFLAGS" &&
export CXXFLAGS="$SLKCFLAGS" &&
./configure \
@@ -68,61 +100,60 @@ export CXXFLAGS="$SLKCFLAGS" &&
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--with-default-mozilla-five-home=/usr/lib${LIBDIRSUFFIX}/thunderbird-$VERSION \
- --with-user-appdir=.thunderbird \
--with-system-zlib \
- --with-system-png \
--enable-application=mail \
- --enable-default-toolkit=gtk2 \
+ --enable-default-toolkit=cairo-gtk2 \
--enable-crypto \
+ --enable-svg \
+ --enable-canvas \
--enable-xft \
- --enable-pango \
--enable-xinerama \
--enable-optimize \
--enable-reorder \
+ --enable-static \
--enable-strip \
+ --enable-system-cairo \
--enable-cpp-rtti \
--enable-single-profile \
- --enable-ldap \
- --disable-freetype2 \
+ --disable-ldap \
--disable-accessibility \
--disable-debug \
--disable-tests \
--disable-logging \
--disable-pedantic \
--disable-installer \
- --disable-profilesharing \
- --disable-gnomevfs \
- --disable-gnomeui
+ --disable-profilesharing
+ # Complains about missing APNG support in Slackware's libpng:
+ #--with-system-png \
-make MOZ_OPT_FLAGS="$SLKCFLAGS" MOZ_MAKE_FLAGS="$NUMJOBS" || make || exit 1
+#make -f client.mk build MOZ_MAKE_FLAGS="$NUMJOBS" || exit 1
+make MOZ_MAKE_FLAGS="$NUMJOBS" || exit 1
make install DESTDIR=$PKG || exit 1
-# We do not need 20+ MB of includes:
+# We don't need these (just symlinks anyway):
+rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/thunderbird-devel-$VERSION
+
+# Nor these:
rm -rf $PKG/usr/include
( cd $PKG/usr/lib${LIBDIRSUFFIX}/thunderbird-$VERSION
- echo "Applying firefox patch"
- zcat $CWD/mozilla-thunderbird-firefox.diff.gz | patch -p0 --verbose || exit 1
+ cp -a defaults/profile/mimeTypes.rdf defaults/profile/mimeTypes.rdf.orig
+ zcat $CWD/mimeTypes.rdf > defaults/profile/mimeTypes.rdf || exit 1
) || exit 1
+mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/mozilla/plugins
mkdir -p $PKG/usr/share/applications
cat $CWD/mozilla-thunderbird.desktop > $PKG/usr/share/applications/mozilla-thunderbird.desktop
mkdir -p $PKG/usr/share/pixmaps
cat $CWD/thunderbird.png > $PKG/usr/share/pixmaps/thunderbird.png
-mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/thunderbird-$VERSION/chrome/icons/default/
-install -m 644 other-licenses/branding/thunderbird/default.xpm \
- $PKG/usr/lib${LIBDIRSUFFIX}/thunderbird-$VERSION/chrome/icons/default/
-install -m 644 other-licenses/branding/thunderbird/default.xpm \
- $PKG/usr/lib${LIBDIRSUFFIX}/thunderbird-$VERSION/icons/
-
-# These files/directories are usually created if Thunderbird is run as root,
-# which on many systems might (and possibly should) be never. Therefore,
-# if we don't see them we'll put stubs in place to prevent startup errors.
+# These files/directories are usually created if Firefox is run as root,
+# which on many systems might (and possibly should) be never. Therefore, if we
+# don't see them we'll put stubs in place to prevent startup errors.
( cd $PKG/usr/lib${LIBDIRSUFFIX}/thunderbird-$VERSION
- if [ -d chrome ]; then
- if [ ! -r chrome/app-chrome.manifest ]; then
- echo > chrome/app-chrome.manifest
+ if [ -d extensions/talkback\@mozilla.org ]; then
+ if [ ! -r extensions/talkback\@mozilla.org/chrome.manifest ]; then
+ echo > extensions/talkback\@mozilla.org/chrome.manifest
fi
fi
if [ ! -d updates ]; then
@@ -130,12 +161,22 @@ install -m 644 other-licenses/branding/thunderbird/default.xpm \
fi
)
+# Need some default icons in the right place:
+mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/thunderbird-$VERSION/chrome/icons/default
+install -m 644 other-licenses/branding/thunderbird/default16.png \
+ $PKG/usr/lib${LIBDIRSUFFIX}/thunderbird-$VERSION/icons/
+install -m 644 other-licenses/branding/thunderbird/default16.png \
+ $PKG/usr/lib${LIBDIRSUFFIX}/thunderbird-$VERSION/chrome/icons/default/
+( cd $PKG/usr/lib${LIBDIRSUFFIX}/thunderbird-$VERSION
+ install -m 644 icons/{default,mozicon50}.xpm chrome/icons/default/
+)
+
# Copy over the LICENSE
-install -c -m 644 LICENSE $PKG/usr/lib${LIBDIRSUFFIX}/thunderbird-$VERSION
+install -p -c -m 644 LICENSE $PKG/usr/lib${LIBDIRSUFFIX}/thunderbird-$VERSION/
mkdir $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
-/sbin/makepkg -l y -c n $TMP/mozilla-thunderbird-$VERSION-${ARCH}-$BUILD.txz
+/sbin/makepkg -l y -c n $TMP/mozilla-thunderbird-$VERSION-$ARCH-$BUILD.txz
diff --git a/source/xap/mozilla-thunderbird/thunderbird.png b/source/xap/mozilla-thunderbird/thunderbird.png
index a6172dcda..61a37d70e 100644
--- a/source/xap/mozilla-thunderbird/thunderbird.png
+++ b/source/xap/mozilla-thunderbird/thunderbird.png
Binary files differ
diff --git a/source/xap/pan/pan.SlackBuild b/source/xap/pan/pan.SlackBuild
index 288b34a7b..4bfbcf7f5 100755
--- a/source/xap/pan/pan.SlackBuild
+++ b/source/xap/pan/pan.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2006, 2007, 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2006, 2007, 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,9 +22,18 @@
PKGNAM=pan
-VERSION=${VERSION:-0.133}
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-1}
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | cut -d - -f 2 | rev | cut -f 3- -d . | rev)}
+BUILD=${BUILD:-2}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -35,6 +44,8 @@ elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
+else
+ SLKCFLAGS="-O2"
fi
CWD=$(pwd)
@@ -48,6 +59,9 @@ rm -rf ${PKGNAM}-${VERSION}
tar xvf $CWD/${PKGNAM}-$VERSION.tar.bz2 || exit 1
cd ${PKGNAM}-$VERSION || exit 1
+zcat $CWD/pan.gmime2.4.diff.gz | patch -p1 || exit 1
+zcat $CWD/pan.gcc44.diff.gz | patch -p1 || exit 1
+
# Make sure ownerships and permissions are sane:
chown -R root:root .
find . \
diff --git a/source/xap/pan/pan.gcc44.diff b/source/xap/pan/pan.gcc44.diff
new file mode 100644
index 000000000..22df125f8
--- /dev/null
+++ b/source/xap/pan/pan.gcc44.diff
@@ -0,0 +1,50 @@
+--- ./pan/usenet-utils/numbers.cc.orig 2008-07-04 10:01:53.000000000 -0500
++++ ./pan/usenet-utils/numbers.cc 2010-02-03 18:06:16.000000000 -0600
+@@ -19,6 +19,7 @@
+
+ #include <config.h>
+ #include <cctype>
++#include <cstdio>
+ #include <pan/general/string-view.h>
+ #include "numbers.h"
+ #include <algorithm>
+--- ./pan/tasks/nntp.cc.orig 2008-07-05 14:16:06.000000000 -0500
++++ ./pan/tasks/nntp.cc 2010-02-03 18:07:19.000000000 -0600
+@@ -20,6 +20,7 @@
+ #include <config.h>
+ #include <cassert>
+ #include <cstdarg>
++#include <cstdio>
+ #include <cstdlib> // abort, atoi, strtoul
+ extern "C" {
+ #include <glib.h>
+--- ./pan/tasks/nntp-pool.cc.orig 2008-07-05 01:39:27.000000000 -0500
++++ ./pan/tasks/nntp-pool.cc 2010-02-03 18:07:55.000000000 -0600
+@@ -19,6 +19,7 @@
+
+ #include <config.h>
+ #include <ctime>
++#include <cstdio>
+ #include <glib/gi18n.h>
+ #include <pan/general/debug.h>
+ #include <pan/general/log.h>
+--- ./pan/general/progress.cc.orig 2007-08-01 12:00:01.000000000 -0500
++++ ./pan/general/progress.cc 2010-02-03 18:05:38.000000000 -0600
+@@ -19,6 +19,7 @@
+
+ #include <config.h>
+ #include <cstdarg>
++#include <cstdio>
+ #include "progress.h"
+ #include "string-view.h"
+
+--- ./pan/general/log.cc.orig 2007-08-01 12:00:01.000000000 -0500
++++ ./pan/general/log.cc 2010-02-03 18:05:19.000000000 -0600
+@@ -20,6 +20,7 @@
+ #include <config.h>
+ #include <iostream>
+ #include <cstdarg>
++#include <cstdio>
+ #include "log.h"
+
+ using namespace pan;
diff --git a/source/xap/pan/pan.gmime2.4.diff b/source/xap/pan/pan.gmime2.4.diff
new file mode 100644
index 000000000..4816ea6cd
--- /dev/null
+++ b/source/xap/pan/pan.gmime2.4.diff
@@ -0,0 +1,1271 @@
+diff -ru pan-0.133.orig/configure pan-0.133/configure
+--- pan-0.133.orig/configure 2008-07-29 19:02:08.000000000 -0700
++++ pan-0.133/configure 2009-09-12 14:58:05.000000000 -0700
+@@ -2377,7 +2377,7 @@
+
+ PCRE_REQUIRED=5.0
+ GLIB_REQUIRED=2.4.0
+-GMIME_REQUIRED=2.1.9
++GMIME_REQUIRED=2.3.5
+ GTK_REQUIRED=2.4.0
+ GTKSPELL_REQUIRED=2.0.7
+
+@@ -7957,12 +7957,12 @@
+ pkg_cv_GMIME_CFLAGS="$GMIME_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+- { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gmime-2.0 >= \$GMIME_REQUIRED\"") >&5
+- ($PKG_CONFIG --exists --print-errors "gmime-2.0 >= $GMIME_REQUIRED") 2>&5
++ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gmime-2.4 >= \$GMIME_REQUIRED\"") >&5
++ ($PKG_CONFIG --exists --print-errors "gmime-2.4 >= $GMIME_REQUIRED") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+- pkg_cv_GMIME_CFLAGS=`$PKG_CONFIG --cflags "gmime-2.0 >= $GMIME_REQUIRED" 2>/dev/null`
++ pkg_cv_GMIME_CFLAGS=`$PKG_CONFIG --cflags "gmime-2.4 >= $GMIME_REQUIRED" 2>/dev/null`
+ else
+ pkg_failed=yes
+ fi
+@@ -7973,12 +7973,12 @@
+ pkg_cv_GMIME_LIBS="$GMIME_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+- { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gmime-2.0 >= \$GMIME_REQUIRED\"") >&5
+- ($PKG_CONFIG --exists --print-errors "gmime-2.0 >= $GMIME_REQUIRED") 2>&5
++ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gmime-2.4 >= \$GMIME_REQUIRED\"") >&5
++ ($PKG_CONFIG --exists --print-errors "gmime-2.4 >= $GMIME_REQUIRED") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+- pkg_cv_GMIME_LIBS=`$PKG_CONFIG --libs "gmime-2.0 >= $GMIME_REQUIRED" 2>/dev/null`
++ pkg_cv_GMIME_LIBS=`$PKG_CONFIG --libs "gmime-2.4 >= $GMIME_REQUIRED" 2>/dev/null`
+ else
+ pkg_failed=yes
+ fi
+@@ -7996,14 +7996,14 @@
+ _pkg_short_errors_supported=no
+ fi
+ if test $_pkg_short_errors_supported = yes; then
+- GMIME_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gmime-2.0 >= $GMIME_REQUIRED" 2>&1`
++ GMIME_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gmime-2.4 >= $GMIME_REQUIRED" 2>&1`
+ else
+- GMIME_PKG_ERRORS=`$PKG_CONFIG --print-errors "gmime-2.0 >= $GMIME_REQUIRED" 2>&1`
++ GMIME_PKG_ERRORS=`$PKG_CONFIG --print-errors "gmime-2.4 >= $GMIME_REQUIRED" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$GMIME_PKG_ERRORS" >&5
+
+- { { echo "$as_me:$LINENO: error: Package requirements (gmime-2.0 >= $GMIME_REQUIRED) were not met:
++ { { echo "$as_me:$LINENO: error: Package requirements (gmime-2.4 >= $GMIME_REQUIRED) were not met:
+
+ $GMIME_PKG_ERRORS
+
+@@ -8014,7 +8014,7 @@
+ and GMIME_LIBS to avoid the need to call pkg-config.
+ See the pkg-config man page for more details.
+ " >&5
+-echo "$as_me: error: Package requirements (gmime-2.0 >= $GMIME_REQUIRED) were not met:
++echo "$as_me: error: Package requirements (gmime-2.4 >= $GMIME_REQUIRED) were not met:
+
+ $GMIME_PKG_ERRORS
+
+diff -ru pan-0.133.orig/configure.in pan-0.133/configure.in
+--- pan-0.133.orig/configure.in 2008-07-29 19:00:01.000000000 -0700
++++ pan-0.133/configure.in 2009-09-12 14:52:37.000000000 -0700
+@@ -18,7 +18,7 @@
+
+ PCRE_REQUIRED=5.0
+ GLIB_REQUIRED=2.4.0
+-GMIME_REQUIRED=2.1.9
++GMIME_REQUIRED=2.3.5
+ GTK_REQUIRED=2.4.0
+ GTKSPELL_REQUIRED=2.0.7
+ AC_SUBST(PCRE_REQUIRED)
+@@ -50,7 +50,7 @@
+
+ PKG_CHECK_MODULES(PCRE, libpcre >= $PCRE_REQUIRED)
+ AM_PATH_GLIB_2_0($GLIB_REQUIRED,,exit 1,gobject gmodule gthread)
+-PKG_CHECK_MODULES(GMIME, gmime-2.0 >= $GMIME_REQUIRED)
++PKG_CHECK_MODULES(GMIME, gmime-2.4 >= $GMIME_REQUIRED)
+ AM_PATH_GTK_2_0($GTK_REQUIRED,,exit 1,gthread)
+
+
+--- pan-0.133.orig/pan/general/utf8-utils.cc 2008-07-04 23:13:14.000000000 -0700
++++ pan-0.133/pan/general/utf8-utils.cc 2009-09-12 14:38:13.000000000 -0700
+@@ -136,7 +136,7 @@
+ {
+ std::string s = content_to_utf8 (header, fallback_charset1, fallback_charset2);
+ if (header.strstr ("=?")) {
+- char * decoded (g_mime_utils_8bit_header_decode ((const guchar*) s.c_str()));
++ char * decoded (g_mime_utils_header_decode_text (s.c_str()));
+ s = clean_utf8 (decoded);
+ g_free (decoded);
+ }
+@@ -147,15 +147,26 @@
+ pan :: mime_part_to_utf8 (GMimePart * part,
+ const char * fallback_charset)
+ {
++ GMimeDataWrapper *content;
++ GMimeStream *stream;
++ const char *charset;
++ GByteArray *buffer;
+ std::string ret;
+
+ g_return_val_if_fail (GMIME_IS_PART(part), ret);
+
+- size_t content_len (0);
+- const char * specified_charset (g_mime_object_get_content_type_parameter (GMIME_OBJECT (part), "charset"));
+- const char * content = g_mime_part_get_content (part, &content_len);
+- if (content && content_len)
+- ret = content_to_utf8 (StringView (content, content_len), specified_charset, fallback_charset);
++ charset = g_mime_object_get_content_type_parameter (GMIME_OBJECT (part), "charset");
++ content = g_mime_part_get_content_object (part);
++
++ stream = g_mime_stream_mem_new ();
++ g_mime_data_wrapper_write_to_stream (content, stream);
++//g_object_unref(content); //SKG gmime 2.4 don't unref returned data wrapper
++
++ buffer = ((GMimeStreamMem *) stream)->buffer;
++
++ ret = content_to_utf8 (StringView ((const char *) buffer->data, buffer->len), charset, fallback_charset);
++
++ g_object_unref (stream);
+
+ return ret;
+ }
+diff -ru pan-0.133.orig/pan/gui/body-pane.cc pan-0.133/pan/gui/body-pane.cc
+--- pan-0.133.orig/pan/gui/body-pane.cc 2008-07-06 07:20:54.000000000 -0700
++++ pan-0.133/pan/gui/body-pane.cc 2009-09-12 14:41:46.000000000 -0700
+@@ -837,7 +837,7 @@
+ }
+
+ g_object_unref (mem_stream);
+- g_object_unref (wrapper);
++ //g_object_unref (wrapper); //SKG gmime 2.4 don't unref returned data wrapper
+ }
+
+ // flush the loader
+@@ -874,7 +874,7 @@
+ return;
+
+ GMimePart * part = GMIME_PART (obj);
+- const GMimeContentType * type = g_mime_object_get_content_type (GMIME_OBJECT (part));
++ GMimeContentType * type = g_mime_object_get_content_type (GMIME_OBJECT (part));
+
+ // decide whether or not this part is a picture
+ bool is_image (g_mime_content_type_is_type (type, "image", "*"));
+@@ -952,11 +952,11 @@
+ GtkTextIter iter;
+ gtk_text_buffer_get_end_iter (_buffer, &iter);
+ gtk_text_buffer_insert (_buffer, &iter, pch, -1);
+- g_free (pch);
++// g_free (pch); //SKG don't unref returned const char *
+ }
+ }
+ void
+-BodyPane :: foreach_part_cb (GMimeObject* o, gpointer self)
++BodyPane :: foreach_part_cb (GMimeObject* /*parent*/, GMimeObject* o, gpointer self)
+ {
+ if (GMIME_IS_MULTIPART (o))
+ g_mime_multipart_foreach (GMIME_MULTIPART (o), foreach_part_cb, self);
+@@ -978,7 +978,7 @@
+ const char * key,
+ const char * fallback_charset)
+ {
+- const char * val (message ? g_mime_message_get_header (message, key) : "");
++ const char * val (message ? g_mime_object_get_header ((GMimeObject *) message, key) : "");
+ const std::string utf8_val (header_to_utf8 (val, fallback_charset));
+ char * e (0);
+ if (strcmp (key, "From"))
+@@ -1015,7 +1015,7 @@
+ const char * key,
+ const char * fallback_charset)
+ {
+- const char * val (msg ? g_mime_message_get_header (msg, key) : "");
++ const char * val (msg ? g_mime_object_get_header ((GMimeObject *) msg, key) : "");
+ return add_header_line (s, key_i18n, key, val, fallback_charset);
+ }
+ }
+@@ -1037,19 +1037,19 @@
+
+ // conditional headers...
+ if (message) {
+- const StringView newsgroups (g_mime_message_get_header (message, "Newsgroups"));
++ const StringView newsgroups (g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
+ if (newsgroups.strchr(',')) {
+ l = add_header_line (s, message, _("Newsgroups"), "Newsgroups", fallback_charset);
+ w = std::max (w, l);
+ }
+- const StringView followup_to (g_mime_message_get_header (message, "Followup-To"));
++ const StringView followup_to (g_mime_object_get_header ((GMimeObject *) message, "Followup-To"));
+ if (!followup_to.empty() && (followup_to!=newsgroups)) {
+ l = add_header_line (s, message, _("Followup-To"), "Followup-To", fallback_charset);
+ w = std::max (w, l);
+ }
+- const StringView reply_to (g_mime_message_get_header (message, "Reply-To"));
++ const StringView reply_to (g_mime_object_get_header ((GMimeObject *) message, "Reply-To"));
+ if (!reply_to.empty()) {
+- const StringView from (g_mime_message_get_header (message, "From"));
++ const StringView from (g_mime_object_get_header ((GMimeObject *) message, "From"));
+ StringView f_addr, f_name, rt_addr, rt_name;
+ GNKSA :: do_check_from (from, f_addr, f_name, false);
+ GNKSA :: do_check_from (reply_to, rt_addr, rt_name, false);
+@@ -1070,7 +1070,7 @@
+
+ // set the x-face...
+ GdkPixbuf * pixbuf (0);
+- const char * pch = message ? g_mime_message_get_header (message, "X-Face") : 0;
++ const char * pch = message ? g_mime_object_get_header ((GMimeObject *) message, "X-Face") : 0;
+ if (pch && _xface->window)
+ pixbuf = pan_gdk_pixbuf_create_from_x_face (gtk_widget_get_colormap(_xface), _xface->window, pch);
+ gtk_image_set_from_pixbuf (GTK_IMAGE(_xface), pixbuf);
+@@ -1101,7 +1101,7 @@
+ // maybe add the headers
+ const bool do_show_headers (_prefs.get_flag ("show-all-headers", false));
+ if (message && do_show_headers) {
+- char * headers (g_mime_message_get_headers (message));
++ char * headers (g_mime_object_get_headers ((GMimeObject *) message));
+ GtkTextIter end;
+ gtk_text_buffer_get_end_iter (_buffer, &end);
+ StringView line, v(headers);
+@@ -1119,7 +1119,7 @@
+
+ // set the text buffer...
+ if (message)
+- g_mime_message_foreach_part (message, foreach_part_cb, this);
++ g_mime_message_foreach (message, foreach_part_cb, this);
+
+ // if there was a picture, scroll to it.
+ // otherwise scroll to the top of the body.
+@@ -1514,7 +1514,7 @@
+ const char * fallback_charset_1,
+ const char * fallback_charset_2)
+ {
+- const StringView v (g_mime_message_get_header (msg, key));
++ const StringView v (g_mime_object_get_header ((GMimeObject *) msg, key));
+ std::string s;
+ if (!v.empty())
+ s = header_to_utf8 (v, fallback_charset_1, fallback_charset_2);
+@@ -1527,7 +1527,7 @@
+ std::string body;
+ };
+
+- void get_utf8_body_foreach_part (GMimeObject *o, gpointer user_data)
++ void get_utf8_body_foreach_part (GMimeObject * /*parent*/, GMimeObject *o, gpointer user_data)
+ {
+ if (GMIME_IS_MULTIPART(o))
+ {
+@@ -1538,7 +1538,7 @@
+ else
+ {
+ GMimePart * part = GMIME_PART (o);
+- const GMimeContentType * type = g_mime_object_get_content_type (o);
++ GMimeContentType * type = g_mime_object_get_content_type (o);
+ const bool is_text (g_mime_content_type_is_type (type, "text", "*"));
+ if (is_text)
+ {
+@@ -1555,7 +1555,7 @@
+ if (fallback_charset)
+ tmp.fallback_charset = fallback_charset;
+ if (source)
+- g_mime_message_foreach_part (source, get_utf8_body_foreach_part, &tmp);
++ g_mime_message_foreach (source, get_utf8_body_foreach_part, &tmp);
+ return tmp.body;
+ }
+ }
+@@ -1571,7 +1571,7 @@
+
+ // fallback character encodings
+ const char * group_charset (_charset.c_str());
+- const GMimeContentType * type (g_mime_object_get_content_type (GMIME_OBJECT(_message)));
++ GMimeContentType * type (g_mime_object_get_content_type (GMIME_OBJECT(_message)));
+ const char * message_charset (type ? g_mime_content_type_get_parameter (type, "charset") : 0);
+
+ ///
+@@ -1585,14 +1585,14 @@
+ const std::string reply_to (get_header (_message, "Reply-To", message_charset, group_charset));
+ if (is_reply || fup_to=="poster") {
+ const std::string& to (reply_to.empty() ? from : reply_to);
+- g_mime_message_add_recipients_from_string (msg, (char*)GMIME_RECIPIENT_TYPE_TO, to.c_str());
++ g_mime_message_add_recipients_from_string (msg, GMIME_RECIPIENT_TYPE_TO, to.c_str());
+ } else {
+ const std::string& groups (fup_to.empty() ? newsgroups : fup_to);
+- g_mime_message_add_header (msg, "Newsgroups", groups.c_str());
++ g_mime_object_append_header ((GMimeObject *) msg, "Newsgroups", groups.c_str());
+ }
+
+ // Subject:
+- StringView v = g_mime_message_get_header (_message, "Subject");
++ StringView v = g_mime_object_get_header ((GMimeObject *) _message, "Subject");
+ std::string h = header_to_utf8 (v, message_charset, group_charset);
+ std::string val (normalize_subject_re (h));
+ if (val.find ("Re:") != 0) // add "Re: " if we don't have one
+@@ -1601,22 +1601,22 @@
+
+ // attribution lines
+
+- const char * cpch = g_mime_message_get_header (_message, "From");
++ const char * cpch = g_mime_object_get_header ((GMimeObject *) _message, "From");
+ h = header_to_utf8 (cpch, message_charset, group_charset);
+- g_mime_message_add_header (msg, "X-Draft-Attribution-Author", h.c_str());
++ g_mime_object_append_header ((GMimeObject *) msg, "X-Draft-Attribution-Author", h.c_str());
+
+ cpch = g_mime_message_get_message_id (_message);
+ h = header_to_utf8 (cpch, message_charset, group_charset);
+- g_mime_message_add_header (msg, "X-Draft-Attribution-Id", h.c_str());
++ g_mime_object_append_header ((GMimeObject *) msg, "X-Draft-Attribution-Id", h.c_str());
+
+- char * tmp = g_mime_message_get_date_string (_message);
++ char * tmp = g_mime_message_get_date_as_string (_message);
+ h = header_to_utf8 (tmp, message_charset, group_charset);
+- g_mime_message_add_header (msg, "X-Draft-Attribution-Date", h.c_str());
++ g_mime_object_append_header ((GMimeObject *) msg, "X-Draft-Attribution-Date", h.c_str());
+ g_free (tmp);
+
+ // references
+ const char * header = "References";
+- v = g_mime_message_get_header (_message, header);
++ v = g_mime_object_get_header ((GMimeObject *) _message, header);
+ val.assign (v.str, v.len);
+ if (!val.empty())
+ val += ' ';
+@@ -1624,7 +1624,7 @@
+ val += g_mime_message_get_message_id (_message);
+ val += ">";
+ val = GNKSA :: trim_references (val);
+- g_mime_message_add_header (msg, header, val.c_str());
++ g_mime_object_append_header ((GMimeObject *) msg, header, val.c_str());
+
+ ///
+ /// BODY
+@@ -1660,17 +1660,17 @@
+ // set the clone's content object with our modified body
+ GMimeStream * stream = g_mime_stream_mem_new ();
+ g_mime_stream_write_string (stream, s.c_str());
+- GMimeDataWrapper * wrapper = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_8BIT);
++ GMimeDataWrapper * wrapper = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_8BIT);
+ GMimePart * part = g_mime_part_new ();
+ GMimeContentType * new_type = g_mime_content_type_new_from_string ("text/plain; charset=UTF-8");
+- g_mime_part_set_content_type (part, new_type);
++ g_mime_object_set_content_type ((GMimeObject *) part, new_type);
+ g_mime_part_set_content_object (part, wrapper);
+- g_mime_part_set_encoding (part, GMIME_PART_ENCODING_8BIT);
++ g_mime_part_set_content_encoding (part, GMIME_CONTENT_ENCODING_8BIT);
+ g_mime_message_set_mime_part (msg, GMIME_OBJECT(part));
+ g_object_unref (wrapper);
+ g_object_unref (part);
+ g_object_unref (stream);
+-//std::cerr << LINE_ID << " here is the modified clone\n [" << g_mime_message_to_string(msg) << ']' << std::endl;
++//std::cerr << LINE_ID << " here is the modified clone\n [" << g_mime_object_to_string((GMimeObject *) msg) << ']' << std::endl;
+ }
+
+ return msg;
+diff -ru pan-0.133.orig/pan/gui/body-pane.h pan-0.133/pan/gui/body-pane.h
+--- pan-0.133.orig/pan/gui/body-pane.h 2008-07-04 10:57:39.000000000 -0700
++++ pan-0.133/pan/gui/body-pane.h 2009-09-08 20:40:40.000000000 -0700
+@@ -86,7 +86,7 @@
+ void append_part (GMimeObject*, GtkAllocation*);
+ static gboolean expander_activated_idle (gpointer self);
+ static void expander_activated_cb (GtkExpander*, gpointer self);
+- static void foreach_part_cb (GMimeObject*, gpointer self);
++ static void foreach_part_cb (GMimeObject*, GMimeObject*, gpointer self);
+ static void text_size_allocated (GtkWidget*, GtkAllocation*, gpointer);
+ static gboolean text_size_allocated_idle_cb (gpointer p);
+ void text_size_allocated_idle ();
+diff -ru pan-0.133.orig/pan/gui/gui.cc pan-0.133/pan/gui/gui.cc
+--- pan-0.133.orig/pan/gui/gui.cc 2008-07-05 00:14:56.000000000 -0700
++++ pan-0.133/pan/gui/gui.cc 2009-09-12 14:44:06.000000000 -0700
+@@ -31,6 +31,7 @@
+ #include <pan/general/file-util.h>
+ #include <pan/general/macros.h>
+ #include <pan/usenet-utils/scorefile.h>
++#include <pan/usenet-utils/mime-utils.h>
+ #include <pan/tasks/task-article.h>
+ #include <pan/tasks/task-groups.h>
+ #include <pan/tasks/task-xover.h>
+@@ -567,7 +568,7 @@
+ ArticleCache& c, const Article& a, const std::string& path):
+ _data(d), _queue(q), _root(r), _prefs(p), _cache(c), _article(a), _path(path) {}
+
+- static void foreach_part_cb (GMimeObject *o, gpointer self)
++ static void foreach_part_cb (GMimeObject * /*parent*/, GMimeObject *o, gpointer self)
+ {
+ static_cast<SaveArticlesFromNZB*>(self)->foreach_part (o);
+ }
+@@ -591,7 +592,7 @@
+ if (!tasks.empty())
+ _queue.add_tasks (tasks, Queue::BOTTOM);
+ g_object_unref (mem_stream);
+- g_object_unref (wrapper);
++// g_object_unref (wrapper); //SKG gmime 2.4 don't unref returned data wrapper
+ }
+ }
+
+@@ -601,7 +602,7 @@
+ {
+ if (status == OK) {
+ GMimeMessage * message = _cache.get_message (_article.get_part_mids());
+- g_mime_message_foreach_part (message, foreach_part_cb, this);
++ g_mime_message_foreach (message, foreach_part_cb, this);
+ g_object_unref (message);
+ }
+ delete this;
+@@ -1041,19 +1042,19 @@
+ const char * cpch;
+ char * old_mid (g_strdup_printf ("<%s>", g_mime_message_get_message_id(message)));
+ GMimeMessage * new_message (g_mime_message_new (false));
+- g_mime_message_set_header (new_message, "Supersedes", old_mid);
++ g_mime_object_set_header ((GMimeObject *) new_message, "Supersedes", old_mid);
+ g_mime_message_set_sender (new_message, g_mime_message_get_sender (message));
+ g_mime_message_set_subject (new_message, g_mime_message_get_subject (message));
+- g_mime_message_set_header (new_message, "Newsgroups", g_mime_message_get_header (message, "Newsgroups"));
+- g_mime_message_set_header (new_message, "References", g_mime_message_get_header (message, "References"));
++ g_mime_object_set_header ((GMimeObject *) new_message, "Newsgroups", g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
++ g_mime_object_set_header ((GMimeObject *) new_message, "References", g_mime_object_get_header ((GMimeObject *) message, "References"));
+ if ((cpch = g_mime_message_get_reply_to (message)))
+ g_mime_message_set_reply_to (new_message, cpch);
+- if ((cpch = g_mime_message_get_header (message, "Followup-To")))
+- g_mime_message_set_header (new_message, "Followup-To", cpch);
++ if ((cpch = g_mime_object_get_header ((GMimeObject *) message, "Followup-To")))
++ g_mime_object_set_header ((GMimeObject *) new_message, "Followup-To", cpch);
+ gboolean unused (false);
+- char * body (g_mime_message_get_body (message, true, &unused));
++ char * body (g_mime_message_get_body (message, &unused));
+ GMimeStream * stream = g_mime_stream_mem_new_with_buffer (body, strlen(body));
+- GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_DEFAULT);
++ GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
+ GMimePart * part = g_mime_part_new ();
+ g_mime_part_set_content_object (part, content_object);
+ g_mime_message_set_mime_part (new_message, GMIME_OBJECT(part));
+@@ -1111,11 +1112,11 @@
+ char * cancel_message = g_strdup_printf ("cancel <%s>", g_mime_message_get_message_id(message));
+ g_mime_message_set_sender (cancel, g_mime_message_get_sender (message));
+ g_mime_message_set_subject (cancel, "Cancel");
+- g_mime_message_set_header (cancel, "Newsgroups", g_mime_message_get_header (message, "Newsgroups"));
+- g_mime_message_set_header (cancel, "Control", cancel_message);
++ g_mime_object_set_header ((GMimeObject *) cancel, "Newsgroups", g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
++ g_mime_object_set_header ((GMimeObject *) cancel, "Control", cancel_message);
+ const char * body ("Ignore\r\nArticle canceled by author using " PACKAGE_STRING "\r\n");
+ GMimeStream * stream = g_mime_stream_mem_new_with_buffer (body, strlen(body));
+- GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_DEFAULT);
++ GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
+ GMimePart * part = g_mime_part_new ();
+ g_mime_part_set_content_object (part, content_object);
+ g_mime_message_set_mime_part (cancel, GMIME_OBJECT(part));
+@@ -1194,12 +1195,12 @@
+ newsgroups = group;
+ }
+ if (!newsgroups.empty())
+- g_mime_message_add_header (message, "Newsgroups", newsgroups.c_str());
++ g_mime_object_append_header ((GMimeObject *) message, "Newsgroups", newsgroups.c_str());
+
+ // content type
+ GMimePart * part = g_mime_part_new ();
+- g_mime_part_set_content_type (part, g_mime_content_type_new_from_string ("text/plain; charset=UTF-8"));
+- g_mime_part_set_encoding (part, GMIME_PART_ENCODING_8BIT);
++ g_mime_object_set_content_type ((GMimeObject *) part, g_mime_content_type_new_from_string ("text/plain; charset=UTF-8"));
++ g_mime_part_set_content_encoding (part, GMIME_CONTENT_ENCODING_8BIT);
+ g_mime_message_set_mime_part (message, GMIME_OBJECT(part));
+ g_object_unref (part);
+
+@@ -1754,8 +1755,8 @@
+ g_snprintf (str, sizeof(str), "%s: %u/%u", _("Tasks"), running, size);
+
+ // build the tooltip
+- gulong queued, unused, stopped;
+- guint64 KiB_remain;
++ long unsigned int queued, unused, stopped; //SKG MacPorts can't find function
++ uint64_t KiB_remain; //SKG using gulong and guint64 types.
+ double KiBps;
+ int hr, min, sec;
+ _queue.get_stats (queued, unused, stopped,
+diff -ru pan-0.133.orig/pan/gui/pan.cc pan-0.133/pan/gui/pan.cc
+--- pan-0.133.orig/pan/gui/pan.cc 2008-07-04 11:30:29.000000000 -0700
++++ pan-0.133/pan/gui/pan.cc 2009-09-12 13:39:13.000000000 -0700
+@@ -211,7 +211,7 @@
+ textdomain (GETTEXT_PACKAGE);
+
+ g_thread_init (0);
+- g_mime_init (GMIME_INIT_FLAG_UTF8);
++ g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
+
+ bool gui(true), nzb(false);
+ std::string url;
+diff -ru pan-0.133.orig/pan/gui/post-ui.cc pan-0.133/pan/gui/post-ui.cc
+--- pan-0.133.orig/pan/gui/post-ui.cc 2008-07-13 06:32:11.000000000 -0700
++++ pan-0.133/pan/gui/post-ui.cc 2009-09-12 13:04:51.000000000 -0700
+@@ -529,8 +529,8 @@
+ {
+ std::string url, to, groups;
+ gboolean unused;
+- char * headers (g_mime_message_get_headers (message));
+- char * body (g_mime_message_get_body (message, true, &unused));
++ char * headers (g_mime_object_get_headers ((GMimeObject *) message));
++ char * body (g_mime_message_get_body (message, &unused));
+ StringView key, val, v(headers);
+ v.trim ();
+ while (v.pop_token (val, '\n') && val.pop_token(key,':')) {
+@@ -629,7 +629,7 @@
+ *** If this is email only, skip the rest of the posting...
+ *** we only stayed this long to get check_message()
+ **/
+- const StringView groups (g_mime_message_get_header (message, "Newsgroups"));
++ const StringView groups (g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
+ if (groups.empty()) {
+ maybe_mail_message (message);
+ return true;
+@@ -903,9 +903,9 @@
+ */
+ void pan_g_mime_message_set_message_id (GMimeMessage *msg, const char *mid)
+ {
+- g_mime_message_add_header (msg, "Message-ID", mid);
++ g_mime_object_append_header ((GMimeObject *) msg, "Message-ID", mid);
+ char * bracketed = g_strdup_printf ("<%s>", mid);
+- g_mime_header_set (GMIME_OBJECT(msg)->headers, "Message-ID", bracketed);
++ g_mime_header_list_set (GMIME_OBJECT(msg)->headers, "Message-ID", bracketed);
+ g_free (bracketed);
+ }
+ }
+@@ -928,27 +928,27 @@
+ // headers from the ui: To
+ const StringView to (gtk_entry_get_text (GTK_ENTRY(_to_entry)));
+ if (!to.empty())
+- g_mime_message_add_recipients_from_string (msg, (char*)GMIME_RECIPIENT_TYPE_TO, to.str);
++ g_mime_message_add_recipients_from_string (msg, GMIME_RECIPIENT_TYPE_TO, to.str);
+
+ // headers from the ui: Newsgroups
+ const StringView groups (gtk_entry_get_text (GTK_ENTRY(_groups_entry)));
+ if (!groups.empty())
+- g_mime_message_set_header (msg, "Newsgroups", groups.str);
++ g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", groups.str);
+
+ // headers from the ui: Followup-To
+ const StringView followupto (gtk_entry_get_text (GTK_ENTRY(_followupto_entry)));
+ if (!followupto.empty())
+- g_mime_message_set_header (msg, "Followup-To", followupto.str);
++ g_mime_object_set_header ((GMimeObject *) msg, "Followup-To", followupto.str);
+
+ // headers from the ui: Reply-To
+ const StringView replyto (gtk_entry_get_text (GTK_ENTRY(_replyto_entry)));
+ if (!replyto.empty())
+- g_mime_message_set_header (msg, "Reply-To", replyto.str);
++ g_mime_object_set_header ((GMimeObject *) msg, "Reply-To", replyto.str);
+
+ // add the 'hidden headers'
+ foreach_const (str2str_t, _hidden_headers, it)
+ if ((mode==DRAFTING) || (it->first.find ("X-Draft-")!=0))
+- g_mime_message_set_header (msg, it->first.c_str(), it->second.c_str());
++ g_mime_object_set_header ((GMimeObject *) msg, it->first.c_str(), it->second.c_str());
+
+ // build headers from the 'more headers' entry field
+ std::map<std::string,std::string> headers;
+@@ -964,14 +964,14 @@
+ val.trim ();
+ std::string key_str (key.to_string());
+ if (extra_header_is_editable (key, val))
+- g_mime_message_set_header (msg, key.to_string().c_str(),
+- val.to_string().c_str());
++ g_mime_object_set_header ((GMimeObject *) msg, key.to_string().c_str(),
++ val.to_string().c_str());
+ }
+ g_free (pch);
+
+ // User-Agent
+ if (mode==POSTING && _prefs.get_flag (USER_AGENT_PREFS_KEY, true))
+- g_mime_message_set_header (msg, "User-Agent", get_user_agent());
++ g_mime_object_set_header ((GMimeObject *) msg, "User-Agent", get_user_agent());
+
+ // Message-ID
+ if (mode==POSTING && _prefs.get_flag (MESSAGE_ID_PREFS_KEY, false)) {
+@@ -987,22 +987,22 @@
+ const std::string charset ((mode==POSTING && !_charset.empty()) ? _charset : "UTF-8");
+ if (charset != "UTF-8") {
+ // add a wrapper to convert from UTF-8 to $charset
+- GMimeStream * tmp = g_mime_stream_filter_new_with_stream (stream);
++ GMimeStream * tmp = g_mime_stream_filter_new (stream);
+ g_object_unref (stream);
+ GMimeFilter * filter = g_mime_filter_charset_new ("UTF-8", charset.c_str());
+ g_mime_stream_filter_add (GMIME_STREAM_FILTER(tmp), filter);
+ g_object_unref (filter);
+ stream = tmp;
+ }
+- GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_PART_ENCODING_DEFAULT);
++ GMimeDataWrapper * content_object = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
+ g_object_unref (stream);
+ GMimePart * part = g_mime_part_new ();
+ pch = g_strdup_printf ("text/plain; charset=%s", charset.c_str());
+ GMimeContentType * type = g_mime_content_type_new_from_string (pch);
+ g_free (pch);
+- g_mime_part_set_content_type (part, type); // part owns type now. type isn't refcounted.
++ g_mime_object_set_content_type ((GMimeObject *) part, type); // part owns type now. type isn't refcounted.
+ g_mime_part_set_content_object (part, content_object);
+- g_mime_part_set_encoding (part, GMIME_PART_ENCODING_8BIT);
++ g_mime_part_set_content_encoding (part, GMIME_CONTENT_ENCODING_8BIT);
+ g_object_unref (content_object);
+ g_mime_message_set_mime_part (msg, GMIME_OBJECT(part));
+ g_object_unref (part);
+@@ -1036,7 +1036,7 @@
+
+ errno = 0;
+ std::ofstream o (filename);
+- char * pch = g_mime_message_to_string (msg);
++ char * pch = g_mime_object_to_string ((GMimeObject *) msg);
+ o << pch;
+ o.close ();
+
+@@ -1504,16 +1504,16 @@
+ std::string s = utf8ize (g_mime_message_get_subject (message));
+ gtk_entry_set_text (GTK_ENTRY(_subject_entry), s.c_str());
+
+- s = utf8ize (g_mime_message_get_header (message, "Newsgroups"));
++ s = utf8ize (g_mime_object_get_header ((GMimeObject *) message, "Newsgroups"));
+ gtk_entry_set_text (GTK_ENTRY(_groups_entry), s.c_str());
+
+- s = utf8ize (g_mime_message_get_header (message, "Followup-To"));
++ s = utf8ize (g_mime_object_get_header ((GMimeObject *) message, "Followup-To"));
+ gtk_entry_set_text (GTK_ENTRY(_followupto_entry), s.c_str());
+
+- s = utf8ize (g_mime_message_get_header (message, "Reply-To"));
++ s = utf8ize (g_mime_object_get_header ((GMimeObject *) message, "Reply-To"));
+ gtk_entry_set_text (GTK_ENTRY(_replyto_entry), s.c_str());
+
+- const InternetAddressList * addresses = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
++ InternetAddressList * addresses = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
+ char * pch = internet_address_list_to_string (addresses, true);
+ s = utf8ize (pch);
+ gtk_entry_set_text (GTK_ENTRY(_to_entry), s.c_str());
+@@ -1521,16 +1521,34 @@
+
+ // update 'other headers'
+ SetMessageForeachHeaderData data;
+- if (message->mime_part && g_mime_header_has_raw (message->mime_part->headers))
+- g_mime_header_foreach (message->mime_part->headers, set_message_foreach_header_func, &data);
+- g_mime_header_foreach (GMIME_OBJECT(message)->headers, set_message_foreach_header_func, &data);
++ const char *name, *value;
++ GMimeHeaderIter iter;
++
++ if (message->mime_part && g_mime_header_list_has_raw (message->mime_part->headers)) {
++ if (g_mime_header_list_get_iter (message->mime_part->headers, &iter)) {
++ do {
++ value = g_mime_header_iter_get_value (&iter);
++ name = g_mime_header_iter_get_name (&iter);
++ set_message_foreach_header_func (name, value, &data);
++ } while (g_mime_header_iter_next (&iter));
++ }
++ }
++
++ if (g_mime_header_list_get_iter (GMIME_OBJECT (message)->headers, &iter)) {
++ do {
++ value = g_mime_header_iter_get_value (&iter);
++ name = g_mime_header_iter_get_name (&iter);
++ set_message_foreach_header_func (name, value, &data);
++ } while (g_mime_header_iter_next (&iter));
++ }
++
+ s = utf8ize (data.visible_headers);
+ gtk_text_buffer_set_text (_headers_buf, s.c_str(), -1);
+ _hidden_headers = data.hidden_headers;
+
+ // update body
+ int ignored;
+- char * tmp = g_mime_message_get_body (message, true, &ignored);
++ char * tmp = g_mime_message_get_body (message, &ignored);
+ s = utf8ize (tmp);
+ g_free (tmp);
+ if (!s.empty()) {
+diff -ru pan-0.133.orig/pan/usenet-utils/message-check-test.cc pan-0.133/pan/usenet-utils/message-check-test.cc
+--- pan-0.133.orig/pan/usenet-utils/message-check-test.cc 2007-08-01 09:59:59.000000000 -0700
++++ pan-0.133/pan/usenet-utils/message-check-test.cc 2009-09-12 13:41:22.000000000 -0700
+@@ -22,6 +22,20 @@
+ std::cerr << LINE_ID << " [" << i << "][" << *it << ']' << std::endl; \
+ }
+
++static void
++mime_part_set_content (GMimePart *part, const char *str)
++{
++ GMimeDataWrapper *content;
++ GMimeStream *stream;
++
++ stream = g_mime_stream_mem_new_with_buffer (str, strlen (str));
++ content = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT);
++ g_object_unref (stream);
++
++ g_mime_part_set_content_object (part, content);
++ g_object_unref (content);
++}
++
+ int main (void)
+ {
+ g_mime_init (0);
+@@ -41,11 +55,11 @@
+ std::string message_id = GNKSA :: generate_message_id ("rebelbase.com");
+ g_mime_message_set_message_id (msg, message_id.c_str());
+ g_mime_message_set_subject (msg, "MAKE MONEY FAST");
+- g_mime_message_set_header (msg, "Organization", "Lazars Android Works");
+- g_mime_message_set_header (msg, "Newsgroups", "alt.test");
++ g_mime_object_set_header ((GMimeObject *) msg, "Organization", "Lazars Android Works");
++ g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test");
+ GMimePart * part = g_mime_part_new_with_type ("text", "plain");
+ const char * cpch = "Hello World!";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ g_mime_message_set_mime_part (msg, GMIME_OBJECT(part));
+ // this should pass the tests
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+@@ -54,7 +68,7 @@
+
+ // all quoted
+ cpch = "> Hello World!\n> All quoted text.";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ std::vector<std::string> e (errors.begin(), errors.end());
+ check (errors.size() == 2)
+@@ -64,7 +78,7 @@
+
+ // mostly quoted
+ cpch = "> Hello World!\n> quoted\n> text\n> foo\n> bar\nnew text";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ e.assign (errors.begin(), errors.end());
+ check (errors.size() == 1)
+@@ -73,14 +87,14 @@
+
+ // mostly quoted border condition: 20% of message is new content (should pass)
+ cpch = "> Hello World!\n> quoted\n> text\n> foo\nnew text";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ check (errors.empty())
+ check (goodness.is_ok())
+
+ // sig check: too long
+ cpch = "Hello!\n\n-- \nThis\nSig\nIs\nToo\nLong\n";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ e.assign (errors.begin(), errors.end());
+ check (errors.size() == 1)
+@@ -95,7 +109,7 @@
+ "This sig line is greater than 80 characters wide. In fact, it's 84 characters wide.\n"
+ "This sig line is greater than 80 characters wide. In fact, it measures 95 characters in width!\n"
+ "This sig line is less than 80 characters wide.";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ e.assign (errors.begin(), errors.end());
+ check (errors.size() == 1)
+@@ -104,7 +118,7 @@
+
+ // sig check: sig marker, no sig
+ cpch = "Hello!\n\n-- \n";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ e.assign (errors.begin(), errors.end());
+ check (errors.size() == 1)
+@@ -113,7 +127,7 @@
+
+ // sig check: okay sig
+ cpch = "Hello!\n\n-- \nThis is a short, narrow sig.\nIt should pass.\n";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ check (errors.empty())
+ check (goodness.is_ok())
+@@ -146,7 +160,7 @@
+ "This sig line is greater than 80 characters wide. In fact, it's 84 characters wide.\n"
+ "This sig line is greater than 80 characters wide. In fact, it measures 95 characters in width!\n"
+ "This sig line is less than 80 characters wide.";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ e.assign (errors.begin(), errors.end());
+ check (errors.size() == 1)
+@@ -155,7 +169,7 @@
+
+ // body empty
+ cpch = "\n\t\n \n-- \nThis is the sig.";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ e.assign (errors.begin(), errors.end());
+ check (errors.size() == 2)
+@@ -163,7 +177,7 @@
+ check (e[0] == "Error: Message appears to have no new content.");
+ check (e[1] == "Error: Message is empty.");
+ cpch = "Some valid message.";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+
+ // empty subject
+ g_mime_message_set_subject (msg, "");
+@@ -175,17 +189,17 @@
+ g_mime_message_set_subject (msg, "Happy Lucky Feeling");
+
+ // newsgroups
+- g_mime_message_set_header (msg, "Newsgroups", "alt.test,unknown.group");
++ g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test,unknown.group");
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ e.assign (errors.begin(), errors.end());
+ check (errors.size() == 1)
+ check (goodness.is_warn())
+ check (e[0] == "Warning: The posting profile's server doesn't carry newsgroup\n\t\"unknown.group\".\n\tIf the group name is correct, switch profiles in the \"From:\"\n\tline or edit the profile with \"Edit|Manage Posting Profiles\".")
+- g_mime_message_set_header (msg, "Newsgroups", "alt.test");
++ g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test");
+
+ // newsgroups w/o followup
+- g_mime_message_set_header (msg, "Newsgroups", "alt.test,alt.religion.kibology,alt.binaries.sounds.mp3.indie");
+- g_mime_header_remove (GMIME_OBJECT(msg)->headers, "Followup-To");
++ g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test,alt.religion.kibology,alt.binaries.sounds.mp3.indie");
++ g_mime_header_list_remove (GMIME_OBJECT(msg)->headers, "Followup-To");
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ e.assign (errors.begin(), errors.end());
+ check (errors.size() == 1)
+@@ -193,8 +207,8 @@
+ check (e[0] == "Warning: Crossposting without setting Followup-To header.")
+
+ // unknown follow-up
+- g_mime_message_set_header (msg, "Newsgroups", "alt.test");
+- g_mime_message_set_header (msg, "Followup-To", "alt.test,unknown.group");
++ g_mime_object_set_header ((GMimeObject *) msg, "Newsgroups", "alt.test");
++ g_mime_object_set_header ((GMimeObject *) msg, "Followup-To", "alt.test,unknown.group");
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ e.assign (errors.begin(), errors.end());
+ check (errors.size() == 1)
+@@ -203,11 +217,11 @@
+ g_mime_object_remove_header (GMIME_OBJECT(msg), "Followup-To");
+
+ // top posting
+- g_mime_message_set_header (msg, "References", "<asdf@foo.com>");
++ g_mime_object_set_header ((GMimeObject *) msg, "References", "<asdf@foo.com>");
+ cpch = "How Fascinating!\n"
+ "\n"
+ "> Blah blah blah.\n";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ e.assign (errors.begin(), errors.end());
+ check (errors.size() == 1)
+@@ -216,7 +230,7 @@
+ g_mime_object_remove_header (GMIME_OBJECT(msg), "References");
+
+ // top posting
+- g_mime_message_set_header (msg, "References", "<asdf@foo.com>");
++ g_mime_object_set_header ((GMimeObject *) msg, "References", "<asdf@foo.com>");
+ cpch = "How Fascinating!\n"
+ "\n"
+ "> Blah blah blah.\n"
+@@ -224,7 +238,7 @@
+ "-- \n"
+ "Pan shouldn't mistake this signature for\n"
+ "original content in the top-posting check.\n";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ e.assign (errors.begin(), errors.end());
+ check (errors.size() == 1)
+@@ -238,7 +252,7 @@
+ "\n"
+ "--\n"
+ "This is my signature.\n";
+- g_mime_part_set_content (part, cpch, strlen(cpch));
++ mime_part_set_content (part, cpch);
+ MessageCheck :: message_check (msg, attribution, groups_our_server_has, errors, goodness);
+ e.assign (errors.begin(), errors.end());
+ check (errors.size() == 1)
+diff -ru pan-0.133.orig/pan/usenet-utils/message-check.cc pan-0.133/pan/usenet-utils/message-check.cc
+--- pan-0.133.orig/pan/usenet-utils/message-check.cc 2008-07-04 23:15:22.000000000 -0700
++++ pan-0.133/pan/usenet-utils/message-check.cc 2009-09-12 13:42:37.000000000 -0700
+@@ -30,6 +30,7 @@
+ #include "gnksa.h"
+ #include "message-check.h"
+ #include "text-massager.h"
++#include "mime-utils.h"
+
+ using namespace pan;
+
+@@ -62,7 +63,7 @@
+ std::string body (body_in.to_string());
+
+ // strip attribution
+- const char * attribution = g_mime_message_get_header (message, PAN_ATTRIBUTION);
++ const char * attribution = g_mime_object_get_header ((GMimeObject *) message, PAN_ATTRIBUTION);
+ if (attribution && *attribution)
+ {
+ std::string::size_type attrib_start_pos = body.find (attribution);
+@@ -99,7 +100,7 @@
+ GMimeMessage * message)
+ {
+ // if it's not a reply, then top-posting check is moot
+- if (g_mime_message_get_header (message, "References") == NULL)
++ if (g_mime_object_get_header ((GMimeObject *) message, "References") == NULL)
+ return;
+
+ bool quoted_found (false);
+@@ -414,7 +415,6 @@
+ }
+ }
+
+-
+ void
+ MessageCheck :: message_check (const GMimeMessage * message_const,
+ const StringView & attribution,
+@@ -432,7 +432,7 @@
+ check_subject (errors, goodness, g_mime_message_get_subject (message));
+
+ // check the author...
+- if (GNKSA::check_from (g_mime_message_get_header (message, "From"), true)) {
++ if (GNKSA::check_from (g_mime_object_get_header ((GMimeObject *) message, "From"), true)) {
+ errors.insert (_("Error: Bad email address."));
+ goodness.raise_to_warn ();
+ }
+@@ -440,17 +440,17 @@
+ // check the body...
+ TextMassager tm;
+ gboolean is_html;
+- char * body = g_mime_message_get_body (message, true, &is_html);
++ char * body = g_mime_message_get_body (message, &is_html);
+ if (is_html) {
+ errors.insert (_("Warning: Most newsgroups frown upon HTML posts."));
+ goodness.raise_to_warn ();
+ }
+ check_body (errors, goodness, tm, message, body, attribution);
+ g_free (body);
+-
++
+ // check the optional followup-to...
+ bool followup_to_set (false);
+- const char * cpch = g_mime_message_get_header (message, "Followup-To");
++ const char * cpch = g_mime_object_get_header ((GMimeObject *) message, "Followup-To");
+ if (cpch && *cpch) {
+ quarks_t groups;
+ get_nntp_rcpts (cpch, groups);
+@@ -460,7 +460,7 @@
+
+ // check the groups...
+ size_t group_qty (0);
+- cpch = g_mime_message_get_header (message, "Newsgroups");
++ cpch = g_mime_object_get_header ((GMimeObject *) message, "Newsgroups");
+ if (cpch && *cpch) {
+ quarks_t groups;
+ get_nntp_rcpts (cpch, groups);
+@@ -469,7 +469,7 @@
+ }
+
+ // one last error check
+- const InternetAddressList * list (g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO));
++ InternetAddressList * list (g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO));
+ const int n_to (internet_address_list_length (list));
+ if (!group_qty && !n_to) {
+ errors.insert (_("Error: No Recipients."));
+diff -ru pan-0.133.orig/pan/usenet-utils/mime-utils.cc pan-0.133/pan/usenet-utils/mime-utils.cc
+--- pan-0.133.orig/pan/usenet-utils/mime-utils.cc 2008-07-04 23:15:24.000000000 -0700
++++ pan-0.133/pan/usenet-utils/mime-utils.cc 2009-09-12 14:46:25.000000000 -0700
+@@ -455,10 +455,10 @@
+ part->stream = g_mime_stream_mem_new ();
+ if (part->type != ENC_PLAIN) {
+ part->filter_stream =
+- g_mime_stream_filter_new_with_stream (part->stream);
++ g_mime_stream_filter_new (part->stream);
+ part->filter = part->type == ENC_UU
+- ? g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_UU_DEC)
+- : g_mime_filter_yenc_new (GMIME_FILTER_YENC_DIRECTION_DECODE);
++ ? g_mime_filter_basic_new (GMIME_CONTENT_ENCODING_UUENCODE, FALSE)
++ : g_mime_filter_yenc_new (FALSE);
+ g_mime_stream_filter_add (GMIME_STREAM_FILTER(part->filter_stream),
+ part->filter);
+ }
+@@ -722,18 +722,21 @@
+ {
+ // if the part is a multipart, check its subparts
+ if (GMIME_IS_MULTIPART (*part)) {
+- GList * subparts = GMIME_MULTIPART (*part)->subparts;
+- while (subparts) {
+- GMimeObject * subpart = (GMimeObject *) subparts->data;
++ GMimeMultipart *multipart = (GMimeMultipart *) *part;
++ int count = g_mime_multipart_get_count(multipart);
++ int i;
++
++ for (i = 0; i < count; i++) {
++ GMimeObject * subpart = g_mime_multipart_remove_at (multipart, i);
+ handle_uu_and_yenc_in_text_plain (&subpart);
+- subparts->data = subpart;
+- subparts = subparts->next;
++ g_mime_multipart_insert (multipart, i, subpart);
++ g_object_unref (subpart);
+ }
+ return;
+ }
+
+ // we assume that inlined yenc and uu are only in text/plain blocks
+- const GMimeContentType * content_type = g_mime_object_get_content_type (*part);
++ GMimeContentType * content_type = g_mime_object_get_content_type (*part);
+ if (!g_mime_content_type_is_type (content_type, "text", "plain"))
+ return;
+
+@@ -746,8 +749,8 @@
+ GMimeStream * stream = g_mime_data_wrapper_get_stream (content);
+ g_mime_stream_reset (stream);
+ GMimeStream * istream = g_mime_stream_buffer_new (stream, GMIME_STREAM_BUFFER_BLOCK_READ);
+- g_object_unref (stream);
+- g_object_unref (content);
++// g_object_unref (stream); //SKG if this is unrefed, when istream is unrefed below, content loses its stream
++// g_object_unref (content); //SKG gmime 2.4 don't unref returned data wrapper
+
+ // break it into separate parts for text, uu, and yenc pieces.
+ temp_parts_t parts;
+@@ -774,22 +777,22 @@
+ g_mime_part_set_filename (subpart, filename);
+
+ GMimeStream * subpart_stream = tmp_part->stream;
+- content = g_mime_data_wrapper_new_with_stream (subpart_stream, GMIME_PART_ENCODING_DEFAULT);
++ content = g_mime_data_wrapper_new_with_stream (subpart_stream, GMIME_CONTENT_ENCODING_DEFAULT);
+ g_mime_part_set_content_object (subpart, content);
+- g_mime_multipart_add_part (GMIME_MULTIPART (multipart), GMIME_OBJECT (subpart));
++ g_mime_multipart_add (GMIME_MULTIPART (multipart), GMIME_OBJECT (subpart));
+
+ g_object_unref (content);
+ g_object_unref (subpart);
+ }
+
+ // replace the old part with the new multipart
+- g_mime_object_unref (*part);
++ g_object_unref (*part);
+ *part = GMIME_OBJECT (multipart);
+ }
+
+ foreach (temp_parts_t, parts, it)
+ delete *it;
+- g_mime_stream_unref (istream);
++ g_object_unref (istream);
+ }
+ }
+
+@@ -831,15 +834,15 @@
+ GMimeStream * stream = g_mime_data_wrapper_get_stream (wrapper);
+ g_mime_stream_reset (stream);
+ g_mime_stream_cat_add_source (GMIME_STREAM_CAT (cat), stream);
+- g_object_unref (stream);
+- g_object_unref (wrapper);
++// g_object_unref (stream); //SKG if this is unrefed cat loses its stream
++// g_object_unref (wrapper); //SKG gmime 2.4 don't unref returned data wrapper
+ }
+
+ GMimeMessage * message = messages[0];
+ GMimeDataWrapper * wrapper = g_mime_part_get_content_object (GMIME_PART(message->mime_part));
+ g_mime_stream_reset (cat);
+ g_mime_data_wrapper_set_stream (wrapper, cat);
+- g_object_unref (wrapper);
++// g_object_unref (wrapper); //SKG gmime 2.4 don't unref returned data wrapper
+ g_object_unref (cat);
+ }
+
+@@ -1007,3 +1010,174 @@
+ {
+ normalize_subject (subject, STRIP_MULTIPART_NUMERATOR, setme);
+ }
++
++static GMimeObject *
++handle_multipart_mixed (GMimeMultipart *multipart, gboolean *is_html);
++
++static GMimeObject *
++handle_multipart_alternative (GMimeMultipart *multipart, gboolean *is_html)
++{
++ GMimeObject *mime_part, *text_part = NULL;
++ GMimeContentType *type;
++ int count = g_mime_multipart_get_count (multipart);
++
++ for (int i = 0; i < count; ++i) {
++ mime_part = g_mime_multipart_get_part (multipart, i);
++
++ type = g_mime_object_get_content_type (mime_part);
++ if (g_mime_content_type_is_type (type, "text", "*")) {
++ if (!text_part || !g_ascii_strcasecmp (type->subtype, "plain")) {
++ *is_html = !g_ascii_strcasecmp (type->subtype, "html");
++ text_part = mime_part;
++ }
++ }
++ }
++
++ return text_part;
++}
++
++static GMimeObject *
++handle_multipart_mixed (GMimeMultipart *multipart, gboolean *is_html)
++{
++ GMimeObject *mime_part, *text_part = NULL;
++ GMimeContentType *type, *first_type = NULL;
++ int count = g_mime_multipart_get_count (multipart);
++
++ for (int i = 0; i < count; ++i) {
++ mime_part = g_mime_multipart_get_part (multipart, i);
++
++ type = g_mime_object_get_content_type (mime_part);
++ if (GMIME_IS_MULTIPART (mime_part)) {
++ multipart = GMIME_MULTIPART (mime_part);
++ if (g_mime_content_type_is_type (type, "multipart", "alternative")) {
++ mime_part = handle_multipart_alternative (multipart, is_html);
++ if (mime_part)
++ return mime_part;
++ } else {
++ mime_part = handle_multipart_mixed (multipart, is_html);
++ if (mime_part && !text_part)
++ text_part = mime_part;
++ }
++ } else if (g_mime_content_type_is_type (type, "text", "*")) {
++ if (!g_ascii_strcasecmp (type->subtype, "plain")) {
++ /* we got what we came for */
++ *is_html = !g_ascii_strcasecmp (type->subtype, "html");
++ return mime_part;
++ }
++
++ /* if we haven't yet found a text part or if it is a type we can
++ * * understand and it is the first of that type, save it */
++ if (!text_part || (!g_ascii_strcasecmp (type->subtype, "plain") && (first_type &&
++ g_ascii_strcasecmp (type->subtype, first_type->subtype) != 0))) {
++ *is_html = !g_ascii_strcasecmp (type->subtype, "html");
++ text_part = mime_part;
++ first_type = type;
++ }
++ }
++ }
++
++ return text_part;
++}
++
++#define NEEDS_DECODING(encoding) ((encoding == GMIME_CONTENT_ENCODING_BASE64) || \
++ (encoding == GMIME_CONTENT_ENCODING_UUENCODE) || \
++ (encoding == GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE))
++
++static const char *
++g_mime_part_get_content (const GMimePart *mime_part, size_t *len)
++{
++ const char *retval = NULL;
++ GMimeStream *stream;
++
++ g_return_val_if_fail (GMIME_IS_PART (mime_part), NULL);
++
++ if (!mime_part->content || !mime_part->content->stream) {
++ g_warning ("no content set on this mime part");
++ return NULL;
++ }
++
++ stream = mime_part->content->stream;
++ if (!GMIME_IS_STREAM_MEM (stream) || NEEDS_DECODING (mime_part->content->encoding)) {
++ /* Decode and cache this mime part's contents... */
++ GMimeStream *cache;
++ GByteArray *buf;
++
++ buf = g_byte_array_new ();
++ cache = g_mime_stream_mem_new_with_byte_array (buf);
++
++ g_mime_data_wrapper_write_to_stream (mime_part->content, cache);
++
++ g_mime_data_wrapper_set_stream (mime_part->content, cache);
++ g_mime_data_wrapper_set_encoding (mime_part->content, GMIME_CONTENT_ENCODING_DEFAULT);
++ g_object_unref (cache);
++
++ *len = buf->len;
++ retval = (char *) buf->data;
++ } else {
++ GByteArray *buf = GMIME_STREAM_MEM (stream)->buffer;
++ off_t end_index = (off_t) buf->len;
++ off_t start_index = 0;
++
++ /* check boundaries */
++ if (stream->bound_start >= 0)
++ start_index = CLAMP (stream->bound_start, 0, (off_t) buf->len);
++ if (stream->bound_end >= 0)
++ end_index = CLAMP (stream->bound_end, 0, (off_t) buf->len);
++ if (end_index < start_index)
++ end_index = start_index;
++
++ *len = end_index - start_index;
++ retval = (char *) buf->data + start_index;
++ }
++
++ return retval;
++}
++
++char *g_mime_message_get_body (GMimeMessage *message, gboolean *is_html)
++{
++ GMimeObject *mime_part = NULL;
++ GMimeContentType *type;
++ GMimeMultipart *multipart;
++ const char *content;
++ char *body = NULL;
++ size_t len = 0;
++
++ g_return_val_if_fail (GMIME_IS_MESSAGE (message), NULL);
++ g_return_val_if_fail (is_html != NULL, NULL);
++
++ type = g_mime_object_get_content_type (message->mime_part);
++ if (GMIME_IS_MULTIPART (message->mime_part)) {
++ /* let's see if we can find a body in the multipart */
++ multipart = GMIME_MULTIPART (message->mime_part);
++ if (g_mime_content_type_is_type (type, "multipart", "alternative"))
++ mime_part = handle_multipart_alternative (multipart, is_html);
++ else
++ mime_part = handle_multipart_mixed (multipart, is_html);
++ } else if (g_mime_content_type_is_type (type, "text", "*")) {
++ /* this *has* to be the message body */
++ if (g_mime_content_type_is_type (type, "text", "html"))
++ *is_html = TRUE;
++ else
++ *is_html = FALSE;
++ mime_part = message->mime_part;
++ }
++
++ if (mime_part != NULL) {
++ content = g_mime_part_get_content (GMIME_PART (mime_part), &len);
++ body = g_strndup (content, len);
++ }
++
++ return body;
++}
++
++void g_mime_message_add_recipients_from_string (GMimeMessage *message, GMimeRecipientType type, const char *string)
++{
++ InternetAddressList *addrlist;
++ if ((addrlist = internet_address_list_parse_string (string))) {
++ for (int i = 0; i < internet_address_list_length (addrlist); ++i) {
++ InternetAddress *ia = internet_address_list_get_address (addrlist, i);
++ if (INTERNET_ADDRESS_IS_MAILBOX(ia))
++ g_mime_message_add_recipient (message, type, internet_address_get_name(ia), internet_address_mailbox_get_addr(INTERNET_ADDRESS_MAILBOX(ia)));
++ }
++ }
++}
+diff -ru pan-0.133.orig/pan/usenet-utils/mime-utils.h pan-0.133/pan/usenet-utils/mime-utils.h
+--- pan-0.133.orig/pan/usenet-utils/mime-utils.h 2007-08-01 09:59:59.000000000 -0700
++++ pan-0.133/pan/usenet-utils/mime-utils.h 2009-09-12 13:20:11.000000000 -0700
+@@ -64,4 +64,8 @@
+ };
+ }
+
++char *g_mime_message_get_body (GMimeMessage *message, gboolean *is_html);
++void g_mime_message_add_recipients_from_string (GMimeMessage *message, GMimeRecipientType type, const char *string);
++
++
+ #endif
+diff -ru pan-0.133.orig/pan.spec pan-0.133/pan.spec
+--- pan-0.133.orig/pan.spec 2008-07-29 19:05:05.000000000 -0700
++++ pan-0.133/pan.spec 2009-09-12 14:58:20.000000000 -0700
+@@ -15,14 +15,14 @@
+
+ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+ BuildRequires: glib2-devel >= 2.4.0
+-BuildRequires: gmime-devel >= 2.1.9
++BuildRequires: gmime-devel >= 2.3.5
+ BuildRequires: gtk2-devel >= 2.4.0
+ BuildRequires: pcre-devel >= 5.0
+ %{!?_without_gtkspell:BuildRequires: gtkspell-devel >= 2.0.7}
+
+ Requires: pcre >= 5.0
+ Requires: glib2 >= 2.4.0
+-Requires: gmime >= 2.1.9
++Requires: gmime >= 2.3.5
+ Requires: gtk2 >= 2.4.0
+ %{!?_without_gtkspell:Requires: gtkspell >= 2.0.7}
+
diff --git a/source/xap/pidgin/pidgin.SlackBuild b/source/xap/pidgin/pidgin.SlackBuild
index fb7def08f..d61713b60 100755
--- a/source/xap/pidgin/pidgin.SlackBuild
+++ b/source/xap/pidgin/pidgin.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2006, 2007, 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2006, 2007, 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,12 +22,21 @@
PKGNAM=pidgin
-VERSION=${VERSION:-2.5.9}
-PIDGINENC=${PIDGINENC:-3.0}
-ARCH=${ARCH:-x86_64}
+VERSION=${VERSION:-2.7.0}
+PIDGINENC=${PIDGINENC:-3.1}
BUILD=${BUILD:-1}
-NUMJOBS=${NUMJOBS:-" -j7 "}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
+NUMJOBS=${NUMJOBS:-" -j6 "}
CWD=$(pwd)
TMP=${TMP:-/tmp}
@@ -38,18 +47,23 @@ mkdir -p $TMP $PKG
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
+ ARCHQUADLET=""
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
+ ARCHQUADLET=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+ ARCHQUADLET=""
elif [ "$ARCH" = "arm" ]; then
- SLKCFLAGS="-O2 -march=armv4 -mtune=xscale"
- LIBDIRSUFFIX=""
-elif [ "$ARCH" = "armel" ]; then
SLKCFLAGS="-O2 -march=armv4t"
LIBDIRSUFFIX=""
+ ARCHQUADLET="-gnueabi"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+ ARCHQUADLET=""
fi
cd $TMP
@@ -80,15 +94,19 @@ CXXFLAGS="$SLKCFLAGS" \
--enable-dbus \
--enable-gnutls=yes \
--enable-nss=no \
+ --disable-vv \
--enable-gtkspell \
--enable-cyrus-sasl \
- --with-perl-lib=vendor \
+ --enable-perl \
--disable-meanwhile \
--disable-avahi \
--disable-nm \
--program-prefix= \
--program-suffix= \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux$ARCHQUADLET || exit 1
+
+# Fix install location:
+grep -lr -- "lib/perl" . | xargs sed -i 's?lib/perl?lib'"$LIBDIRSUFFIX"'/perl?g'
# Build and install:
make $NUMJOBS || make || exit 1
@@ -99,11 +117,21 @@ eval $(perl '-V:archlib')
eval $(perl '-V:privlib')
VENDORPERL="$(echo $archlib | sed -e "s/perl5/perl5\/vendor_perl/")"
-find $PKG -type f -name perllocal.pod -exec mv {} $PKG/$VENDORPERL/Pidgin.pod \;
+mkdir -vpm755 $PKG/$VENDORPERL/
+find $PKG -type f -name perllocal.pod -exec mv -fv {} $PKG/$VENDORPERL/Pidgin.pod \;
+# Fix install location for 64bit:
+sed -i 's?/lib/perl?/lib'"$LIBDIRSUFFIX"'/perl?g' $PKG/$VENDORPERL/Pidgin.pod
mkdir -p $PKG/usr/man/man3
-find $PKG/usr/share/man -type f -name *.3 -exec mv {} $PKG/usr/man/man3 \;
+find $PKG/usr/share/man -type f -name *.3 -exec mv -fv {} $PKG/usr/man/man3 \;
rm -rf $PKG/usr/share/man
rm -r $PKG$privlib
+# This is empty:
+rmdir $PKG/usr/lib$LIBDIRSUFFIX/perl[0-9]*/$ARCH-linux-thread-multi/
+
+# In case of unwanted junk dirs on 64-bit... this may fail, but doesn't hurt:
+rmdir $PKG/usr/lib/perl[0-9]*/$ARCH-linux-thread-multi/
+rmdir $PKG/usr/lib/perl[0-9]*
+rmdir $PKG/usr/lib
# This removes our DESTDIR from the packlist filenames, to keep perl's
# internal inventories consistent and correct.
@@ -142,7 +170,11 @@ done
--with-nspr-libs=/usr/lib${LIBDIRSUFFIX}/seamonkey/ \
--program-prefix="" \
--program-suffix="" \
- --build=$ARCH-slackware-linux
+ --build=$ARCH-slackware-linux$ARCHQUADLET || exit 1
+
+ # Fix install location:
+ grep -lr -- "lib/perl" . | xargs sed -i 's?lib/perl?lib'"$LIBDIRSUFFIX"'/perl?g'
+
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
) || exit 1
diff --git a/source/xap/sane/sane-frontends-1.0.14-sane_cap_always_settable.diff b/source/xap/sane/sane-frontends-1.0.14-sane_cap_always_settable.diff
new file mode 100644
index 000000000..98f2715ac
--- /dev/null
+++ b/source/xap/sane/sane-frontends-1.0.14-sane_cap_always_settable.diff
@@ -0,0 +1,11 @@
+diff -Nur sane-backends-1.0.20.orig/include/sane/sane.h sane-backends-1.0.20/include/sane/sane.h
+--- sane-backends-1.0.20.orig/include/sane/sane.h 2009-04-23 14:59:23.000000000 -0500
++++ sane-backends-1.0.20/include/sane/sane.h 2010-01-19 18:24:29.954762582 -0600
+@@ -115,6 +115,7 @@
+ #define SANE_CAP_AUTOMATIC (1 << 4)
+ #define SANE_CAP_INACTIVE (1 << 5)
+ #define SANE_CAP_ADVANCED (1 << 6)
++#define SANE_CAP_ALWAYS_SETTABLE (1 << 7)
+
+ #define SANE_OPTION_IS_ACTIVE(cap) (((cap) & SANE_CAP_INACTIVE) == 0)
+ #define SANE_OPTION_IS_SETTABLE(cap) (((cap) & SANE_CAP_SOFT_SELECT) != 0)
diff --git a/source/xap/sane/sane.SlackBuild b/source/xap/sane/sane.SlackBuild
index 2d82f09e0..95daed9de 100755
--- a/source/xap/sane/sane.SlackBuild
+++ b/source/xap/sane/sane.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,11 +20,20 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-VERSION=1.0.19
-BACKVER=1.0.19
+VERSION=1.0.21
+BACKVER=1.0.21
FRONTVER=1.0.14
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-4}
+BUILD=${BUILD:-1}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -37,6 +46,9 @@ elif [ "$ARCH" = "s390" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
CWD=$(pwd)
@@ -52,6 +64,11 @@ rm -rf sane-backends-$BACKVER
tar xvf $CWD/sane-backends-$BACKVER.tar.bz2 || exit 1
cd sane-backends-$BACKVER
chown -R root:root .
+
+# Put the SANE_CAP_ALWAYS_SETTABLE definition back until
+# everything else catches up with the API change...
+zcat $CWD/sane-frontends-1.0.14-sane_cap_always_settable.diff.gz | patch -p1 || exit 1
+
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
@@ -69,11 +86,10 @@ make $NUMJOBS || make || exit 1
make install || exit 1
make install DESTDIR=$PKG || exit 1
-# Add the default udev rules, and until it's handled upstream,
-# fix their syntax work with recent versions of udev
+# Add the default udev rules
mkdir -p $PKG/lib/udev/rules.d
-sed s/SYSFS/ATTRS/g tools/udev/libsane.rules \
- > $PKG/lib/udev/rules.d/80-libsane.rules
+cat tools/udev/libsane.rules > $PKG/lib/udev/rules.d/80-libsane.rules
+
# Add the hal fdi file
mkdir -p $PKG/usr/share/hal/fdi/policy/10osvendor/
cat tools/hal/libsane.fdi \
@@ -85,6 +101,7 @@ rm -rf sane-frontends-$FRONTVER
tar xvf $CWD/sane-frontends-$FRONTVER.tar.bz2 || exit 1
cd sane-frontends-$FRONTVER
chown -R root:root .
+
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
diff --git a/source/xap/seamonkey/pkgconfig/seamonkey-gtkmozembed.pc b/source/xap/seamonkey/pkgconfig/seamonkey-gtkmozembed.pc
new file mode 100644
index 000000000..e5053267d
--- /dev/null
+++ b/source/xap/seamonkey/pkgconfig/seamonkey-gtkmozembed.pc
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=/usr
+libdir=/usr/@LIB@/seamonkey-@VERSION@
+includedir=/usr/include/seamonkey-@VERSION@
+
+Name: Mozilla Gtk Embedding Widget
+Description: Mozilla Embedding Widget for Gtk+
+Version: @VERSION@
+Requires: seamonkey-xpcom = @VERSION@
+Libs: -L${libdir} -lgtkembedmoz
+Cflags: -I${includedir}/gtkembedmoz
diff --git a/source/xap/seamonkey/pkgconfig/seamonkey-js.pc b/source/xap/seamonkey/pkgconfig/seamonkey-js.pc
new file mode 100644
index 000000000..31433be28
--- /dev/null
+++ b/source/xap/seamonkey/pkgconfig/seamonkey-js.pc
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=/usr
+libdir=/usr/@LIB@/seamonkey-@VERSION@
+includedir=/usr/include/seamonkey-@VERSION@
+
+Name: JavaScript
+Description: The Mozilla JavaScript Library
+Version: @VERSION@
+Requires: seamonkey-nspr >= 4.7.1
+Libs: -L${libdir} -lmozjs
+Cflags: -I${includedir}/js -DXP_UNIX -DJS_THREADSAFE
diff --git a/source/xap/seamonkey/pkgconfig/seamonkey-nspr.pc b/source/xap/seamonkey/pkgconfig/seamonkey-nspr.pc
new file mode 100644
index 000000000..756e996d6
--- /dev/null
+++ b/source/xap/seamonkey/pkgconfig/seamonkey-nspr.pc
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=/usr
+libdir=/usr/@LIB@/seamonkey-@VERSION@
+includedir=/usr/include/seamonkey-@VERSION@
+
+Name: NSPR
+Description: The Netscape Portable Runtime
+Version: 4.7.1
+Libs: -L/usr/@LIB@/seamonkey-@VERSION@ -lplds4 -lplc4 -lnspr4 -lpthread -ldl
+Cflags: -I/usr/include/seamonkey-@VERSION@/nspr
+
+
diff --git a/source/xap/seamonkey/pkgconfig/seamonkey-nss.pc b/source/xap/seamonkey/pkgconfig/seamonkey-nss.pc
new file mode 100644
index 000000000..b929f202f
--- /dev/null
+++ b/source/xap/seamonkey/pkgconfig/seamonkey-nss.pc
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=/usr
+libdir=/usr/@LIB@/seamonkey-@VERSION@
+includedir=/usr/include/seamonkey-@VERSION@
+
+Name: NSS
+Description: Mozilla Network Security Services
+Version: @VERSION@
+Requires: seamonkey-nspr >= 4.7.1
+Libs: -L${libdir} -lnss3 -lsmime3 -lssl3 -lsoftokn3
+Cflags: -I${includedir}/nss
diff --git a/source/xap/seamonkey/pkgconfig/seamonkey-plugin.pc b/source/xap/seamonkey/pkgconfig/seamonkey-plugin.pc
new file mode 100644
index 000000000..4550444af
--- /dev/null
+++ b/source/xap/seamonkey/pkgconfig/seamonkey-plugin.pc
@@ -0,0 +1,10 @@
+prefix=/usr
+exec_prefix=/usr
+libdir=/usr/@LIB@/seamonkey-@VERSION@
+includedir=/usr/include/seamonkey-@VERSION@
+
+Name: Mozilla Plug-In API
+Description: Mozilla Plug-In API
+Version: @VERSION@
+Requires: seamonkey-nspr >= 4.7.1
+Cflags: -I${includedir}/java -I${includedir}/plugin
diff --git a/source/xap/seamonkey/pkgconfig/seamonkey-xpcom.pc b/source/xap/seamonkey/pkgconfig/seamonkey-xpcom.pc
new file mode 100644
index 000000000..532005671
--- /dev/null
+++ b/source/xap/seamonkey/pkgconfig/seamonkey-xpcom.pc
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=/usr
+libdir=/usr/@LIB@/seamonkey-@VERSION@
+includedir=/usr/include/seamonkey-@VERSION@
+idldir=/usr/share/idl/seamonkey-@VERSION@
+
+Name: XPCOM
+Description: The Mozilla Cross Platform Component Library
+Version: @VERSION@
+Requires: seamonkey-nspr >= 4.7.1
+Libs: -L${libdir} -lxpcom
+Cflags: -I${includedir} -I${includedir}/xpcom -I${includedir}/string
diff --git a/source/xap/seamonkey/seamonkey.SlackBuild b/source/xap/seamonkey/seamonkey.SlackBuild
index a08695589..af563c092 100755
--- a/source/xap/seamonkey/seamonkey.SlackBuild
+++ b/source/xap/seamonkey/seamonkey.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -20,27 +20,23 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-VERSION=${VERSION:-1.1.17}
-ARCH=${ARCH:-x86_64}
+VERSION=${VERSION:-$(basename $(ls seamonkey-*.tar.* | cut -d - -f 2 | rev | cut -f 3- -d . | rev) .source)}
BUILD=${BUILD:-1}
-
NUMJOBS=${NUMJOBS:-" -j7 "}
-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"
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ "$ARCH" = "x86_64" ]; then
LIBDIRSUFFIX="64"
-elif [ "$ARCH" = "arm" ]; then
- SLKCFLAGS="-O2 -march=armv4 -mtune=xscale"
- LIBDIRSUFFIX=""
-elif [ "$ARCH" = "armel" ]; then
- SLKCFLAGS="-O2 -march=armv4t"
+else
LIBDIRSUFFIX=""
fi
@@ -51,15 +47,9 @@ rm -rf $PKG
mkdir -p $TMP $PKG/usr
cd $TMP
-rm -rf mozilla
-tar xvf $CWD/seamonkey-${VERSION}.source.tar.xz || exit 1
-cd mozilla || exit 1
-
-# Add /usr/lib/mozilla/plugins to MOZ_PLUGINS_PATH:
-zcat $CWD/seamonkey.moz_plugin_path.diff.gz \
- | sed -e "s#usr/lib#usr/lib${LIBDIRSUFFIX}#g" \
- | patch -p1 --verbose || exit 1
-rm -f xpfe/bootstrap/mozilla.in.orig
+rm -rf comm-1.9.1
+tar xvf $CWD/seamonkey-${VERSION}.source.tar.?z* || exit 1
+cd comm-1.9.1 || exit 1
# Make sure the perms/ownerships are sane:
chown -R root:root .
@@ -71,7 +61,7 @@ find . \
# Fix a long standing bug that's prevented staying current on GTK+.
# Thanks to the BLFS folks. :-)
-cat >> layout/build/Makefile.in << EOF
+cat >> mozilla/layout/build/Makefile.in << EOF
ifdef MOZ_ENABLE_CANVAS
EXTRA_DSO_LDOPTS += \$(XLDFLAGS) -lX11 -lXrender
@@ -83,7 +73,7 @@ chown -R root:root .
BUILD_OFFICIAL=1 MOZILLA_OFFICIAL=1 \
./configure --prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
- --enable-optimize="$CFLAGS" \
+ --enable-optimize=-O2 \
--disable-debug \
--with-default-mozilla-five-home=/usr/lib${LIBDIRSUFFIX}/seamonkey-${VERSION} \
--enable-strip \
@@ -99,7 +89,6 @@ BUILD_OFFICIAL=1 MOZILLA_OFFICIAL=1 \
--without-system-nspr \
--with-system-zlib \
--with-system-jpeg \
- --with-system-png \
--with-system-mng \
--enable-application=suite \
--enable-xft \
@@ -107,15 +96,25 @@ BUILD_OFFICIAL=1 MOZILLA_OFFICIAL=1 \
--target=$ARCH-slackware-linux \
--build=$ARCH-slackware-linux
-BUILD_OFFICIAL=1 MOZILLA_OFFICIAL=1 make $NUMJOBS -s export || exit 1
-BUILD_OFFICIAL=1 MOZILLA_OFFICIAL=1 make $NUMJOBS -s libs || exit 1
-BUILD_OFFICIAL=1 MOZILLA_OFFICIAL=1 DESTDIR=$PKG make install || exit 1
+ # --with-system-png
+make $NUMJOBS || exit 1
+DESTDIR=$PKG make install || exit 1
-# Install nss headers.
-mkdir -p $PKG/usr/include/seamonkey-${VERSION}/nss
-find security/nss/lib -name "*.h" -type f -exec cp -a {} $PKG/usr/include/seamonkey-${VERSION}/nss \;
-chown -R root:root $PKG/usr/include/seamonkey-${VERSION}/nss
-chmod 644 $PKG/usr/include/seamonkey-${VERSION}/nss/*
+# Install js/nspr/nss headers.
+for includedir in js nspr nspr/obsolete nspr/private nss plugin xpcom ; do
+ mkdir -p $PKG/usr/include/seamonkey-${VERSION}/$includedir
+ cp -aL mozilla/dist/include/${includedir}/*.h $PKG/usr/include/seamonkey-${VERSION}/$includedir
+done
+cp -aL mozilla/dist/include/js/*.tbl mozilla/dist/include/js/*.msg $PKG/usr/include/seamonkey-${VERSION}/js
+cp -aL mozilla/dist/include/*.h $PKG/usr/include/seamonkey-${VERSION}
+cp -aL mozilla/dist/sdk/include/* $PKG/usr/include/seamonkey-${VERSION}
+( cd $PKG/usr/include/seamonkey-${VERSION}/plugin
+ for file in ../j*.h ; do
+ ln -sf $file .
+ done
+)
+chown -R root:root $PKG/usr/include/seamonkey-${VERSION}
+find $PKG/usr/include/seamonkey-${VERSION} -name "*.h" -type f -exec chmod 644 {} \;
# Create a more generic include files symlink:
( cd $PKG/usr/include
if [ ! -e seamonkey ]; then
@@ -123,23 +122,23 @@ chmod 644 $PKG/usr/include/seamonkey-${VERSION}/nss/*
fi
)
-# Let the nspr be found by gxine:
-( cd $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig; ln -s seamonkey-nspr.pc nspr.pc )
-
-# A Better Way to handle the problem below is simply to add /usr/lib/seamonkey
-# to /etc/ld.so.conf. After all, the various Mozilla offshoots all set an
-# LD_LIBRARY_PATH to make sure *they* use the right libraries anyway, and as
-# far as I know seamonkey has the only set of Mozilla development libraries
-# right now. Plus, doing it this way doesn't stomp all over efforts by people
-# who would like to use seamonkey-nss-solibs.
+# Install pkgconfig files:
+mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
+for file in $CWD/pkgconfig/* ; do
+cat $file \
+ | sed -e "s/@LIB@/lib${LIBDIRSUFFIX}/" \
+ -e "s/@VERSION@/$VERSION/" \
+ > $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/$(basename $file)
+done
-## Link some libraries into /usr/lib. Unless this is done, some things (like gxine)
-## will be unable to load them, even if they linked with them successfully.
-#( cd $PKG/usr/lib${LIBDIRSUFFIX} && ( for somelib in libmozjs.so libnspr4.so libnss3.so libplc4.so libplds4.so libsmime3.so libsoftokn3.so libssl3.so ; do
-# # Link to it:
-# ln -sf seamonkey-${VERSION}/$somelib .
-# done )
-#)
+# Add symlinks for the pkgconfig files:
+( cd $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
+ ln -s seamonkey-js.pc js.pc
+ ln -s seamonkey-nspr.pc nspr.pc
+ ln -s seamonkey-nss.pc nss.pc
+ ln -s seamonkey-plugin.pc plugin.pc
+ ln -s seamonkey-xpcom.pc xpcom.pc
+)
# Compress and if needed symlink the man pages:
if [ -d $PKG/usr/man ]; then
@@ -163,7 +162,7 @@ find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
# This remains the standard plugin directory for all browsers.
mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/mozilla/plugins
-# Some software won't compile without this symlink:
+# This is traditional.
( cd $PKG/usr/lib${LIBDIRSUFFIX}
if [ ! -e seamonkey ]; then
ln -sf seamonkey-${VERSION} seamonkey
@@ -180,9 +179,11 @@ chown -R root:root $PKG/usr/share/pixmaps
chmod 644 $PKG/usr/share/pixmaps/*
mkdir -p $PKG/usr/doc/seamonkey-$VERSION
-cp -a \
- LEGAL LICENSE README.txt \
- $PKG/usr/doc/seamonkey-$VERSION
+( cd mozilla
+ cp -a \
+ LEGAL LICENSE README.txt \
+ $PKG/usr/doc/seamonkey-$VERSION
+)
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
@@ -198,8 +199,8 @@ mkdir -p $TMP/package-seamonkey-solibs/usr/doc
cp -a $PKG/usr/doc/seamonkey-$VERSION $TMP/package-seamonkey-solibs/usr/doc
mkdir -p $TMP/package-seamonkey-solibs/usr/lib${LIBDIRSUFFIX}/seamonkey-${VERSION}
for file in libfreebl3.chk libfreebl3.so libmozjs.so libnspr4.so libnss3.so \
- libnssckbi.so libplc4.so libplds4.so libsmime3.so libsoftokn3.chk \
- libsoftokn3.so libssl3.so ; do
+ libnssckbi.so libnssutil3.so libplc4.so libplds4.so libsmime3.so \
+ libsoftokn3.chk libsoftokn3.so libssl3.so ; do
cp -a $PKG/usr/lib${LIBDIRSUFFIX}/seamonkey-${VERSION}/$file \
$TMP/package-seamonkey-solibs/usr/lib${LIBDIRSUFFIX}/seamonkey-${VERSION}
done
diff --git a/source/xap/seamonkey/seamonkey.moz_plugin_path.diff b/source/xap/seamonkey/seamonkey.moz_plugin_path.diff
deleted file mode 100644
index f967580b6..000000000
--- a/source/xap/seamonkey/seamonkey.moz_plugin_path.diff
+++ /dev/null
@@ -1,16 +0,0 @@
---- ./xpfe/bootstrap/mozilla.in.orig 2006-08-20 17:44:28.000000000 -0500
-+++ ./xpfe/bootstrap/mozilla.in 2007-02-19 21:25:32.000000000 -0600
-@@ -60,6 +60,13 @@
- MOZ_PIS_SESSION_PID="$$"
- MOZ_PIS_USER_DIR="${MOZ_USER_DIR}"
- export MOZ_PIS_API MOZ_PIS_MOZBINDIR MOZ_PIS_SESSION_PID MOZ_PIS_USER_DIR
-+ # Include /usr/lib/mozilla/plugins in the plugin path:
-+ if [ "$MOZ_PLUGIN_PATH" ] ; then
-+ MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:${moz_libdir}/plugins:/usr/lib/mozilla/plugins
-+ else
-+ MOZ_PLUGIN_PATH=${moz_libdir}/plugins:/usr/lib/mozilla/plugins
-+ fi
-+ export MOZ_PLUGIN_PATH
-
- case "${1}" in
- "start")
diff --git a/source/xap/seamonkey/slack-desc b/source/xap/seamonkey/slack-desc
index 978c1d09b..af6ee2408 100644
--- a/source/xap/seamonkey/slack-desc
+++ b/source/xap/seamonkey/slack-desc
@@ -10,9 +10,9 @@ seamonkey: SeaMonkey (an open-source web browser suite)
seamonkey:
seamonkey: The SeaMonkey browser suite. SeaMonkey features a state-of-the-art
seamonkey: web browser and powerful email client, as well as a WYSIWYG web page
-seamonkey: composer and a feature-rich IRC chat client. For web developers,
-seamonkey: mozilla.org's DOM inspector and JavaScript debugger tools are
-seamonkey: included as well.
+seamonkey: composer and a feature-rich IRC chat client.
+seamonkey:
+seamonkey:
seamonkey:
seamonkey: Visit the SeaMonkey project at this URL:
seamonkey: http://www.mozilla.org/projects/seamonkey/
diff --git a/source/xap/windowmaker/windowmaker.SlackBuild b/source/xap/windowmaker/windowmaker.SlackBuild
index 8736f0589..15e32edfc 100755
--- a/source/xap/windowmaker/windowmaker.SlackBuild
+++ b/source/xap/windowmaker/windowmaker.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,11 +22,20 @@
VERSION=20060427cvs
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-3}
NUMJOBS=${NUMJOBS:-" -j7 "}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
@@ -36,11 +45,15 @@ elif [ "$ARCH" = "s390" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-windowmaker
+
rm -rf $PKG
mkdir -p $TMP $PKG
@@ -50,6 +63,9 @@ tar xvf $CWD/WindowMaker-$VERSION.tar.bz2 || exit 1
cd WindowMaker-$VERSION || exit 1
zcat $CWD/windowmaker.no-mmx.diff.gz | patch -p1 --verbose -F 3 || exit 1
+
+zcat $CWD/windowmaker.png.1.4.0.diff.gz | patch -p1 --verbose || exit 1
+
sh autogen.sh
chown -R root:root .
@@ -89,6 +105,15 @@ mkdir -p $PKG/usr/doc/WindowMaker-$VERSION
cp -a \
AUTHORS BUGFORM BUGS COPYING COPYING.WTFPL FAQ FAQ.I18N FAQ.I18N.cs FAQ.I18N.sk INSTALL INSTALL.cs INSTALL.es INSTALL.fr INSTALL.pt INSTALL.sk MIRRORS NEWS README README.definable-cursor README.pt TODO \
$PKG/usr/doc/WindowMaker-$VERSION
+
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
cd $TMP
rm -rf WindowMaker-extra-0.1
tar xvf $CWD/WindowMaker-extra-0.1.tar.gz || exit 1
@@ -98,7 +123,7 @@ CFLAGS="$SLKCFLAGS" \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--with-iconsdir=/usr/share/pixmaps \
- $ARCH-slackware-linux
+ --build=$ARCH-slackware-linux
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
@@ -107,8 +132,8 @@ find $PKG | xargs file | grep -e "executable" -e "shared object" \
| grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
mkdir -p $PKG/etc/X11/xinit
-cat $CWD/xinitrc.wmaker > $PKG/etc/X11/xinit/xinitrc.wmaker
-chmod 755 $PKG/etc/X11/xinit/xinitrc.wmaker
+zcat $CWD/xinitrc.wmaker.gz > $PKG/etc/X11/xinit/xinitrc.wmaker
+chmod 0755 $PKG/etc/X11/xinit/xinitrc.wmaker
gzip -9 $PKG/usr/man/man1/* $PKG/usr/man/sk/man1/*
diff --git a/source/xap/windowmaker/windowmaker.png.1.4.0.diff b/source/xap/windowmaker/windowmaker.png.1.4.0.diff
new file mode 100644
index 000000000..a6359c4b2
--- /dev/null
+++ b/source/xap/windowmaker/windowmaker.png.1.4.0.diff
@@ -0,0 +1,11 @@
+--- ./wrlib/load.c.orig 2008-04-30 15:45:26.000000000 -0500
++++ ./wrlib/load.c 2010-02-11 15:39:38.000000000 -0600
+@@ -348,7 +348,7 @@
+
+ #ifdef USE_PNG
+ /* check for PNG */
+- if (png_check_sig(buffer, 8))
++ if (!png_sig_cmp(buffer, 0, 8))
+ return IM_PNG;
+ #endif
+
diff --git a/source/xap/windowmaker/xinitrc.wmaker b/source/xap/windowmaker/xinitrc.wmaker
index 4e28503b1..09ca61b4f 100644
--- a/source/xap/windowmaker/xinitrc.wmaker
+++ b/source/xap/windowmaker/xinitrc.wmaker
@@ -3,8 +3,8 @@
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
-sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
-sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap
+sysresources=/etc/X11/xinit/.Xresources
+sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
diff --git a/source/xap/xchat/xchat.SlackBuild b/source/xap/xchat/xchat.SlackBuild
index 1f05472bf..8058f9043 100755
--- a/source/xap/xchat/xchat.SlackBuild
+++ b/source/xap/xchat/xchat.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,8 +22,17 @@
VERSION=2.8.6
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-3}
+BUILD=${BUILD:-5}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -36,6 +45,9 @@ elif [ "$ARCH" = "s390" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
CWD=$(pwd)
diff --git a/source/xap/xfce/patches/exo_quoting_fix.diff b/source/xap/xfce/patches/exo_quoting_fix.diff
deleted file mode 100644
index ac6544576..000000000
--- a/source/xap/xfce/patches/exo_quoting_fix.diff
+++ /dev/null
@@ -1,66 +0,0 @@
-Index: exo-open/main.c
-===================================================================
---- exo-open/main.c (revision 30250)
-+++ exo-open/main.c (revision 30251)
-@@ -36,7 +36,17 @@
- #include <exo/exo.h>
-
-
-+/**
-+ * For testing this code the following commands should work:
-+ *
-+ * exo-open --launch WebBrowser http://xfce.org (bug #5461).
-+ * exo-open http://xfce.org
-+ * exo-open --launch TerminalEmulator ./script.sh 'something with a space' 'nospace' (bug #5132).
-+ * exo-open --launch TerminalEmulator ssh -l username some.host.com
-+ **/
-
-+
-+
- static gboolean opt_help = FALSE;
- static gboolean opt_version = FALSE;
- static gchar *opt_launch = NULL;
-@@ -143,6 +153,8 @@
- {
- if (argc > 1)
- {
-+ /* NOTE: see the comment at the top of this document! */
-+
- /* combine all specified parameters to one parameter string */
- join = g_string_new (NULL);
- for (i = 1; argv[i] != NULL; i++)
-@@ -150,11 +162,18 @@
- /* separate the arguments */
- if (i > 1)
- join = g_string_append_c (join, ' ');
--
-- /* append the quoted argument */
-- quoted = g_shell_quote (argv[i]);
-- join = g_string_append (join, quoted);
-- g_free (quoted);
-+
-+ /* only quote arguments with spaces */
-+ if (strchr (argv[i], ' ') != NULL)
-+ {
-+ quoted = g_shell_quote (argv[i]);
-+ join = g_string_append (join, quoted);
-+ g_free (quoted);
-+ }
-+ else
-+ {
-+ join = g_string_append (join, argv[i]);
-+ }
- }
- parameter = g_string_free (join, FALSE);
- }
-@@ -163,6 +182,10 @@
- parameter = NULL;
- }
-
-+#ifndef NDEBUG
-+ g_message ("launch=%s, wd=%s, parameters (%d)=%s", opt_launch, opt_working_directory, argc, parameter);
-+#endif
-+
- /* run the preferred application */
- if (!exo_execute_preferred_application (opt_launch, parameter, opt_working_directory, NULL, &err))
- {
diff --git a/source/xap/xfce/patches/launcher-plugin-migrate-icon-cat.diff b/source/xap/xfce/patches/launcher-plugin-migrate-icon-cat.diff
deleted file mode 100644
index 4370281a3..000000000
--- a/source/xap/xfce/patches/launcher-plugin-migrate-icon-cat.diff
+++ /dev/null
@@ -1,48 +0,0 @@
-diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
-index 8edc66c..1e370c4 100644
---- a/plugins/launcher/launcher.c
-+++ b/plugins/launcher/launcher.c
-@@ -37,6 +37,30 @@
- #include "launcher-exec.h"
- #include "launcher-dialog.h"
-
-+/* for 4.4 settings migration */
-+static const gchar *icon_category_map[] = {
-+ "applications-other",
-+ "accessories-text-editor",
-+ "system-file-manager",
-+ "applications-accessories",
-+ "applications-games",
-+ "help-browser",
-+ "applications-multimedia",
-+ "applications-internet",
-+ "applications-graphics",
-+ "printer",
-+ "office-calendar",
-+ "applications-office",
-+ "audio-card",
-+ "utilities-terminal",
-+ "applications-development",
-+ "preferences-desktop",
-+ "applications-system",
-+ "applications-other",
-+ "applications-accessories",
-+};
-+#define ICON_CATEGORY_MAP_MAX (G_N_ELEMENTS (icon_category_map) - 1)
-+
- /* prototypes */
- static void launcher_utility_icon_theme_changed (GtkIconTheme *icon_theme,
- LauncherPlugin *launcher);
-@@ -1216,6 +1240,12 @@ launcher_plugin_read (LauncherPlugin *launcher)
- entry->name = launcher_plugin_read_entry (rc, "Name");
- entry->comment = launcher_plugin_read_entry (rc, "Comment");
- entry->icon = launcher_plugin_read_entry (rc, "Icon");
-+ if (G_UNLIKELY (!entry->icon))
-+ {
-+ gint icon_category = xfce_rc_read_int_entry (rc, "X-XFCE-IconCategory", -1);
-+ if (G_LIKELY (icon_category >= 0 && icon_category <= ICON_CATEGORY_MAP_MAX))
-+ entry->icon = g_strdup (icon_category_map[icon_category]);
-+ }
- entry->exec = launcher_plugin_read_entry (rc, "Exec");
- entry->path = launcher_plugin_read_entry (rc, "Path");
-
diff --git a/source/xap/xfce/patches/migrate-itheme-smartly.diff b/source/xap/xfce/patches/migrate-itheme-smartly.diff
deleted file mode 100644
index e9c66ed2e..000000000
--- a/source/xap/xfce/patches/migrate-itheme-smartly.diff
+++ /dev/null
@@ -1,92 +0,0 @@
-Index: scripts/xfconf-migration-4.6.pl.in
-===================================================================
---- a/scripts/xfconf-migration-4.6.pl.in (revision 29645)
-+++ b/scripts/xfconf-migration-4.6.pl.in (working copy)
-@@ -256,6 +256,77 @@
- return $mcs.'.xml';
- }
-
-+sub icon_theme_exists
-+{
-+ my ($dirref,$themename) = @_;
-+ my @dirs = @{$dirref};
-+
-+ foreach my $d (@dirs) {
-+ return 1 if(-f "$d/$themename/index.theme");
-+ }
-+
-+ return 0;
-+}
-+
-+sub migrate_icon_theme
-+{
-+ my ($ref,$chan) = @_;
-+ my %opts = %{$ref};
-+ my $opt = 'Net/IconThemeName';
-+
-+ return if(!defined($opts{$opt}));
-+ my $val = $opts{$opt}->{'value'};
-+
-+ if(lc($val) eq 'rodent') {
-+ # we don't ship rodent anymore, so try to find something suitable
-+ my @icondirs;
-+ if(defined($ENV{'XDG_DATA_HOME'})) {
-+ @icondirs = ( $ENV{'XDG_DATA_HOME'} . '/icons' );
-+ } else {
-+ @icondirs = ( $ENV{'HOME'} . '/.local/share/icons' );
-+ }
-+
-+ if(defined($ENV{'XDG_DATA_DIRS'})) {
-+ push(@icondirs, split(/:/, $ENV{'XDG_DATA_DIRS'}));
-+ } else {
-+ push(@icondirs, ( '/usr/share/icons', '/usr/local/share/icons' ));
-+ }
-+
-+ $val = undef;
-+ foreach my $itheme (('Tango', 'gnome', 'crystalsvg')) {
-+ if(icon_theme_exists(\@icondirs, $itheme)) {
-+ $val = $itheme;
-+ last;
-+ }
-+ }
-+
-+ if(!defined($val)) {
-+ # pick the first one that is not 'hicolor'
-+ foreach my $d (@icondirs) {
-+ opendir(DIR, $d) and do {
-+ my @subdirs = grep { $_ ne 'hicolor' && -d "$d/$_" } readdir(DIR);
-+ foreach my $sd (@subdirs) {
-+ if(-f "$d/$sd/index.theme") {
-+ $val = $sd;
-+ last;
-+ }
-+ }
-+ closedir(DIR);
-+ };
-+ last if(defined($val));
-+ }
-+
-+ if(!defined($val)) {
-+ # ok, their system is kinda b0rked; not much we can do
-+ warn("Couldn't find a suitable icon theme to migrate to");
-+ return;
-+ }
-+ }
-+ }
-+
-+ xfconf_set($chan, 'string', '/Net/IconThemeName', $val);
-+}
-+
- sub migrate_xsettings
- {
- my $mcs = 'gtk';
-@@ -283,8 +354,7 @@
- '/Net/CursorBlinkTime', 'int');
- save_xfconf_prop($ref, $chan, 'Net/DndDragThreshold',
- '/Net/DndDragThreshold', 'int');
-- save_xfconf_prop($ref, $chan, 'Net/IconThemeName',
-- '/Net/IconThemeName', 'string');
-+ migrate_icon_theme($ref, $chan);
- save_xfconf_prop($ref, $chan, 'Net/ThemeName',
- '/Net/ThemeName', 'string');
-
diff --git a/source/xap/xfce/patches/terminal-0.4.0-fixup_docdir.diff b/source/xap/xfce/patches/terminal-0.4.0-fixup_docdir.diff
deleted file mode 100644
index d9608470f..000000000
--- a/source/xap/xfce/patches/terminal-0.4.0-fixup_docdir.diff
+++ /dev/null
@@ -1,132 +0,0 @@
-diff -Nur Terminal-0.4.0.orig/Makefile.in Terminal-0.4.0/Makefile.in
---- Terminal-0.4.0.orig/Makefile.in 2009-07-20 13:04:04.000000000 -0500
-+++ Terminal-0.4.0/Makefile.in 2009-07-20 13:50:20.529864039 -0500
-@@ -986,7 +986,7 @@
-
- TerminalHelp: TerminalHelp.in Makefile
- rm -f TerminalHelp.gen TerminalHelp
-- sed -e "s,\@datadir\@,$(datadir),g" \
-+ sed -e "s,\@docdir\@,$(docdir),g" \
- < $(srcdir)/TerminalHelp.in \
- > TerminalHelp.gen
- mv TerminalHelp.gen TerminalHelp
-diff -Nur Terminal-0.4.0.orig/TerminalHelp.in Terminal-0.4.0/TerminalHelp.in
---- Terminal-0.4.0.orig/TerminalHelp.in 2009-07-20 13:03:50.000000000 -0500
-+++ Terminal-0.4.0/TerminalHelp.in 2009-07-20 13:50:20.529864039 -0500
-@@ -19,7 +19,7 @@
- # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- #
-
--HELPDIR="@datadir@/doc/Terminal/"
-+HELPDIR="@docdir@/"
-
- if test -n "$LC_ALL"; then
- LC=$LC_ALL
-diff -Nur Terminal-0.4.0.orig/doc/C/Makefile.in Terminal-0.4.0/doc/C/Makefile.in
---- Terminal-0.4.0.orig/doc/C/Makefile.in 2009-07-20 13:04:02.000000000 -0500
-+++ Terminal-0.4.0/doc/C/Makefile.in 2009-07-20 13:50:20.533867320 -0500
-@@ -260,7 +260,7 @@
- SUBDIRS = \
- images
-
--TARGET_DIR = $(datadir)/doc/Terminal/C
-+TARGET_DIR = $(docdir)/C
- STYLESHEET = ../terminal.xsl
- DOCUMENT = Terminal.xml
-
-diff -Nur Terminal-0.4.0.orig/doc/C/images/Makefile.in Terminal-0.4.0/doc/C/images/Makefile.in
---- Terminal-0.4.0.orig/doc/C/images/Makefile.in 2009-07-20 13:04:02.000000000 -0500
-+++ Terminal-0.4.0/doc/C/images/Makefile.in 2009-07-20 13:50:20.533867320 -0500
-@@ -240,7 +240,7 @@
- top_build_prefix = @top_build_prefix@
- top_builddir = @top_builddir@
- top_srcdir = @top_srcdir@
--imagesdir = $(datadir)/doc/Terminal/C/images
-+imagesdir = $(docdir)/C/images
- images_DATA = \
- terminal-compose-shortcut.png \
- terminal-edit-preferences.png \
-diff -Nur Terminal-0.4.0.orig/doc/Makefile.in Terminal-0.4.0/doc/Makefile.in
---- Terminal-0.4.0.orig/doc/Makefile.in 2009-07-20 13:04:02.000000000 -0500
-+++ Terminal-0.4.0/doc/Makefile.in 2009-07-20 13:51:00.229192942 -0500
-@@ -286,7 +286,7 @@
- fr \
- ja
-
--cssdir = $(datadir)/doc/Terminal
-+cssdir = $(docdir)/
- css_DATA = \
- terminal.css
-
-diff -Nur Terminal-0.4.0.orig/doc/da/Makefile.in Terminal-0.4.0/doc/da/Makefile.in
---- Terminal-0.4.0.orig/doc/da/Makefile.in 2009-07-20 13:04:02.000000000 -0500
-+++ Terminal-0.4.0/doc/da/Makefile.in 2009-07-20 13:50:20.533867320 -0500
-@@ -260,7 +260,7 @@
- SUBDIRS = \
- images
-
--TARGET_DIR = $(datadir)/doc/Terminal/da
-+TARGET_DIR = $(docdir)/da
- STYLESHEET = ../terminal.xsl
- DOCUMENT = Terminal.xml
-
-diff -Nur Terminal-0.4.0.orig/doc/da/images/Makefile.in Terminal-0.4.0/doc/da/images/Makefile.in
---- Terminal-0.4.0.orig/doc/da/images/Makefile.in 2009-07-20 13:04:02.000000000 -0500
-+++ Terminal-0.4.0/doc/da/images/Makefile.in 2009-07-20 13:50:20.533867320 -0500
-@@ -240,7 +240,7 @@
- top_build_prefix = @top_build_prefix@
- top_builddir = @top_builddir@
- top_srcdir = @top_srcdir@
--imagesdir = $(datadir)/doc/Terminal/da/images
-+imagesdir = $(docdir)/da/images
- images_DATA = \
- terminal-compose-shortcut.png \
- terminal-edit-preferences.png \
-diff -Nur Terminal-0.4.0.orig/doc/fr/Makefile.in Terminal-0.4.0/doc/fr/Makefile.in
---- Terminal-0.4.0.orig/doc/fr/Makefile.in 2009-07-20 13:04:02.000000000 -0500
-+++ Terminal-0.4.0/doc/fr/Makefile.in 2009-07-20 13:50:20.533867320 -0500
-@@ -260,7 +260,7 @@
- SUBDIRS = \
- images
-
--TARGET_DIR = $(datadir)/doc/Terminal/fr
-+TARGET_DIR = $(docdir)/fr
- STYLESHEET = ../terminal.xsl
- DOCUMENT = Terminal.xml
-
-diff -Nur Terminal-0.4.0.orig/doc/fr/images/Makefile.in Terminal-0.4.0/doc/fr/images/Makefile.in
---- Terminal-0.4.0.orig/doc/fr/images/Makefile.in 2009-07-20 13:04:03.000000000 -0500
-+++ Terminal-0.4.0/doc/fr/images/Makefile.in 2009-07-20 13:50:20.533867320 -0500
-@@ -240,7 +240,7 @@
- top_build_prefix = @top_build_prefix@
- top_builddir = @top_builddir@
- top_srcdir = @top_srcdir@
--imagesdir = $(datadir)/doc/Terminal/fr/images
-+imagesdir = $(docdir)/fr/images
- images_DATA = \
- terminal-compose-shortcut.png \
- terminal-edit-preferences.png \
-diff -Nur Terminal-0.4.0.orig/doc/ja/Makefile.in Terminal-0.4.0/doc/ja/Makefile.in
---- Terminal-0.4.0.orig/doc/ja/Makefile.in 2009-07-20 13:04:03.000000000 -0500
-+++ Terminal-0.4.0/doc/ja/Makefile.in 2009-07-20 13:50:20.537889876 -0500
-@@ -260,7 +260,7 @@
- SUBDIRS = \
- images
-
--TARGET_DIR = $(datadir)/doc/Terminal/ja
-+TARGET_DIR = $(docdir)/ja
- STYLESHEET = ../terminal.xsl
- DOCUMENT = Terminal.xml
-
-diff -Nur Terminal-0.4.0.orig/doc/ja/images/Makefile.in Terminal-0.4.0/doc/ja/images/Makefile.in
---- Terminal-0.4.0.orig/doc/ja/images/Makefile.in 2009-07-20 13:04:03.000000000 -0500
-+++ Terminal-0.4.0/doc/ja/images/Makefile.in 2009-07-20 13:50:20.537889876 -0500
-@@ -240,7 +240,7 @@
- top_build_prefix = @top_build_prefix@
- top_builddir = @top_builddir@
- top_srcdir = @top_srcdir@
--imagesdir = $(datadir)/doc/Terminal/ja/images
-+imagesdir = $(docdir)/ja/images
- images_DATA = \
- terminal-compose-shortcut.png \
- terminal-edit-preferences.png \
diff --git a/source/xap/xfce/patches/terminal.gtk.2.18.fix.diff b/source/xap/xfce/patches/terminal.gtk.2.18.fix.diff
new file mode 100644
index 000000000..69a9e70e8
--- /dev/null
+++ b/source/xap/xfce/patches/terminal.gtk.2.18.fix.diff
@@ -0,0 +1,101 @@
+From 028dc2efd846defe796c7fa097ed84818bb43431 Mon Sep 17 00:00:00 2001
+From: Nick Schermer <nick@xfce.org>
+Date: Sun, 21 Mar 2010 22:05:31 +0000
+Subject: Disconnect bindings before closing the dialog.
+
+This avoids possible problems when Gtk+ emits property
+changes before the widgets are destroyed. This is currently
+the case for text entries in some Gtk 2.18 releases.
+---
+diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
+index 587bd92..8f33628 100644
+--- a/terminal/terminal-preferences-dialog.c
++++ b/terminal/terminal-preferences-dialog.c
+@@ -64,24 +64,28 @@ terminal_preferences_dialog_class_init (TerminalPreferencesDialogClass *klass)
+
+
+ #define BIND_PROPERTIES(name, property) \
+- { object = gtk_builder_get_object (GTK_BUILDER (dialog), name); \
++ G_STMT_START { \
++ object = gtk_builder_get_object (GTK_BUILDER (dialog), name); \
+ terminal_return_if_fail (G_IS_OBJECT (object)); \
+- exo_mutual_binding_new (G_OBJECT (dialog->preferences), name, \
+- G_OBJECT (object), property); }
++ binding = exo_mutual_binding_new (G_OBJECT (dialog->preferences), name, \
++ G_OBJECT (object), property); \
++ dialog->bindings = g_slist_prepend (dialog->bindings, binding); \
++ } G_STMT_END
+
+
+
+ static void
+ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
+ {
+- GError *error = NULL;
+- guint i;
+- GObject *object, *object2;
+- GtkWidget *editor;
+- gchar palette_name[16];
+- GtkFileFilter *filter;
+- gchar *file;
+- const gchar *props_active[] = { "title-mode", "command-login-shell",
++ GError *error = NULL;
++ guint i;
++ GObject *object, *object2;
++ GtkWidget *editor;
++ gchar palette_name[16];
++ GtkFileFilter *filter;
++ gchar *file;
++ ExoMutualBinding *binding;
++ const gchar *props_active[] = { "title-mode", "command-login-shell",
+ "command-update-records", "scrolling-single-line",
+ "scrolling-on-output", "scrolling-on-keystroke",
+ "scrolling-bar", "font-allow-bold",
+@@ -94,9 +98,9 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
+ , "font-anti-alias"
+ #endif
+ };
+- const gchar *props_color[] = { "color-foreground", "color-cursor",
+- "color-background", "tab-activity-color",
+- "color-selection" };
++ const gchar *props_color[] = { "color-foreground", "color-cursor",
++ "color-background", "tab-activity-color",
++ "color-selection" };
+
+ dialog->preferences = terminal_preferences_get ();
+
+@@ -248,6 +252,8 @@ terminal_preferences_dialog_response (GtkWidget *widget,
+ gint response,
+ TerminalPreferencesDialog *dialog)
+ {
++ GSList *li;
++
+ /* check if we should open the user manual */
+ if (G_UNLIKELY (response == 1))
+ {
+@@ -256,6 +262,11 @@ terminal_preferences_dialog_response (GtkWidget *widget,
+ }
+ else
+ {
++ /* disconnect all the bindings */
++ for (li = dialog->bindings; li != NULL; li = li->next)
++ exo_mutual_binding_unbind (li->data);
++ g_slist_free (dialog->bindings);
++
+ /* close the preferences dialog */
+ gtk_widget_destroy (widget);
+ }
+diff --git a/terminal/terminal-preferences-dialog.h b/terminal/terminal-preferences-dialog.h
+index b2db4f5..268d70a 100644
+--- a/terminal/terminal-preferences-dialog.h
++++ b/terminal/terminal-preferences-dialog.h
+@@ -48,6 +48,7 @@ struct _TerminalPreferencesDialog
+
+ TerminalPreferences *preferences;
+ guint signal_id;
++ GSList *bindings;
+ };
+
+ GType terminal_preferences_dialog_get_type (void) G_GNUC_CONST;
+--
+cgit v0.8.2.1
diff --git a/source/xap/xfce/patches/thunar-1.0.1-png14.diff b/source/xap/xfce/patches/thunar-1.0.1-png14.diff
new file mode 100644
index 000000000..6c67a407d
--- /dev/null
+++ b/source/xap/xfce/patches/thunar-1.0.1-png14.diff
@@ -0,0 +1,11 @@
+--- ./thunar-vfs/thunar-vfs-thumb.c.orig 2009-01-12 14:38:49.000000000 -0600
++++ ./thunar-vfs/thunar-vfs-thumb.c 2010-02-12 13:24:33.000000000 -0600
+@@ -1169,7 +1169,7 @@
+ goto done0;
+
+ /* verify the png signature */
+- if (G_LIKELY (png_check_sig ((png_bytep) signature, sizeof (signature))))
++ if (G_LIKELY (png_sig_cmp ((png_bytep) signature, 0, sizeof (signature)) == 0))
+ rewind (fp);
+ else
+ goto done0;
diff --git a/source/xap/xfce/patches/thunar-fix_umask_properly.diff b/source/xap/xfce/patches/thunar-fix_umask_properly.diff
new file mode 100644
index 000000000..2070b5802
--- /dev/null
+++ b/source/xap/xfce/patches/thunar-fix_umask_properly.diff
@@ -0,0 +1,52 @@
+commit eb58c6a6ba7f77c2c16016db064524df598ef421
+Author: Jannis Pohlmann <jannis@xfce.org>
+Date: Sat Oct 3 11:49:41 2009 +0200
+
+ Fix bugs #3532 (umask < 0022 not honoured) and #5813 properly (I hope).
+
+ The previous patch applied in e53de71e6add9b28ba034111a1d19db7def8f7e7
+ made things worse than before: it used DEFFILEMODE which seems to be
+ BSD-specific for creating files. It also reset the umask to 0 when
+ creating the first directory with _thunar_vfs_io_jobs_mkdir().
+
+ What we really want is to use 0777 (dirs) and 0666 (files) and let the
+ standard C system calls like open() apply the umask value. This should
+ work on all POSIX-compliant systems.
+
+ Patch provided by Craig Ringer <craig@postnewspapers.com.au>.
+
+diff --git a/thunar-vfs/thunar-vfs-io-jobs.c b/thunar-vfs/thunar-vfs-io-jobs.c
+index 8d70812..c94523a 100644
+--- a/thunar-vfs/thunar-vfs-io-jobs.c
++++ b/thunar-vfs/thunar-vfs-io-jobs.c
+@@ -432,8 +432,12 @@ _thunar_vfs_io_jobs_create (ThunarVfsJob *job,
+ absolute_path = thunar_vfs_path_dup_string (lp->data);
+
+ again:
+- /* try to create the file at the given path */
+- fd = g_open (absolute_path, O_CREAT | O_EXCL | O_WRONLY, DEFFILEMODE);
++ /* Try to create the file at the given path.
++ *
++ * Note that despite the 0666 mask, we won't really create a world-writable
++ * file unless the user's umask permits it (ie the umask is 0000).
++ */
++ fd = g_open (absolute_path, O_CREAT | O_EXCL | O_WRONLY, 0666);
+ if (G_UNLIKELY (fd < 0))
+ {
+ /* check if the file already exists */
+@@ -707,8 +711,13 @@ _thunar_vfs_io_jobs_mkdir (ThunarVfsJob *job,
+ /* update the progress information */
+ _thunar_vfs_job_process_path (job, lp);
+
+- /* try to create the target directory */
+- if (!_thunar_vfs_io_ops_mkdir (lp->data, 0777 & ~umask(0), THUNAR_VFS_IO_OPS_NONE, error))
++ /* try to create the target directory
++ *
++ * Note that the mode specified here is limited by the user's umask, so we will not
++ * actually be creating a world writable directory unless the user's umask permits
++ * it.
++ */
++ if (!_thunar_vfs_io_ops_mkdir (lp->data, 0777, THUNAR_VFS_IO_OPS_NONE, error))
+ return FALSE;
+ }
+
diff --git a/source/xap/xfce/patches/xfce-utils.xinitrc.consolekit.diff b/source/xap/xfce/patches/xfce-utils.xinitrc.consolekit.diff
new file mode 100644
index 000000000..a8d5b2a5f
--- /dev/null
+++ b/source/xap/xfce/patches/xfce-utils.xinitrc.consolekit.diff
@@ -0,0 +1,11 @@
+--- ./scripts/xinitrc.in.in.orig 2009-04-09 18:21:13.000000000 -0500
++++ ./scripts/xinitrc.in.in 2010-05-06 03:06:02.000000000 -0500
+@@ -131,7 +131,7 @@
+ x|xno*)
+ ;;
+ *)
+- $xfcesm
++ ck-launch-session $xfcesm
+
+ if test $kill_sshagent -eq 1; then
+ eval `$sshagent -k`
diff --git a/source/xap/xfce/patches/xfce4-settings.libxklavier5.diff b/source/xap/xfce/patches/xfce4-settings.libxklavier5.diff
new file mode 100644
index 000000000..d5f8ed8c6
--- /dev/null
+++ b/source/xap/xfce/patches/xfce4-settings.libxklavier5.diff
@@ -0,0 +1,11 @@
+--- ./dialogs/keyboard-settings/xfce-keyboard-settings.c.orig 2010-01-02 07:31:06.000000000 -0600
++++ ./dialogs/keyboard-settings/xfce-keyboard-settings.c 2010-02-12 02:11:05.000000000 -0600
+@@ -457,7 +457,7 @@
+
+ #ifdef HAVE_LIBXKLAVIER
+ /* Stop xklavier engine */
+- xkl_engine_stop_listen (settings->priv->xkl_engine);
++ xkl_engine_stop_listen (settings->priv->xkl_engine, XKLL_TRACK_KEYBOARD_STATE);
+ #endif /* HAVE_LIBXKLAVIER */
+
+ g_object_unref (settings->priv->provider);
diff --git a/source/xap/xfce/xfce.SlackBuild b/source/xap/xfce/xfce.SlackBuild
index 2ed8042e6..a59aa9497 100755
--- a/source/xap/xfce/xfce.SlackBuild
+++ b/source/xap/xfce/xfce.SlackBuild
@@ -1,7 +1,7 @@
#!/bin/sh
# Copyright 2003 Slackware Linux, Inc., Concord, CA, USA
-# Copyright 2007, 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2007, 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,20 +22,35 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
VERSION=4.6.1
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-5}
+BUILD=${BUILD:-8}
# A few tarballs have different versions; handle them here
-XDT_VERS=4.6.0 # xfce4-dev-tools version
-EXO_VERS=0.3.101 # exo version
+XDT_VERS=4.7.2 # xfce4-dev-tools version
+# We're going to ship xdt from git (targeting xfce-4.8) since it's not used
+# for building release tarballs anyway, but it's handy to have around for
+# building from git, and some folks might want to do that later...
+EXO_VERS=0.3.106 # exo version
THUNAR_VERS=1.0.1 # thunar version
GXE_VERS=2.6.0 # gtk-xfce-engine version
-TERM_VERS=0.4.0 # terminal version
+TERM_VERS=0.4.4 # terminal version
MPAD_VERS=0.2.16 # mousepad version
XFWMTHEME_VERS=4.6.0 # xfwm4-themes version
+SETTINGS_VERS=4.6.4 # xfce4-settings version
+PANEL_VERS=4.6.3 # xfce4-panel version
+XFCEGUI_VERS=4.6.3 # libxfcegui4 version
NUMJOBS=${NUMJOBS:--j6}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
CWD=$(pwd)
TMP=${TMP:-/tmp/xfce-build-dir}
PKG=$TMP/package-xfce
@@ -49,6 +64,9 @@ elif [ "$ARCH" = "s390" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
rm -rf $PKG
@@ -66,12 +84,12 @@ for file in \
xfce4-dev-tools-$XDT_VERS.tar.$COMPRESSION \
libxfce4util-$VERSION.tar.$COMPRESSION \
xfconf-$VERSION.tar.$COMPRESSION \
- libxfcegui4-$VERSION.tar.$COMPRESSION \
+ libxfcegui4-$XFCEGUI_VERS.tar.$COMPRESSION \
libxfce4menu-$VERSION.tar.$COMPRESSION \
exo-$EXO_VERS.tar.$COMPRESSION \
- xfce4-panel-$VERSION.tar.$COMPRESSION \
+ xfce4-panel-$PANEL_VERS.tar.$COMPRESSION \
Thunar-$THUNAR_VERS.tar.$COMPRESSION \
- xfce4-settings-$VERSION.tar.$COMPRESSION \
+ xfce4-settings-$SETTINGS_VERS.tar.$COMPRESSION \
xfce4-session-$VERSION.tar.$COMPRESSION \
xfdesktop-$VERSION.tar.$COMPRESSION \
xfwm4-$VERSION.tar.$COMPRESSION \
@@ -100,24 +118,29 @@ do
if [ "$file" = "orage-$VERSION.tar.$COMPRESSION" ]; then
zcat $CWD/patches/xfcalendar.desktop.in.diff.gz | patch -p1 || exit 1
fi
- # Fix http://bugzilla.xfce.org/show_bug.cgi?id=5461
- # and enable python bindings in libexo
- if [ "$file" = "exo-$EXO_VERS.tar.$COMPRESSION" ]; then
- zcat $CWD/patches/exo_fix_quoting.diff.gz | patch -p0 || exit 1
- PACKAGE_SPECIFIC_OPTIONS="--enable-python"
- fi
- # Make Terminal respect --docdir
+ # Fix Terminal's title bar and preferences problems with GTK+ 2.18:
if [ "$file" = "Terminal-$TERM_VERS.tar.$COMPRESSION" ]; then
- zcat $CWD/patches/terminal-0.4.0-fixup_docdir.diff.gz | patch -p1 || exit 1
+ zcat $CWD/patches/terminal.gtk.2.18.fix.diff.gz | patch -p1 || exit 1
fi
# Make Thunar respect --docdir
if [ "$file" = "Thunar-$THUNAR_VERS.tar.$COMPRESSION" ]; then
zcat $CWD/patches/thunar-1.0.1-fixup_docdir.diff.gz | patch -p1 || exit 1
+ zcat $CWD/patches/thunar-fix_umask_properly.diff.gz | patch -p1 || exit 1
+ # Port to PNG 1.4.0:
+ zcat $CWD/patches/thunar-1.0.1-png14.diff.gz | patch -p1 || exit 1
fi
# Fix the missing education icon in the desktop menu
if [ "$file" = "xfdesktop-$VERSION.tar.$COMPRESSION" ]; then
zcat $CWD/patches/xfdesktop-fix_education_icon.diff.gz | patch -p1 || exit 1
fi
+ # Port xfce4-settings to libxklavier-5.x:
+ if [ "$file" = "xfce4-settings-$SETTINGS_VERS.tar.$COMPRESSION" ]; then
+ zcat $CWD/patches/xfce4-settings.libxklavier5.diff.gz | patch -p1 || exit 1
+ fi
+ # Launch xfce through consolekit so that ck enabled stuff works in xfce:
+ if [ "$file" = "xfce-utils-$VERSION.tar.$COMPRESSION" ]; then
+ zcat $CWD/patches/xfce-utils.xinitrc.consolekit.diff.gz | patch -p1 || exit 1
+ fi
# End patches/package-specific stuff
CFLAGS="$SLKCFLAGS" \
@@ -148,6 +171,14 @@ do
$PKG/usr/doc/xfce-$VERSION/$(basename $file .tar.$COMPRESSION) \
2> /dev/null || true
+ # If there's a ChangeLog, installing at least part of the recent history
+ # is useful, but don't let it get totally out of control:
+ if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/xfce-$VERSION/$(basename $file .tar.$COMPRESSION))
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+ fi
+
cd - ;
done
diff --git a/source/xap/xfce4-notifyd/doinst.sh b/source/xap/xfce4-notifyd/doinst.sh
new file mode 100644
index 000000000..ec1b3d8a2
--- /dev/null
+++ b/source/xap/xfce4-notifyd/doinst.sh
@@ -0,0 +1,10 @@
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications 2>/dev/null
+fi
+
+if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
+ if [ -x /usr/bin/gtk-update-icon-cache ]; then
+ /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1
+ fi
+fi
+
diff --git a/source/xap/xfce4-notifyd/slack-desc b/source/xap/xfce4-notifyd/slack-desc
new file mode 100644
index 000000000..1463db0bd
--- /dev/null
+++ b/source/xap/xfce4-notifyd/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------------------------------------------------------|
+xfce4-notifyd: xfce4-notifyd (Xfce Notify Daemon)
+xfce4-notifyd:
+xfce4-notifyd: Xfce4-notifyd is a simple, visually-appealing notification daemon
+xfce4-notifyd: for Xfce. Applications can use xfce4-notifyd to pop up a notification
+xfce4-notifyd: bubble by sending messages through D-Bus.
+xfce4-notifyd:
+xfce4-notifyd: Homepage: http://spuriousinterrupt.org/projects/xfce4-notifyd
+xfce4-notifyd:
+xfce4-notifyd:
+xfce4-notifyd:
+xfce4-notifyd:
diff --git a/source/xap/xfce4-notifyd/xfce4-notifyd.SlackBuild b/source/xap/xfce4-notifyd/xfce4-notifyd.SlackBuild
new file mode 100755
index 000000000..2f33dbd88
--- /dev/null
+++ b/source/xap/xfce4-notifyd/xfce4-notifyd.SlackBuild
@@ -0,0 +1,103 @@
+#!/bin/sh
+
+# Slackware build script for Xfce4-notifyd
+
+# Copyright 2008 Frank Caraballo <fecaraballo{at}gmail{dot}com>
+# Copyright 2010 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=xfce4-notifyd
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-1}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-$PKGNAM
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+cd $TMP
+rm -rf $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1
+cd $PKGNAM-$VERSION || exit 1
+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 {} \;
+
+CFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc/xfce \
+ --localstatedir=/var \
+ --enable-debug=no \
+ --build=$ARCH-slackware-linux
+
+make || exit 1
+make install-strip DESTDIR=$PKG || exit 1
+
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
+cp -a \
+ AUTHORS COPYING INSTALL NEWS README TODO \
+ $PKG/usr/doc/$PKGNAM-$VERSION
+
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/xap/xfce4-power-manager/xfce4-power-manager.SlackBuild b/source/xap/xfce4-power-manager/xfce4-power-manager.SlackBuild
index 1487b2d05..1aa24bde0 100755
--- a/source/xap/xfce4-power-manager/xfce4-power-manager.SlackBuild
+++ b/source/xap/xfce4-power-manager/xfce4-power-manager.SlackBuild
@@ -2,8 +2,8 @@
# Slackware build script for xfce4-power-manager
-# Copyright 2008-2009 Robby Workman Northport, Alabama, USA
-# Copyright 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2006-2010 Robby Workman Northport, Alabama, USA
+# Copyright 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -24,14 +24,23 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-PRGNAM=xfce4-power-manager
-VERSION=0.6.6
-ARCH=${ARCH:-x86_64}
+PKGNAM=xfce4-power-manager
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-1}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
CWD=$(pwd)
TMP=${TMP:-/tmp}
-PKG=$TMP/package-$PRGNAM
+PKG=$TMP/package-$PKGNAM
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
@@ -42,14 +51,17 @@ elif [ "$ARCH" = "i686" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP || exit 1
-rm -rf $PRGNAM-$VERSION
-tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 || exit 1
-cd $PRGNAM-$VERSION || exit 1
+rm -rf $PKGNAM-$VERSION
+tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1
+cd $PKGNAM-$VERSION || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -60,11 +72,14 @@ find . \
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
- --sysconfdir=/etc/xfce \
--libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc/xfce \
--mandir=/usr/man \
- --docdir=/usr/doc/$PRGNAM-$VERSION \
+ --docdir=/usr/doc/$PKGNAM-$VERSION \
+ --enable-shared=yes \
+ --enable-static=no \
--enable-debug=no \
+ --disable-network-manager \
--build=$ARCH-slackware-linux
make || exit 1
@@ -73,19 +88,29 @@ make install DESTDIR=$PKG
find $PKG | xargs file | grep -e "executable" -e "shared object" \
| grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
-mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/html
+gzip -9 $PKG/usr/man/man?/*.?
+
+mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/html
cp -a \
- AUTHORS COPYING ChangeLog INSTALL NEWS README TODO \
- $PKG/usr/doc/$PRGNAM-$VERSION
-( cd $PKG/usr/doc/$PRGNAM-$VERSION/html
+ AUTHORS COPYING NEWS README TODO \
+ $PKG/usr/doc/$PKGNAM-$VERSION
+( cd $PKG/usr/doc/$PKGNAM-$VERSION/html
ln -s /usr/share/xfce4/doc/C/xfce4-power-manager.html index.html
ln -s /usr/share/xfce4/doc/C/images .
)
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
cd $PKG
-/sbin/makepkg -l y -c n $TMP/$PRGNAM-$VERSION-$ARCH-$BUILD.txz
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
diff --git a/source/xap/xine-lib/xine-lib-1.1.17.ff.diff b/source/xap/xine-lib/xine-lib-1.1.17.ff.diff
new file mode 100644
index 000000000..c08913eaa
--- /dev/null
+++ b/source/xap/xine-lib/xine-lib-1.1.17.ff.diff
@@ -0,0 +1,1044 @@
+--- ./src/combined/ffmpeg/ff_video_decoder.c.orig 2009-11-30 14:55:46.000000000 -0600
++++ ./src/combined/ffmpeg/ff_video_decoder.c 2009-04-02 13:44:01.000000000 -0500
+@@ -1,25 +1,25 @@
+ /*
+ * Copyright (C) 2001-2008 the xine project
+- *
++ *
+ * This file is part of xine, a free video player.
+- *
++ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+- *
++ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+- *
++ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * xine video decoder plugin using ffmpeg
+ */
+-
++
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #include "../../libffmpeg/ffmpeg_config.h"
+@@ -73,7 +73,7 @@
+ int thread_count;
+ int8_t skip_loop_filter_enum;
+ int8_t choose_speed_over_accuracy;
+-
++
+ xine_t *xine;
+ } ff_video_class_t;
+
+@@ -107,13 +107,13 @@
+ int bufsize;
+ int size;
+ int skipframes;
+-
++
+ int slice_offset_size;
+
+ AVFrame *av_frame;
+ AVCodecContext *context;
+ AVCodec *codec;
+-
++
+ int pp_quality;
+ int pp_flags;
+ pp_context_t *pp_context;
+@@ -126,7 +126,7 @@
+ int aspect_ratio_prio;
+ int frame_flags;
+ int crop_right, crop_bottom;
+-
++
+ int output_format;
+
+ xine_list_t *dr1_frames;
+@@ -154,7 +154,7 @@
+ vo_frame_t *img;
+ int width = context->width;
+ int height = context->height;
+-
++
+ if (!this->bih.biWidth || !this->bih.biHeight) {
+ this->bih.biWidth = width;
+ this->bih.biHeight = height;
+@@ -166,12 +166,12 @@
+ set_stream_info(this);
+ }
+ }
+-
++
+ avcodec_align_dimensions(context, &width, &height);
+
+ if( this->context->pix_fmt != PIX_FMT_YUV420P && this->context->pix_fmt != PIX_FMT_YUVJ420P ) {
+ if (!this->is_direct_rendering_disabled) {
+- xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+ _("ffmpeg_video_dec: unsupported frame format, DR1 disabled.\n"));
+ this->is_direct_rendering_disabled = 1;
+ }
+@@ -182,14 +182,14 @@
+ av_frame->data[2]= NULL;
+ return avcodec_default_get_buffer(context, av_frame);
+ }
+-
++
+ if((width != this->bih.biWidth) || (height != this->bih.biHeight)) {
+ if(this->stream->video_out->get_capabilities(this->stream->video_out) & VO_CAP_CROP) {
+ this->crop_right = width - this->bih.biWidth;
+ this->crop_bottom = height - this->bih.biHeight;
+ } else {
+ if (!this->is_direct_rendering_disabled) {
+- xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+ _("ffmpeg_video_dec: unsupported frame dimensions, DR1 disabled.\n"));
+ this->is_direct_rendering_disabled = 1;
+ }
+@@ -204,7 +204,7 @@
+ img = this->stream->video_out->get_frame (this->stream->video_out,
+ width,
+ height,
+- this->aspect_ratio,
++ this->aspect_ratio,
+ this->output_format,
+ VO_BOTH_FIELDS|this->frame_flags);
+
+@@ -246,7 +246,7 @@
+ }
+
+ xine_list_iterator_t it;
+-
++
+ it = xine_list_find(this->dr1_frames, av_frame);
+ assert(it);
+ if( it != NULL )
+@@ -300,7 +300,7 @@
+ }
+
+ if (!this->codec) {
+- xprintf (this->stream->xine, XINE_VERBOSITY_LOG,
++ xprintf (this->stream->xine, XINE_VERBOSITY_LOG,
+ _("ffmpeg_video_dec: couldn't find ffmpeg decoder for buf type 0x%X\n"),
+ codec_type);
+ _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HANDLED, 0);
+@@ -309,14 +309,14 @@
+
+ lprintf("lavc decoder found\n");
+
+- /* force (width % 8 == 0), otherwise there will be
+- * display problems with Xv.
+- */
++ /* force (width % 8 == 0), otherwise there will be
++ * display problems with Xv.
++ */
+ this->bih.biWidth = (this->bih.biWidth + 1) & (~1);
+
+ this->context->width = this->bih.biWidth;
+ this->context->height = this->bih.biHeight;
+- this->context->stream_codec_tag = this->context->codec_tag =
++ this->context->stream_codec_tag = this->context->codec_tag =
+ _x_stream_info_get(this->stream, XINE_STREAM_INFO_VIDEO_FOURCC);
+
+
+@@ -325,14 +325,14 @@
+ if(this->codec->capabilities & CODEC_CAP_DR1 && this->codec->id != CODEC_ID_H264) {
+ this->context->flags |= CODEC_FLAG_EMU_EDGE;
+ }
+-
++
+ if (this->class->choose_speed_over_accuracy)
+ this->context->flags2 |= CODEC_FLAG2_FAST;
+
+ pthread_mutex_lock(&ffmpeg_lock);
+ if (avcodec_open (this->context, this->codec) < 0) {
+ pthread_mutex_unlock(&ffmpeg_lock);
+- xprintf (this->stream->xine, XINE_VERBOSITY_LOG,
++ xprintf (this->stream->xine, XINE_VERBOSITY_LOG,
+ _("ffmpeg_video_dec: couldn't open decoder\n"));
+ free(this->context);
+ this->context = NULL;
+@@ -340,22 +340,6 @@
+ return;
+ }
+
+- if (this->codec->id == CODEC_ID_VC1 &&
+- (!this->bih.biWidth || !this->bih.biHeight)) {
+- /* VC1 codec must be re-opened with correct width and height. */
+- avcodec_close(this->context);
+-
+- if (avcodec_open (this->context, this->codec) < 0) {
+- pthread_mutex_unlock(&ffmpeg_lock);
+- xprintf (this->stream->xine, XINE_VERBOSITY_LOG,
+- _("ffmpeg_video_dec: couldn't open decoder (pass 2)\n"));
+- free(this->context);
+- this->context = NULL;
+- _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HANDLED, 0);
+- return;
+- }
+- }
+-
+ if (this->class->thread_count > 1) {
+ avcodec_thread_init(this->context, this->class->thread_count);
+ this->context->thread_count = this->class->thread_count;
+@@ -384,14 +368,14 @@
+ (this->stream->video_out->open) (this->stream->video_out, this->stream);
+
+ this->skipframes = 0;
+-
++
+ /* enable direct rendering by default */
+ this->output_format = XINE_IMGFMT_YV12;
+ #ifdef ENABLE_DIRECT_RENDERING
+ if( this->codec->capabilities & CODEC_CAP_DR1 && this->codec->id != CODEC_ID_H264 ) {
+ this->context->get_buffer = get_buffer;
+ this->context->release_buffer = release_buffer;
+- xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+ _("ffmpeg_video_dec: direct rendering enabled\n"));
+ }
+ #endif
+@@ -422,25 +406,25 @@
+
+ static void choose_speed_over_accuracy_cb(void *user_data, xine_cfg_entry_t *entry) {
+ ff_video_class_t *class = (ff_video_class_t *) user_data;
+-
++
+ class->choose_speed_over_accuracy = entry->num_value;
+ }
+
+ static void skip_loop_filter_enum_cb(void *user_data, xine_cfg_entry_t *entry) {
+ ff_video_class_t *class = (ff_video_class_t *) user_data;
+-
++
+ class->skip_loop_filter_enum = entry->num_value;
+ }
+
+ static void thread_count_cb(void *user_data, xine_cfg_entry_t *entry) {
+ ff_video_class_t *class = (ff_video_class_t *) user_data;
+-
++
+ class->thread_count = entry->num_value;
+ }
+
+ static void pp_quality_cb(void *user_data, xine_cfg_entry_t *entry) {
+ ff_video_class_t *class = (ff_video_class_t *) user_data;
+-
++
+ class->pp_quality = entry->num_value;
+ }
+
+@@ -453,15 +437,15 @@
+ this->pp_flags);
+ if(this->pp_mode)
+ pp_free_mode(this->pp_mode);
+-
+- this->pp_mode = pp_get_mode_by_name_and_quality("hb:a,vb:a,dr:a",
++
++ this->pp_mode = pp_get_mode_by_name_and_quality("hb:a,vb:a,dr:a",
+ this->pp_quality);
+ } else {
+ if(this->pp_mode) {
+ pp_free_mode(this->pp_mode);
+ this->pp_mode = NULL;
+ }
+-
++
+ if(this->pp_context) {
+ pp_free_context(this->pp_context);
+ this->pp_context = NULL;
+@@ -486,22 +470,22 @@
+ this->pp_available = 0;
+ break;
+ }
+-
++
+ /* Detect what cpu accel we have */
+ cpu_caps = xine_mm_accel();
+ this->pp_flags = PP_FORMAT_420;
+-
++
+ if(cpu_caps & MM_ACCEL_X86_MMX)
+ this->pp_flags |= PP_CPU_CAPS_MMX;
+-
++
+ if(cpu_caps & MM_ACCEL_X86_MMXEXT)
+ this->pp_flags |= PP_CPU_CAPS_MMX2;
+-
+- if(cpu_caps & MM_ACCEL_X86_3DNOW)
++
++ if(cpu_caps & MM_ACCEL_X86_3DNOW)
+ this->pp_flags |= PP_CPU_CAPS_3DNOW;
+-
++
+ /* Set level */
+- pp_change_quality(this);
++ pp_change_quality(this);
+ }
+
+ static int ff_handle_mpeg_sequence(ff_video_decoder_t *this, mpeg_parser_t *parser) {
+@@ -510,13 +494,13 @@
+ * init codec
+ */
+ if (this->decoder_init_mode) {
+- _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC,
++ _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC,
+ "mpeg-1 (ffmpeg)");
+
+ init_video_codec (this, BUF_VIDEO_MPEG);
+ this->decoder_init_mode = 0;
+ }
+-
++
+ /* frame format change */
+ if ((parser->width != this->bih.biWidth) ||
+ (parser->height != this->bih.biHeight) ||
+@@ -542,7 +526,7 @@
+ xine_event_send(this->stream, &event);
+ }
+ this->video_step = this->mpeg_parser->frame_duration;
+-
++
+ return 1;
+ }
+
+@@ -611,7 +595,7 @@
+ this->bih.biHeight);
+
+ } else if (this->context->pix_fmt == PIX_FMT_RGB32) {
+-
++
+ int x, plane_ptr = 0;
+ uint32_t *argb_pixels;
+ uint32_t argb;
+@@ -620,7 +604,7 @@
+ argb_pixels = (uint32_t *)sy;
+ for(x = 0; x < img->width; x++) {
+ uint8_t r, g, b;
+-
++
+ /* this is endian-safe as the ARGB pixels are stored in
+ * machine order */
+ argb = *argb_pixels++;
+@@ -635,9 +619,9 @@
+ }
+ sy += this->av_frame->linesize[0];
+ }
+-
++
+ yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]);
+-
++
+ } else if (this->context->pix_fmt == PIX_FMT_RGB565) {
+
+ int x, plane_ptr = 0;
+@@ -648,7 +632,7 @@
+ src = sy;
+ for(x = 0; x < img->width; x++) {
+ uint8_t r, g, b;
+-
++
+ /* a 16-bit RGB565 pixel is supposed to be stored in native-endian
+ * byte order; the following should be endian-safe */
+ pixel16 = *((uint16_t *)src);
+@@ -664,20 +648,20 @@
+ }
+ sy += this->av_frame->linesize[0];
+ }
+-
++
+ yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]);
+-
++
+ } else if (this->context->pix_fmt == PIX_FMT_RGB555) {
+-
++
+ int x, plane_ptr = 0;
+ uint8_t *src;
+ uint16_t pixel16;
+-
++
+ for(y = 0; y < this->bih.biHeight; y++) {
+ src = sy;
+ for(x = 0; x < img->width; x++) {
+ uint8_t r, g, b;
+-
++
+ /* a 16-bit RGB555 pixel is supposed to be stored in native-endian
+ * byte order; the following should be endian-safe */
+ pixel16 = *((uint16_t *)src);
+@@ -693,9 +677,9 @@
+ }
+ sy += this->av_frame->linesize[0];
+ }
+-
++
+ yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]);
+-
++
+ } else if (this->context->pix_fmt == PIX_FMT_BGR24) {
+
+ int x, plane_ptr = 0;
+@@ -705,7 +689,7 @@
+ src = sy;
+ for(x = 0; x < img->width; x++) {
+ uint8_t r, g, b;
+-
++
+ b = *src++;
+ g = *src++;
+ r = *src++;
+@@ -717,9 +701,9 @@
+ }
+ sy += this->av_frame->linesize[0];
+ }
+-
++
+ yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]);
+-
++
+ } else if (this->context->pix_fmt == PIX_FMT_RGB24) {
+
+ int x, plane_ptr = 0;
+@@ -729,7 +713,7 @@
+ src = sy;
+ for(x = 0; x < img->width; x++) {
+ uint8_t r, g, b;
+-
++
+ r = *src++;
+ g = *src++;
+ b = *src++;
+@@ -741,11 +725,11 @@
+ }
+ sy += this->av_frame->linesize[0];
+ }
+-
++
+ yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]);
+-
++
+ } else if (this->context->pix_fmt == PIX_FMT_PAL8) {
+-
++
+ int x, plane_ptr = 0;
+ uint8_t *src;
+ uint8_t pixel;
+@@ -780,34 +764,34 @@
+ }
+ sy += this->av_frame->linesize[0];
+ }
+-
++
+ yuv444_to_yuy2(&this->yuv, img->base[0], img->pitches[0]);
+-
++
+ } else {
+-
++
+ for (y = 0; y < this->bih.biHeight; y++) {
+ xine_fast_memcpy (dy, sy, img->width);
+-
++
+ dy += img->pitches[0];
+-
++
+ sy += this->av_frame->linesize[0];
+ }
+
+ for (y = 0; y < this->bih.biHeight / 2; y++) {
+-
++
+ if (this->context->pix_fmt != PIX_FMT_YUV444P) {
+-
++
+ xine_fast_memcpy (du, su, img->width/2);
+ xine_fast_memcpy (dv, sv, img->width/2);
+-
++
+ } else {
+-
++
+ int x;
+ uint8_t *src;
+ uint8_t *dst;
+-
++
+ /* subsample */
+-
++
+ src = su; dst = du;
+ for (x=0; x<(img->width/2); x++) {
+ *dst = *src;
+@@ -822,7 +806,7 @@
+ }
+
+ }
+-
++
+ du += img->pitches[1];
+ dv += img->pitches[2];
+
+@@ -840,8 +824,8 @@
+ static void ff_check_bufsize (ff_video_decoder_t *this, int size) {
+ if (size > this->bufsize) {
+ this->bufsize = size + size / 2;
+- xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+- _("ffmpeg_video_dec: increasing buffer to %d to avoid overflow.\n"),
++ xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
++ _("ffmpeg_video_dec: increasing buffer to %d to avoid overflow.\n"),
+ this->bufsize);
+ this->buf = realloc(this->buf, this->bufsize + FF_INPUT_BUFFER_PADDING_SIZE );
+ }
+@@ -887,28 +871,28 @@
+ if (buf->decoder_flags & BUF_FLAG_STDHEADER) {
+
+ lprintf("standard header\n");
+-
++
+ /* init package containing bih */
+ memcpy ( &this->bih, this->buf, sizeof(xine_bmiheader) );
+
+ if (this->bih.biSize > sizeof(xine_bmiheader)) {
+ this->context->extradata_size = this->bih.biSize - sizeof(xine_bmiheader);
+- this->context->extradata = malloc(this->context->extradata_size +
++ this->context->extradata = malloc(this->context->extradata_size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ memcpy(this->context->extradata, this->buf + sizeof(xine_bmiheader),
+ this->context->extradata_size);
+ }
+-
++
+ this->context->bits_per_sample = this->bih.biBitCount;
+-
++
+ } else {
+-
++
+ switch (codec_type) {
+ case BUF_VIDEO_RV10:
+ case BUF_VIDEO_RV20:
+ this->bih.biWidth = _X_BE_16(&this->buf[12]);
+ this->bih.biHeight = _X_BE_16(&this->buf[14]);
+-
++
+ this->context->sub_id = _X_BE_32(&this->buf[30]);
+
+ this->context->slice_offset = calloc(SLICE_OFFSET_SIZE, sizeof(int));
+@@ -950,7 +934,7 @@
+ }
+
+ static void ff_handle_special_buffer (ff_video_decoder_t *this, buf_element_t *buf) {
+- /* take care of all the various types of special buffers
++ /* take care of all the various types of special buffers
+ * note that order is important here */
+ lprintf("special buffer\n");
+
+@@ -959,34 +943,34 @@
+
+ lprintf("BUF_SPECIAL_STSD_ATOM\n");
+ this->context->extradata_size = buf->decoder_info[2];
+- this->context->extradata = malloc(buf->decoder_info[2] +
++ this->context->extradata = malloc(buf->decoder_info[2] +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ memcpy(this->context->extradata, buf->decoder_info_ptr[2],
+ buf->decoder_info[2]);
+
+ } else if (buf->decoder_info[1] == BUF_SPECIAL_DECODER_CONFIG &&
+ !this->context->extradata_size) {
+-
++
+ lprintf("BUF_SPECIAL_DECODER_CONFIG\n");
+ this->context->extradata_size = buf->decoder_info[2];
+ this->context->extradata = malloc(buf->decoder_info[2] +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ memcpy(this->context->extradata, buf->decoder_info_ptr[2],
+ buf->decoder_info[2]);
+-
++
+ } else if (buf->decoder_info[1] == BUF_SPECIAL_PALETTE) {
+ unsigned int i;
+
+ palette_entry_t *demuxer_palette;
+ AVPaletteControl *decoder_palette;
+-
++
+ lprintf("BUF_SPECIAL_PALETTE\n");
+ this->context->palctrl = &this->palette_control;
+ decoder_palette = (AVPaletteControl *)this->context->palctrl;
+ demuxer_palette = (palette_entry_t *)buf->decoder_info_ptr[2];
+
+ for (i = 0; i < buf->decoder_info[2]; i++) {
+- decoder_palette->palette[i] =
++ decoder_palette->palette[i] =
+ (demuxer_palette[i].r << 16) |
+ (demuxer_palette[i].g << 8) |
+ (demuxer_palette[i].b << 0);
+@@ -995,20 +979,20 @@
+
+ } else if (buf->decoder_info[1] == BUF_SPECIAL_RV_CHUNK_TABLE) {
+ int i;
+-
++
+ lprintf("BUF_SPECIAL_RV_CHUNK_TABLE\n");
+ this->context->slice_count = buf->decoder_info[2]+1;
+
+ lprintf("slice_count=%d\n", this->context->slice_count);
+-
++
+ if(this->context->slice_count > this->slice_offset_size) {
+ this->context->slice_offset = realloc(this->context->slice_offset,
+ sizeof(int)*this->context->slice_count);
+ this->slice_offset_size = this->context->slice_count;
+ }
+-
++
+ for(i = 0; i < this->context->slice_count; i++) {
+- this->context->slice_offset[i] =
++ this->context->slice_offset[i] =
+ ((uint32_t *) buf->decoder_info_ptr[2])[(2*i)+1];
+ lprintf("slice_offset[%d]=%d\n", i, this->context->slice_offset[i]);
+ }
+@@ -1051,7 +1035,7 @@
+
+ if (!this->decoder_ok)
+ return;
+-
++
+ if (flush) {
+ lprintf("flush lavc buffers\n");
+ /* hack: ffmpeg outputs the last frame if size=0 */
+@@ -1069,11 +1053,11 @@
+ len, got_picture);
+ len = current - buf->content - offset;
+ lprintf("avcodec_decode_video: consumed_size=%d\n", len);
+-
++
+ flush = next_flush;
+
+ if ((len < 0) || (len > buf->size)) {
+- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
++ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "ffmpeg_video_dec: error decompressing frame\n");
+ size = 0; /* draw a bad frame and exit */
+ } else {
+@@ -1088,7 +1072,7 @@
+ img = this->stream->video_out->get_frame (this->stream->video_out,
+ this->bih.biWidth,
+ this->bih.biHeight,
+- this->aspect_ratio,
++ this->aspect_ratio,
+ this->output_format,
+ VO_BOTH_FIELDS|this->frame_flags);
+ free_img = 1;
+@@ -1108,7 +1092,7 @@
+
+ img->crop_right = this->crop_right;
+ img->crop_bottom = this->crop_bottom;
+-
++
+ this->skipframes = img->draw(img, this->stream);
+
+ if(free_img)
+@@ -1121,7 +1105,7 @@
+ img = this->stream->video_out->get_frame (this->stream->video_out,
+ this->bih.biWidth,
+ this->bih.biHeight,
+- this->aspect_ratio,
++ this->aspect_ratio,
+ this->output_format,
+ VO_BOTH_FIELDS|this->frame_flags);
+ img->pts = 0;
+@@ -1181,49 +1165,6 @@
+ }
+ }
+
+-static int ff_vc1_find_header(ff_video_decoder_t *this, buf_element_t *buf)
+-{
+- uint8_t *p = buf->content;
+-
+- if (!p[0] && !p[1] && p[2] == 1 && p[3] == 0x0f) {
+- int i;
+-
+- this->context->extradata = calloc(1, buf->size);
+- this->context->extradata_size = 0;
+-
+- for (i = 0; i < buf->size && i < 128; i++) {
+- if (!p[i] && !p[i+1] && p[i+2]) {
+- lprintf("00 00 01 %02x at %d\n", p[i+3], i);
+- if (p[i+3] != 0x0e && p[i+3] != 0x0f)
+- break;
+- }
+- this->context->extradata[i] = p[i];
+- this->context->extradata_size++;
+- }
+-
+- lprintf("ff_video_decoder: found VC1 sequence header\n");
+- return 1;
+- }
+-
+- xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
+- "ffmpeg_video_dec: VC1 extradata missing !\n");
+- return 0;
+-}
+-
+-static int ff_check_extradata(ff_video_decoder_t *this, unsigned int codec_type, buf_element_t *buf)
+-{
+- if (this->context && this->context->extradata)
+- return 1;
+-
+- switch (codec_type) {
+- case BUF_VIDEO_VC1:
+- return ff_vc1_find_header(this, buf);
+- default:;
+- }
+-
+- return 1;
+-}
+-
+ #endif /* AVCODEC_HAS_REORDERED_OPAQUE */
+ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) {
+ uint8_t *chunk_buf = this->buf;
+@@ -1235,9 +1176,6 @@
+ if (this->decoder_init_mode) {
+ int codec_type = buf->type & 0xFFFF0000;
+
+- if (!ff_check_extradata(this, codec_type, buf))
+- return;
+-
+ /* init ffmpeg decoder */
+ init_video_codec(this, codec_type);
+ init_postprocess(this);
+@@ -1256,8 +1194,7 @@
+ if (this->size == 0) {
+ /* take over pts when we are about to buffer a frame */
+ this->av_frame->reordered_opaque = ff_tag_pts(this, this->pts);
+- if (this->context) /* shouldn't be NULL */
+- this->context->reordered_opaque = ff_tag_pts(this, this->pts);
++ this->context->reordered_opaque = ff_tag_pts(this, this->pts);
+ this->pts = 0;
+ }
+ #endif /* AVCODEC_HAS_REORDERED_OPAQUE */
+@@ -1265,7 +1202,7 @@
+ /* data accumulation */
+ if (buf->size > 0) {
+ if ((this->size == 0) &&
+- ((buf->size + FF_INPUT_BUFFER_PADDING_SIZE) < buf->max_size) &&
++ ((buf->size + FF_INPUT_BUFFER_PADDING_SIZE) < buf->max_size) &&
+ (buf->decoder_flags & BUF_FLAG_FRAME_END)) {
+ /* buf contains a complete frame */
+ /* no memcpy needed */
+@@ -1278,7 +1215,7 @@
+ chunk_buf = this->buf; /* ff_check_bufsize might realloc this->buf */
+
+ xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size);
+-
++
+ this->size += buf->size;
+ lprintf("accumulate data into this->buf\n");
+ }
+@@ -1301,7 +1238,7 @@
+ memset(&chunk_buf[this->size], 0, FF_INPUT_BUFFER_PADDING_SIZE);
+
+ while (this->size > 0) {
+-
++
+ /* DV frames can be completely skipped */
+ if( codec_type == BUF_VIDEO_DV && this->skipframes ) {
+ this->size = 0;
+@@ -1322,7 +1259,7 @@
+
+ lprintf("consumed size: %d, got_picture: %d\n", len, got_picture);
+ if ((len <= 0) || (len > this->size)) {
+- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
++ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "ffmpeg_video_dec: error decompressing frame\n");
+ this->size = 0;
+
+@@ -1366,7 +1303,7 @@
+ this->bih.biHeight = this->context->height;
+ }
+
+- this->aspect_ratio = av_q2d(this->context->sample_aspect_ratio) *
++ this->aspect_ratio = av_q2d(this->context->sample_aspect_ratio) *
+ (double)this->bih.biWidth / (double)this->bih.biHeight;
+ this->aspect_ratio_prio = 2;
+ lprintf("ffmpeg aspect ratio: %f\n", this->aspect_ratio);
+@@ -1405,7 +1342,7 @@
+ img = this->stream->video_out->get_frame (this->stream->video_out,
+ (this->bih.biWidth + 15) & ~15,
+ (this->bih.biHeight + 15) & ~15,
+- this->aspect_ratio,
++ this->aspect_ratio,
+ this->output_format,
+ VO_BOTH_FIELDS|this->frame_flags);
+ free_img = 1;
+@@ -1426,17 +1363,17 @@
+ img = this->stream->video_out->get_frame (this->stream->video_out,
+ (img->width + 15) & ~15,
+ (img->height + 15) & ~15,
+- this->aspect_ratio,
++ this->aspect_ratio,
+ this->output_format,
+ VO_BOTH_FIELDS|this->frame_flags);
+ free_img = 1;
+ }
+
+- pp_postprocess(this->av_frame->data, this->av_frame->linesize,
+- img->base, img->pitches,
++ pp_postprocess(this->av_frame->data, this->av_frame->linesize,
++ img->base, img->pitches,
+ img->width, img->height,
+ this->av_frame->qscale_table, this->av_frame->qstride,
+- this->pp_mode, this->pp_context,
++ this->pp_mode, this->pp_context,
+ this->av_frame->pict_type);
+
+ } else if (!this->av_frame->opaque) {
+@@ -1476,7 +1413,7 @@
+ img->top_field_first = this->av_frame->top_field_first;
+
+ this->skipframes = img->draw(img, this->stream);
+-
++
+ if(free_img)
+ img->free(img);
+ }
+@@ -1490,7 +1427,7 @@
+ img = this->stream->video_out->get_frame (this->stream->video_out,
+ (this->bih.biWidth <= 0) ? 16 : ((this->bih.biWidth + 15) & ~15),
+ (this->bih.biHeight <= 0) ? 16 : ((this->bih.biHeight + 15) & ~15),
+- this->aspect_ratio,
++ this->aspect_ratio,
+ this->output_format,
+ VO_BOTH_FIELDS|this->frame_flags);
+ /* set PTS to allow early syncing */
+@@ -1520,7 +1457,7 @@
+ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
+ ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen;
+
+- lprintf ("processing packet type = %08x, len = %d, decoder_flags=%08x\n",
++ lprintf ("processing packet type = %08x, len = %d, decoder_flags=%08x\n",
+ buf->type, buf->size, buf->decoder_flags);
+
+ if (buf->decoder_flags & BUF_FLAG_FRAMERATE) {
+@@ -1529,7 +1466,7 @@
+ }
+
+ if (buf->decoder_flags & BUF_FLAG_PREVIEW) {
+-
++
+ ff_handle_preview_buffer(this, buf);
+
+ } else {
+@@ -1537,7 +1474,7 @@
+ if (buf->decoder_flags & BUF_FLAG_SPECIAL) {
+
+ ff_handle_special_buffer(this, buf);
+-
++
+ }
+
+ if (buf->decoder_flags & BUF_FLAG_HEADER) {
+@@ -1551,7 +1488,7 @@
+ lprintf("aspect ratio: %f\n", this->aspect_ratio);
+ set_stream_info(this);
+ }
+- }
++ }
+
+ } else {
+
+@@ -1582,7 +1519,7 @@
+
+ if(this->context && this->decoder_ok)
+ avcodec_flush_buffers(this->context);
+-
++
+ if (this->is_mpeg12)
+ mpeg_parser_reset(this->mpeg_parser);
+
+@@ -1596,14 +1533,14 @@
+
+ static void ff_discontinuity (video_decoder_t *this_gen) {
+ ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen;
+-
++
+ lprintf ("ff_discontinuity\n");
+ this->pts = 0;
+
+ #ifdef AVCODEC_HAS_REORDERED_OPAQUE
+ /*
+ * there is currently no way to reset all the pts which are stored in the decoder.
+- * therefore, we add a unique tag (generated from pts_tag_counter) to pts (see
++ * therefore, we add a unique tag (generated from pts_tag_counter) to pts (see
+ * ff_tag_pts()) and wait for it to appear on returned frames.
+ * until then, any retrieved pts value will be reset to 0 (see ff_untag_pts()).
+ * when we see the tag returned, pts_tag will be reset to 0. from now on, any
+@@ -1640,15 +1577,15 @@
+ ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen;
+
+ lprintf ("ff_dispose\n");
+-
++
+ if (this->decoder_ok) {
+ xine_list_iterator_t it;
+ AVFrame *av_frame;
+-
++
+ pthread_mutex_lock(&ffmpeg_lock);
+ avcodec_close (this->context);
+ pthread_mutex_unlock(&ffmpeg_lock);
+-
++
+ /* frame garbage collector here - workaround for buggy ffmpeg codecs that
+ * don't release their DR1 frames */
+ while( (it = xine_list_front(this->dr1_frames)) != NULL )
+@@ -1656,7 +1593,7 @@
+ av_frame = (AVFrame *)xine_list_get_value(this->dr1_frames, it);
+ release_buffer(this->context, av_frame);
+ }
+-
++
+ this->stream->video_out->close(this->stream->video_out, this->stream);
+ this->decoder_ok = 0;
+ }
+@@ -1669,27 +1606,27 @@
+
+ if(this->yuv_init)
+ free_yuv_planes(&this->yuv);
+-
++
+ if( this->context )
+ av_free( this->context );
+
+ if( this->av_frame )
+ av_free( this->av_frame );
+-
++
+ if (this->buf)
+ free(this->buf);
+ this->buf = NULL;
+-
++
+ if(this->pp_context)
+ pp_free_context(this->pp_context);
+-
++
+ if(this->pp_mode)
+ pp_free_mode(this->pp_mode);
+
+ mpeg_parser_dispose(this->mpeg_parser);
+-
++
+ xine_list_delete(this->dr1_frames);
+-
++
+ free (this_gen);
+ }
+
+@@ -1715,7 +1652,7 @@
+ this->context = avcodec_alloc_context();
+ this->context->opaque = this;
+ this->context->palctrl = NULL;
+-
++
+ this->decoder_ok = 0;
+ this->decoder_init_mode = 1;
+ this->buf = calloc(1, VIDEOBUFSIZE + FF_INPUT_BUFFER_PADDING_SIZE);
+@@ -1727,9 +1664,9 @@
+ this->pp_quality = 0;
+ this->pp_context = NULL;
+ this->pp_mode = NULL;
+-
++
+ this->mpeg_parser = NULL;
+-
++
+ this->dr1_frames = xine_list_new();
+
+ #ifdef LOG
+@@ -1755,7 +1692,7 @@
+
+ ff_video_class_t *this;
+ config_values_t *config;
+-
++
+ this = calloc(1, sizeof (ff_video_class_t));
+
+ this->decoder_class.open_plugin = ff_video_open_plugin;
+@@ -1765,12 +1702,12 @@
+ this->xine = xine;
+
+ pthread_once( &once_control, init_once_routine );
+-
++
+ /* Configuration for post processing quality - default to mid (3) for the
+ * moment */
+ config = xine->config;
+-
+- this->pp_quality = xine->config->register_range(config, "video.processing.ffmpeg_pp_quality", 3,
++
++ this->pp_quality = xine->config->register_range(config, "video.processing.ffmpeg_pp_quality", 3,
+ 0, PP_QUALITY_MAX,
+ _("MPEG-4 postprocessing quality"),
+ _("You can adjust the amount of post processing applied to MPEG-4 video.\n"
+@@ -1779,8 +1716,8 @@
+ "too heavy post processing can actually make the image worse by blurring it "
+ "too much."),
+ 10, pp_quality_cb, this);
+-
+- this->thread_count = xine->config->register_num(config, "video.processing.ffmpeg_thread_count", 1,
++
++ this->thread_count = xine->config->register_num(config, "video.processing.ffmpeg_thread_count", 1,
+ _("FFmpeg video decoding thread count"),
+ _("You can adjust the number of video decoding threads which FFmpeg may use.\n"
+ "Higher values should speed up decoding but it depends on the codec used "
+@@ -1789,7 +1726,7 @@
+ "A change of this setting will take effect with playing the next stream."),
+ 10, thread_count_cb, this);
+
+- this->skip_loop_filter_enum = xine->config->register_enum(config, "video.processing.ffmpeg_skip_loop_filter", 0,
++ this->skip_loop_filter_enum = xine->config->register_enum(config, "video.processing.ffmpeg_skip_loop_filter", 0,
+ (char **)skip_loop_filter_enum_names,
+ _("Skip loop filter"),
+ _("You can control for which frames the loop filter shall be skipped after "
+@@ -1800,7 +1737,7 @@
+ "A change of this setting will take effect with playing the next stream."),
+ 10, skip_loop_filter_enum_cb, this);
+
+- this->choose_speed_over_accuracy = xine->config->register_bool(config, "video.processing.ffmpeg_choose_speed_over_accuracy", 0,
++ this->choose_speed_over_accuracy = xine->config->register_bool(config, "video.processing.ffmpeg_choose_speed_over_accuracy", 0,
+ _("Choose speed over specification compliance"),
+ _("You may want to allow speed cheats which violate codec specification.\n"
+ "Cheating may speed up decoding but can also lead to decoding artefacts.\n"
+@@ -1810,14 +1747,14 @@
+ return this;
+ }
+
+-static uint32_t wmv8_video_types[] = {
++static uint32_t wmv8_video_types[] = {
+ BUF_VIDEO_WMV8,
+- 0
++ 0
+ };
+
+-static uint32_t wmv9_video_types[] = {
++static uint32_t wmv9_video_types[] = {
+ BUF_VIDEO_WMV9,
+- 0
++ 0
+ };
+
+ decoder_info_t dec_info_ffmpeg_video = {
diff --git a/source/xap/xine-lib/xine-lib.SlackBuild b/source/xap/xine-lib/xine-lib.SlackBuild
index 84c6703f1..50bc2edee 100755
--- a/source/xap/xine-lib/xine-lib.SlackBuild
+++ b/source/xap/xine-lib/xine-lib.SlackBuild
@@ -22,17 +22,26 @@
# Version on the tarball
-VERSION=1.1.16.3
+VERSION=1.1.17
# Version used in the source directory to cd into
-DIRVER=1.1.16.3
+DIRVER=1.1.17
# Version used for the Slackware package
-PKGVER=1.1.16.3
+PKGVER=1.1.17
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i686 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
# I would use "-march=i486 -mtune=i686" here as usual, but with XINE it's all or nothing.
# I'd rather have it work well for the i686/Athlon crowd than suck for everyone.
-ARCH=${ARCH:-x86_64}
TARGET=${TARGET:-$ARCH-pc-linux-gnu}
-BUILD=${BUILD:-6}
+BUILD=${BUILD:-1}
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -53,6 +62,10 @@ rm -rf xine-lib-$VERSION
tar xvf $CWD/xine-lib-$VERSION.tar.bz2 || exit 1
cd xine-lib-$DIRVER || exit 1
+# revert to xine-lib-1.1.16.3 ffmpeg video decoder...
+# the new one doesn't compile:
+zcat $CWD/xine-lib-1.1.17.ff.diff.gz | patch -p1 --verbose || exit 1
+
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
diff --git a/source/xap/xine-ui/xine-ui.SlackBuild b/source/xap/xine-ui/xine-ui.SlackBuild
index 1dd61f1f6..61650223f 100755
--- a/source/xap/xine-ui/xine-ui.SlackBuild
+++ b/source/xap/xine-ui/xine-ui.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,12 +21,21 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-VERSION=0.99.5
+VERSION=${VERSION:-$(echo xine-ui-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
# I would use "-march=i486 -mcpu=i686" here as usual, but with XINE it's all or nothing.
# I'd rather have it work well for the i686/Athlon crowd than suck for everyone.
-ARCH=${ARCH:-x86_64}
+BUILD=${BUILD:-3}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i686 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
TARGET=${TARGET:-$ARCH-pc-linux-gnu}
-BUILD=${BUILD:-2}
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -41,6 +50,8 @@ rm -rf xine-ui-$VERSION
tar xvf $CWD/xine-ui-$VERSION.tar.bz2 || exit 1
cd xine-ui-$VERSION || exit 1
+zcat $CWD/xine-ui.png14.diff.gz | patch -p1 --verbose || exit 1
+
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
diff --git a/source/xap/xine-ui/xine-ui.png14.diff b/source/xap/xine-ui/xine-ui.png14.diff
new file mode 100644
index 000000000..35a06513c
--- /dev/null
+++ b/source/xap/xine-ui/xine-ui.png14.diff
@@ -0,0 +1,11 @@
+--- ./src/xitk/Imlib-light/load.c.orig 2003-07-14 17:44:10.000000000 -0500
++++ ./src/xitk/Imlib-light/load.c 2010-02-19 13:41:27.000000000 -0600
+@@ -193,7 +193,7 @@
+ return 0;
+ fread(buf, 1, 8, f);
+ rewind(f);
+- return (int)png_check_sig(buf, 8);
++ return (int)(png_sig_cmp(buf, 0, 8) == 0);
+ }
+
+ ImlibImage * Imlib_load_image(ImlibData * id, char *file) {
diff --git a/source/xap/xmms/xmms.SlackBuild b/source/xap/xmms/xmms.SlackBuild
index b11afde61..042d8310e 100755
--- a/source/xap/xmms/xmms.SlackBuild
+++ b/source/xap/xmms/xmms.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,9 +22,17 @@
VERSION=1.2.11
-ARCH=${ARCH:-x86_64}
-NUMJOBS=${NUMJOBS:-" -j7 "}
-BUILD=${BUILD:-3}
+BUILD=${BUILD:-4}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
@@ -38,8 +46,14 @@ elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
ARCHOPTS=""
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+ ARCHOPTS=""
fi
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-xmms
@@ -68,7 +82,7 @@ CXXFLAGS="$SLKCFLAGS" \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--localstatedir=/var/lib \
--disable-static \
- --with-ipv6 \
+ --enable-ipv6 \
$ARCHOPTS \
--build=$ARCH-slackware-linux
@@ -79,6 +93,10 @@ make install DESTDIR=$PKG || exit 1
mkdir -p $PKG/usr/share/applications
cat $CWD/xmms.desktop > $PKG/usr/share/applications/xmms.desktop
+# Add an icon for the menus:
+mkdir -p $PKG/usr/share/pixmaps
+cat $CWD/xmms.png > $PKG/usr/share/pixmaps/xmms.png
+
mkdir -p $PKG/usr/doc/xmms-$VERSION
cp -a \
ABOUT-NLS AUTHORS COPYING FAQ INSTALL NEWS README TODO \
diff --git a/source/xap/xmms/xmms.png b/source/xap/xmms/xmms.png
new file mode 100644
index 000000000..7ff618709
--- /dev/null
+++ b/source/xap/xmms/xmms.png
Binary files differ
diff --git a/source/xap/xpaint/xpaint.SlackBuild b/source/xap/xpaint/xpaint.SlackBuild
index c353c7384..367df5ee0 100755
--- a/source/xap/xpaint/xpaint.SlackBuild
+++ b/source/xap/xpaint/xpaint.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,10 +22,20 @@
PKGNAM=xpaint
-VERSION=${VERSION:-2.7.8.1}
-ARCH=${ARCH:-x86_64}
+VERSION=${VERSION:-2.8.16}
+BUILD=${BUILD:-1}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-BUILD=${BUILD:-2}
CWD=$(pwd)
@@ -43,6 +53,9 @@ elif [ "$ARCH" = "s390" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
cd $TMP
@@ -54,8 +67,6 @@ if [ "$ARCH" = "x86_64" ]; then
# Make it detect Xaw3d:
sed -i -e "s#usr/lib/#usr/lib${LIBDIRSUFFIX}/#g" $( grep -lr 'usr/lib/' * )
fi
-zcat ${CWD}/xpaint_xaw3d_no_scroll_mode.diff.gz | patch -p1 || exit 1
-#zcat ${CWD}/xpaint_2.7.8.1-1.2.diff.gz | patch -p1 || exit 1
# Make sure ownerships and permissions are sane:
chown -R root:root .
@@ -109,9 +120,17 @@ fi
# Add a documentation directory:
mkdir -p ${PKG}/usr/doc/xpaint-$VERSION
cp -a \
- README README.PNG README.old TODO \
+ GPL* INSTALL README* TODO* \
${PKG}/usr/doc/xpaint-$VERSION
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
+ cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+ touch -r ChangeLog $DOCSDIR/ChangeLog
+fi
+
mkdir -p $PKG/install
cat $CWD/slack-desc > ${PKG}/install/slack-desc
diff --git a/source/xap/xpaint/xpaint_2.7.8.1-1.2.diff b/source/xap/xpaint/xpaint_2.7.8.1-1.2.diff
deleted file mode 100644
index 1f8cc82e1..000000000
--- a/source/xap/xpaint/xpaint_2.7.8.1-1.2.diff
+++ /dev/null
@@ -1,47 +0,0 @@
---- ./misc.h.orig 2005-08-15 14:50:05.000000000 -0500
-+++ ./misc.h 2007-05-10 16:46:23.000000000 -0500
-@@ -24,7 +24,7 @@
- long random(void);
- #endif
-
--#if !defined(__VMS) & !defined(linux) & !defined(__EMX__) & !defined(__FreeBSD__) & !defined(__CYGWIN__)
-+#if !defined(__VMS) & !defined(linux) & !defined(__EMX__) & !defined(__FreeBSD__) & !defined(__CYGWIN__) & !defined(__GLIBC__)
- #if defined(BSD4_4) || defined(HPArchitecture) || defined(SGIArchitecture) || defined(_AIX) || defined(_SCO_DS)
- void srandom(unsigned int);
- #else
---- ./Local.config.orig 2005-04-30 16:33:14.000000000 -0500
-+++ ./Local.config 2007-05-10 16:47:02.000000000 -0500
-@@ -132,11 +132,11 @@
- XCOMM You must have the XPM library.
- XCOMM Make sure the path name to the library is correct.
-
--XPM_LIB = -L/usr/X11R6/lib -lXpm
-+XPM_LIB = -lXpm
-
- XCOMM Make sure this points to the location of the 'xpm.h' file.
-
--XPM_INCLUDE = -I/usr/X11R6/include/X11
-+XPM_INCLUDE = -I/usr/include/X11
-
-
- DEPENDFLAGS = -I./bitmaps
---- ./configure.orig 2005-06-03 07:26:11.000000000 -0500
-+++ ./configure 2007-05-10 16:46:23.000000000 -0500
-@@ -7,7 +7,7 @@
- echo "(looking for Xaw, Xaw3d, Xaw95, neXtaw)"
- echo ""
- else
-- WIDGETS=`echo $1 | tr [a:z] [A:Z]`
-+ WIDGETS=`echo $1`
- fi
-
- if test "$WIDGETS" = "" ; then
-@@ -54,7 +54,7 @@
- fi
- fi
-
--if test "$WIDGETS" = "XAW3DG" ; then
-+if test "$WIDGETS" = "xaw3dg" ; then
- ln -sf /usr/include/X11/Xaw3d xaw_incdir
- echo "XAWLIB_DEFINES = -DXAW3D -DXAW3DG"
- echo "XAWLIB_DEFINES = -DXAW3D -DXAW3DG" > Local.xawdefs
diff --git a/source/xap/xpaint/xpaint_xaw3d_no_scroll_mode.diff b/source/xap/xpaint/xpaint_xaw3d_no_scroll_mode.diff
deleted file mode 100644
index f89b12c1d..000000000
--- a/source/xap/xpaint/xpaint_xaw3d_no_scroll_mode.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- xpaint-2.7.8.1/misc.c.orig 2005-04-24 11:57:52.000000000 +0000
-+++ xpaint-2.7.8.1/misc.c 2008-11-06 21:43:46.000000000 +0000
-@@ -671,7 +671,7 @@
- }
- else return;
- if (sb == None) return;
--#ifdef XAW3DG
-+#if defined(XAW3DG) && defined(XAW_ARROW_SCROLLBARS)
- if (((ScrollbarWidget)sb)->scrollbar.scroll_mode == 2 /* if scroll continuous */
- || LookAhead (sb, event))
- return;
diff --git a/source/xap/xpdf/VendorP.h.buggy.diff b/source/xap/xpdf/VendorP.h.buggy.diff
deleted file mode 100644
index a8c91ab4b..000000000
--- a/source/xap/xpdf/VendorP.h.buggy.diff
+++ /dev/null
@@ -1,19 +0,0 @@
---- ./VendorP.h.orig 2007-02-14 02:45:33.000000000 -0600
-+++ ./VendorP.h 2007-08-08 14:22:17.000000000 -0500
-@@ -76,6 +76,8 @@
- XtPointer extension; /* pointer to extension record */
- } VendorShellClassPart;
-
-+struct VendorShellClassRec;
-+/*
- typedef struct _VendorShellClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
-@@ -85,6 +87,7 @@
- } VendorShellClassRec;
-
- externalref VendorShellClassRec vendorShellClassRec;
-+*/
-
- /* New fields for the vendor shell widget. */
-
diff --git a/source/xap/xpdf/doinst.sh b/source/xap/xpdf/doinst.sh
new file mode 100644
index 000000000..03a6ae859
--- /dev/null
+++ b/source/xap/xpdf/doinst.sh
@@ -0,0 +1,19 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+config etc/xpdfrc.new
+
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
+fi
+
diff --git a/source/xap/xpdf/xpdf-arabic.diff b/source/xap/xpdf/lang/xpdf-arabic.diff
index a6dfcf1f5..a6dfcf1f5 100644
--- a/source/xap/xpdf/xpdf-arabic.diff
+++ b/source/xap/xpdf/lang/xpdf-arabic.diff
diff --git a/source/xap/xpdf/xpdf-chinese-simplified.diff b/source/xap/xpdf/lang/xpdf-chinese-simplified.diff
index adb125a49..adb125a49 100644
--- a/source/xap/xpdf/xpdf-chinese-simplified.diff
+++ b/source/xap/xpdf/lang/xpdf-chinese-simplified.diff
diff --git a/source/xap/xpdf/xpdf-chinese-traditional.diff b/source/xap/xpdf/lang/xpdf-chinese-traditional.diff
index 71d35ee5d..71d35ee5d 100644
--- a/source/xap/xpdf/xpdf-chinese-traditional.diff
+++ b/source/xap/xpdf/lang/xpdf-chinese-traditional.diff
diff --git a/source/xap/xpdf/xpdf-cyrillic.diff b/source/xap/xpdf/lang/xpdf-cyrillic.diff
index ec841961e..ec841961e 100644
--- a/source/xap/xpdf/xpdf-cyrillic.diff
+++ b/source/xap/xpdf/lang/xpdf-cyrillic.diff
diff --git a/source/xap/xpdf/xpdf-greek.diff b/source/xap/xpdf/lang/xpdf-greek.diff
index fe47d4434..fe47d4434 100644
--- a/source/xap/xpdf/xpdf-greek.diff
+++ b/source/xap/xpdf/lang/xpdf-greek.diff
diff --git a/source/xap/xpdf/xpdf-hebrew.diff b/source/xap/xpdf/lang/xpdf-hebrew.diff
index e7d091d00..e7d091d00 100644
--- a/source/xap/xpdf/xpdf-hebrew.diff
+++ b/source/xap/xpdf/lang/xpdf-hebrew.diff
diff --git a/source/xap/xpdf/xpdf-japanese.diff b/source/xap/xpdf/lang/xpdf-japanese.diff
index 5c1878fe8..5c1878fe8 100644
--- a/source/xap/xpdf/xpdf-japanese.diff
+++ b/source/xap/xpdf/lang/xpdf-japanese.diff
diff --git a/source/xap/xpdf/xpdf-korean.diff b/source/xap/xpdf/lang/xpdf-korean.diff
index 632fc2145..632fc2145 100644
--- a/source/xap/xpdf/xpdf-korean.diff
+++ b/source/xap/xpdf/lang/xpdf-korean.diff
diff --git a/source/xap/xpdf/xpdf-latin2.diff b/source/xap/xpdf/lang/xpdf-latin2.diff
index 88ce2444e..88ce2444e 100644
--- a/source/xap/xpdf/xpdf-latin2.diff
+++ b/source/xap/xpdf/lang/xpdf-latin2.diff
diff --git a/source/xap/xpdf/xpdf-thai.diff b/source/xap/xpdf/lang/xpdf-thai.diff
index 75b9b1a28..75b9b1a28 100644
--- a/source/xap/xpdf/xpdf-thai.diff
+++ b/source/xap/xpdf/lang/xpdf-thai.diff
diff --git a/source/xap/xpdf/xpdf-turkish.diff b/source/xap/xpdf/lang/xpdf-turkish.diff
index ec7fe79f0..ec7fe79f0 100644
--- a/source/xap/xpdf/xpdf-turkish.diff
+++ b/source/xap/xpdf/lang/xpdf-turkish.diff
diff --git a/source/xap/xpdf/xpdf-3.02pl1.patch b/source/xap/xpdf/patches/xpdf-3.02pl1.patch
index cd42fb962..cd42fb962 100644
--- a/source/xap/xpdf/xpdf-3.02pl1.patch
+++ b/source/xap/xpdf/patches/xpdf-3.02pl1.patch
diff --git a/source/xap/xpdf/xpdf-3.02pl2.patch b/source/xap/xpdf/patches/xpdf-3.02pl2.patch
index ab9e3c671..ab9e3c671 100644
--- a/source/xap/xpdf/xpdf-3.02pl2.patch
+++ b/source/xap/xpdf/patches/xpdf-3.02pl2.patch
diff --git a/source/xap/xpdf/xpdf-3.02pl3.patch b/source/xap/xpdf/patches/xpdf-3.02pl3.patch
index b5988805f..b5988805f 100644
--- a/source/xap/xpdf/xpdf-3.02pl3.patch
+++ b/source/xap/xpdf/patches/xpdf-3.02pl3.patch
diff --git a/source/xap/xpdf/patches/xpdf-3.02pl4.patch b/source/xap/xpdf/patches/xpdf-3.02pl4.patch
new file mode 100644
index 000000000..082d11750
--- /dev/null
+++ b/source/xap/xpdf/patches/xpdf-3.02pl4.patch
@@ -0,0 +1,282 @@
+*** xpdf-3.02.orig/xpdf/Stream.cc Fri Jul 24 14:30:46 2009
+--- xpdf-3.02/xpdf/Stream.cc Mon Oct 5 11:07:49 2009
+***************
+*** 323,328 ****
+--- 323,332 ----
+ } else {
+ imgLineSize = nVals;
+ }
++ if (width > INT_MAX / nComps) {
++ // force a call to gmallocn(-1,...), which will throw an exception
++ imgLineSize = -1;
++ }
+ imgLine = (Guchar *)gmallocn(imgLineSize, sizeof(Guchar));
+ imgIdx = nVals;
+ }
+*** xpdf-3.02.orig/xpdf/PSOutputDev.cc Tue Feb 27 14:05:52 2007
+--- xpdf-3.02/xpdf/PSOutputDev.cc Fri Oct 2 12:38:58 2009
+***************
+*** 4301,4307 ****
+ width, -height, height);
+
+ // allocate a line buffer
+! lineBuf = (Guchar *)gmalloc(4 * width);
+
+ // set up to process the data stream
+ imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(),
+--- 4301,4307 ----
+ width, -height, height);
+
+ // allocate a line buffer
+! lineBuf = (Guchar *)gmallocn(width, 4);
+
+ // set up to process the data stream
+ imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(),
+diff -r -c xpdf-3.02.orig/splash/Splash.cc xpdf-3.02/splash/Splash.cc
+*** xpdf-3.02.orig/splash/Splash.cc Tue Feb 27 14:05:52 2007
+--- xpdf-3.02/splash/Splash.cc Fri Aug 14 14:05:08 2009
+***************
+*** 12,17 ****
+--- 12,18 ----
+
+ #include <stdlib.h>
+ #include <string.h>
++ #include <limits.h>
+ #include "gmem.h"
+ #include "SplashErrorCodes.h"
+ #include "SplashMath.h"
+***************
+*** 1912,1918 ****
+ xq = w % scaledWidth;
+
+ // allocate pixel buffer
+! pixBuf = (SplashColorPtr)gmalloc((yp + 1) * w);
+
+ // initialize the pixel pipe
+ pipeInit(&pipe, 0, 0, state->fillPattern, NULL, state->fillAlpha,
+--- 1913,1922 ----
+ xq = w % scaledWidth;
+
+ // allocate pixel buffer
+! if (yp < 0 || yp > INT_MAX - 1) {
+! return splashErrBadArg;
+! }
+! pixBuf = (SplashColorPtr)gmallocn(yp + 1, w);
+
+ // initialize the pixel pipe
+ pipeInit(&pipe, 0, 0, state->fillPattern, NULL, state->fillAlpha,
+***************
+*** 2208,2216 ****
+ xq = w % scaledWidth;
+
+ // allocate pixel buffers
+! colorBuf = (SplashColorPtr)gmalloc((yp + 1) * w * nComps);
+ if (srcAlpha) {
+! alphaBuf = (Guchar *)gmalloc((yp + 1) * w);
+ } else {
+ alphaBuf = NULL;
+ }
+--- 2212,2223 ----
+ xq = w % scaledWidth;
+
+ // allocate pixel buffers
+! if (yp < 0 || yp > INT_MAX - 1 || w > INT_MAX / nComps) {
+! return splashErrBadArg;
+! }
+! colorBuf = (SplashColorPtr)gmallocn(yp + 1, w * nComps);
+ if (srcAlpha) {
+! alphaBuf = (Guchar *)gmallocn(yp + 1, w);
+ } else {
+ alphaBuf = NULL;
+ }
+diff -r -c xpdf-3.02.orig/splash/SplashErrorCodes.h xpdf-3.02/splash/SplashErrorCodes.h
+*** xpdf-3.02.orig/splash/SplashErrorCodes.h Tue Feb 27 14:05:52 2007
+--- xpdf-3.02/splash/SplashErrorCodes.h Fri Aug 14 14:03:46 2009
+***************
+*** 29,32 ****
+--- 29,34 ----
+
+ #define splashErrSingularMatrix 8 // matrix is singular
+
++ #define splashErrBadArg 9 // bad argument
++
+ #endif
+*** xpdf-3.02.orig/splash/SplashBitmap.cc Tue Feb 27 14:05:52 2007
+--- xpdf-3.02/splash/SplashBitmap.cc Wed Aug 19 14:55:39 2009
+***************
+*** 11,16 ****
+--- 11,17 ----
+ #endif
+
+ #include <stdio.h>
++ #include <limits.h>
+ #include "gmem.h"
+ #include "SplashErrorCodes.h"
+ #include "SplashBitmap.h"
+***************
+*** 27,56 ****
+ mode = modeA;
+ switch (mode) {
+ case splashModeMono1:
+! rowSize = (width + 7) >> 3;
+ break;
+ case splashModeMono8:
+! rowSize = width;
+ break;
+ case splashModeRGB8:
+ case splashModeBGR8:
+! rowSize = width * 3;
+ break;
+ #if SPLASH_CMYK
+ case splashModeCMYK8:
+! rowSize = width * 4;
+ break;
+ #endif
+ }
+! rowSize += rowPad - 1;
+! rowSize -= rowSize % rowPad;
+! data = (SplashColorPtr)gmalloc(rowSize * height);
+ if (!topDown) {
+ data += (height - 1) * rowSize;
+ rowSize = -rowSize;
+ }
+ if (alphaA) {
+! alpha = (Guchar *)gmalloc(width * height);
+ } else {
+ alpha = NULL;
+ }
+--- 28,75 ----
+ mode = modeA;
+ switch (mode) {
+ case splashModeMono1:
+! if (width > 0) {
+! rowSize = (width + 7) >> 3;
+! } else {
+! rowSize = -1;
+! }
+ break;
+ case splashModeMono8:
+! if (width > 0) {
+! rowSize = width;
+! } else {
+! rowSize = -1;
+! }
+ break;
+ case splashModeRGB8:
+ case splashModeBGR8:
+! if (width > 0 && width <= INT_MAX / 3) {
+! rowSize = width * 3;
+! } else {
+! rowSize = -1;
+! }
+ break;
+ #if SPLASH_CMYK
+ case splashModeCMYK8:
+! if (width > 0 && width <= INT_MAX / 4) {
+! rowSize = width * 4;
+! } else {
+! rowSize = -1;
+! }
+ break;
+ #endif
+ }
+! if (rowSize > 0) {
+! rowSize += rowPad - 1;
+! rowSize -= rowSize % rowPad;
+! }
+! data = (SplashColorPtr)gmallocn(height, rowSize);
+ if (!topDown) {
+ data += (height - 1) * rowSize;
+ rowSize = -rowSize;
+ }
+ if (alphaA) {
+! alpha = (Guchar *)gmallocn(width, height);
+ } else {
+ alpha = NULL;
+ }
+*** xpdf-3.02.orig/xpdf/XRef.cc Tue Feb 27 14:05:52 2007
+--- xpdf-3.02/xpdf/XRef.cc Tue Oct 13 11:57:24 2009
+***************
+*** 52,57 ****
+--- 52,59 ----
+ // generation 0.
+ ObjectStream(XRef *xref, int objStrNumA);
+
++ GBool isOk() { return ok; }
++
+ ~ObjectStream();
+
+ // Return the object number of this object stream.
+***************
+*** 67,72 ****
+--- 69,75 ----
+ int nObjects; // number of objects in the stream
+ Object *objs; // the objects (length = nObjects)
+ int *objNums; // the object numbers (length = nObjects)
++ GBool ok;
+ };
+
+ ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
+***************
+*** 80,85 ****
+--- 83,89 ----
+ nObjects = 0;
+ objs = NULL;
+ objNums = NULL;
++ ok = gFalse;
+
+ if (!xref->fetch(objStrNum, 0, &objStr)->isStream()) {
+ goto err1;
+***************
+*** 105,110 ****
+--- 109,121 ----
+ goto err1;
+ }
+
++ // this is an arbitrary limit to avoid integer overflow problems
++ // in the 'new Object[nObjects]' call (Acrobat apparently limits
++ // object streams to 100-200 objects)
++ if (nObjects > 1000000) {
++ error(-1, "Too many objects in an object stream");
++ goto err1;
++ }
+ objs = new Object[nObjects];
+ objNums = (int *)gmallocn(nObjects, sizeof(int));
+ offsets = (int *)gmallocn(nObjects, sizeof(int));
+***************
+*** 161,170 ****
+ }
+
+ gfree(offsets);
+
+ err1:
+ objStr.free();
+- return;
+ }
+
+ ObjectStream::~ObjectStream() {
+--- 172,181 ----
+ }
+
+ gfree(offsets);
++ ok = gTrue;
+
+ err1:
+ objStr.free();
+ }
+
+ ObjectStream::~ObjectStream() {
+***************
+*** 837,842 ****
+--- 848,858 ----
+ delete objStr;
+ }
+ objStr = new ObjectStream(this, e->offset);
++ if (!objStr->isOk()) {
++ delete objStr;
++ objStr = NULL;
++ goto err;
++ }
+ }
+ objStr->getObject(e->gen, num, obj);
+ break;
diff --git a/source/xap/xpdf/xpdf-resizefix.diff b/source/xap/xpdf/patches/xpdf-resizefix.diff
index 4be7feb0a..4be7feb0a 100644
--- a/source/xap/xpdf/xpdf-resizefix.diff
+++ b/source/xap/xpdf/patches/xpdf-resizefix.diff
diff --git a/source/xap/xpdf/xpdf_3.02-1.3.diff b/source/xap/xpdf/patches/xpdf_3.02-1.3.diff
index 6a769e5c9..6a769e5c9 100644
--- a/source/xap/xpdf/xpdf_3.02-1.3.diff
+++ b/source/xap/xpdf/patches/xpdf_3.02-1.3.diff
diff --git a/source/xap/xpdf/xpdfrc.diff b/source/xap/xpdf/patches/xpdfrc.diff
index f005414e0..f005414e0 100644
--- a/source/xap/xpdf/xpdfrc.diff
+++ b/source/xap/xpdf/patches/xpdfrc.diff
diff --git a/source/xap/xpdf/xpdf.SlackBuild b/source/xap/xpdf/xpdf.SlackBuild
index d07fb9aa6..5acf7c06e 100755
--- a/source/xap/xpdf/xpdf.SlackBuild
+++ b/source/xap/xpdf/xpdf.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -22,10 +22,20 @@
VERSION=3.02
-PATCHLEVEL=pl3
-ARCH=${ARCH:-x86_64}
+PATCHLEVEL=pl4
+BUILD=${BUILD:-2}
+
NUMJOBS=${NUMJOBS:-" -j7 "}
-BUILD=1
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
@@ -36,25 +46,23 @@ elif [ "$ARCH" = "s390" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-xpdf
+
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf xpdf-$VERSION
-tar xvf $CWD/xpdf-$VERSION.tar.gz || exit 1
+tar xvf $CWD/xpdf-$VERSION.tar.?z || exit 1
cd xpdf-$VERSION || exit 1
-zcat $CWD/xpdf-resizefix.diff.gz | patch -p1 --verbose || exit 1
-cat $CWD/xpdf-3.02pl1.patch | patch -p1 --verbose || exit 1
-cat $CWD/xpdf-3.02pl2.patch | patch -p1 --verbose || exit 1
-cat $CWD/xpdf-3.02pl3.patch | patch -p1 --verbose || exit 1
-zcat $CWD/xpdf_3.02-1.3.diff.gz | patch -p1 --verbose || exit 1
-
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
@@ -62,7 +70,14 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
-zcat $CWD/xpdfrc.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit
+zcat $CWD/patches/xpdf-resizefix.diff.gz | patch -p1 --verbose || exit 1
+cat $CWD/patches/xpdf-3.02pl1.patch | patch -p1 --verbose || exit 1
+cat $CWD/patches/xpdf-3.02pl2.patch | patch -p1 --verbose || exit 1
+cat $CWD/patches/xpdf-3.02pl3.patch | patch -p1 --verbose || exit 1
+cat $CWD/patches/xpdf-3.02pl4.patch | patch -p1 --verbose || exit 1
+zcat $CWD/patches/xpdf_3.02-1.3.diff.gz | patch -p1 --verbose || exit 1
+zcat $CWD/patches/xpdfrc.diff.gz | patch -p1 --verbose || exit 1
+
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
@@ -71,71 +86,68 @@ CXXFLAGS="$SLKCFLAGS" \
--mandir=/usr/man \
--sysconfdir=/etc \
--with-gzip \
- --with-freetype2-includes=/usr/include/freetype2
+ --with-freetype2-includes=/usr/include/freetype2 \
+ --build=$ARCH-slackware-linux
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
-mkdir -p $PKG/etc
-cat doc/sample-xpdfrc > $PKG/etc/xpdfrc
-mkdir -p $PKG/usr/share/applications
-cat $CWD/xpdf.desktop > $PKG/usr/share/applications/xpdf.desktop
-mkdir -p $PKG/usr/share/icons
-cat xpdf/xpdfIcon.xpm > $PKG/usr/share/icons/xpdfIcon.xpm
+chmod 0755 $PKG/usr/bin/*
+gzip -9 $PKG/usr/man/man?/*
-find $PKG | xargs file | grep -e "executable" -e "shared object" \
- | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+# We'll use the versions of these from the poppler derived work (if they exist here):
+( cd $PKG/usr/bin
+ rm -f pdfinfo pdftops pdftoppm pdftohtml pdftotext pdfimages pdffonts
+ cd $PKG/usr/man/man1
+ for file in pdfinfo pdftops pdftoppm pdftohtml pdftotext pdfimages pdffonts ; do
+ rm -f ${file}.1.gz
+ done
+)
-chmod 755 $PKG/usr/bin/*
-gzip -9 $PKG/usr/man/man?/*
+# Don't clobber /etc/xpdfrc
+mkdir -p $PKG/etc
+cat doc/sample-xpdfrc > $PKG/etc/xpdfrc
+mv $PKG/etc/xpdfrc $PKG/etc/xpdfrc.new
-mkdir -p $PKG/usr/doc/xpdf-$VERSION
-cp -a \
- ANNOUNCE CHANGES COPYING INSTALL README \
- $PKG/usr/doc/xpdf-$VERSION
-chmod 644 $PKG/usr/doc/xpdf-$VERSION/*
+# Add desktop menu entry and icon
+mkdir -p $PKG/usr/share/{applications,pixmaps}
+cat $CWD/xpdf.desktop > $PKG/usr/share/applications/xpdf.desktop
+cat xpdf/xpdfIcon.xpm > $PKG/usr/share/pixmaps/xpdfIcon.xpm
# Add additional language support:
for language in xpdf-arabic xpdf-chinese-simplified xpdf-chinese-traditional xpdf-cyrillic xpdf-greek xpdf-hebrew xpdf-japanese xpdf-korean xpdf-latin2 xpdf-thai xpdf-turkish ; do
rm -rf ${language}
- tar xf $CWD/${language}.tar.gz
+ tar xf $CWD/lang/${language}.tar.gz
( cd ${language}
- zcat $CWD/${language}.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
+ zcat $CWD/lang/${language}.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
chown -R root:root .
find . -type f -exec chmod 644 {} \;
- cat add-to-xpdfrc >> $PKG/etc/xpdfrc
+ cat add-to-xpdfrc >> $PKG/etc/xpdfrc.new
mkdir -p $PKG/usr/share/xpdf/$(echo ${language} | cut -f2- -d -)
cp -a * $PKG/usr/share/xpdf/$(echo ${language} | cut -f2- -d -)
)
done
+find $PKG | xargs file | grep -e "executable" -e "shared object" \
+ | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+mkdir -p $PKG/usr/doc/xpdf-$VERSION
+cp -a \
+ ANNOUNCE CHANGES COPYING INSTALL README \
+ $PKG/usr/doc/xpdf-$VERSION
+chmod 0644 $PKG/usr/doc/xpdf-$VERSION/*
+
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r CHANGES ]; then
+ DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
+ cat CHANGES | head -n 1000 > $DOCSDIR/CHANGES
+ touch -r CHANGES $DOCSDIR/CHANGES
+fi
+
mkdir -p $PKG/install
-mv $PKG/etc/xpdfrc $PKG/etc/xpdfrc.new
-cat << EOF > $PKG/install/doinst.sh
-#!/bin/sh
-config() {
- NEW="\$1"
- OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
- # If there's no config file by that name, mv it over:
- if [ ! -r \$OLD ]; then
- mv \$NEW \$OLD
- elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then # toss the redundant copy
- rm \$NEW
- fi
- # Otherwise, we leave the .new copy for the admin to consider...
-}
-config etc/xpdfrc.new
-EOF
cat $CWD/slack-desc > $PKG/install/slack-desc
-
-# We'll use the versions of these from the poppler derived work (if they exist here):
-( cd $PKG/usr/bin
- rm -f pdfinfo pdftops pdftoppm pdftohtml pdftotext pdfimages pdffonts
- cd $PKG/usr/man/man1
- for file in pdfinfo pdftops pdftoppm pdftohtml pdftotext pdfimages pdffonts ; do
- rm -f ${file}.1.gz
- done
-)
+zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
# Build the package:
cd $PKG
diff --git a/source/xap/xpdf/xpdf.desktop b/source/xap/xpdf/xpdf.desktop
index b8f4c9b17..51d1a5a6d 100644
--- a/source/xap/xpdf/xpdf.desktop
+++ b/source/xap/xpdf/xpdf.desktop
@@ -1,5 +1,4 @@
[Desktop Entry]
-Encoding=UTF-8
Name=X PDF
Name[bn]=à¦à¦•à§à¦¸ পি-ডি-à¦à¦«
Name[de]=X-PDF
@@ -11,7 +10,7 @@ Name[ko]=Xìš© PDF
Name[mn]=X-PDF
Name[nds]=X-PDF
Name[te]=à°Žà°•à±à°¸à± పిడిఎఫà±
-MimeType=application/pdf
+MimeType=application/pdf;
GenericName=PDF Viewer
GenericName[af]=Pdf Aansig
GenericName[ar]=عارض الملÙات PDF
@@ -93,8 +92,7 @@ GenericName[zh_TW]=PDF 檢視程å¼
GenericName[zu]=Umbukisi we-PDF
Exec=xpdf
Icon=xpdfIcon
-Path=
Type=Application
Terminal=false
X-KDE-StartupNotify=false
-Categories=Graphics;PDFViewer;
+Categories=Graphics;
diff --git a/source/xap/xsane/xsane.SlackBuild b/source/xap/xsane/xsane.SlackBuild
index f8d730124..444700c51 100755
--- a/source/xap/xsane/xsane.SlackBuild
+++ b/source/xap/xsane/xsane.SlackBuild
@@ -22,8 +22,17 @@
VERSION=0.996
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
NUMJOBS=${NUMJOBS:-" -j7 "}
@@ -37,6 +46,8 @@ elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
+else
+ SLKCFLAGS="-O2"
fi
rm -rf $PKG
diff --git a/source/xap/xscreensaver/xscreensaver.SlackBuild b/source/xap/xscreensaver/xscreensaver.SlackBuild
index 4eb2fdfd4..6d01ced00 100755
--- a/source/xap/xscreensaver/xscreensaver.SlackBuild
+++ b/source/xap/xscreensaver/xscreensaver.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2008, 2009, 2010 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,11 +21,20 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-VERSION=5.08
-ARCH=${ARCH:-x86_64}
-NUMJOBS=${NUMJOBS:-" -j7 "}
-BUILD=${BUILD:-2}
+VERSION=${VERSION:-$(echo xscreensaver-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-1}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
+NUMJOBS=${NUMJOBS:-" -j7 "}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
@@ -36,6 +45,9 @@ elif [ "$ARCH" = "s390" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
CWD=$(pwd)
diff --git a/source/xap/xv/xv-3.10a-enhancements.20070520-20081216.diff b/source/xap/xv/xv-3.10a-enhancements.20070520-20081216.diff
new file mode 100644
index 000000000..c9b5528f5
--- /dev/null
+++ b/source/xap/xv/xv-3.10a-enhancements.20070520-20081216.diff
@@ -0,0 +1,293 @@
+ 20070621
+ fixed improper ClearCode termination condition in GIF decoder (JZ); fixed
+ some minor inconsistencies in Makefile (GRR)
+ - xv-joe-zbiciak-20070621-gif-decoder-bugfix.dif
+
+ 20080121
+ removed duplicate "XDestroyWindow(theDisp, pngW);" in xvmisc.c (IMC); fixed
+ empty-filename click-and-crash bug in xvdir.c (IMC, DB)
+ - xv-ian-collier-20080118-crash-fixes.msg
+ - xv-david-bath-20080901-empty-filename-save-crash-fix.dif
+
+ 20081205
+ reverted xvxwd.c to SJT's version (bug reported by Jari Ruusu)
+
+ 20081216
+ fixed crash-bug in IFF decoder (EP)
+ - xv-elmar-plischke-20081216-xviff-crash-fix.dif
+
+
+
+diff -ru ../test3.20070520.stock/xv-3.10a/xv.h ./xv.h
+--- ../test3.20070520.stock/xv-3.10a/xv.h 2007-05-20 22:23:33.000000000 -0700
++++ ./xv.h 2008-12-16 09:45:00.000000000 -0800
+@@ -16,8 +16,9 @@
+ /* GRR 2nd public jumbo F+E patches: 20050410 */
+ /* GRR 3rd public jumbo F+E patches: 20050501 */
+ /* GRR 4th public jumbo F+E patch: 20070520 */
+-#define REVDATE "version 3.10a-jumboFix+Enh of 20070520"
+-#define VERSTR "3.10a-20070520"
++/* GRR 5th public jumbo F+E patch: 200xxxxx (probably mid-2009) */
++#define REVDATE "version 3.10a-jumboFix+Enh of 20081216 (interim!)"
++#define VERSTR "3.10a-20081216"
+
+ /*
+ * uncomment the following, and modify for your site, but only if you've
+
+
+
+diff -ru ../test3.20070520.stock/xv-3.10a/xvdir.c ./xvdir.c
+--- ../test3.20070520.stock/xv-3.10a/xvdir.c 2007-05-20 22:23:33.000000000 -0700
++++ ./xvdir.c 2008-01-21 13:02:38.000000000 -0800
+@@ -539,8 +539,9 @@
+ return -1;
+ }
+
+- /* handle clicks inside the filename box */
+- if (x > 80 &&
++ /* handle clicks inside the filename box, but only when box is not empty */
++ if (enPos > stPos &&
++ x > 80 &&
+ y > dList.y + (int) dList.h + 30 &&
+ x < 80 + DNAMWIDE+6 &&
+ y < dList.y + (int) dList.h + 30 + LINEHIGH+5) {
+
+
+
+diff -ru ../test3.20070520.stock/xv-3.10a/xvgif.c ./xvgif.c
+--- ../test3.20070520.stock/xv-3.10a/xvgif.c 2007-05-20 22:23:33.000000000 -0700
++++ ./xvgif.c 2007-06-21 09:36:40.000000000 -0700
+@@ -700,7 +700,7 @@
+ * associated output code on the output queue.
+ */
+
+- while (CurCode > BitMask) {
++ while (CurCode >= ClearCode) { /* Joe Zbiciak fix, 20070621 */
+ if (OutCount > 4096) break; /* corrupt file */
+ OutCode[OutCount++] = Suffix[CurCode];
+ CurCode = Prefix[CurCode];
+
+
+
+diff -ru ../test3.20070520.stock/xv-3.10a/xvmisc.c ./xvmisc.c
+--- ../test3.20070520.stock/xv-3.10a/xvmisc.c 2007-05-20 22:23:33.000000000 -0700
++++ ./xvmisc.c 2008-01-21 12:57:29.000000000 -0800
+@@ -561,10 +561,6 @@
+ if (mgcsfxW) XDestroyWindow(theDisp, mgcsfxW);
+ #endif
+
+-#ifdef HAVE_PNG
+- if (pngW) XDestroyWindow(theDisp, pngW);
+-#endif
+-
+ /* if NOT using stdcmap for images, free stdcmap */
+ if (colorMapMode != CM_STDCMAP) {
+ int j;
+
+
+
+[This one reverts xvxwd.c to the pre-2007 SJT version, which actually worked...]
+
+diff -ru ../test3.20070520.stock/xv-3.10a/xvxwd.c ./xvxwd.c
+--- ../test3.20070520.stock/xv-3.10a/xvxwd.c 2007-05-20 22:23:33.000000000 -0700
++++ ./xvxwd.c 2008-12-06 00:30:44.000000000 -0800
+@@ -19,6 +19,12 @@
+ */
+
+ #include "xv.h"
++#include <limits.h> /* for CHAR_BIT */
++
++/* SJT: just in case ... */
++#ifndef CHAR_BIT
++# define CHAR_BIT 8
++#endif
+
+
+ /***************************** x11wd.h *****************************/
+@@ -83,9 +89,14 @@
+ static int writebiglong PARM((FILE *, CARD32));
+ #endif
+
++static void getcolorshift PARM((CARD32, int *, int *)); /* SJT */
++
++/* SJT: for 16bpp and 24bpp shifts */
++static int red_shift_right, red_justify_left,
++ grn_shift_right, grn_justify_left,
++ blu_shift_right, blu_justify_left;
+ static byte *pic8, *pic24;
+-static CARD32 red_mask, green_mask, blue_mask;
+-static int red_shift, green_shift, blue_shift;
++static CARD32 red_mask, grn_mask, blu_mask;
+ static int bits_per_item, bits_used, bit_shift,
+ bits_per_pixel, bits_per_rgb;
+ static char buf[4];
+@@ -189,38 +200,34 @@
+ return 0;
+ }
+
+- switch (bits_per_pixel) {
+- case 16:
+- case 24:
+- case 32:
+- ;
+- default:
+- xwdError("True/Direct supports only 16, 24, and 32 bits");
+- return 0;
+- }
++ for (row=0; row<rows; row++) {
++ for (col=0, xP=pic24+(row*cols*3); col<cols; col++) {
++ CARD32 ul;
+
+- if (byte_order == MSBFirst) {
+- for (row=0; row<rows; row++) {
+- for (col=0, xP=pic24+(row*cols*3); col<cols; col++) {
+- register CARD32 ul = getpixnum(ifp);
+-
+- *xP++ = ul >> red_shift & red_mask ;
+- *xP++ = ul >> green_shift & green_mask;
+- *xP++ = ul >> blue_shift & blue_mask ;
+- };
+- for (col=0; col<padright; col++) getpixnum(ifp);
+- }
+- } else {
+- for (row=0; row<rows; row++) {
+- for (col=0, xP=pic24+(row*cols*3); col<cols; col++) {
+- register CARD32 ul = getpixnum(ifp);
+-
+- *xP++ = ul >> blue_shift & blue_mask ;
+- *xP++ = ul >> green_shift & green_mask;
+- *xP++ = ul >> red_shift & red_mask ;
+- };
+- for (col=0; col<padright; col++) getpixnum(ifp);
++ ul = getpixnum(ifp);
++ switch (bits_per_pixel) {
++ case 16:
++ case 24:
++ case 32:
++ /* SJT: shift all the way to the right and then shift left. The
++ pairs of shifts could be combined. There will be two right and
++ one left shift, but it's unknown which will be which. It seems
++ easier to do the shifts (which might be 0) separately than to
++ have a complex set of tests. I believe this is independent of
++ byte order but I have no way to test.
++ */
++ *xP++ = ((ul & red_mask) >> red_shift_right) << red_justify_left;
++ *xP++ = ((ul & grn_mask) >> grn_shift_right) << grn_justify_left;
++ *xP++ = ((ul & blu_mask) >> blu_shift_right) << blu_justify_left;
++ break;
++
++ default:
++ xwdError("True/Direct supports only 16, 24, and 32 bits");
++ return 0;
++ }
+ }
++
++ for (col=0; col<padright; col++) getpixnum(ifp);
+ }
+
+ pinfo->type = PIC24;
+@@ -445,28 +452,18 @@
+ (i.e., 3 bytes, no alpha/padding) */
+
+
+- bits_used = bits_per_item;
++ bits_used = bits_per_item;
+
+ if (bits_per_pixel == sizeof(pixel_mask) * 8) pixel_mask = (CARD32) -1;
+ else pixel_mask = (1 << bits_per_pixel) - 1;
+
+- red_mask = h11P->red_mask;
+- green_mask = h11P->grn_mask;
+- blue_mask = h11P->blu_mask;
+-
+- red_shift = blue_shift = green_shift = 0;
+- while (!(red_mask & 1)) {
+- red_mask >>= 1;
+- ++red_shift;
+- }
+- while (!(blue_mask & 1)) {
+- blue_mask >>= 1;
+- ++blue_shift;
+- }
+- while (!(green_mask & 1)) {
+- green_mask >>= 1;
+- ++green_shift;
+- }
++ red_mask = h11P->red_mask;
++ grn_mask = h11P->grn_mask;
++ blu_mask = h11P->blu_mask;
++
++ getcolorshift(red_mask, &red_shift_right, &red_justify_left);
++ getcolorshift(grn_mask, &grn_shift_right, &grn_justify_left);
++ getcolorshift(blu_mask, &blu_shift_right, &blu_justify_left);
+
+ byteP = (char *) buf;
+ shortP = (CARD16 *) buf;
+@@ -476,6 +473,45 @@
+ }
+
+
++/* SJT: figure out the proper shifts */
++static void getcolorshift (CARD32 mask, int *rightshift, int *leftshift)
++{
++ int lshift, rshift;
++ unsigned int uu;
++
++ if (mask == 0)
++ {
++ *rightshift = *leftshift = 0;
++ return;
++ }
++
++ uu = mask;
++ lshift = rshift = 0;
++ while ((uu & 0xf) == 0)
++ {
++ rshift += 4;
++ uu >>= 4;
++ }
++ while ((uu & 1) == 0)
++ {
++ rshift++;
++ uu >>= 1;
++ }
++
++ while (uu != 0)
++ {
++ if (uu & 1)
++ {
++ lshift++;
++ uu >>= 1;
++ }
++ }
++ *rightshift = rshift;
++ *leftshift = CHAR_BIT * sizeof(pixel) - lshift;
++ return;
++}
++
++
+ /******************************/
+ static CARD32 getpixnum(file)
+ FILE* file;
+
+
+
+diff -ru ../test3.20070520.stock/xv-3.10a/xviff.c ./xviff.c
+--- ../test3.20070520.stock/xv-3.10a/xviff.c 2007-05-13 17:50:59.000000000 -0700
++++ ./xviff.c 2008-12-16 09:20:25.000000000 -0800
+@@ -73,6 +73,7 @@
+ int BMHDok, CMAPok, CAMGok;
+ int bmhd_width, bmhd_height, bmhd_bitplanes, bmhd_transcol;
+ int i, j, k, lineskip, colors, fmt;
++ int npixels = 0; /* needs to be initialized _outside_ while-loop */
+ byte bmhd_masking, bmhd_compression;
+ long chunkLen, camg_viewmode;
+ byte *databuf, *dataptr, *cmapptr, *picptr, *pic, *bodyptr;
+@@ -138,7 +139,6 @@
+ BODY chunk was found or dataptr ran over end of file */
+
+ while ((rv<0) && (dataptr < (databuf + filesize))) {
+- int npixels = 0;
+ chunkLen = (iff_getlong(dataptr + 4) + 1) & 0xfffffffe; /* make even */
+
+ if (strncmp((char *) dataptr, "BMHD", (size_t) 4)==0) { /* BMHD chunk? */
diff --git a/source/xap/xv/xv-3.10a-jumbo-README.txt b/source/xap/xv/xv-3.10a-jumbo-README.txt
index 63627ddff..00b1c3e4e 100644
--- a/source/xap/xv/xv-3.10a-jumbo-README.txt
+++ b/source/xap/xv/xv-3.10a-jumbo-README.txt
@@ -1,6 +1,6 @@
-These are the latest versions of the XV jumbo patches I originally created
-in February 2000 (but never distributed) and eventually updated and released
-in May 2004, prompted by a discussion on LWN (http://lwn.net/Articles/76391/).
+This is the latest version of the XV jumbo patches I originally created in
+February 2000 (but never distributed) and eventually updated and released in
+May 2004, prompted by a discussion on LWN (http://lwn.net/Articles/76391/).
Information about the patches, updates to the patches, and the patches
themselves can all be found here:
@@ -10,16 +10,14 @@ themselves can all be found here:
(Use the "Subscribe to new releases" link on the latter page if you want to
be notified of new versions automatically; trivial registration required.)
-These two patches incorporate all of the fix- and enhancement-patches
-available from John's XV site (http://www.trilon.com/xv/downloads.html
-and ftp://ftp.trilon.com/pub/xv/patches/), plus a number of my own fixes
-and additions, plus quite a few from other people--though not all of the
-ones I'd intended to, due to lack of time after dealing with the latest
-set of security issues (one of which I discovered, sigh). They're still
-not fully complete, and it's possible they never will be, but I do plan
-to continue tinkering with them whenever the mood strikes--and I may even
-release them publicly on rare occasions. (At the current rate, it looks
-like once a year may be the best we can hope for...we'll see.)
+These patches incorporate all of the fix- and enhancement-patches available
+from John's XV site (http://www.trilon.com/xv/downloads.html and
+ftp://ftp.trilon.com/pub/xv/patches/), plus a number of my own fixes and
+additions (security-related and otherwise), plus quite a few from other
+people. They're still not fully complete, and it's probable they never
+will be, but I do plan to continue tinkering with them whenever the mood
+strikes--and I may even release them publicly on rare occasions. (At the
+current rate, once every few years may be the best we can hope for....)
Also be aware that several other people have had the same idea over the
years. Ones I've found, more or less by accident, include:
@@ -45,43 +43,58 @@ years. Ones I've found, more or less by accident, include:
- Kyoichiro Suda <sudakyo fat.coara.or.jp>
http://www.coara.or.jp/~sudakyo/XV_jp.html
-I very much doubt that this is an exhaustive list. So far, most of the
-other patch-sets appear not to be as extensive or as up-to-date as my own,
-particularly now that the (very large) "Japanese extension" patches are
-incorporated--big thanks to Werner Fink of SuSE for that!
+This is not an exhaustive list (e.g., Jörgen Grahn also had one). So far,
+most of the other patch-sets appear not to be as extensive or as up-to-date
+as my own, particularly now that the (very large) "Japanese extension" patches
+are incorporated--big thanks to Werner Fink of SuSE for that!
Below I summarize the component patches that are encompassed by my jumbo
-bugfixes and jumbo enhancements patches. Unfortunately, some of my own
-additions never saw the light of day as standalone patches, but considering
-the number of overlaps (collisions) already implicit in this list, it would
-have been difficult to accomplish even if I'd had the time.
+bugfixes and jumbo enhancements patches, circa 2005. (As of 2007, they're
+distributed as a single monster-patch, and the "component patches" are now
+listed in the changelog section at the bottom of this file.) Unfortunately,
+some of my own additions never saw the light of day as standalone patches,
+but considering the number of overlaps (collisions) already implicit in the
+list, that would have been difficult to accomplish even if I'd had the time.
-Here's a quick guide to the "third-party" credits in the lists below:
+Here's a quick guide to the "third-party" credits in the lists and changelog
+below:
AAC = Andrey A. Chernov [ache]
(http://cvsweb.freebsd.org/ports/graphics/xv/files/patch-ab)
AD = Andreas Dilger (adilger clusterfs.com)
AL = Alexander Lehmann (lehmann usa.net)
+ AS = Alexey Spiridonov (http://www-math.mit.edu/~lesha/)
AT = Anthony Thyssen (http://www.cit.gu.edu.au/~anthony/)
+ BR = Bruno Rohee (http://bruno.rohee.com/)
DAC = David A. Clunie (http://www.dclunie.com/xv-pcd.html)
+ EAJ = Erling A. Jacobsen (linuxcub email.dk)
EK = Egmont Koblinger (egmont users.sourceforge.net)
- GRR = Greg Roelofs (http://pobox.com/~newt/)
+ FG = Fabian Greffrath (fabian debian-unofficial.org)
+ GRR = Greg Roelofs (http://pobox.com/~newt/greg_contact.html)
GV = Guido Vollbeding (http://sylvana.net/guido/)
IM = IKEMOTO Masahiro (ikeyan airlab.cs.ritsumei.ac.jp)
+ JC = John Cooper (john.cooper third-harmonic.com)
JCE = John C. Elliott (http://www.seasip.demon.co.uk/ZX/zxdload.html)
+ JDB = John D. Baker (http://mylinuxisp.com/~jdbaker/)
+ JG = Jörgen Grahn (jgrahn algonet.se)
JHB = John H. Bradley, of course (http://www.trilon.com/xv/)
JPD = Jean-Pierre Demailly (http://www-fourier.ujf-grenoble.fr/~demailly/)
JR = John Rochester (http://www.freebsd.org/cgi/query-pr.cgi?pr=2920)
(also http://cvsweb.freebsd.org/ports/graphics/xv/files/patch-af, -ag)
+ JRK = James Roberts Kirkpatrick (uwyo.edu)
JZ = Joe Zbiciak (http://spatula-city.org/~im14u2c/)
KS = Kyoichiro Suda (http://www.coara.or.jp/~sudakyo/XV_jp.html)
LCN = Landon Curt "chongo" Noll (http://www.isthe.com/chongo/)
LJ = Larry Jones (lawrence.jones ugs.com)
PBJ = Peter Jordan (http://www.ibiblio.org/pub/Linux/apps/graphics/viewers/X/)
PSV = Pawel S. Veselov (http://manticore.2y.net/wbmp.html)
+ RAC = Ross Combs (rocombs cs.nmsu.edu)
+ RJH = Robin Humble (http://www.cita.utoronto.ca/~rjh/)
SB = Sean Borman (http://www.nd.edu/~sborman/software/xvwheelmouse.html)
SJT = TenThumbs (tenthumbs cybernex.net)
+ SBM = Scott B. Marovich (formerly marovich hpl.hp.com)
TA = Tim Adye (http://hepwww.rl.ac.uk/Adye/xv-psnewstyle.html)
+ TAR = Tim Ramsey (tar pobox.com)
TI = Tetsuya INOUE (tin329 chino.it.okayama-u.ac.jp)
TO = Tavis Ormandy (taviso gentoo.org)
WF = Werner Fink (http://www.suse.de/~werner/)
@@ -90,86 +103,79 @@ Other credits are as listed on the XV Downloads page or in the respective
patches (e.g., the jp-extension patches or within the PNG patch).
Finally, please note that these patches have not been blessed by John Bradley
-in any way (although I copied him on the May 2004 announcement--no response
-at that time). Nor have I personally tested every change and feature! (See
-the BIG SCARY WARNING below for further caveats.) In other words, they're
-both completely unofficial and completely unguaranteed. But they seem to
-work for me. (And when they don't, I fix 'em. Eventually, anyway... ;-) )
+in any way (although I copied him on the May 2004 announcement and wrote to
+him again in May 2005), unless you count Debian's redistribution permission
+(Daniel Kirchheimer, 5 Dec 2005). Nor have I personally tested every change
+and feature! (See the BIG SCARY WARNING below for further caveats.) In other
+words, they're both completely unofficial and completely unguaranteed. But
+they seem to work for me. (And when they don't, I try to fix 'em--eventually,
+anyway... ;-) )
-One further "final" note: as of this release, I am no longer updating the
-fixes patch; new stuff (including fixes) now appears only in the enhancements
-one. It simply became too much of a timesink to maintain parallel trees--not
-to mention parallel makefiles (generic/public vs. local/personal, old vs.
-new libjpeg/libtiff) and xv.h (unregistered/public vs. registered/personal),
-particularly when some fixes came about while working on an enhancement and
-others were provided by third parties relative to the previous fix+enh state.
-Hence the mismatched "20050410" date on the fixes patch.
-
-GRR 20050501
+Greg Roelofs, 20070520
+http://pobox.com/~newt/greg_contact.html
How to build
------------
-The following assumes you, the user, already have the libtiff,[1]
-libjpeg,[2] libpng,[3] and zlib[4] libraries downloaded, patched (if
-necessary), compiled, and installed, not to mention a C compiler and
-the bzip2,[5] tar,[6] patch,[7] and make[8] utilities. You should also
-have downloaded the original XV 3.10a source distribution from the XV
-Downloads page[9] and be able to edit its Makefile and config.h files
-as indicated in the INSTALL file. Finally, you should know what a
-Unix(-style) command line is, where to find one, and how to wield it
-with abandon (or at least with adult supervision)--and preferably not
-as the root user until the make install step. (A filesystem is a
-terrible thing to waste.)
+The following assumes you, the user, already have the libtiff,[1] libjpeg,[2]
+libpng,[3] zlib,[4] and JasPer[5] libraries downloaded, patched (if necessary),
+compiled, and installed, not to mention a C compiler and the bzip2,[6] tar,[7]
+patch,[8] and make[9] utilities. You should also have downloaded the original
+XV 3.10a source distribution from the XV Downloads page[10] and be able to edit
+its Makefile and config.h files as indicated in the INSTALL file. (Editing
+the Makefile will also allow you to disable some of the third-party libraries
+if you wish.) Finally, you should know what a Unix(-style) command line is,
+where to find one, and how to wield it with abandon (or at least with adult
+supervision)--and preferably not as the root user until the "make install"
+step. (A filesystem is a terrible thing to waste.)
[1] http://www.remotesensing.org/libtiff/
[2] http://www.ijg.org/
[3] http://www.libpng.org/pub/png/libpng.html
[4] http://www.zlib.net/
- [5] http://sources.redhat.com/bzip2/
- [6] http://www.gnu.org/directory/devel/specific/tar.html
- [7] http://www.gnu.org/directory/devel/specific/patch.html
- [8] http://www.gnu.org/directory/devel/specific/make.html
- [9] http://www.trilon.com/xv/downloads.html#src-distrib
+ [5] http://www.ece.uvic.ca/~mdadams/jasper/
+ [6] http://sources.redhat.com/bzip2/
+ [7] http://www.gnu.org/directory/devel/specific/tar.html
+ [8] http://www.gnu.org/directory/devel/specific/patch.html
+ [9] http://www.gnu.org/directory/devel/specific/make.html
+ [10] http://www.trilon.com/xv/downloads.html#src-distrib
+-------------------------------------------------------------------------+
| |
| BIG SCARY WARNING |
| |
-| These patches work for Greg (and parts of them apparently work for |
+| These patches work for Greg (and parts of them reportedly work for |
| various other people), and so far Greg's CPU still computes and his |
-| hard disks haven't been wiped. But there's no guarantee that that |
+| hard disks haven't been wiped. But there's no guarantee that this |
| will be the case for you! In particular, not every incorporated patch |
| has been explicitly tested, nor has every possible subcase of the |
-| explicitly tested subset. (Read that again; it's grammatical.) Nor are |
-| these patches officially blessed by John Bradley in any way. In other |
-| words, if you use these patches, you do so at your own risk. (Greg |
-| doesn't believe there are any serious problems remaining, but then, |
-| what programmer ever does? Bugs happen.) |
+| explicitly tested subset. (Read that again; it's grammatical.) Nor |
+| are these patches officially blessed by John Bradley in any way. In |
+| other words, if you use these patches, you do so at your own risk. |
+| (Greg doesn't believe there are any serious problems remaining, but |
+| then, what programmer ever does? Bugs happen.) |
| |
+-------------------------------------------------------------------------+
Assuming you have the prerequisites out of the way and aren't scared
off by the Big Scary Warning, here's the build procedure:
- bzip2 -dc xv-3.10a-jumbo-patches-20050501.tar.bz2 | tar xvf -
- (or tar xvzf xv-3.10a-jumbo-patches-20050501.tar.gz)
+ tar xvzf xv-3.10a-jumbo-patches-20070520.tar.gz
+ (or: gzip -dc xv-3.10a-jumbo-patches-20070520.tar.gz | tar xvf - )
tar xvzf xv-3.10a.tar.gz
cd xv-3.10a
- patch -p1 < ../xv-3.10a-jumbo-fix-patch-20050410.txt
-
- [optional] patch -p1 < ../xv-3.10a-jumbo-enh-patch-20050501.txt
+ patch -p1 < ../xv-3.10a-jumbo-fix-enh-patch-20070520.txt
edit Makefile and config.h as directed in INSTALL file (in particular,
ensure paths to external libraries and header files are correct)
make
- ./xv your_favorite_image your_other_favorite_image etc.
+ ./xv your_favorite_image your_other_favorite_image etc.
If everything seems to be working to your satisfaction, go ahead and install:
@@ -179,12 +185,14 @@ If everything seems to be working to your satisfaction, go ahead and install:
become root if necessary (e.g., type su)
make install
+ (or: sudo make install)
That wasn't so hard, was it?
-Summary of incorporated and unincorporated patches
---------------------------------------------------
+Summary of incorporated and unincorporated patches (through 20050501)
+---------------------------------------------------------------------
+(See the ChangeLog at the bottom for more recent incorporated patches.)
fixes ((*) = listed on XV Downloads page, (f) = on ftp site only):
@@ -270,7 +278,7 @@ enhancements ((*) = listed on XV Downloads page, (<who>) = third-party):
20050501:
- xv-3.10a-bmpfix.patch (WF) [*SECURITY*]
- xv310a-jp-extension-rev5.3.3.tar.gz (TI, IM, ..., WF)
- (adds support for MAG, MAKI, Pi, PIC, and PIC2 formats[*]; "magic suffix"
+ (adds support for MAG, MAKI, Pi, PIC, and PIC2 formats[!]; "magic suffix"
detection/conversion; MacBinary prefixes; archives as virtual filesystems;
multilingual text viewer [though not Unicode]; etc.)
- xv-3.10a-yaos.dif (WF, TO) [*SECURITY*]
@@ -288,7 +296,7 @@ enhancements ((*) = listed on XV Downloads page, (<who>) = third-party):
- PATCH.stat (LJ)
- PATCH.thumbs (LJ)
- xv-startgrab-imake-hips.patch (JPD)
- ("hips" portion only; adds support for HIPS image format[*])
+ ("hips" portion only; adds support for HIPS image format[!])
- xv-3.10a-formatstr.patch (KS)
- xv-3.10a-shortsleep.patch (KS)
- xv-3.10a-locale-linux.patch (KS)
@@ -298,8 +306,7 @@ enhancements ((*) = listed on XV Downloads page, (<who>) = third-party):
- xv-3.10a-xvexecpath.patch (but disabled pending fixes) (KS)
- xv-3.10a-zeroquit.patch (KS, GRR)
-
-[*] Note that all six of these formats may still suffer from exploitable heap
+[!] Note that all six of these formats may still suffer from exploitable heap
overflows [*SECURITY*] when decoding images with large (possibly invalid)
dimensions; as a result, they are DISABLED by default. (Search for "GRR
POSSIBLE OVERFLOW / FIXME" comments in xvmag.c, xvmaki.c, xvpi.c, xvpic.c,
@@ -334,9 +341,11 @@ not (yet?) included:
- xv-3.10a+jp-extension-rev5.3.3+FLmask.v2.1+png+misc.patch ["mask" support]
- - xv-psnewstyle.patch (TA) [coming later in 2005?]
+ - xv-psnewstyle.patch (TA) [coming "soon"?]
- xv-3.10a.patch.linux (PBJ) [maybe use vdcomp.c changes?]
- xvxpm-anthony-thyssen.c (AT) ["slate grey" bug already gone?]
+ - xv-geoff-kuenning-iconsize-slideshow.patch [var. icons; full-screen slides]
+ - xv-scott-marovich-20070214-xvtiff.c.patch6.unified [TIFF CMYK support]
- stuff in xv/unsupt:
-rw-r--r-- 30527 Dec 22 1994 FITS.rite
@@ -360,9 +369,8 @@ not finished (and/or even started ;-) ):
- (better) fix for never-ending pile of SLOW popups when viewing TIFFs with
unknown tags (or truncated/corrupted images)
- fix for minor .Z inefficiency in xv.c ("FIXME")
- - fix for filename entry-field mouse/cursor bogosity
- (want at least positioning to work; preferably also select/cut/paste)
- - fix for spacebar-for-next-image getting stuck at first text file
+ - fix for filename entry-field mouse/cursor deficiencies
+ (positioning fixed 20070104 by Ross Combs; would like select/cut/paste, too)
- fix for .ppm.gz "disk leak" [can't reproduce...already fixed?]
(maybe occurs only if filesystem is already nearly full? bad .gz?)
@@ -440,3 +448,112 @@ ChangeLog
suffix" (xv_mgcsfx) config dir (enh); added PREFIX and DESTDIR support to
Makefile (enh); fixed handling of zero-length files and other text-viewer
failures (enh)
+
+ 20050528
+ conditionally added missing alloca.h to xvpcd.c (required if alloca() is
+ a macro and alloca.h not included in stdlib.h, for example); fixed bogus
+ __S_IWRITE introduced in 20050501 release; fixed Makefile "install" target
+ (mkdir, chmod); fixed bug in MUST macro in xvwbmp.c; fixed prototype
+ warnings in xvevent.c, xvpcd.c (JRK, GRR)
+ - xv-3.10a-jimkirk-fixes.patch
+
+ 20050630
+ fixed broken mkdir(.xvpics) introduced in 20050501 release (RJH, GRR);
+ tweaked GUNZIP config for OpenBSD (GRR)
+ - xv-3.10a-xvpics-mkdir-fix.patch
+
+ 20051014
+ fixed longstanding xvevent.c typo (wasJpegUp -> wasPngUp) that caused build
+ failure if no JPEG support (TAR)
+
+ 20051019
+ fixed Darwin (Mac OS X) build error in xv.h and vdcomp.c due to lack of
+ malloc.h (JDB)
+
+ 20070210
+ fixed minor grammos (GRR); promoted PNG to first position, demoted GIF to
+ third (GRR); changed internal type of default image to PNG (GRR); increased
+ max files again, to 65536 (GRR)
+
+ 20070310
+ incorporated JPEG-2000 patch (SBM, GRR); added manual fax options for
+ unrecognized G3 images (SBM); relaxed 30-byte minimum file size (SBM)
+ - http://www.ece.uvic.ca/~mdadams/jasper/software/xv-patches
+
+ 20070318
+ incorporated 16bps raw (binary) PPM patch (define ASSUME_RAW_PPM_LSB_FIRST
+ for old behavior) (RAC, GRR); updated format list, web sites in xv man page
+ (GRR); fixed Makefile "install" target to create any necessary directories
+ (RAC, GRR); fixed GIF decoder bug (sizes of global, local color tables
+ different) (GRR)
+ - xv-ross-combs-ppm-16bps-rawbits.patch
+
+ 20070325
+ fixed invalid gamma assumption in PNG decoder (=> progressive color changes
+ over load/save cycles) (GRR)
+
+ 20070328
+ fixed animated-GIF /tmp/xvpgXXXXXX droppings (GRR)
+
+ 20070331
+ fixed PNG duplicate-palette-entries bug (GRR)
+
+ 20070415
+ incorporated EXIF-preserve patch (GHK); added missing JP2/JPC VS bits code
+ (GRR); added extended-warning options to CCOPTS (RAC); added "const" to
+ huge number of function args (RAC, GRR); made more effectively static
+ functions officially static (RAC); added mouse-clickability (but not
+ selectability) to text-entry fields (RAC); fixed window positioning (race
+ conditions?) under some virtual window managers (e.g., tvtwm) (RAC);
+ removed explicit paths for external (de)compressors (GRR, RAC)
+ - xv-geoff-kuenning-jpeg-exif-preserve.patch
+ - xv-ross-combs-20070104.diff
+
+ 20070422
+ incorporated function-key-scripts patch (see contrib/fnkey-scripts) (AS);
+ fixed man-page-section extensions ("1", not "l" or "1X") (FG); switched to
+ more sensible install paths for docs (FG); added Fedora Core build script
+ (see contrib/fedora) (JC); fixed VS to switch from move-mode to copy-mode
+ if source dir is read-only (EAJ); extended VS incremental-search mode (EAJ)
+ - xv-alexey-spiridonov-20070116-fnkey-scripts.tar.bz2
+ - xv-fabian-greffrath-20070215-debian-04-manpages.dpatch
+ - xv-fabian-greffrath-20070215-debian-03-makefiles.dpatch
+ - xv-john-cooper-Build-FC5-script.sh
+ - xv-erling-jacobsen-20060617-incr-search.patch
+
+ 20070428
+ modified install to include README.jumbo in docs (GRR); incorporated PNG
+ no-stdio patch (SBM); fixed XWD endianness support, improved performance
+ (replaces SJT 16/24-bit fix) (SBM)
+ - xv-scott-marovich-20070214-xvpng.diff
+ - xv-scott-marovich-20070214-xvxwd.c.patch
+
+ 20070506
+ added JPEG CMYK support (SBM); fixed TIFF (and others?) /tmp/xvpgXXXXXX
+ droppings (GRR); added VS clipboard support (JG)
+ - xv-scott-marovich-20070214-xvjpeg.c.patch
+ - xv-jurgen-grahn-20051127-schnauzer-clip.patch
+
+ 20070512
+ inverted handling of malloc.h header file to require NEED_MALLOC_H macro
+ for those few systems that actually need it (GRR)
+
+ 20070513
+ fixed GCC 4.1.x warnings (GRR); next round of const cleanup (GRR); fixed
+ minor TIFF memleak (GRR)
+
+ 20070514
+ fixed TIFF YCbCr reference black/white levels (SBM); added option to use
+ libjpeg YCbCr-to-RGB conversion for TIFF images (SBM, GRR)
+ - xv-scott-marovich-20070214-xvtiff.c.patch2.unified
+ - xv-scott-marovich-20070214-xvtiff.c.patch3.unified
+
+ 20070519
+ fixed handling of multi-page JPEG-compressed TIFFs (old or new) (SBM);
+ added TIFF YCbCr separated-color-plane support (may require libtiff
+ patch(es) to tif_ojpeg.c and/or tif_jpeg.c) (SBM)
+ - xv-scott-marovich-20070214-xvtiff.c.patch4.unified
+ - xv-scott-marovich-20070214-xvtiff.c.patch5.unified
+
+ 20070520
+ updated README.jumbo
diff --git a/source/xap/xv/xv-3.10a-jumbo-enh-patch-20050501.txt b/source/xap/xv/xv-3.10a-jumbo-additions.diff
index d78b601a9..8f398ddf2 100644
--- a/source/xap/xv/xv-3.10a-jumbo-enh-patch-20050501.txt
+++ b/source/xap/xv/xv-3.10a-jumbo-additions.diff
@@ -1,832 +1,288 @@
-diff : xv-3.10a-jumbo-enh-patch-20050501.txt
-
-This is a unified diff. It should be applied (using Larry Wall's "patch"
-program) to the XV 3.10a sources AFTER the jumbo-fixes patch has already
-been applied.
-
-diffs below:
- Imakefile
- Makefile
- Makefile.std
- README.jumbo
- README.pcd
- bggen.c
- bits/br_bzip2
- bits/br_mag
- bits/br_maki
- bits/br_mgcsfx
- bits/br_pcd
- bits/br_pi
- bits/br_pic
- bits/br_pic2
- bits/br_png
- bits/br_zx
- config.h
- tiff/Makefile
- vdcomp.c
- xcmap.c
- xv.c
- xv.h
- xv_mgcsfx.sample
- xvbmp.c
- xvbrowse.c
- xvctrl.c
- xvdial.c
- xvdir.c
- xvevent.c
- xvfits.c
- xvgam.c
- xvgif.c
- xvgrab.c
- xvhips.c
- xvhips.h
- xvimage.c
- xvinfo.c
- xvjpeg.c
- xvmag.c
- xvmaki.c
- xvmgcsfx.c
- xvmisc.c
- xvml.c
- xvml.h
- xvpbm.c
- xvpcd.c
- xvpds.c
- xvpi.c
- xvpic.c
- xvpic2.c
- xvpng.c
- xvpopup.c
- xvps.c
- xvrle.c
- xvroot.c
- xvsmooth.c
- xvtext.c
- xvtiff.c
- xvtiffwr.c
- xvvd.c
- xvwbmp.c
- xvxpm.c
- xvzx.c
-
-
-diff -ruN xv-3.10a-bugfixes/Imakefile xv-3.10a-enhancements/Imakefile
---- xv-3.10a-bugfixes/Imakefile 1995-01-13 12:24:01.000000000 -0800
-+++ xv-3.10a-enhancements/Imakefile 2005-04-17 14:04:22.000000000 -0700
-@@ -104,6 +104,11 @@
- SGI = -Dsgi
- #endif
-
-+/* install directory of xv_mgcsfx.sample. */
-+MGCSFXDIR = $(LIBDIR)
-+/* Directory of default configuration file. */
-+MGCSFX = -DMGCSFXDIR=\"$(MGCSFXDIR)\"
-+
-
-
-
-@@ -137,6 +142,8 @@
- #if defined(SCOArchitecture)
- SCO= -Dsco -DPOSIX -DNO_RANDOM
- SYS_LIBRARIES= -lm -lc -lx
-+#elif defined(HPArchitecture)
-+SYS_LIBRARIES= -lm -lV3
- #else
- SYS_LIBRARIES= -lm
- #endif
-@@ -147,7 +154,7 @@
-
- DEFINES= $(SCO) $(UNIX) $(NODIRENT) $(VPRINTF) $(TIMERS) \
- $(HPUX7) $(JPEG) $(TIFF) $(PDS) $(DXWM) $(RAND) \
-- $(BACKING_STORE) $(BSDTYPES) $(SGI)
-+ $(BACKING_STORE) $(BSDTYPES) $(SGI) $(MGCSFX)
-
- INCLUDES = $(JPEGINCLUDE) $(TIFFINCLUDE)
-
-@@ -157,7 +164,9 @@
- xvdial.c xvgraf.c xvsunras.c xvjpeg.c xvps.c xvpopup.c xvdflt.c \
- xvtiff.c xvtiffwr.c xvpds.c xvrle.c xviris.c xvgrab.c vprintf.c \
- xvbrowse.c xvtext.c xvpcx.c xviff.c xvtarga.c xvxpm.c xvcut.c \
-- xvxwd.c xvfits.c
-+ xvxwd.c xvfits.c xvpng.c xvzx.c xvwbmp.c xvpcd.c \
-+ xvmag.c xvpic.c xvmaki.c xvpi.c xvpic2.c xvvd.c xvmgcsfx.c \
-+ xvml.c
-
- OBJS1 = xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
- xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
-@@ -165,7 +174,9 @@
- xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
- xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
- xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
-- xvxwd.o xvfits.o
-+ xvxwd.o xvfits.o xvpng.o xvzx.o xvwbmp.o xvpcd.o \
-+ xvmag.o xvpic.o xvmaki.o xvpi.o xvpic2.o xvvd.o xvmgcsfx.o \
-+ xvml.o
-
- SRCS2= bggen.c
- OBJS2= bggen.o
-@@ -266,6 +277,8 @@
- InstallManPageLong(docs/xvp2p,$(MANDIR),xvpictoppm)
- InstallManPageLong(docs/vdcomp,$(MANDIR),vdcomp)
-
-+InstallNonExecFile(xv_mgcsfx.sample,$(MGCSFXDIR))
-+
- tar:
- tar cf xv.tar Makefile* Imakefile *.c *.h bits docs \
- docs unsupt vms $(JPEGDIR) $(TIFFDIR) $(MISC)
-diff -ruN xv-3.10a-bugfixes/Makefile xv-3.10a-enhancements/Makefile
---- xv-3.10a-bugfixes/Makefile 2005-04-06 08:17:13.000000000 -0700
-+++ xv-3.10a-enhancements/Makefile 2005-05-01 10:23:32.000000000 -0700
-@@ -41,10 +41,14 @@
-
-
- ### Installation locations
--BINDIR = /usr/local/bin
--MANDIR = /usr/local/man/man1
-+PREFIX = /usr/local
-+BINDIR = $(PREFIX)/bin
-+MANDIR = $(PREFIX)/man/man1
- MANSUF = 1
--LIBDIR = /usr/local/lib
-+DOCDIR = $(PREFIX)/doc/xv-3.10a
-+LIBDIR = $(PREFIX)/lib/xv
-+SYSCONFDIR = $(PREFIX)/etc
-+DESTDIR =
-
-
- buildit: all
-@@ -59,13 +63,59 @@
- ### on your machine, *COMMENT OUT* the following lines
- ###
- JPEG = -DDOJPEG
--JPEGDIR = jpeg
--JPEGINC = -I$(JPEGDIR)
--JPEGLIB = $(JPEGDIR)/libjpeg.a
--$(JPEGDIR)/jconfig.h:
-- cd $(JPEGDIR) ; ./configure CC='$(CC)'
--$(JPEGLIB): $(JPEGDIR)/jconfig.h
-- cd $(JPEGDIR) ; make
-+#JPEGDIR = jpeg
-+JPEGDIR = /usr
-+#JPEGDIR = /usr/local
-+#JPEGDIR = ../../libjpeg
-+###
-+JPEGINC = -I$(JPEGDIR)/include
-+#JPEGINC = -I$(JPEGDIR)
-+###
-+JPEGLIB = -L$(JPEGDIR)/lib -ljpeg
-+#JPEGLIB = -L$(JPEGDIR) -ljpeg
-+#JPEGLIB = $(JPEGDIR)/libjpeg.a
-+###
-+### this is intended to build the ancient version (5a) that's included in the
-+### "jpeg" subdir of XV, not an arbitrary copy of libjpeg:
-+###
-+#$(JPEGDIR)/jconfig.h:
-+# cd $(JPEGDIR) ; ./configure CC='$(CC)'
-+#$(JPEGLIB): $(JPEGDIR)/jconfig.h
-+# cd $(JPEGDIR) ; make
-+
-+
-+###
-+### if, for whatever reason, you're unable to get the PNG library to compile
-+### on your machine, *COMMENT OUT* the following lines
-+###
-+PNG = -DDOPNG
-+PNGDIR = /usr
-+#PNGDIR = /usr/local
-+#PNGDIR = ../../libpng
-+###
-+PNGINC = -I$(PNGDIR)/include
-+#PNGINC = -I$(PNGDIR)
-+###
-+PNGLIB = -L$(PNGDIR)/lib -lpng
-+#PNGLIB = -L$(PNGDIR) -lpng
-+#PNGLIB = $(PNGDIR)/libpng.a
-+
-+
-+###
-+### if, for whatever reason, you're unable to get both the PNG library and
-+### (newer versions of) the TIFF library to compile on your machine, *COMMENT
-+### OUT* the following lines
-+###
-+ZLIBDIR = /usr
-+#ZLIBDIR = /usr/local
-+#ZLIBDIR = ../../zlib
-+###
-+ZLIBINC = -I$(ZLIBDIR)/include
-+#ZLIBINC = -I$(ZLIBDIR)
-+###
-+ZLIBLIB = -L$(ZLIBDIR)/lib -lz
-+#ZLIBLIB = -L$(ZLIBDIR) -lz
-+#ZLIBLIB = $(ZLIBDIR)/libz.a
-
-
- ###
-@@ -80,17 +130,32 @@
- ###
- #TIFF = -DDOTIFF
- TIFF = -DDOTIFF -DUSE_TILED_TIFF_BOTLEFT_FIX
--TIFFDIR = tiff
--TIFFINC = -I$(TIFFDIR)
--TIFFLIB = $(TIFFDIR)/libtiff.a
--$(TIFFLIB):
-- ( cd $(TIFFDIR) ; make CC='$(CC)' COPTS='$(CCOPTS) $(MCHN)' )
-+#TIFFDIR = tiff
-+TIFFDIR = /usr
-+#TIFFDIR = /usr/local
-+#TIFFDIR = ../../libtiff
-+###
-+TIFFINC = -I$(TIFFDIR)/include
-+#TIFFINC = -I$(TIFFDIR)
-+###
-+### libtiff 3.5 and up may be compiled with zlib and libjpeg, but dependency
-+### is properly handled in LIBS line ~143 lines below
-+###
-+TIFFLIB = -L$(TIFFDIR)/lib -ltiff
-+#TIFFLIB = -L$(TIFFDIR) -ltiff
-+#TIFFLIB = $(TIFFDIR)/libtiff.a
-+###
-+### this is intended to build the ancient version (3.3.016 beta) that's included
-+### in the "tiff" subdir of XV, not an arbitrary copy of libtiff:
-+###
-+#$(TIFFLIB):
-+# ( cd $(TIFFDIR) ; make CC='$(CC)' COPTS='$(CCOPTS) $(MCHN)' )
-
-
- ###
- ### if, for whatever reason, you're unable to get the PDS/VICAR support
- ### to compile (xvpds.c, and vdcomp.c), *COMMENT OUT* the following line,
--### and also remove 'vdcomp' from the 'all:' dependancy
-+### and also remove 'vdcomp' from the 'all:' dependency
- ###
- PDS = -DDOPDS
-
-@@ -98,8 +163,10 @@
- #----------System V----------
-
- # if you are running on a SysV-based machine, such as HP, Silicon Graphics,
--# Solaris, etc., uncomment the following line to get mostly there.
--#UNIX = -DSVR4
-+# Solaris, etc.; uncomment one of the following lines to get you *most* of
-+# the way there. SYSV means System V R3.
-+# UNIX = -DSVR4
-+# UNIX = -DSYSV
-
-
- #----------Machine-Specific Configurations----------
-@@ -121,12 +188,15 @@
- # To use old HP compilers (HPUX 7.0 or so), you may need
- #MCHN= -Dhpux -D_HPUX_SOURCE +Ns4000
- #
--# also, if you're using HP's compiler, add '-Aa' to whichever of those
-+# Also, if you're using HP's compiler, add '-Aa' to whichever of those
- # two lines you're using, to turn on ANSI C mode. Or so I'm told.
- #
--# note: You may need to add '-I/usr/include/X11R5' (or R6, or whatever)
-+# Note: You may need to add '-I/usr/include/X11R5' (or R6, or whatever)
- # to whichever of those lines you used, as HP tends to store their X11
- # include files in a non-standard place...
-+#
-+# And you probably have to add '-lV3' to the end of the LIBS def when
-+# using XV's AUTO_EXPAND option.
-
-
- ### for LINUX, uncomment the following line
-@@ -205,6 +275,16 @@
- #VPRINTF = -DNEED_VPRINTF -DLONGINT -DNOSTDHDRS
-
-
-+# if your X Window System compiled with -DX_LOCALE,
-+# uncomment the following line:
-+# TVL10N = -DX_LOCALE
-+
-+# Install directory of xv_mgcsfx.sample.
-+MGCSFXDIR = $(LIBDIR)
-+# Directory of default configuration file.
-+MGCSFX = -DMGCSFXDIR=\"$(MGCSFXDIR)\"
-+
-+
-
-
- ################ END OF CONFIGURATION OPTIONS #################
-@@ -212,13 +292,14 @@
-
-
-
--CFLAGS = $(CCOPTS) $(JPEG) $(JPEGINC) $(TIFF) $(TIFFINC) $(PDS) \
-- $(NODIRENT) $(VPRINTF) $(TIMERS) $(UNIX) $(BSDTYPES) $(RAND) \
-- $(DXWM) $(MCHN)
-+CFLAGS = $(CCOPTS) $(PNG) $(PNGINC) $(ZLIBINC) $(JPEG) $(JPEGINC) \
-+ $(TIFF) $(TIFFINC) $(PDS) $(NODIRENT) $(VPRINTF) $(TIMERS) \
-+ $(UNIX) $(BSDTYPES) $(RAND) $(DXWM) $(MCHN) $(TVL10N) $(MGCSFX) \
-+ -DSYSCONFDIR=\"$(SYSCONFDIR)\" -DXVEXECPATH=\"$(LIBDIR)\"
-
- ### remove -lm for BeOS:
--LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) -lm
--#LIBS = -lX11 $(JPEGLIB) $(TIFFLIB)
-+LIBS = $(TIFFLIB) $(JPEGLIB) $(PNGLIB) $(ZLIBLIB) -L/usr/X11R6/lib -lX11 -lm
-+#LIBS = $(TIFFLIB) $(JPEGLIB) $(PNGLIB) $(ZLIBLIB) -lX11
-
- OBJS = xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
- xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
-@@ -226,7 +307,9 @@
- xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
- xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
- xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
-- xvxwd.o xvfits.o
-+ xvxwd.o xvfits.o xvpng.o xvzx.o xvwbmp.o xvpcd.o xvhips.o \
-+ xvmag.o xvpic.o xvmaki.o xvpi.o xvpic2.o xvvd.o xvmgcsfx.o \
-+ xvml.o
-
- MISC = README INSTALL CHANGELOG IDEAS
-
-@@ -236,10 +319,12 @@
-
-
-
--all: $(JPEGLIB) $(TIFFLIB) xv bggen vdcomp xcmap xvpictoppm
-+#all: $(JPEGLIB) $(TIFFLIB) xv bggen vdcomp xcmap xvpictoppm
-+all: xv bggen vdcomp xcmap xvpictoppm
-
-
--xv: $(OBJS) $(JPEGLIB) $(TIFFLIB)
-+#xv: $(OBJS) $(JPEGLIB) $(TIFFLIB)
-+xv: $(OBJS)
- $(CC) -o xv $(CFLAGS) $(OBJS) $(LIBS)
-
- bggen: bggen.c
-@@ -268,13 +353,14 @@
-
-
- install: all
-- cp xv bggen vdcomp xcmap xvpictoppm $(BINDIR)
-- cp docs/xv.man $(MANDIR)/xv.$(MANSUF)
-- cp docs/bggen.man $(MANDIR)/bggen.$(MANSUF)
-- cp docs/xcmap.man $(MANDIR)/xcmap.$(MANSUF)
-- cp docs/xvp2p.man $(MANDIR)/xvpictoppm.$(MANSUF)
-- cp docs/vdcomp.man $(MANDIR)/vdcomp.$(MANSUF)
-- cp docs/xvdocs.ps* $(LIBDIR)
-+ cp xv bggen vdcomp xcmap xvpictoppm $(DESTDIR)$(BINDIR)
-+ cp docs/xv.man $(DESTDIR)$(MANDIR)/xv.$(MANSUF)
-+ cp docs/bggen.man $(DESTDIR)$(MANDIR)/bggen.$(MANSUF)
-+ cp docs/xcmap.man $(DESTDIR)$(MANDIR)/xcmap.$(MANSUF)
-+ cp docs/xvp2p.man $(DESTDIR)$(MANDIR)/xvpictoppm.$(MANSUF)
-+ cp docs/vdcomp.man $(DESTDIR)$(MANDIR)/vdcomp.$(MANSUF)
-+ cp docs/xvdocs.ps* $(DESTDIR)$(LIBDIR) # or $(DESTDIR)$(DOCDIR)
-+ #cp xv_mgcsfx.sample $(DESTDIR)$(SYSCONFDIR)/xv_mgcsfx
-
- tar:
- # tar only local jpeg and tiff dirs, not user's or system's copies:
-@@ -299,7 +385,7 @@
- xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds
- xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm
- xvbrowse.o: bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm
--xvbrowse.o: bits/br_xwd
-+xvbrowse.o: bits/br_xwd bits/br_png bits/br_zx bits/br_pcd bits/br_bzip2
-
- xvbutt.o: bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top
- xvbutt.o: bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body
-diff -ruN xv-3.10a-bugfixes/Makefile.std xv-3.10a-enhancements/Makefile.std
---- xv-3.10a-bugfixes/Makefile.std 2005-04-06 08:17:13.000000000 -0700
-+++ xv-3.10a-enhancements/Makefile.std 2005-05-01 10:23:32.000000000 -0700
-@@ -41,10 +41,14 @@
-
-
- ### Installation locations
--BINDIR = /usr/local/bin
--MANDIR = /usr/local/man/man1
-+PREFIX = /usr/local
-+BINDIR = $(PREFIX)/bin
-+MANDIR = $(PREFIX)/man/man1
- MANSUF = 1
--LIBDIR = /usr/local/lib
-+DOCDIR = $(PREFIX)/doc/xv-3.10a
-+LIBDIR = $(PREFIX)/lib/xv
-+SYSCONFDIR = $(PREFIX)/etc
-+DESTDIR =
-
-
- buildit: all
-@@ -59,13 +63,59 @@
- ### on your machine, *COMMENT OUT* the following lines
- ###
- JPEG = -DDOJPEG
--JPEGDIR = jpeg
--JPEGINC = -I$(JPEGDIR)
--JPEGLIB = $(JPEGDIR)/libjpeg.a
--$(JPEGDIR)/jconfig.h:
-- cd $(JPEGDIR) ; ./configure CC='$(CC)'
--$(JPEGLIB): $(JPEGDIR)/jconfig.h
-- cd $(JPEGDIR) ; make
-+#JPEGDIR = jpeg
-+JPEGDIR = /usr
-+#JPEGDIR = /usr/local
-+#JPEGDIR = ../../libjpeg
-+###
-+JPEGINC = -I$(JPEGDIR)/include
-+#JPEGINC = -I$(JPEGDIR)
-+###
-+JPEGLIB = -L$(JPEGDIR)/lib -ljpeg
-+#JPEGLIB = -L$(JPEGDIR) -ljpeg
-+#JPEGLIB = $(JPEGDIR)/libjpeg.a
-+###
-+### this is intended to build the ancient version (5a) that's included in the
-+### "jpeg" subdir of XV, not an arbitrary copy of libjpeg:
-+###
-+#$(JPEGDIR)/jconfig.h:
-+# cd $(JPEGDIR) ; ./configure CC='$(CC)'
-+#$(JPEGLIB): $(JPEGDIR)/jconfig.h
-+# cd $(JPEGDIR) ; make
-+
-+
-+###
-+### if, for whatever reason, you're unable to get the PNG library to compile
-+### on your machine, *COMMENT OUT* the following lines
-+###
-+PNG = -DDOPNG
-+PNGDIR = /usr
-+#PNGDIR = /usr/local
-+#PNGDIR = ../../libpng
-+###
-+PNGINC = -I$(PNGDIR)/include
-+#PNGINC = -I$(PNGDIR)
-+###
-+PNGLIB = -L$(PNGDIR)/lib -lpng
-+#PNGLIB = -L$(PNGDIR) -lpng
-+#PNGLIB = $(PNGDIR)/libpng.a
-+
-+
-+###
-+### if, for whatever reason, you're unable to get both the PNG library and
-+### (newer versions of) the TIFF library to compile on your machine, *COMMENT
-+### OUT* the following lines
-+###
-+ZLIBDIR = /usr
-+#ZLIBDIR = /usr/local
-+#ZLIBDIR = ../../zlib
-+###
-+ZLIBINC = -I$(ZLIBDIR)/include
-+#ZLIBINC = -I$(ZLIBDIR)
-+###
-+ZLIBLIB = -L$(ZLIBDIR)/lib -lz
-+#ZLIBLIB = -L$(ZLIBDIR) -lz
-+#ZLIBLIB = $(ZLIBDIR)/libz.a
-
-
- ###
-@@ -80,17 +130,32 @@
- ###
- #TIFF = -DDOTIFF
- TIFF = -DDOTIFF -DUSE_TILED_TIFF_BOTLEFT_FIX
--TIFFDIR = tiff
--TIFFINC = -I$(TIFFDIR)
--TIFFLIB = $(TIFFDIR)/libtiff.a
--$(TIFFLIB):
-- ( cd $(TIFFDIR) ; make CC='$(CC)' COPTS='$(CCOPTS) $(MCHN)' )
-+#TIFFDIR = tiff
-+TIFFDIR = /usr
-+#TIFFDIR = /usr/local
-+#TIFFDIR = ../../libtiff
-+###
-+TIFFINC = -I$(TIFFDIR)/include
-+#TIFFINC = -I$(TIFFDIR)
-+###
-+### libtiff 3.5 and up may be compiled with zlib and libjpeg, but dependency
-+### is properly handled in LIBS line ~143 lines below
-+###
-+TIFFLIB = -L$(TIFFDIR)/lib -ltiff
-+#TIFFLIB = -L$(TIFFDIR) -ltiff
-+#TIFFLIB = $(TIFFDIR)/libtiff.a
-+###
-+### this is intended to build the ancient version (3.3.016 beta) that's included
-+### in the "tiff" subdir of XV, not an arbitrary copy of libtiff:
-+###
-+#$(TIFFLIB):
-+# ( cd $(TIFFDIR) ; make CC='$(CC)' COPTS='$(CCOPTS) $(MCHN)' )
-
-
- ###
- ### if, for whatever reason, you're unable to get the PDS/VICAR support
- ### to compile (xvpds.c, and vdcomp.c), *COMMENT OUT* the following line,
--### and also remove 'vdcomp' from the 'all:' dependancy
-+### and also remove 'vdcomp' from the 'all:' dependency
- ###
- PDS = -DDOPDS
-
-@@ -98,8 +163,10 @@
- #----------System V----------
-
- # if you are running on a SysV-based machine, such as HP, Silicon Graphics,
--# Solaris, etc., uncomment the following line to get mostly there.
--#UNIX = -DSVR4
-+# Solaris, etc.; uncomment one of the following lines to get you *most* of
-+# the way there. SYSV means System V R3.
-+# UNIX = -DSVR4
-+# UNIX = -DSYSV
-
-
- #----------Machine-Specific Configurations----------
-@@ -121,12 +188,15 @@
- # To use old HP compilers (HPUX 7.0 or so), you may need
- #MCHN= -Dhpux -D_HPUX_SOURCE +Ns4000
- #
--# also, if you're using HP's compiler, add '-Aa' to whichever of those
-+# Also, if you're using HP's compiler, add '-Aa' to whichever of those
- # two lines you're using, to turn on ANSI C mode. Or so I'm told.
- #
--# note: You may need to add '-I/usr/include/X11R5' (or R6, or whatever)
-+# Note: You may need to add '-I/usr/include/X11R5' (or R6, or whatever)
- # to whichever of those lines you used, as HP tends to store their X11
- # include files in a non-standard place...
-+#
-+# And you probably have to add '-lV3' to the end of the LIBS def when
-+# using XV's AUTO_EXPAND option.
-
-
- ### for LINUX, uncomment the following line
-@@ -205,6 +275,16 @@
- #VPRINTF = -DNEED_VPRINTF -DLONGINT -DNOSTDHDRS
-
-
-+# if your X Window System compiled with -DX_LOCALE,
-+# uncomment the following line:
-+# TVL10N = -DX_LOCALE
-+
-+# Install directory of xv_mgcsfx.sample.
-+MGCSFXDIR = $(LIBDIR)
-+# Directory of default configuration file.
-+MGCSFX = -DMGCSFXDIR=\"$(MGCSFXDIR)\"
-+
-+
-
-
- ################ END OF CONFIGURATION OPTIONS #################
-@@ -212,13 +292,14 @@
-
-
-
--CFLAGS = $(CCOPTS) $(JPEG) $(JPEGINC) $(TIFF) $(TIFFINC) $(PDS) \
-- $(NODIRENT) $(VPRINTF) $(TIMERS) $(UNIX) $(BSDTYPES) $(RAND) \
-- $(DXWM) $(MCHN)
-+CFLAGS = $(CCOPTS) $(PNG) $(PNGINC) $(ZLIBINC) $(JPEG) $(JPEGINC) \
-+ $(TIFF) $(TIFFINC) $(PDS) $(NODIRENT) $(VPRINTF) $(TIMERS) \
-+ $(UNIX) $(BSDTYPES) $(RAND) $(DXWM) $(MCHN) $(TVL10N) $(MGCSFX) \
-+ -DSYSCONFDIR=\"$(SYSCONFDIR)\" -DXVEXECPATH=\"$(LIBDIR)\"
-
- ### remove -lm for BeOS:
--LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) -lm
--#LIBS = -lX11 $(JPEGLIB) $(TIFFLIB)
-+LIBS = $(TIFFLIB) $(JPEGLIB) $(PNGLIB) $(ZLIBLIB) -L/usr/X11R6/lib -lX11 -lm
-+#LIBS = $(TIFFLIB) $(JPEGLIB) $(PNGLIB) $(ZLIBLIB) -lX11
-
- OBJS = xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
- xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
-@@ -226,7 +307,9 @@
- xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
- xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
- xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
-- xvxwd.o xvfits.o
-+ xvxwd.o xvfits.o xvpng.o xvzx.o xvwbmp.o xvpcd.o xvhips.o \
-+ xvmag.o xvpic.o xvmaki.o xvpi.o xvpic2.o xvvd.o xvmgcsfx.o \
-+ xvml.o
-
- MISC = README INSTALL CHANGELOG IDEAS
-
-@@ -236,10 +319,12 @@
-
-
-
--all: $(JPEGLIB) $(TIFFLIB) xv bggen vdcomp xcmap xvpictoppm
-+#all: $(JPEGLIB) $(TIFFLIB) xv bggen vdcomp xcmap xvpictoppm
-+all: xv bggen vdcomp xcmap xvpictoppm
-
-
--xv: $(OBJS) $(JPEGLIB) $(TIFFLIB)
-+#xv: $(OBJS) $(JPEGLIB) $(TIFFLIB)
-+xv: $(OBJS)
- $(CC) -o xv $(CFLAGS) $(OBJS) $(LIBS)
-
- bggen: bggen.c
-@@ -268,13 +353,14 @@
-
-
- install: all
-- cp xv bggen vdcomp xcmap xvpictoppm $(BINDIR)
-- cp docs/xv.man $(MANDIR)/xv.$(MANSUF)
-- cp docs/bggen.man $(MANDIR)/bggen.$(MANSUF)
-- cp docs/xcmap.man $(MANDIR)/xcmap.$(MANSUF)
-- cp docs/xvp2p.man $(MANDIR)/xvpictoppm.$(MANSUF)
-- cp docs/vdcomp.man $(MANDIR)/vdcomp.$(MANSUF)
-- cp docs/xvdocs.ps* $(LIBDIR)
-+ cp xv bggen vdcomp xcmap xvpictoppm $(DESTDIR)$(BINDIR)
-+ cp docs/xv.man $(DESTDIR)$(MANDIR)/xv.$(MANSUF)
-+ cp docs/bggen.man $(DESTDIR)$(MANDIR)/bggen.$(MANSUF)
-+ cp docs/xcmap.man $(DESTDIR)$(MANDIR)/xcmap.$(MANSUF)
-+ cp docs/xvp2p.man $(DESTDIR)$(MANDIR)/xvpictoppm.$(MANSUF)
-+ cp docs/vdcomp.man $(DESTDIR)$(MANDIR)/vdcomp.$(MANSUF)
-+ cp docs/xvdocs.ps* $(DESTDIR)$(LIBDIR) # or $(DESTDIR)$(DOCDIR)
-+ #cp xv_mgcsfx.sample $(DESTDIR)$(SYSCONFDIR)/xv_mgcsfx
-
- tar:
- # tar only local jpeg and tiff dirs, not user's or system's copies:
-@@ -299,7 +385,7 @@
- xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds
- xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm
- xvbrowse.o: bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm
--xvbrowse.o: bits/br_xwd
-+xvbrowse.o: bits/br_xwd bits/br_png bits/br_zx bits/br_pcd bits/br_bzip2
-
- xvbutt.o: bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top
- xvbutt.o: bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body
-diff -ruN xv-3.10a-bugfixes/README.jumbo xv-3.10a-enhancements/README.jumbo
---- xv-3.10a-bugfixes/README.jumbo 2005-04-10 19:55:23.000000000 -0700
-+++ xv-3.10a-enhancements/README.jumbo 2005-05-01 13:45:58.000000000 -0700
-@@ -14,10 +14,10 @@
- available from John's XV site (http://www.trilon.com/xv/downloads.html
- and ftp://ftp.trilon.com/pub/xv/patches/), plus a number of my own fixes
- and additions, plus quite a few from other people--though not all of the
--ones I'd intended to (sorry, SJT, AT, and JPD!) due to lack of time after
--dealing with the latest security issue (which I discovered, sigh). They're
--still not fully complete, and it's possible they never will be, but I do
--plan to continue working on them whenever the mood strikes--and I may even
-+ones I'd intended to, due to lack of time after dealing with the latest
-+set of security issues (one of which I discovered, sigh). They're still
-+not fully complete, and it's possible they never will be, but I do plan
-+to continue tinkering with them whenever the mood strikes--and I may even
- release them publicly on rare occasions. (At the current rate, it looks
- like once a year may be the best we can hope for...we'll see.)
-
-@@ -26,91 +26,86 @@
-
- - Landon Curt "chongo" Noll (http://www.isthe.com/chongo/)
- http://www.isthe.com/chongo/src/xv-patch/
-- - Mark Ashley <mark@ibiblio.org>
+diff -u -r --new-file xv-3.10a.orig/README.jumbo xv-3.10a/README.jumbo
+--- xv-3.10a.orig/README.jumbo 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/README.jumbo 2007-05-21 00:19:20.000000000 -0500
+@@ -0,0 +1,559 @@
++This is the latest version of the XV jumbo patches I originally created in
++February 2000 (but never distributed) and eventually updated and released in
++May 2004, prompted by a discussion on LWN (http://lwn.net/Articles/76391/).
++Information about the patches, updates to the patches, and the patches
++themselves can all be found here:
++
++ http://pobox.com/~newt/greg_xv.html
++ http://freshmeat.net/projects/xvjumbopatches/
++
++(Use the "Subscribe to new releases" link on the latter page if you want to
++be notified of new versions automatically; trivial registration required.)
++
++These patches incorporate all of the fix- and enhancement-patches available
++from John's XV site (http://www.trilon.com/xv/downloads.html and
++ftp://ftp.trilon.com/pub/xv/patches/), plus a number of my own fixes and
++additions (security-related and otherwise), plus quite a few from other
++people. They're still not fully complete, and it's probable they never
++will be, but I do plan to continue tinkering with them whenever the mood
++strikes--and I may even release them publicly on rare occasions. (At the
++current rate, once every few years may be the best we can hope for....)
++
++Also be aware that several other people have had the same idea over the
++years. Ones I've found, more or less by accident, include:
++
++ - Landon Curt "chongo" Noll (http://www.isthe.com/chongo/)
++ http://www.isthe.com/chongo/src/xv-patch/
+ - Mark Ashley <mark ibiblio.org>
- http://www.ibiblio.org/pub/packages/solaris/sparc/html/xv.3.10a.p19.html
-- - Peter Jordan <pete@dc.seflin.org>
++ http://www.ibiblio.org/pub/packages/solaris/sparc/html/xv.3.10a.p19.html
+ - Peter Jordan <pete dc.seflin.org>
- http://www.ibiblio.org/pub/Linux/apps/graphics/viewers/X/xv-3.10a.patch.*
- - Uwe F. Mayer (http://www.tux.org/~mayer/)
- http://www.tux.org/~mayer/linux/book/node311.html
-- - Kurt Wall <kwall@kurtwerks.com>
++ http://www.ibiblio.org/pub/Linux/apps/graphics/viewers/X/xv-3.10a.patch.*
++ - Uwe F. Mayer (http://www.tux.org/~mayer/)
++ http://www.tux.org/~mayer/linux/book/node311.html
+ - Kurt Wall <kwall kurtwerks.com>
- http://www.kurtwerks.com/software/xv.html
- - Chisato Yamauchi (http://phe.phyas.aichi-edu.ac.jp/~cyamauch/index_en.html)
- http://phe.phyas.aichi-edu.ac.jp/~cyamauch/xv.html
-- - Daisuke Yabuki <dxy@optix.org>
++ http://www.kurtwerks.com/software/xv.html
++ - Chisato Yamauchi (http://phe.phyas.aichi-edu.ac.jp/~cyamauch/index_en.html)
++ http://phe.phyas.aichi-edu.ac.jp/~cyamauch/xv.html
+ - Daisuke Yabuki <dxy optix.org>
- http://www.optix.org/~dxy/solaris/xv/
- - Pekoe (http://pekoe.lair.net/)
- http://pekoe.lair.net/diary/xv.html
- - FreeBSD FreshPorts
- http://www.freshports.org/graphics/xv/
-- - <sudakyo@fat.coara.or.jp>
++ http://www.optix.org/~dxy/solaris/xv/
++ - Pekoe (http://pekoe.lair.net/)
++ http://pekoe.lair.net/diary/xv.html
++ - FreeBSD FreshPorts
++ http://www.freshports.org/graphics/xv/
+ - Kyoichiro Suda <sudakyo fat.coara.or.jp>
- http://www.coara.or.jp/~sudakyo/XV_jp.html
-
--I very much doubt that this is an exhaustive list. So far, most of the other
--patch-sets appear not to be quite as extensive or as up-to-date as my own,
--although the last three or four do include the [large] Japanese extension
--patches that I omitted--not because they're unworthy, but simply because I
--didn't find them until collisions between the two sets of patches had become
--a large problem. (Maybe for the next release... I'd intended to try for
--this release, but the security issues ended up taking almost all of my
--available time. And, to be honest, from my perspective, inclusion of the
--jp-extension patches is more for completeness' sake than personal interest,
--so their priority is fairly low.)
-+I very much doubt that this is an exhaustive list. So far, most of the
-+other patch-sets appear not to be as extensive or as up-to-date as my own,
-+particularly now that the (very large) "Japanese extension" patches are
-+incorporated--big thanks to Werner Fink of SuSE for that!
-
- Below I summarize the component patches that are encompassed by my jumbo
- bugfixes and jumbo enhancements patches. Unfortunately, some of my own
- additions never saw the light of day as standalone patches, but considering
- the number of overlaps (collisions) already implicit in this list, it would
--have been difficult to accomplish even if I'd had the time. In any case,
--they're present in these jumbo patches but not chongo's, so those who _really_
--care can "subtract" the two sets of patches to see what I did.
-+have been difficult to accomplish even if I'd had the time.
-
- Here's a quick guide to the "third-party" credits in the lists below:
-
- AAC = Andrey A. Chernov [ache]
- (http://cvsweb.freebsd.org/ports/graphics/xv/files/patch-ab)
-- AD = Andreas Dilger (adilger@clusterfs.com)
-- AL = Alexander Lehmann (lehmann@usa.net)
++ http://www.coara.or.jp/~sudakyo/XV_jp.html
++
++This is not an exhaustive list (e.g., Jörgen Grahn also had one). So far,
++most of the other patch-sets appear not to be as extensive or as up-to-date
++as my own, particularly now that the (very large) "Japanese extension" patches
++are incorporated--big thanks to Werner Fink of SuSE for that!
++
++Below I summarize the component patches that are encompassed by my jumbo
++bugfixes and jumbo enhancements patches, circa 2005. (As of 2007, they're
++distributed as a single monster-patch, and the "component patches" are now
++listed in the changelog section at the bottom of this file.) Unfortunately,
++some of my own additions never saw the light of day as standalone patches,
++but considering the number of overlaps (collisions) already implicit in the
++list, that would have been difficult to accomplish even if I'd had the time.
++
++Here's a quick guide to the "third-party" credits in the lists and changelog
++below:
++
++ AAC = Andrey A. Chernov [ache]
++ (http://cvsweb.freebsd.org/ports/graphics/xv/files/patch-ab)
+ AD = Andreas Dilger (adilger clusterfs.com)
+ AL = Alexander Lehmann (lehmann usa.net)
- AT = Anthony Thyssen (http://www.cit.gu.edu.au/~anthony/)
- DAC = David A. Clunie (http://www.dclunie.com/xv-pcd.html)
-- EK = Egmont Koblinger (egmont@users.sourceforge.net)
++ AS = Alexey Spiridonov (http://www-math.mit.edu/~lesha/)
++ AT = Anthony Thyssen (http://www.cit.gu.edu.au/~anthony/)
++ BR = Bruno Rohee (http://bruno.rohee.com/)
++ DAC = David A. Clunie (http://www.dclunie.com/xv-pcd.html)
++ EAJ = Erling A. Jacobsen (linuxcub email.dk)
+ EK = Egmont Koblinger (egmont users.sourceforge.net)
- GRR = Greg Roelofs (http://pobox.com/~newt/)
- GV = Guido Vollbeding (http://sylvana.net/guido/)
++ FG = Fabian Greffrath (fabian debian-unofficial.org)
++ GRR = Greg Roelofs (http://pobox.com/~newt/greg_contact.html)
++ GV = Guido Vollbeding (http://sylvana.net/guido/)
+ IM = IKEMOTO Masahiro (ikeyan airlab.cs.ritsumei.ac.jp)
- JCE = John C. Elliott (http://www.seasip.demon.co.uk/ZX/zxdload.html)
- JHB = John H. Bradley, of course (http://www.trilon.com/xv/)
- JPD = Jean-Pierre Demailly (http://www-fourier.ujf-grenoble.fr/~demailly/)
- JR = John Rochester (http://www.freebsd.org/cgi/query-pr.cgi?pr=2920)
- (also http://cvsweb.freebsd.org/ports/graphics/xv/files/patch-af, -ag)
- JZ = Joe Zbiciak (http://spatula-city.org/~im14u2c/)
++ JC = John Cooper (john.cooper third-harmonic.com)
++ JCE = John C. Elliott (http://www.seasip.demon.co.uk/ZX/zxdload.html)
++ JDB = John D. Baker (http://mylinuxisp.com/~jdbaker/)
++ JG = Jörgen Grahn (jgrahn algonet.se)
++ JHB = John H. Bradley, of course (http://www.trilon.com/xv/)
++ JPD = Jean-Pierre Demailly (http://www-fourier.ujf-grenoble.fr/~demailly/)
++ JR = John Rochester (http://www.freebsd.org/cgi/query-pr.cgi?pr=2920)
++ (also http://cvsweb.freebsd.org/ports/graphics/xv/files/patch-af, -ag)
++ JRK = James Roberts Kirkpatrick (uwyo.edu)
++ JZ = Joe Zbiciak (http://spatula-city.org/~im14u2c/)
+ KS = Kyoichiro Suda (http://www.coara.or.jp/~sudakyo/XV_jp.html)
- LCN = Landon Curt "chongo" Noll (http://www.isthe.com/chongo/)
++ LCN = Landon Curt "chongo" Noll (http://www.isthe.com/chongo/)
+ LJ = Larry Jones (lawrence.jones ugs.com)
- PBJ = Peter Jordan (http://www.ibiblio.org/pub/Linux/apps/graphics/viewers/X/)
- PSV = Pawel S. Veselov (http://manticore.2y.net/wbmp.html)
- SB = Sean Borman (http://www.nd.edu/~sborman/software/xvwheelmouse.html)
-- SJT = TenThumbs (tenthumbs@cybernex.net)
++ PBJ = Peter Jordan (http://www.ibiblio.org/pub/Linux/apps/graphics/viewers/X/)
++ PSV = Pawel S. Veselov (http://manticore.2y.net/wbmp.html)
++ RAC = Ross Combs (rocombs cs.nmsu.edu)
++ RJH = Robin Humble (http://www.cita.utoronto.ca/~rjh/)
++ SB = Sean Borman (http://www.nd.edu/~sborman/software/xvwheelmouse.html)
+ SJT = TenThumbs (tenthumbs cybernex.net)
- TA = Tim Adye (http://hepwww.rl.ac.uk/Adye/xv-psnewstyle.html)
++ SBM = Scott B. Marovich (formerly marovich hpl.hp.com)
++ TA = Tim Adye (http://hepwww.rl.ac.uk/Adye/xv-psnewstyle.html)
++ TAR = Tim Ramsey (tar pobox.com)
+ TI = Tetsuya INOUE (tin329 chino.it.okayama-u.ac.jp)
+ TO = Tavis Ormandy (taviso gentoo.org)
+ WF = Werner Fink (http://www.suse.de/~werner/)
-
- Other credits are as listed on the XV Downloads page or in the respective
- patches (e.g., the jp-extension patches or within the PNG patch).
-
- Finally, please note that these patches have not been blessed by John Bradley
--in any way (although I copied him on the May 2004 announcement--no response).
--Nor have I personally tested every change and feature! (See the BIG SCARY
--WARNING below for further caveats.) In other words, they're both completely
--unofficial and completely unguaranteed. But they seem to work for me. (And
--when they don't, I fix 'em. Eventually, anyway... ;-) )
--
--One further "final" note: this may well be the last release to include
--separate fix- and enhancements-patches. It is too much of a timesink to
--maintain parallel trees--not to mention parallel makefiles (generic/public
--vs. local/personal, old vs. new libjpeg/libtiff) and xv.h (unregistered/
--public vs. registered/personal), particularly when some fixes come about
--while working on an enhancement. Henceforth--assuming, of course, that
--there _is_ a "henceforth"--I expect to merge the patches into a single
--jumbo patch. (Alternatively, I may simply freeze the current fix-patch
--and continue to evolve only the enhancements patch; in particular, new
--fixes would appear only in it. Either approach would be simple enough;
--feedback as to which would be preferable is welcomed.)
-+in any way (although I copied him on the May 2004 announcement--no response
-+at that time). Nor have I personally tested every change and feature! (See
-+the BIG SCARY WARNING below for further caveats.) In other words, they're
-+both completely unofficial and completely unguaranteed. But they seem to
-+work for me. (And when they don't, I fix 'em. Eventually, anyway... ;-) )
-+
-+One further "final" note: as of this release, I am no longer updating the
-+fixes patch; new stuff (including fixes) now appears only in the enhancements
-+one. It simply became too much of a timesink to maintain parallel trees--not
-+to mention parallel makefiles (generic/public vs. local/personal, old vs.
-+new libjpeg/libtiff) and xv.h (unregistered/public vs. registered/personal),
-+particularly when some fixes came about while working on an enhancement and
-+others were provided by third parties relative to the previous fix+enh state.
-+Hence the mismatched "20050410" date on the fixes patch.
-
--GRR 20050410
-+GRR 20050501
-
-
- How to build
-@@ -158,8 +153,8 @@
- Assuming you have the prerequisites out of the way and aren't scared
- off by the Big Scary Warning, here's the build procedure:
-
-- bzip2 -dc xv-3.10a-jumbo-patches-20050410.tar.bz2 | tar xvf -
-- (or tar xvzf xv-3.10a-jumbo-patches-20050410.tar.gz)
-+ bzip2 -dc xv-3.10a-jumbo-patches-20050501.tar.bz2 | tar xvf -
-+ (or tar xvzf xv-3.10a-jumbo-patches-20050501.tar.gz)
-
- tar xvzf xv-3.10a.tar.gz
-
-@@ -167,7 +162,7 @@
-
- patch -p1 < ../xv-3.10a-jumbo-fix-patch-20050410.txt
-
-- [optional] patch -p1 < ../xv-3.10a-jumbo-enh-patch-20050410.txt
-+ [optional] patch -p1 < ../xv-3.10a-jumbo-enh-patch-20050501.txt
-
- edit Makefile and config.h as directed in INSTALL file (in particular,
- ensure paths to external libraries and header files are correct)
-@@ -221,6 +216,8 @@
- - freebsd-vdcomp-newline.patch (AAC)
- - xv-3.10a.patch.linux (PBJ) [/bin/sh versions of cleandir, RANLIB.sh only]
- - removed trailing white space (GRR) [purely cosmetic]
++
++Other credits are as listed on the XV Downloads page or in the respective
++patches (e.g., the jp-extension patches or within the PNG patch).
++
++Finally, please note that these patches have not been blessed by John Bradley
++in any way (although I copied him on the May 2004 announcement and wrote to
++him again in May 2005), unless you count Debian's redistribution permission
++(Daniel Kirchheimer, 5 Dec 2005). Nor have I personally tested every change
++and feature! (See the BIG SCARY WARNING below for further caveats.) In other
++words, they're both completely unofficial and completely unguaranteed. But
++they seem to work for me. (And when they don't, I try to fix 'em--eventually,
++anyway... ;-) )
++
++Greg Roelofs, 20070520
++http://pobox.com/~newt/greg_contact.html
++
++
++How to build
++------------
++
++The following assumes you, the user, already have the libtiff,[1] libjpeg,[2]
++libpng,[3] zlib,[4] and JasPer[5] libraries downloaded, patched (if necessary),
++compiled, and installed, not to mention a C compiler and the bzip2,[6] tar,[7]
++patch,[8] and make[9] utilities. You should also have downloaded the original
++XV 3.10a source distribution from the XV Downloads page[10] and be able to edit
++its Makefile and config.h files as indicated in the INSTALL file. (Editing
++the Makefile will also allow you to disable some of the third-party libraries
++if you wish.) Finally, you should know what a Unix(-style) command line is,
++where to find one, and how to wield it with abandon (or at least with adult
++supervision)--and preferably not as the root user until the "make install"
++step. (A filesystem is a terrible thing to waste.)
++
++ [1] http://www.remotesensing.org/libtiff/
++ [2] http://www.ijg.org/
++ [3] http://www.libpng.org/pub/png/libpng.html
++ [4] http://www.zlib.net/
++ [5] http://www.ece.uvic.ca/~mdadams/jasper/
++ [6] http://sources.redhat.com/bzip2/
++ [7] http://www.gnu.org/directory/devel/specific/tar.html
++ [8] http://www.gnu.org/directory/devel/specific/patch.html
++ [9] http://www.gnu.org/directory/devel/specific/make.html
++ [10] http://www.trilon.com/xv/downloads.html#src-distrib
++
+++-------------------------------------------------------------------------+
++| |
++| BIG SCARY WARNING |
++| |
++| These patches work for Greg (and parts of them reportedly work for |
++| various other people), and so far Greg's CPU still computes and his |
++| hard disks haven't been wiped. But there's no guarantee that this |
++| will be the case for you! In particular, not every incorporated patch |
++| has been explicitly tested, nor has every possible subcase of the |
++| explicitly tested subset. (Read that again; it's grammatical.) Nor |
++| are these patches officially blessed by John Bradley in any way. In |
++| other words, if you use these patches, you do so at your own risk. |
++| (Greg doesn't believe there are any serious problems remaining, but |
++| then, what programmer ever does? Bugs happen.) |
++| |
+++-------------------------------------------------------------------------+
++
++Assuming you have the prerequisites out of the way and aren't scared
++off by the Big Scary Warning, here's the build procedure:
++
++ tar xvzf xv-3.10a-jumbo-patches-20070520.tar.gz
++ (or: gzip -dc xv-3.10a-jumbo-patches-20070520.tar.gz | tar xvf - )
++
++ tar xvzf xv-3.10a.tar.gz
++
++ cd xv-3.10a
++
++ patch -p1 < ../xv-3.10a-jumbo-fix-enh-patch-20070520.txt
++
++ edit Makefile and config.h as directed in INSTALL file (in particular,
++ ensure paths to external libraries and header files are correct)
++
++ make
++
++ ./xv your_favorite_image your_other_favorite_image etc.
++
++If everything seems to be working to your satisfaction, go ahead and install:
++
++ make -n install (and double-check that things will be installed
++ where you want them to be)
++
++ become root if necessary (e.g., type su)
++
++ make install
++ (or: sudo make install)
++
++That wasn't so hard, was it?
++
++
++Summary of incorporated and unincorporated patches (through 20050501)
++---------------------------------------------------------------------
++(See the ChangeLog at the bottom for more recent incorporated patches.)
++
++fixes ((*) = listed on XV Downloads page, (f) = on ftp site only):
++
++20040516:
++ - grabpatch (*) [obsoleted by new-xvgrab.c below]
++ - vispatch (*)
++ - mp-tiff-patch (*) [technically an enhancement, but JHB says...]
++ - longname.patch (*) [*SECURITY*]
++ - xpm.patch (*)
++ - deepcolor.patch (*) [slightly modified for language conformance]
++ - gifpatch (*)
++ - exceed_grab.patch (*)
++ - xv-redhat6-readme.txt (*) [slightly modified for portability]
++ - beos.patch (*) [modified for portability]
++ - croppad.patch (f)
++ - epsfpatch (f)
++ - tiff1200.patch (*)
++ - gssafer.patch (*) [*SECURITY*]
++ - new-xvgrab.c (f) [includes grabpatch but not exceed_grab.patch]
++ - xcmap.diff (AD) [part of xv-3.10a-png-1.2d.tar.gz]
++ - fixes for huge number gcc -Wall warnings--including two bugs (GRR)
++ - fix for cleandir script when no makefile exists (GRR)
++ - *SECURITY* fix for gets() in vdcomp.c (GRR, LCN vdcomp-security.patch)
++ - *SECURITY* fix for getwd() on Linux (GRR, LCN Linux-compile.patch)
++ - fix for "no fuss" Linux compiles (LCN Linux-compile.patch)
++ - partial *SECURITY* fix for mktemp() in xv.c and xvdir.c (GRR)
++ (remaining instances in xv.c (2), xvimage.c, xvfits.c, xvpds.c, xvps.c, and
++ possibly xvtiff.c--most involve system())
++ - freebsd-vdcomp-newline.patch (AAC)
++ - xv-3.10a.patch.linux (PBJ) [/bin/sh versions of cleandir, RANLIB.sh only]
++ - removed trailing white space (GRR) [purely cosmetic]
+20040523:
+ - fixed compilation error in registered versions (GRR)
- 20050410:
- - fix for YCbCr oversaturated-green bug(s) in TIFF decoder (GRR)
- - provisional fix for contiguous tiled TIFFs with bottom-* orientation (GRR)
-@@ -265,12 +262,50 @@
- - boosted maximum number of files from 4096 to 32768 (GRR)
- (note that OS kernel limits may also apply; for example, in Linux see
- MAX_ARG_PAGES in linux-<version>/include/linux/binfmts.h)
-- - xv-3.10a-bmp16.patch
-- (from http://www.coara.or.jp/~sudakyo/XV_jp.html)
++20050410:
++ - fix for YCbCr oversaturated-green bug(s) in TIFF decoder (GRR)
++ - provisional fix for contiguous tiled TIFFs with bottom-* orientation (GRR)
++ - fixes for gcc 3.3 -Wall warnings (GRR)
++ - fix for incorrect 16/24-bit display of xwd dumps (SJT)
++ - *SECURITY* fix for multiple input-validation bugs (OpenBSD/SuSE, Gentoo, GRR)
++ (this also completes the partial mktemp() security fix listed above)
++ - fix for (probable) 24-bit endianness bug in fixpix code (GRR)
++
++
++enhancements ((*) = listed on XV Downloads page, (<who>) = third-party):
++
++20040516:
++ - xv-3.10a.JPEG-patch (*)
++ (xv-3.10a.JPEG-patch.old differs only in ftp site listed in comments at top)
++ - xv-3.10a.TIFF-patch (*)
++ - xv-3.10a-png-1.2d.tar.gz (AL, AD) (*)
++ (xvjpeg.diff and xvtiff.diff ignored; xcmap.diff included in fixes)
++ - xvpng-1.2d-fix3.patch (GRR, SJT) (*)
++ - pdf.patch (*)
++ - windowid.patch + windowid.patch.readme (*)
++ - bmp32.patch (*)
++ - fixpix-20000610.tar.gz (GV)
++ (identical to 19961127 version except for README updates and new Win32 file)
++ [modified to be runtime-selectable via -/+fixpix option]
++ - browse-remember.patch (JZ)
++ - faster-smooth.patch (JZ)
++ - PAM support (GRR)
++ - PNG/GIF -ibg ("image background") transparency option (GRR)
++ (does not yet support TIFF, XPM or TGA)
++ - VersionInfo* in help screen (GRR)
++ - minor grammar/spelling fixes (GRR)
++ - floating-point support for -wait when USE_TICKS enabled (GRR)
++ - wheelmouse.patch (SB)
++ - freebsd-gravity-hints-patch (JR)
++ - xv-zx.patch (JCE)
++ - xv3.10a.wapbmp.patch (PSV)
++ - xv-3.10a-pcd.patch.20010708 (DAC)
++ - jp-ext-bzip2-1.1.patch
++ (from ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/shige/xv/)
++20050410:
++ - boosted maximum number of files from 4096 to 32768 (GRR)
++ (note that OS kernel limits may also apply; for example, in Linux see
++ MAX_ARG_PAGES in linux-<version>/include/linux/binfmts.h)
+ - xv-3.10a-bmp16.patch (KS)
- - final-image delay (e.g., "-wait 0.2,3" : pause 3 secs on final image) (GRR)
- - xv-numpad.patch (EK)
- - xv-delete-is-not-backspace.patch (EK)
- - made browser window (schnauzer) and icons configurable (AT, GRR)
++ - final-image delay (e.g., "-wait 0.2,3" : pause 3 secs on final image) (GRR)
++ - xv-numpad.patch (EK)
++ - xv-delete-is-not-backspace.patch (EK)
++ - made browser window (schnauzer) and icons configurable (AT, GRR)
+20050501:
+ - xv-3.10a-bmpfix.patch (WF) [*SECURITY*]
+ - xv310a-jp-extension-rev5.3.3.tar.gz (TI, IM, ..., WF)
-+ (adds support for MAG, MAKI, Pi, PIC, and PIC2 formats[*]; "magic suffix"
++ (adds support for MAG, MAKI, Pi, PIC, and PIC2 formats[!]; "magic suffix"
+ detection/conversion; MacBinary prefixes; archives as virtual filesystems;
+ multilingual text viewer [though not Unicode]; etc.)
+ - xv-3.10a-yaos.dif (WF, TO) [*SECURITY*]
@@ -844,7 +300,7 @@ diff -ruN xv-3.10a-bugfixes/README.jumbo xv-3.10a-enhancements/README.jumbo
+ - PATCH.stat (LJ)
+ - PATCH.thumbs (LJ)
+ - xv-startgrab-imake-hips.patch (JPD)
-+ ("hips" portion only; adds support for HIPS image format[*])
++ ("hips" portion only; adds support for HIPS image format[!])
+ - xv-3.10a-formatstr.patch (KS)
+ - xv-3.10a-shortsleep.patch (KS)
+ - xv-3.10a-locale-linux.patch (KS)
@@ -854,82 +310,119 @@ diff -ruN xv-3.10a-bugfixes/README.jumbo xv-3.10a-enhancements/README.jumbo
+ - xv-3.10a-xvexecpath.patch (but disabled pending fixes) (KS)
+ - xv-3.10a-zeroquit.patch (KS, GRR)
+
-+
-+[*] Note that all six of these formats may still suffer from exploitable heap
++[!] Note that all six of these formats may still suffer from exploitable heap
+ overflows [*SECURITY*] when decoding images with large (possibly invalid)
+ dimensions; as a result, they are DISABLED by default. (Search for "GRR
+ POSSIBLE OVERFLOW / FIXME" comments in xvmag.c, xvmaki.c, xvpi.c, xvpic.c,
+ xvpic2.c, and xvhips.c, but keep in mind that these may not be exhaustive.)
+ Users who choose to overlook these security issues can enable any or all
+ of them by editing config.h.
-
-
- not (yet?) included:
-@@ -284,31 +319,21 @@
- -rw-r--r-- 42397 Mar 11 2004 xv-3.10a-download-test2.patch
- -rw-r--r-- 47679 Mar 11 2004 xv-3.10a-download-test3.patch
- -rw-r--r-- 52745 Mar 11 2004 xv-3.10a-download-test4.patch
-- -rw-r--r-- 415 Mar 11 2004 xv-3.10a-formatstr.patch
- -rw-r--r-- 3423 Apr 24 2004 xv-3.10a-keyzoom.patch
-- -rw-r--r-- 1461 Mar 11 2004 xv-3.10a-locale-linux.patch
- -rw-r--r-- 12387 Mar 15 2004 xv-3.10a-menubutton.patch
- -rw-r--r-- 1178 Apr 24 2004 xv-3.10a-noblink.patch
-- -rw-r--r-- 484 Mar 11 2004 xv-3.10a-printkey.patch
- -rw-r--r-- 57092 Jul 9 2004 xv-3.10a-resolution.patch
- -rw-r--r-- 4645 Apr 24 2004 xv-3.10a-selall.patch
-- -rw-r--r-- 360 Mar 11 2004 xv-3.10a-shortsleep.patch
- -rw-r--r-- 702 Apr 24 2004 xv-3.10a-showlongname.patch
- -rw-r--r-- 1205 Apr 24 2004 xv-3.10a-staytoppdir.patch
-- -rw-r--r-- 1591 Mar 15 2004 xv-3.10a-sysconfdir.patch
- -rw-r--r-- 4228 Apr 24 2004 xv-3.10a-wheelmouse.patch
- -rw-r--r-- 744 Apr 24 2004 xv-3.10a-xvbutt_wait.patch
-- -rw-r--r-- 712 Mar 11 2004 xv-3.10a-xvexecpath.patch
- -rw-r--r-- 3757 Jul 9 2004 xv-3.10a-xvscrl_button2.patch
- -rw-r--r-- 1494 Jul 9 2004 xv-3.10a-xvscrl_wait.patch
- -rw-r--r-- 19352 Jul 9 2004 xv-3.10a-xvzoom.patch
-- -rw-r--r-- 1827 Apr 24 2004 xv-3.10a-zeroquit.patch
-
-- - xv310a-jp-extension-rev5.3.3.tar.gz [extensive]
-- - xv-3.10a-jp-extension-5.3.3-png-1.2d.patch [PNG patch relative to jp-ext]
-- - xv-3.10a+jp-extension-rev5.3.3+FLmask.v2.1+png+misc.patch [??]
++
++
++not (yet?) included:
++
++ - others from http://www.coara.or.jp/~sudakyo/XV_jp.html (some are duplicates):
++ -rw-r--r-- 4644 Mar 11 2004 xv-3.10a-directory.patch
++ -rw-r--r-- 462 Mar 11 2004 xv-3.10a-dirwkey.patch
++ -rw-r--r-- 688 Mar 11 2004 xv-3.10a-docdir.patch
++ -rw-r--r-- 11952 Mar 11 2004 xv-3.10a-download-test0.patch
++ -rw-r--r-- 41786 Mar 11 2004 xv-3.10a-download-test1.patch
++ -rw-r--r-- 42397 Mar 11 2004 xv-3.10a-download-test2.patch
++ -rw-r--r-- 47679 Mar 11 2004 xv-3.10a-download-test3.patch
++ -rw-r--r-- 52745 Mar 11 2004 xv-3.10a-download-test4.patch
++ -rw-r--r-- 3423 Apr 24 2004 xv-3.10a-keyzoom.patch
++ -rw-r--r-- 12387 Mar 15 2004 xv-3.10a-menubutton.patch
++ -rw-r--r-- 1178 Apr 24 2004 xv-3.10a-noblink.patch
++ -rw-r--r-- 57092 Jul 9 2004 xv-3.10a-resolution.patch
++ -rw-r--r-- 4645 Apr 24 2004 xv-3.10a-selall.patch
++ -rw-r--r-- 702 Apr 24 2004 xv-3.10a-showlongname.patch
++ -rw-r--r-- 1205 Apr 24 2004 xv-3.10a-staytoppdir.patch
++ -rw-r--r-- 4228 Apr 24 2004 xv-3.10a-wheelmouse.patch
++ -rw-r--r-- 744 Apr 24 2004 xv-3.10a-xvbutt_wait.patch
++ -rw-r--r-- 3757 Jul 9 2004 xv-3.10a-xvscrl_button2.patch
++ -rw-r--r-- 1494 Jul 9 2004 xv-3.10a-xvscrl_wait.patch
++ -rw-r--r-- 19352 Jul 9 2004 xv-3.10a-xvzoom.patch
++
+ - xv-3.10a+jp-extension-rev5.3.3+FLmask.v2.1+png+misc.patch ["mask" support]
-
-- - xv-grab-imake-hips.patch (JPD) [HIPS format, -startgrab option]
- - xv-psnewstyle.patch (TA) [coming later in 2005?]
- - xv-3.10a.patch.linux (PBJ) [maybe use vdcomp.c changes?]
- - xvxpm-anthony-thyssen.c (AT) ["slate grey" bug already gone?]
-@@ -332,8 +357,8 @@
- not finished (and/or even started ;-) ):
-
- - fix xvpng.c not to use direct struct access
-- - fix for never-ending pile of SLOW popups when viewing TIFFs with unknown tags
-- (or truncated/corrupted images)
++
++ - xv-psnewstyle.patch (TA) [coming "soon"?]
++ - xv-3.10a.patch.linux (PBJ) [maybe use vdcomp.c changes?]
++ - xvxpm-anthony-thyssen.c (AT) ["slate grey" bug already gone?]
++ - xv-geoff-kuenning-iconsize-slideshow.patch [var. icons; full-screen slides]
++ - xv-scott-marovich-20070214-xvtiff.c.patch6.unified [TIFF CMYK support]
++
++ - stuff in xv/unsupt:
++ -rw-r--r-- 30527 Dec 22 1994 FITS.rite
++ -rw-r--r-- 49152 Dec 22 1994 FITS.tar
++ -rw-r--r-- 3753 Dec 22 1994 G3.patch1
++ -rw-r--r-- 24576 Dec 22 1994 G3.tar
++ -rw-r--r-- 1098 Dec 22 1994 INFO.cgm
++ -rw-r--r-- 1941 Dec 22 1994 README
++ -rwxr-xr-x 1059 Dec 22 1994 getweather
++ -rwxr-xr-x 2186 Dec 22 1994 getweather.ksh
++ -rw-r--r-- 856 Dec 22 1994 twm.fix
++ -rw-r--r-- 844 Dec 22 1994 vargs.c
++ -rw-r--r-- 47626 Dec 22 1994 vis
++ -rw-r--r-- 21097 Dec 22 1994 xscm
++
++
++
++not finished (and/or even started ;-) ):
++
++ - fix xvpng.c not to use direct struct access
+ - (better) fix for never-ending pile of SLOW popups when viewing TIFFs with
+ unknown tags (or truncated/corrupted images)
- - fix for minor .Z inefficiency in xv.c ("FIXME")
- - fix for filename entry-field mouse/cursor bogosity
- (want at least positioning to work; preferably also select/cut/paste)
-@@ -344,6 +369,7 @@
- - transparency support for TIFF, XPM and TGA images
- - support for tiled background image (with transparent foreground image)
- - MNG/JNG support
++ - fix for minor .Z inefficiency in xv.c ("FIXME")
++ - fix for filename entry-field mouse/cursor deficiencies
++ (positioning fixed 20070104 by Ross Combs; would like select/cut/paste, too)
++ - fix for .ppm.gz "disk leak" [can't reproduce...already fixed?]
++ (maybe occurs only if filesystem is already nearly full? bad .gz?)
++
++ - transparency support for TIFF, XPM and TGA images
++ - support for tiled background image (with transparent foreground image)
++ - MNG/JNG support
+ - SVG support
-
-
- ChangeLog
-@@ -364,7 +390,7 @@
- 20040531
- fixed undefined CLK_TCK with gcc -ansi (enh/USE_TICKS option); made
- libjpeg, libtiff, libpng and zlib sections of makefile more consistent
-- (enh);
++
++
++ChangeLog
++---------
++
++ 20000220
++ original pair of jumbo patches, comprising perhaps 16 fix-patches and a
++ dozen enhancement-patches; never publicly released
++
++ 20040516
++ first public release, incorporating 25 fix-patches and 21 enhancement-
++ patches
++
++ 20040523
++ minor fix to xvctrl.c to support registered versions (GRR warnings-patch
++ was slightly overzealous); switched to tarball packaging
++
++ 20040531
++ fixed undefined CLK_TCK with gcc -ansi (enh/USE_TICKS option); made
++ libjpeg, libtiff, libpng and zlib sections of makefile more consistent
+ (enh)
-
- 20040606
- added freshmeat link, build instructions, and changelog to jumbo README
-@@ -385,3 +411,32 @@
- sex bug in 24-bit FixPix display code (enh/USE_24BIT_ENDIAN_FIX option);
- fixed numerical-keypad NumLock behavior and delete-key behavior in file-
- load/save window (enh); made schnauzer window and icons configurable (enh)
++
++ 20040606
++ added freshmeat link, build instructions, and changelog to jumbo README
++ (this file)
++
++ 20050213
++ increased max number of files from 4096 to 32768 (enh)
++
++ 20050320-20050410
++ fixed two very long-standing YCbCr bugs in TIFF decoder (fix);
++ provisionally fixed bug in TIFF decoder for contiguous tiled TIFFs with
++ bottom-* orientation (fix/USE_TILED_TIFF_BOTLEFT_FIX option); fixed new
++ gcc 3.3 warnings (fix); fixed incorrect 16/24-bit display of xwd dumps
++ (fix); fixed multiple input-validation bugs (potential heap overflows)
++ and mktemp() dependencies (*SECURITY* fixes: CAN-2004-1725, CAN-2004-
++ 1726, CAN-2005-0665, CERT VU#622622, and others); added support for 16-
++ and 32-bit BMPs using bitfields "compression" (enh); fixed probable byte-
++ sex bug in 24-bit FixPix display code (enh/USE_24BIT_ENDIAN_FIX option);
++ fixed numerical-keypad NumLock behavior and delete-key behavior in file-
++ load/save window (enh); made schnauzer window and icons configurable (enh)
+
+ 20050417
+ incorporated "Japanese extension" patches, revision 5.3.3 (enh); fixed
@@ -959,9 +452,118 @@ diff -ruN xv-3.10a-bugfixes/README.jumbo xv-3.10a-enhancements/README.jumbo
+ suffix" (xv_mgcsfx) config dir (enh); added PREFIX and DESTDIR support to
+ Makefile (enh); fixed handling of zero-length files and other text-viewer
+ failures (enh)
-diff -ruN xv-3.10a-bugfixes/README.pcd xv-3.10a-enhancements/README.pcd
---- xv-3.10a-bugfixes/README.pcd 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/README.pcd 2001-07-08 11:21:19.000000000 -0700
++
++ 20050528
++ conditionally added missing alloca.h to xvpcd.c (required if alloca() is
++ a macro and alloca.h not included in stdlib.h, for example); fixed bogus
++ __S_IWRITE introduced in 20050501 release; fixed Makefile "install" target
++ (mkdir, chmod); fixed bug in MUST macro in xvwbmp.c; fixed prototype
++ warnings in xvevent.c, xvpcd.c (JRK, GRR)
++ - xv-3.10a-jimkirk-fixes.patch
++
++ 20050630
++ fixed broken mkdir(.xvpics) introduced in 20050501 release (RJH, GRR);
++ tweaked GUNZIP config for OpenBSD (GRR)
++ - xv-3.10a-xvpics-mkdir-fix.patch
++
++ 20051014
++ fixed longstanding xvevent.c typo (wasJpegUp -> wasPngUp) that caused build
++ failure if no JPEG support (TAR)
++
++ 20051019
++ fixed Darwin (Mac OS X) build error in xv.h and vdcomp.c due to lack of
++ malloc.h (JDB)
++
++ 20070210
++ fixed minor grammos (GRR); promoted PNG to first position, demoted GIF to
++ third (GRR); changed internal type of default image to PNG (GRR); increased
++ max files again, to 65536 (GRR)
++
++ 20070310
++ incorporated JPEG-2000 patch (SBM, GRR); added manual fax options for
++ unrecognized G3 images (SBM); relaxed 30-byte minimum file size (SBM)
++ - http://www.ece.uvic.ca/~mdadams/jasper/software/xv-patches
++
++ 20070318
++ incorporated 16bps raw (binary) PPM patch (define ASSUME_RAW_PPM_LSB_FIRST
++ for old behavior) (RAC, GRR); updated format list, web sites in xv man page
++ (GRR); fixed Makefile "install" target to create any necessary directories
++ (RAC, GRR); fixed GIF decoder bug (sizes of global, local color tables
++ different) (GRR)
++ - xv-ross-combs-ppm-16bps-rawbits.patch
++
++ 20070325
++ fixed invalid gamma assumption in PNG decoder (=> progressive color changes
++ over load/save cycles) (GRR)
++
++ 20070328
++ fixed animated-GIF /tmp/xvpgXXXXXX droppings (GRR)
++
++ 20070331
++ fixed PNG duplicate-palette-entries bug (GRR)
++
++ 20070415
++ incorporated EXIF-preserve patch (GHK); added missing JP2/JPC VS bits code
++ (GRR); added extended-warning options to CCOPTS (RAC); added "const" to
++ huge number of function args (RAC, GRR); made more effectively static
++ functions officially static (RAC); added mouse-clickability (but not
++ selectability) to text-entry fields (RAC); fixed window positioning (race
++ conditions?) under some virtual window managers (e.g., tvtwm) (RAC);
++ removed explicit paths for external (de)compressors (GRR, RAC)
++ - xv-geoff-kuenning-jpeg-exif-preserve.patch
++ - xv-ross-combs-20070104.diff
++
++ 20070422
++ incorporated function-key-scripts patch (see contrib/fnkey-scripts) (AS);
++ fixed man-page-section extensions ("1", not "l" or "1X") (FG); switched to
++ more sensible install paths for docs (FG); added Fedora Core build script
++ (see contrib/fedora) (JC); fixed VS to switch from move-mode to copy-mode
++ if source dir is read-only (EAJ); extended VS incremental-search mode (EAJ)
++ - xv-alexey-spiridonov-20070116-fnkey-scripts.tar.bz2
++ - xv-fabian-greffrath-20070215-debian-04-manpages.dpatch
++ - xv-fabian-greffrath-20070215-debian-03-makefiles.dpatch
++ - xv-john-cooper-Build-FC5-script.sh
++ - xv-erling-jacobsen-20060617-incr-search.patch
++
++ 20070428
++ modified install to include README.jumbo in docs (GRR); incorporated PNG
++ no-stdio patch (SBM); fixed XWD endianness support, improved performance
++ (replaces SJT 16/24-bit fix) (SBM)
++ - xv-scott-marovich-20070214-xvpng.diff
++ - xv-scott-marovich-20070214-xvxwd.c.patch
++
++ 20070506
++ added JPEG CMYK support (SBM); fixed TIFF (and others?) /tmp/xvpgXXXXXX
++ droppings (GRR); added VS clipboard support (JG)
++ - xv-scott-marovich-20070214-xvjpeg.c.patch
++ - xv-jurgen-grahn-20051127-schnauzer-clip.patch
++
++ 20070512
++ inverted handling of malloc.h header file to require NEED_MALLOC_H macro
++ for those few systems that actually need it (GRR)
++
++ 20070513
++ fixed GCC 4.1.x warnings (GRR); next round of const cleanup (GRR); fixed
++ minor TIFF memleak (GRR)
++
++ 20070514
++ fixed TIFF YCbCr reference black/white levels (SBM); added option to use
++ libjpeg YCbCr-to-RGB conversion for TIFF images (SBM, GRR)
++ - xv-scott-marovich-20070214-xvtiff.c.patch2.unified
++ - xv-scott-marovich-20070214-xvtiff.c.patch3.unified
++
++ 20070519
++ fixed handling of multi-page JPEG-compressed TIFFs (old or new) (SBM);
++ added TIFF YCbCr separated-color-plane support (may require libtiff
++ patch(es) to tif_ojpeg.c and/or tif_jpeg.c) (SBM)
++ - xv-scott-marovich-20070214-xvtiff.c.patch4.unified
++ - xv-scott-marovich-20070214-xvtiff.c.patch5.unified
++
++ 20070520
++ updated README.jumbo
+diff -u -r --new-file xv-3.10a.orig/README.pcd xv-3.10a/README.pcd
+--- xv-3.10a.orig/README.pcd 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/README.pcd 2001-07-08 13:21:19.000000000 -0500
@@ -0,0 +1,159 @@
+Copyright 1993-2001 David Clunie.
+
@@ -1122,21 +724,9 @@ diff -ruN xv-3.10a-bugfixes/README.pcd xv-3.10a-enhancements/README.pcd
+
+
+
-diff -ruN xv-3.10a-bugfixes/bggen.c xv-3.10a-enhancements/bggen.c
---- xv-3.10a-bugfixes/bggen.c 2004-05-16 17:50:52.000000000 -0700
-+++ xv-3.10a-enhancements/bggen.c 2005-04-17 14:04:22.000000000 -0700
-@@ -34,7 +34,7 @@
- #define MAXCOLS 128
-
- /* some VMS thing... */
--#ifdef vax11c
-+#if defined(vax11c) || (defined(__sony_news) && (defined(bsd43) || defined(__bsd43) || defined(SYSTYPE_BSD) || defined(__SYSTYPE_BSD)))
- #include <ctype.h>
- #endif
-
-diff -ruN xv-3.10a-bugfixes/bits/br_bzip2 xv-3.10a-enhancements/bits/br_bzip2
---- xv-3.10a-bugfixes/bits/br_bzip2 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/bits/br_bzip2 1998-04-12 19:23:39.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/bits/br_bzip2 xv-3.10a/bits/br_bzip2
+--- xv-3.10a.orig/bits/br_bzip2 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/bits/br_bzip2 1998-04-12 21:23:39.000000000 -0500
@@ -0,0 +1,27 @@
+#define br_bzip2_width 48
+#define br_bzip2_height 48
@@ -1165,9 +755,71 @@ diff -ruN xv-3.10a-bugfixes/bits/br_bzip2 xv-3.10a-enhancements/bits/br_bzip2
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03};
-diff -ruN xv-3.10a-bugfixes/bits/br_mag xv-3.10a-enhancements/bits/br_mag
---- xv-3.10a-bugfixes/bits/br_mag 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/bits/br_mag 2005-04-17 14:04:22.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/bits/br_jp2 xv-3.10a/bits/br_jp2
+--- xv-3.10a.orig/bits/br_jp2 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/bits/br_jp2 2005-05-09 00:00:27.000000000 -0500
+@@ -0,0 +1,27 @@
++#define br_jp2_width 48
++#define br_jp2_height 48
++static unsigned char br_jp2_bits[] = {
++ 0xe0, 0xff, 0xff, 0xff, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x03, 0x00,
++ 0x20, 0x00, 0x00, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x09, 0x00,
++ 0x20, 0x00, 0x00, 0x00, 0x11, 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00,
++ 0x20, 0x00, 0x00, 0x00, 0x41, 0x00, 0x20, 0x00, 0x00, 0x00, 0x81, 0x00,
++ 0x20, 0x00, 0x00, 0x00, 0x01, 0x01, 0x20, 0x00, 0x00, 0x00, 0xff, 0x03,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x7f, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x7f, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0xfb, 0xf1, 0x01, 0x02,
++ 0x20, 0x00, 0xfb, 0xfb, 0x03, 0x02, 0x20, 0x00, 0x1b, 0x1b, 0x03, 0x02,
++ 0x20, 0x00, 0x1b, 0x1b, 0x00, 0x02, 0x20, 0x00, 0x1b, 0x1b, 0x00, 0x02,
++ 0x20, 0x00, 0x9b, 0x1b, 0x00, 0x02, 0x20, 0x00, 0xfb, 0x19, 0x00, 0x02,
++ 0x20, 0x00, 0xfb, 0x18, 0x00, 0x02, 0x20, 0x18, 0x1b, 0x18, 0x00, 0x02,
++ 0x20, 0x18, 0x1b, 0x18, 0x00, 0x02, 0x20, 0xb8, 0x1b, 0x18, 0x03, 0x02,
++ 0x20, 0xf0, 0x19, 0xf8, 0x03, 0x02, 0x20, 0xe0, 0x18, 0xf0, 0x01, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x7f, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x7f, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03};
+diff -u -r --new-file xv-3.10a.orig/bits/br_jpc xv-3.10a/bits/br_jpc
+--- xv-3.10a.orig/bits/br_jpc 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/bits/br_jpc 2005-05-09 00:00:27.000000000 -0500
+@@ -0,0 +1,27 @@
++#define br_jpc_width 48
++#define br_jpc_height 48
++static unsigned char br_jpc_bits[] = {
++ 0xe0, 0xff, 0xff, 0xff, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x03, 0x00,
++ 0x20, 0x00, 0x00, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x09, 0x00,
++ 0x20, 0x00, 0x00, 0x00, 0x11, 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00,
++ 0x20, 0x00, 0x00, 0x00, 0x41, 0x00, 0x20, 0x00, 0x00, 0x00, 0x81, 0x00,
++ 0x20, 0x00, 0x00, 0x00, 0x01, 0x01, 0x20, 0x00, 0x00, 0x00, 0xff, 0x03,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x7f, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x7f, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0xfb, 0xf1, 0x01, 0x02,
++ 0x20, 0x00, 0xfb, 0xfb, 0x03, 0x02, 0x20, 0x00, 0x1b, 0x1b, 0x03, 0x02,
++ 0x20, 0x00, 0x1b, 0x03, 0x03, 0x02, 0x20, 0x00, 0x1b, 0x03, 0x03, 0x02,
++ 0x20, 0x00, 0x9b, 0x83, 0x01, 0x02, 0x20, 0x00, 0xfb, 0xc1, 0x01, 0x02,
++ 0x20, 0x00, 0xfb, 0xe0, 0x00, 0x02, 0x20, 0x18, 0x1b, 0x70, 0x00, 0x02,
++ 0x20, 0x18, 0x1b, 0x38, 0x00, 0x02, 0x20, 0xb8, 0x1b, 0x18, 0x00, 0x02,
++ 0x20, 0xf0, 0x19, 0xf8, 0x03, 0x02, 0x20, 0xe0, 0x18, 0xf8, 0x03, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x7f, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x7f, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
++ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03};
+diff -u -r --new-file xv-3.10a.orig/bits/br_mag xv-3.10a/bits/br_mag
+--- xv-3.10a.orig/bits/br_mag 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/bits/br_mag 2005-04-17 16:04:22.000000000 -0500
@@ -0,0 +1,27 @@
+#define br_mag_width 48
+#define br_mag_height 48
@@ -1196,9 +848,9 @@ diff -ruN xv-3.10a-bugfixes/bits/br_mag xv-3.10a-enhancements/bits/br_mag
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03};
-diff -ruN xv-3.10a-bugfixes/bits/br_maki xv-3.10a-enhancements/bits/br_maki
---- xv-3.10a-bugfixes/bits/br_maki 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/bits/br_maki 2005-04-17 14:04:22.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/bits/br_maki xv-3.10a/bits/br_maki
+--- xv-3.10a.orig/bits/br_maki 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/bits/br_maki 2005-04-17 16:04:22.000000000 -0500
@@ -0,0 +1,27 @@
+#define br_maki_width 48
+#define br_maki_height 48
@@ -1227,9 +879,9 @@ diff -ruN xv-3.10a-bugfixes/bits/br_maki xv-3.10a-enhancements/bits/br_maki
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03};
-diff -ruN xv-3.10a-bugfixes/bits/br_mgcsfx xv-3.10a-enhancements/bits/br_mgcsfx
---- xv-3.10a-bugfixes/bits/br_mgcsfx 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/bits/br_mgcsfx 2005-04-17 14:04:22.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/bits/br_mgcsfx xv-3.10a/bits/br_mgcsfx
+--- xv-3.10a.orig/bits/br_mgcsfx 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/bits/br_mgcsfx 2005-04-17 16:04:22.000000000 -0500
@@ -0,0 +1,27 @@
+#define br_mgcsfx_width 48
+#define br_mgcsfx_height 48
@@ -1258,9 +910,9 @@ diff -ruN xv-3.10a-bugfixes/bits/br_mgcsfx xv-3.10a-enhancements/bits/br_mgcsfx
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03};
-diff -ruN xv-3.10a-bugfixes/bits/br_pcd xv-3.10a-enhancements/bits/br_pcd
---- xv-3.10a-bugfixes/bits/br_pcd 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/bits/br_pcd 1995-06-15 21:31:53.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/bits/br_pcd xv-3.10a/bits/br_pcd
+--- xv-3.10a.orig/bits/br_pcd 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/bits/br_pcd 1995-06-15 23:31:53.000000000 -0500
@@ -0,0 +1,27 @@
+#define br_pcd_width 48
+#define br_pcd_height 48
@@ -1289,9 +941,9 @@ diff -ruN xv-3.10a-bugfixes/bits/br_pcd xv-3.10a-enhancements/bits/br_pcd
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03};
-diff -ruN xv-3.10a-bugfixes/bits/br_pi xv-3.10a-enhancements/bits/br_pi
---- xv-3.10a-bugfixes/bits/br_pi 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/bits/br_pi 2005-04-17 14:04:22.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/bits/br_pi xv-3.10a/bits/br_pi
+--- xv-3.10a.orig/bits/br_pi 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/bits/br_pi 2005-04-17 16:04:22.000000000 -0500
@@ -0,0 +1,27 @@
+#define br_pi_width 48
+#define br_pi_height 48
@@ -1320,9 +972,9 @@ diff -ruN xv-3.10a-bugfixes/bits/br_pi xv-3.10a-enhancements/bits/br_pi
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03};
-diff -ruN xv-3.10a-bugfixes/bits/br_pic xv-3.10a-enhancements/bits/br_pic
---- xv-3.10a-bugfixes/bits/br_pic 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/bits/br_pic 2005-04-17 14:04:22.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/bits/br_pic xv-3.10a/bits/br_pic
+--- xv-3.10a.orig/bits/br_pic 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/bits/br_pic 2005-04-17 16:04:22.000000000 -0500
@@ -0,0 +1,27 @@
+#define br_pic_width 48
+#define br_pic_height 48
@@ -1351,9 +1003,9 @@ diff -ruN xv-3.10a-bugfixes/bits/br_pic xv-3.10a-enhancements/bits/br_pic
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03};
-diff -ruN xv-3.10a-bugfixes/bits/br_pic2 xv-3.10a-enhancements/bits/br_pic2
---- xv-3.10a-bugfixes/bits/br_pic2 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/bits/br_pic2 2005-04-17 14:04:22.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/bits/br_pic2 xv-3.10a/bits/br_pic2
+--- xv-3.10a.orig/bits/br_pic2 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/bits/br_pic2 2005-04-17 16:04:22.000000000 -0500
@@ -0,0 +1,27 @@
+#define br_pic2_width 48
+#define br_pic2_height 48
@@ -1382,9 +1034,9 @@ diff -ruN xv-3.10a-bugfixes/bits/br_pic2 xv-3.10a-enhancements/bits/br_pic2
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03};
-diff -ruN xv-3.10a-bugfixes/bits/br_png xv-3.10a-enhancements/bits/br_png
---- xv-3.10a-bugfixes/bits/br_png 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/bits/br_png 1996-06-13 14:32:08.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/bits/br_png xv-3.10a/bits/br_png
+--- xv-3.10a.orig/bits/br_png 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/bits/br_png 1996-06-13 16:32:08.000000000 -0500
@@ -0,0 +1,28 @@
+#define br_png_width 48
+#define br_png_height 48
@@ -1414,9 +1066,9 @@ diff -ruN xv-3.10a-bugfixes/bits/br_png xv-3.10a-enhancements/bits/br_png
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03,
+ };
-diff -ruN xv-3.10a-bugfixes/bits/br_zx xv-3.10a-enhancements/bits/br_zx
---- xv-3.10a-bugfixes/bits/br_zx 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/bits/br_zx 1998-08-06 13:00:03.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/bits/br_zx xv-3.10a/bits/br_zx
+--- xv-3.10a.orig/bits/br_zx 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/bits/br_zx 1998-08-06 15:00:03.000000000 -0500
@@ -0,0 +1,28 @@
+#define br_zx_width 48
+#define br_zx_height 48
@@ -1446,2778 +1098,320 @@ diff -ruN xv-3.10a-bugfixes/bits/br_zx xv-3.10a-enhancements/bits/br_zx
+ 0x20, 0x00, 0x00, 0x84, 0x87, 0x03, 0x20, 0x00, 0x00, 0xc2, 0xc3, 0x03,
+ 0x20, 0x00, 0x00, 0xe1, 0xe1, 0x03, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03,
+ };
-diff -ruN xv-3.10a-bugfixes/config.h xv-3.10a-enhancements/config.h
---- xv-3.10a-bugfixes/config.h 2005-03-21 23:21:31.000000000 -0800
-+++ xv-3.10a-enhancements/config.h 2005-04-30 23:52:42.000000000 -0700
-@@ -6,26 +6,46 @@
- /***************************************************************************
- * GZIP'd file support
- *
-- * if you have the gnu uncompression utility 'gunzip', XV can use it to
-- * automatically 'unzip' any gzip'd files. To enable this feature,
-- * change 'undef' to 'define' in the following line. Needless to say, if
-- * your gunzip is installed elsewhere on your machine, change the 'GUNZIP'
-- * definition appropriately. (use 'which gunzip' to find if you have gunzip,
-- * and where it lives)
-+ * if you have the GNU uncompression utility 'gunzip' (or 'gzip' itself,
-+ * which is just a link to gunzip), XV can use it to automatically 'unzip'
-+ * any gzip'd files. To enable this feature, change 'undef' to 'define' in
-+ * the following line. Needless to say, if your gunzip is installed elsewhere
-+ * on your machine, change the 'GUNZIP' definition appropriately. (use
-+ * 'which gunzip' to find if you have gunzip, and where it lives; ditto for
-+ * gzip)
- */
--#undef USE_GUNZIP
-+#define USE_GUNZIP
-
- #ifdef USE_GUNZIP
- # ifdef VMS
- # define GUNZIP "UNCOMPRESS"
- # else
--/* define GUNZIP "/usr/local/bin/gunzip -q" */
--# define GUNZIP "/usr/bin/gzip -dq" /* more portable */
-+# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__)
-+# define GUNZIP "/usr/bin/gzip -dq"
-+# else
-+# define GUNZIP "/usr/local/bin/gzip -dq" /* is full path truly needed? */
-+# endif
- # endif
- #endif
-
-
- /***************************************************************************
-+ * BZIP2'd file support
-+ *
-+ * if you have the uncompression utility 'bunzip2' (or 'bzip2' itself, which
-+ * is just a link to bunzip2), XV can use it to automatically 'unzip' any
-+ * bzip2'd files. To enable this feature, change 'undef' to 'define' in the
-+ * following line (if not already done). Use 'which bunzip2' or 'which bzip2'
-+ * to find if you have bzip2/bunzip2, and where it lives.
-+ */
-+#define USE_BUNZIP2
-+
-+#ifdef USE_BUNZIP2
-+# define BUNZIP2 "bzip2 -d" /* should this include the full path? */
-+#endif
-+
-+
-+/***************************************************************************
- * compress'd file support
- *
- * if you have GUNZIP defined above, just ignore this, as 'gunzip' can
-@@ -38,7 +58,14 @@
- */
- #define UNCOMPRESS "/usr/ucb/uncompress"
-
--#if defined(hpux) || defined(SVR4) || defined(__386BSD__)
-+#if defined(hpux) || defined(SVR4) || \
-+ defined(__386BSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
-+ defined(__linux__)
-+ /*
-+ I want to use BSD macro for checking if this OS is *BSD or not,
-+ but the macro is defined in <sys/parm.h>, which I don't know all
-+ machine has or not.
-+ */
- # undef UNCOMPRESS
- # define UNCOMPRESS "/usr/bin/uncompress"
- #endif
-@@ -90,6 +117,7 @@
- */
-
- /* #define GS_PATH "/usr/local/bin/gs" */
-+#define GS_PATH "/usr/bin/gs"
- /* #define GS_LIB "." */
- /* #define GS_DEV "ppmraw" */
-
-@@ -120,3 +148,201 @@
-
- #define BACKING_STORE
-
-+
-+/***************************************************************************
-+ * PhotoCD/MAG/PIC/MAKI/Pi/PIC2/HIPS format Support:
-+ *
-+ * if, for whatever reason--say, security concerns--you don't want to
-+ * include support for one or more of the PhotoCD, MAG/MAKI/Pi/PIC/PIC2
-+ * (Japanese), or HIPS (astronomical) image formats, change the relevant
-+ * 'define' to 'undef' in the following lines. Conversely, if you *do*
-+ * want them, change 'undef' to 'define' as appropriate.
-+ */
-+
-+#define HAVE_PCD /* believed to be reasonably safe */
-+
-+#undef HAVE_MAG /* probable security issues */
-+#undef HAVE_MAKI /* probable security issues */
-+#undef HAVE_PI /* probable security issues */
-+#undef HAVE_PIC /* probable security issues */
-+#undef HAVE_PIC2 /* probable security issues */
-+
-+#undef HAVE_HIPS /* probable security issues */
-+
-+
-+/***************************************************************************
-+ * MacBinary file support:
-+ *
-+ * if you want XV to be able to handle ``MacBinary'' files (which have
-+ * 128 byte info file header at the head), change 'undef' to 'define'
-+ * in the following line.
-+ */
-+
-+#undef MACBINARY
-+
-+
-+/***************************************************************************
-+ * Auto Expand support:
-+ *
-+ * if you want to extract archived file automatically and regard it as
-+ * a directory, change 'undef' to 'define' in the AUTO_EXPAND line.
-+ *
-+ * Virtual Thumbdir support:
-+ *
-+ * if you want Virtual directory based Thumbdir(It means that XV
-+ * doesn't forget builded Icons still be quited even if the directory
-+ * is read-only), change 'undef' to 'define' the VIRTUAL_TD line.
-+ */
-+
-+#undef AUTO_EXPAND
-+#undef VIRTUAL_TD
-+
-+#if defined(VIRTUAL_TD) && !defined(AUTO_EXPAND)
-+# undef VIRTUAL_TD
-+#endif
-+
-+
-+/***************************************************************************
-+ * Adjust the aspect ratio of Icons:
-+ *
-+ * if you want to adjust the aspect ratio of the icons in Visual
-+ * Schnauzer, change 'undef' to 'define' in the following line.
-+ */
-+
-+#undef VS_ADJUST
-+
-+
-+/***************************************************************************
-+ * Restore original colormap:
-+ *
-+ * if you want to restore original colormap when icons in Visual
-+ * Shunauzer is double-clicked, change 'undef' to 'define' in the
-+ * following line.
-+ */
-+
-+#undef VS_RESCMAP
-+
-+
-+/***************************************************************************
-+ * TextViewer l10n support:
-+ *
-+ * if you want XV to show the text in Japanese on TextViewer, change
-+ * 'undef' to 'define' in the following line.
-+ */
-+
-+#undef TV_L10N
-+
-+#ifdef TV_L10N
-+/*
-+ * if you want to change the default code-set used in case that XV
-+ * fails to select correct code-set, uncomment the '#define
-+ * LOCALE_DEFAULT' line and change the 'LOCALE_DEFAULT' definition
-+ * appropriately.
-+ * (0:ASCII, 1:EUC-j, 2:JIS, 3:MS Kanji) */
-+
-+/* # define LOCALE_DEFAULT 0 */
-+
-+/*
-+ * Uncomment and edit the following lines, if your X Window System was
-+ * not compiled with -DX_LOCALE and you failed to display the Japanese
-+ * text in TextViewer. You don't have to write locale name of JIS code-set
-+ * and Microsoft code-set, if your system doesn't support those code-sets.
-+ */
-+
-+/*
-+# define LOCALE_NAME_EUC "ja_JP.EUC"
-+# define LOCALE_NAME_JIS "ja_JP.JIS"
-+# define LOCALE_NAME_MSCODE "ja_JP.SJIS"
-+*/
-+
-+/*
-+ * if your system doesn't have the Japanese fonts in the sizes,
-+ * Uncomment and edit the following font size entries.
-+ */
-+
-+/* # define TV_FONTSIZE 14,16,24 */
-+
-+/*
-+ * If you need, uncomment and modify the following font name.
-+ */
-+
-+/* # define TV_FONTSET "-*-fixed-medium-r-normal--%d-*" */
-+#endif /* TV_L10N */
-+
-+
-+/***************************************************************************
-+ * User definable filter support:
-+ *
-+ * Use the filters as input and output method for load and save unsupported
-+ * image format file. The filter command is recognized by definition of
-+ * magic number or suffix in "~/.xv_mgcsfx" .
-+ * To enable this feature, change 'undef' to 'define' in the following line.
-+ */
-+#undef HAVE_MGCSFX
-+
-+#ifdef HAVE_MGCSFX
-+/*
-+ * Support symbol 'auto' as <input image type> in startup file. This type
-+ * cannot use pipe as input; it writes to a temporary file and recognizes
-+ * the actual filetype by XV processing.
-+ */
-+# define HAVE_MGCSFX_AUTO
-+
-+/*
-+ * The startup file of definition for MgcSfx. 'MGCSFX_SITE_RC' is read
-+ * first and '~/MGCSFX_RC' is second. So same definitions in both files
-+ * are overridden by '~/MGCSFX_RC'
-+ * To define startup file, see the sample of startup file 'xv_mgcsfx.sample'.
-+ */
-+# define MGCSFX_SITE_RC "xv_mgcsfx"
-+# define MGCSFX_RC ".xv_mgcsfx"
-+
-+/*
-+ * If you want startup file to pass preprocessor in reading time, then
-+ * change 'undef' to 'define' in the following line.
-+ *
-+ * WARNING : If you decide to use preprocessor, you must not write
-+ * '# <comment>' style comment in startup file. Because,
-+ * preprocessor can't recognize. */
-+# undef USE_MGCSFX_PREPROCESSOR
-+
-+# ifdef USE_MGCSFX_PREPROCESSOR
-+/*
-+ * This is used like "system("MGCSFX_PREPROCESSOR MGCSFX_RC > tmp_name");",
-+ * and read tmp_name instead of MGCSFX_RC.
-+ */
-+# define MGCSFX_PREPROCESSOR "/usr/lib/cpp"
-+/* # define MGCSFX_PREPROCESSOR "cc -E" */
-+
-+# endif /* USE_MGCSFX_PREPROCESSOR */
-+
-+/*
-+ * Default string of command. If input command is required for undefined file,
-+ * dialog is popuped with 'MGCSFX_DEFAULT_INPUT_COMMAND'. And, if output
-+ * command is required in save dialog of MgcSfx, dialog is popuped with
-+ * 'MGCSFX_DEFAULT_OUTPUT_COMMAND'.
-+ *
-+ * WARNING : Now, supported only 'PNM' image format, when command input is
-+ * required. You should define filter which use 'PNM' image format
-+ * as input or output.
-+ */
-+# define MGCSFX_DEFAULT_INPUT_COMMAND "tifftopnm"
-+# define MGCSFX_DEFAULT_OUTPUT_COMMAND "pnmtotiff"
-+
-+#endif /* HAVE_MGCSFX */
-+
-+
-+/***************************************************************************
-+ * Multi-Lingual TextViewer
-+ *
-+ * if you want XV to show the text in multi-lingual on TextViewer, change
-+ * 'undef' to 'define' in the following line.
-+ */
-+
-+#undef TV_MULTILINGUAL
-+
-+#define TV_DEFAULT_CODESET TV_EUC_JAPAN
-+
-+#ifdef TV_MULTILINGUAL
-+# undef TV_L10N
-+#endif
-diff -ruN xv-3.10a-bugfixes/tiff/Makefile xv-3.10a-enhancements/tiff/Makefile
---- xv-3.10a-bugfixes/tiff/Makefile 2004-05-16 18:49:11.000000000 -0700
-+++ xv-3.10a-enhancements/tiff/Makefile 2005-04-17 14:45:28.000000000 -0700
-@@ -38,7 +38,7 @@
- IPATH= -I.
-
- COPTS= -O
--CFLAGS= ${COPTS} ${IPATH}
-+CFLAGS= ${COPTS} ${IPATH} -D_BSD_SOURCE
-
- INCS= tiff.h tiffio.h
-
-diff -ruN xv-3.10a-bugfixes/vdcomp.c xv-3.10a-enhancements/vdcomp.c
---- xv-3.10a-bugfixes/vdcomp.c 2005-03-20 17:48:59.000000000 -0800
-+++ xv-3.10a-enhancements/vdcomp.c 2005-04-17 22:59:39.000000000 -0700
-@@ -106,6 +106,7 @@
- !defined(pyr) && \
- !defined(__UMAXV__) && \
- !defined(bsd43) && \
-+ !defined(__bsd43) && \
- !defined(aux) && \
- !defined(__bsdi__) && \
- !defined(sequent) && \
-@@ -115,7 +116,14 @@
- # if defined(hp300) || defined(hp800) || defined(NeXT)
- # include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */
- # else
--# include <malloc.h>
-+# if !defined(__386BSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
-+ /*
-+ I want to use BSD macro for checking if this OS is *BSD or not,
-+ but the macro is defined in <sys/parm.h>, which I don't know all
-+ machine has or not.
-+ */
-+# include <malloc.h>
-+# endif
- # endif
- # endif
- #endif /* !VMS */
-diff -ruN xv-3.10a-bugfixes/xcmap.c xv-3.10a-enhancements/xcmap.c
---- xv-3.10a-bugfixes/xcmap.c 2005-03-20 15:51:59.000000000 -0800
-+++ xv-3.10a-enhancements/xcmap.c 2005-04-17 14:45:28.000000000 -0700
-@@ -163,7 +163,7 @@
- XSetBackground(theDisp,theGC,bcol);
-
- CreateMainWindow(cmd,geom,argc,argv);
-- Resize(WIDE,HIGH);
-+ Resize((int)WIDE,(int)HIGH);
-
- XSelectInput(theDisp, mainW, ExposureMask | KeyPressMask
- | StructureNotifyMask | ButtonPressMask);
-@@ -212,10 +212,10 @@
-
- case ConfigureNotify: {
- XConfigureEvent *conf_event = (XConfigureEvent *) event;
-+ int w = conf_event->width, h = conf_event->height;
-
-- if (conf_event->window == mainW &&
-- (conf_event->width != WIDE || conf_event->height != HIGH))
-- Resize(conf_event->width, conf_event->height);
-+ if (conf_event->window == mainW && (w != WIDE || h != HIGH))
-+ Resize((int)(w ? w : WIDE), (int)(h ? h : HIGH));
- }
- break;
-
-@@ -274,6 +274,8 @@
- WIDE = HIGH = 256; /* default window size */
-
- x=y=w=h=1;
-+ hints.flags = 0;
-+
- i=XParseGeometry(geom,&x,&y,&w,&h);
- if (i&WidthValue)
- {
-diff -ruN xv-3.10a-bugfixes/xv.c xv-3.10a-enhancements/xv.c
---- xv-3.10a-bugfixes/xv.c 2005-03-20 22:25:22.000000000 -0800
-+++ xv-3.10a-enhancements/xv.c 2005-05-01 13:33:25.000000000 -0700
-@@ -62,6 +62,19 @@
-
- static char basefname[128]; /* just the current fname, no path */
-
-+#ifdef TV_L10N
-+# ifndef TV_FONTSET
-+# define TV_FONTSET "-*-fixed-medium-r-normal--%d-*"
-+# endif
-+# ifndef TV_FONTSIZE
-+# define TV_FONTSIZE 14,16
-+# endif
-+
-+static int mfontsize[] = { TV_FONTSIZE, 0 };
-+static char mfontset[256];
-+#endif
-+
-+
- /* things to do upon successfully loading an image */
- static int autoraw = 0; /* force raw if using stdcmap */
- static int autodither = 0; /* dither */
-@@ -78,6 +91,12 @@
-
- static int force8 = 0; /* force 8-bit mode */
- static int force24 = 0; /* force 24-bit mode */
-+#ifdef HAVE_PCD
-+static int PcdSize = -1; /* force dialog to ask */
-+#endif
-+
-+static float waitsec_nonfinal = -1; /* "normal" waitsec value */
-+static float waitsec_final = -1; /* final-image waitsec value */
-
- /* used in DeleteCmd() and Quit() */
- static char **mainargv;
-@@ -103,7 +122,6 @@
- static void openNextLoop PARM((void));
- static void openPrevPic PARM((void));
- static void openNamedPic PARM((void));
--static int findRandomPic PARM((void));
- static void mainLoop PARM((void));
- static void createMainWindow PARM((char *, char *));
- static void setWinIconNames PARM((char *));
-@@ -120,16 +138,17 @@
- int imap, ctrlmap, gmap, browmap, cmtmap, clrroot, nopos, limit2x;
- char *display, *whitestr, *blackstr, *histr, *lostr,
- *infogeom, *fgstr, *bgstr, *ctrlgeom, *gamgeom, *browgeom, *tmpstr;
--char *rootfgstr, *rootbgstr, *visualstr, *textgeom, *cmtgeom;
-+char *rootfgstr, *rootbgstr, *imagebgstr, *visualstr, *textgeom, *cmtgeom;
- char *monofontname, *flistName;
-+#ifdef TV_L10N
-+char **misscharset, *defstr;
-+int nmisscharset;
-+#endif
- int curstype, stdinflag, browseMode, savenorm, preview, pscomp, preset,
- rmodeset, gamset, cgamset, perfect, owncmap, rwcolor, stdcmap;
- int nodecor;
- double gamval, rgamval, ggamval, bgamval;
-
--
--
--
- /*******************************************/
- int main(argc, argv)
- int argc;
-@@ -137,6 +156,9 @@
- /*******************************************/
- {
- int i;
-+#ifdef TV_L10N
-+ int j;
-+#endif
- XColor ecdef;
- Window rootReturn, parentReturn, *children;
- unsigned int numChildren, rootDEEP;
-@@ -153,6 +175,13 @@
- /*** variable Initialization ***/
- /*****************************************************/
-
-+#ifdef TV_L10N
-+ /* setlocale(LC_ALL, localeList[LOCALE_EUCJ]); */
-+ setlocale(LC_ALL, "");
-+ xlocale = (int)XSupportsLocale(); /* assume that (Bool) is (int) */
-+ /* if X doesn't support ja_JP.ujis text viewer l10n doesn't work. */
-+#endif
-+
- xv_getwd(initdir, sizeof(initdir));
- searchdir[0] = '\0';
- fullfname[0] = '\0';
-@@ -162,7 +191,7 @@
-
- /* init internal variables */
- display = NULL;
-- fgstr = bgstr = rootfgstr = rootbgstr = NULL;
-+ fgstr = bgstr = rootfgstr = rootbgstr = imagebgstr = NULL;
- histr = lostr = whitestr = blackstr = NULL;
- visualstr = monofontname = flistName = NULL;
- winTitle = NULL;
-@@ -180,6 +209,7 @@
- autoclose = autoDelete = 0;
- cmapInGam = 0;
- grabDelay = 0;
-+ startGrab = 0;
- showzoomcursor = 0;
- perfect = owncmap = stdcmap = rwcolor = 0;
-
-@@ -228,6 +258,10 @@
- if (!tmpdir) FatalError("can't malloc 'tmpdir'\n");
- strcpy(tmpdir, tmpstr);
- }
-+#ifdef AUTO_EXPAND
-+ Vdinit();
-+ vd_handler_setup();
-+#endif
-
- /* init command-line options flags */
- infogeom = DEFINFOGEOM; ctrlgeom = DEFCTRLGEOM;
-@@ -238,7 +272,7 @@
- ninstall = 0; fixedaspect = 0; noFreeCols = nodecor = 0;
- DEBUG = 0; bwidth = 2;
- nolimits = useroot = clrroot = noqcheck = 0;
-- waitsec = -1; waitloop = 0; automax = 0;
-+ waitsec = waitsec_final = -1.0; waitloop = 0; automax = 0;
- rootMode = 0; hsvmode = 0;
- rmodeset = gamset = cgamset = 0;
- nopos = limit2x = 0;
-@@ -251,6 +285,10 @@
- preset = 0;
- viewonly = 0;
-
-+#ifdef ENABLE_FIXPIX_SMOOTH
-+ do_fixpix_smooth = 0;
-+#endif
-+
- /* init 'xormasks' array */
- xorMasks[0] = 0x01010101;
- xorMasks[1] = 0x02020203;
-@@ -277,6 +315,24 @@
- tiffW = (Window) NULL; tiffUp = 0;
- #endif
-
-+#ifdef HAVE_PNG
-+ pngW = (Window) NULL; pngUp = 0;
-+#endif
-+
-+ pcdW = (Window) NULL; pcdUp = 0;
-+
-+#ifdef HAVE_PIC2
-+ pic2W = (Window) NULL; pic2Up = 0;
-+#endif
-+
-+#ifdef HAVE_PCD
-+ pcdW = (Window) NULL; pcdUp = 0;
-+#endif
-+
-+#ifdef HAVE_MGCSFX
-+ mgcsfxW = (Window) NULL; mgcsfxUp = 0;
-+#endif
-+
- imap = ctrlmap = gmap = browmap = cmtmap = 0;
-
- ch_offx = ch_offy = p_offx = p_offy = 0;
-@@ -303,13 +359,35 @@
- verifyArgs();
-
-
-+#if 0
-+#ifdef XVEXECPATH
-+ /* set up path to search for external executables */
-+ {
-+ char *systempath = getenv("PATH");
-+ char *xvexecpath = getenv("XVPATH");
-+ if (xvexecpath == NULL) xvexecpath = XVEXECPATH;
-+ /* FIXME: can systempath == NULL? */
-+ strcat(systempath, ":"); /* FIXME: writing to mem we don't own */
-+ strcat(systempath, xvexecpath); /* FIXME: writing to mem we don't own */
-+ /* FIXME: was there supposed to be a setenv() call in here? */
-+ if (DEBUG)
-+ fprintf(stderr, "DEBUG: executable search path: %s\n", systempath);
-+ }
-+#endif
-+#endif
-+
-+
- /*****************************************************/
- /*** X Setup ***/
- /*****************************************************/
-
- theScreen = DefaultScreen(theDisp);
- theCmap = DefaultColormap(theDisp, theScreen);
-- rootW = RootWindow(theDisp,theScreen);
-+ if (spec_window) {
-+ rootW = spec_window;
-+ } else {
-+ rootW = RootWindow(theDisp,theScreen);
-+ }
- theGC = DefaultGC(theDisp,theScreen);
- theVisual = DefaultVisual(theDisp,theScreen);
- ncells = DisplayCells(theDisp, theScreen);
-@@ -320,7 +398,7 @@
-
- rootDEEP = dispDEEP;
-
-- /* things dependant on theVisual:
-+ /* things dependent on theVisual:
- * dispDEEP, theScreen, rootW, ncells, theCmap, theGC,
- * vrWIDE, dispWIDE, vrHIGH, dispHIGH, maxWIDE, maxHIGH
- */
-@@ -500,6 +578,7 @@
- arrow = XCreateFontCursor(theDisp,(u_int) curstype);
- cross = XCreateFontCursor(theDisp,XC_crosshair);
- tcross = XCreateFontCursor(theDisp,XC_tcross);
-+ tlcorner = XCreateFontCursor(theDisp,XC_top_left_corner);
- zoom = XCreateFontCursor(theDisp,XC_sizing);
-
- {
-@@ -575,6 +654,18 @@
- xvAllocColor(theDisp, theCmap, &ecdef)) rootbg = ecdef.pixel;
-
-
-+ /* GRR 19980308: set up image bg color (for transparent images) */
-+ have_imagebg = 0;
-+ if (imagebgstr && XParseColor(theDisp, theCmap, imagebgstr, &ecdef) &&
-+ xvAllocColor(theDisp, theCmap, &ecdef)) {
-+ /* imagebg = ecdef.pixel; */
-+ have_imagebg = 1;
-+ imagebgR = ecdef.red;
-+ imagebgG = ecdef.green;
-+ imagebgB = ecdef.blue;
-+ }
-+
-+
- /* set up hi/lo colors */
- i=0;
- if (dispDEEP > 1) { /* only if we're on a reasonable display */
-@@ -664,6 +755,61 @@
-
- monofont=monofinfo->fid;
-
-+#ifdef TV_L10N
-+ if (xlocale) {
-+ i = 0;
-+ while (mfontsize[i]) {
-+ xlocale = 1; /* True */
-+
-+ sprintf(mfontset, TV_FONTSET, mfontsize[i]);
-+/*fprintf(stderr, "FontSet: %s\n", mfontset);*/
-+
-+ monofset = XCreateFontSet(theDisp, mfontset,
-+ &misscharset, &nmisscharset, &defstr);
-+# if 0 /* not useful */
-+ if (!monofset) {
-+ /* the current locale is not supported */
-+/*fprintf(stderr, "Current locale `%s' is not supported.\n", localeList[i]);*/
-+ xlocale = 0;
-+ break;
-+ }
-+# endif
-+/*fprintf(stderr, "# of misscharset in mfontsize[%d]: %d\n", i,nmisscharset);*/
-+
-+ for (j = 0; j < nmisscharset; j++) {
-+ if (!strncmp(misscharset[j], "jisx0208", 8)) {
-+ /* font for JIS X 0208 is not found */
-+ xlocale = 0;
-+ break;
-+ }
-+ }
+diff -u -r --new-file xv-3.10a.orig/contrib/fedora/Build-FC5 xv-3.10a/contrib/fedora/Build-FC5
+--- xv-3.10a.orig/contrib/fedora/Build-FC5 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/contrib/fedora/Build-FC5 2006-06-01 10:12:47.000000000 -0500
+@@ -0,0 +1,56 @@
++#!/bin/bash
++#
++# prep and build XV for FC5
++#
++# adapted from Slackware 10.2 -- john.cooper@third-harmonic.com
++#
+
-+ if (xlocale) {
-+ monofsetinfo = XExtentsOfFontSet(monofset);
-+ monofsetinfo->max_logical_extent.width = mfontsize[i];
-+ /* correct size of TextViewer
-+ in case that JIS X 0208 is not found */
-+ break;
-+ }
++if [ ${1}foo == "__LOGGED__foo" ]; then
++ shift
++else
++ for i in `seq 0 9`
++ do
++ if [ -e ${0}.log.$((9-i)) ]; then
++ mv ${0}.log.$((9-i)) ${0}.log.$((9-i+1))
++ fi
++ done
+
-+ i++;
-+ } /* while (mfontsize[i]) */
++ exec $0 __LOGGED__ $@ 2>&1 | tee $BUILDDIR/$0.log.0
++ exit $?
++fi
+
-+# if 0
-+ if (nmisscharset > 0) {
-+ sprintf(str,"missing %d charset:\n", nmisscharset);
-+ for (i = 0; i < nmisscharset; i++) {
-+ sprintf(str, "%s\t%s\n", str, misscharset[i]);
-+ }
-+# if 0
-+ FatalError(str);
-+# else
-+ fprintf(stderr, "%s", str);
-+# endif
-+ }
-+# endif
-+ }
-+#endif /* TV_L10N */
-
-
-
-@@ -693,6 +839,18 @@
- }
- else namelist[0] = NULL;
- }
-+ else if (randomShow) {
-+ int i, j;
-+ char *tmp;
++SOURCE=`pwd`
++if [ "$BUILD" = "" ]; then
++ BUILD=./build
++fi
+
-+ srandom((int)time((time_t *)0));
-+ for (i = numnames; i > 1; i--) {
-+ j = random() % i;
-+ tmp = namelist[i-1];
-+ namelist[i-1] = namelist[j];
-+ namelist[j] = tmp;
-+ }
-+ }
-
- if (numnames) makeDispNames();
-
-@@ -796,6 +954,25 @@
- XSetTransientForHint(theDisp, tiffW, dirW);
- #endif
-
-+#ifdef HAVE_PNG
-+ CreatePNGW();
-+ XSetTransientForHint(theDisp, pngW, dirW);
-+#endif
++if [ ! -d $BUILD ]; then
++ mkdir -p $BUILD
++fi
+
-+#ifdef HAVE_PCD
-+ CreatePCDW();
-+ XSetTransientForHint(theDisp, pcdW, dirW);
-+#endif
++PFLAGS="--verbose --backup --suffix=.orig"
+
-+#ifdef HAVE_PIC2
-+ CreatePIC2W();
-+ XSetTransientForHint(theDisp, pic2W, dirW);
-+#endif
-+
-+#ifdef HAVE_MGCSFX
-+ CreateMGCSFXW();
-+ XSetTransientForHint(theDisp, mgcsfxW, dirW);
-+#endif
-
- LoadFishCursors();
- SetCursors(-1);
-@@ -964,7 +1141,11 @@
-
- dispDEEP = vinfo[best].depth;
- theScreen = vinfo[best].screen;
-- rootW = RootWindow(theDisp, theScreen);
-+ if (spec_window) {
-+ rootW = spec_window;
-+ } else {
-+ rootW = RootWindow(theDisp,theScreen);
-+ }
- ncells = vinfo[best].colormap_size;
- theCmap = XCreateColormap(theDisp, rootW, theVisual, AllocNone);
-
-@@ -1095,6 +1276,9 @@
-
- if (rd_str ("fileList")) flistName = def_str;
- if (rd_flag("fixed")) fixedaspect = def_int;
-+#ifdef ENABLE_FIXPIX_SMOOTH
-+ if (rd_flag("fixpix")) do_fixpix_smooth = def_int;
-+#endif
- if (rd_flag("force8")) force8 = def_int;
- if (rd_flag("force24")) force24 = def_int;
- if (rd_str ("foreground")) fgstr = def_str;
-@@ -1106,21 +1290,37 @@
- if (rd_str ("highlight")) histr = def_str;
- if (rd_str ("iconGeometry")) icongeom = def_str;
- if (rd_flag("iconic")) startIconic = def_int;
-+ if (rd_str ("imageBackground")) imagebgstr = def_str;
- if (rd_str ("infoGeometry")) infogeom = def_str;
- if (rd_flag("infoMap")) imap = def_int;
- if (rd_flag("loadBrowse")) browseMode = def_int;
- if (rd_str ("lowlight")) lostr = def_str;
-+#ifdef MACBINARY
-+ if (rd_flag("macbinary")) handlemacb = def_int;
-+#endif
-+#ifdef HAVE_MGCSFX
-+ if (rd_flag("mgcsfx")) mgcsfx = def_int;
-+#endif
- if (rd_flag("mono")) mono = def_int;
- if (rd_str ("monofont")) monofontname = def_str;
- if (rd_int ("ncols")) ncols = def_int;
- if (rd_flag("ninstall")) ninstall = def_int;
- if (rd_flag("nodecor")) nodecor = def_int;
- if (rd_flag("nolimits")) nolimits = def_int;
-+#ifdef HAVE_MGCSFX
-+ if (rd_flag("nomgcsfx")) nomgcsfx = def_int;
-+#endif
-+#if defined(HAVE_PIC) || defined(HAVE_PIC2)
-+ if (rd_flag("nopicadjust")) nopicadjust = def_int;
-+#endif
- if (rd_flag("nopos")) nopos = def_int;
- if (rd_flag("noqcheck")) noqcheck = def_int;
- if (rd_flag("nostat")) nostat = def_int;
- if (rd_flag("ownCmap")) owncmap = def_int;
- if (rd_flag("perfect")) perfect = def_int;
-+#ifdef HAVE_PIC2
-+ if (rd_flag("pic2split")) pic2split = def_int;
-+#endif
- if (rd_flag("popupKludge")) winCtrPosKludge = def_int;
- if (rd_str ("print")) strncpy(printCmd, def_str,
- (size_t) PRINTCMDLEN);
-@@ -1138,6 +1338,9 @@
- if (rd_str ("textviewGeometry")) textgeom = def_str;
- if (rd_flag("useStdCmap")) stdcmap = def_int;
- if (rd_str ("visual")) visualstr = def_str;
-+#ifdef VS_ADJUST
-+ if (rd_flag("vsadjust")) vsadjust = def_int;
-+#endif
- if (rd_flag("vsDisable")) novbrowse = def_int;
- if (rd_str ("vsGeometry")) browgeom = def_str;
- if (rd_flag("vsMap")) browmap = def_int;
-@@ -1172,7 +1375,13 @@
- }
-
- if (numnames<MAXNAMES) {
-+#ifdef AUTO_EXPAND
-+ if(Isarchive(argv[i]) == 0){ /* Not archive file */
-+ namelist[numnames++] = argv[i];
++function bail()
++ {
++ echo "$0: failed $1"
++ exit 1
+ }
-+#else
- namelist[numnames++] = argv[i];
-+#endif
- if (numnames==MAXNAMES) {
- fprintf(stderr,"%s: too many filenames. Only using first %d.\n",
- cmd, MAXNAMES);
-@@ -1198,6 +1407,14 @@
- }
- }
-
-+ else if (!argcmp(argv[i],"-windowid",3,0,&pm)) {
-+ if (++i<argc) {
-+ if (sscanf(argv[i], "%ld", &spec_window) != 1) {
-+ fprintf(stderr,"%s: bad argument to -windowid '%s'\n",cmd,argv[i]);
-+ }
-+ }
-+ }
-+
- else if (!argcmp(argv[i],"-best24",3,0,&pm)) /* -best */
- conv24 = CONV24_BEST;
-
-@@ -1289,7 +1506,11 @@
- else if (!argcmp(argv[i],"-fg",3,0,&pm)) /* fg color */
- { if (++i<argc) fgstr = argv[i]; }
-
-- else if (!argcmp(argv[i],"-fixed",3,1,&fixedaspect)); /* fix asp. ratio */
-+ else if (!argcmp(argv[i],"-fixed",5,1,&fixedaspect)); /* fix asp. ratio */
-+
-+#ifdef ENABLE_FIXPIX_SMOOTH
-+ else if (!argcmp(argv[i],"-fixpix",5,1,&do_fixpix_smooth)); /* dithering */
-+#endif
-
- else if (!argcmp(argv[i],"-flist",3,0,&pm)) /* file list */
- { if (++i<argc) flistName = argv[i]; }
-@@ -1330,6 +1551,10 @@
- { if (++i<argc) infogeom = argv[i]; }
-
- else if (!argcmp(argv[i],"-imap", 3,1,&imap)); /* imap */
-+
-+ else if (!argcmp(argv[i],"-ibg",3,0,&pm)) /* GRR: image background color */
-+ { if (++i<argc) imagebgstr = argv[i]; }
-+
- else if (!argcmp(argv[i],"-lbrowse", 3,1,&browseMode)); /* browse mode */
-
- else if (!argcmp(argv[i],"-lo",3,0,&pm)) /* lowlight */
-@@ -1354,9 +1579,17 @@
- else if (!argcmp(argv[i],"-maxpect",5,1,&pm)) /* auto maximize */
- { automax=pm; fixedaspect=pm; }
-
-+#ifdef MACBINARY
-+ else if (!argcmp(argv[i],"-macbinary",3,1,&handlemacb)); /* macbinary */
-+#endif
-+
- else if (!argcmp(argv[i],"-mfn",3,0,&pm)) /* mono font name */
- { if (++i<argc) monofontname = argv[i]; }
-
-+#ifdef HAVE_MGCSFX
-+ else if (!argcmp(argv[i],"-mgcsfx", 4,1,&mgcsfx)); /* mgcsfx */
-+#endif
-+
- else if (!argcmp(argv[i],"-mono",3,1,&mono)); /* mono */
-
- else if (!argcmp(argv[i],"-name",3,0,&pm)) /* name */
-@@ -1365,17 +1598,30 @@
- else if (!argcmp(argv[i],"-ncols",3,0,&pm)) /* ncols */
- { if (++i<argc) ncols=abs(atoi(argv[i])); }
-
-- else if (!argcmp(argv[i],"-ninstall", 3,1,&ninstall)); /* inst cmaps?*/
-+ else if (!argcmp(argv[i],"-ninstall", 3,1,&ninstall)); /* inst cmaps? */
- else if (!argcmp(argv[i],"-nodecor", 4,1,&nodecor));
- else if (!argcmp(argv[i],"-nofreecols",4,1,&noFreeCols));
- else if (!argcmp(argv[i],"-nolimits", 4,1,&nolimits)); /* nolimits */
-+#ifdef HAVE_MGCSFX
-+ else if (!argcmp(argv[i],"-nomgcsfx", 4,1,&nomgcsfx)); /* nomgcsfx */
-+#endif
-+#if defined(HAVE_PIC) || defined(HAVE_PIC2)
-+ else if (!argcmp(argv[i],"-nopicadjust", 4,1,&nopicadjust));/*nopicadjust*/
-+#endif
- else if (!argcmp(argv[i],"-nopos", 4,1,&nopos)); /* nopos */
- else if (!argcmp(argv[i],"-noqcheck", 4,1,&noqcheck)); /* noqcheck */
-- else if (!argcmp(argv[i],"-noresetroot",5,1,&resetroot)); /* reset root*/
-+ else if (!argcmp(argv[i],"-noresetroot",5,1,&resetroot)); /* reset root */
- else if (!argcmp(argv[i],"-norm", 5,1,&autonorm)); /* norm */
- else if (!argcmp(argv[i],"-nostat", 4,1,&nostat)); /* nostat */
- else if (!argcmp(argv[i],"-owncmap", 2,1,&owncmap)); /* own cmap */
-+#ifdef HAVE_PCD
-+ else if (!argcmp(argv[i],"-pcd", 4,0,&pm)) /* pcd with size */
-+ { if (i+1<argc) PcdSize = atoi(argv[++i]); }
-+#endif
- else if (!argcmp(argv[i],"-perfect", 3,1,&perfect)); /* -perfect */
-+#ifdef HAVE_PIC2
-+ else if (!argcmp(argv[i],"-pic2split", 3,1,&pic2split)); /* pic2split */
-+#endif
- else if (!argcmp(argv[i],"-pkludge", 3,1,&winCtrPosKludge));
- else if (!argcmp(argv[i],"-poll", 3,1,&polling)); /* chk mod? */
-
-@@ -1418,6 +1664,7 @@
- conv24 = CONV24_SLOW;
-
- else if (!argcmp(argv[i],"-smooth",3,1,&autosmooth)); /* autosmooth */
-+ else if (!argcmp(argv[i],"-startgrab",3,1,&startGrab)); /* startGrab */
- else if (!argcmp(argv[i],"-stdcmap",3,1,&stdcmap)); /* use stdcmap */
-
- else if (!argcmp(argv[i],"-tgeometry",2,0,&pm)) /* textview geom */
-@@ -1429,6 +1676,10 @@
- else if (!argcmp(argv[i],"-visual",4,0,&pm)) /* visual */
- { if (++i<argc) visualstr = argv[i]; }
-
-+#ifdef VS_ADJUST
-+ else if (!argcmp(argv[i],"-vsadjust", 3,1,&vsadjust)); /* vsadjust */
-+#endif
-+
- else if (!argcmp(argv[i],"-vsdisable",4,1,&novbrowse)); /* disable sch? */
-
- else if (!argcmp(argv[i],"-vsgeometry",4,0,&pm)) /* visSchnauzer geom */
-@@ -1440,8 +1691,9 @@
-
- else if (!argcmp(argv[i],"-wait",3,0,&pm)) { /* secs betwn pics */
- if (++i<argc) {
-- waitsec = abs(atoi(argv[i]));
-- if (waitsec<0) waitsec = 0;
-+ char *comma = strchr(argv[i], ',');
-+ waitsec_nonfinal = fabs(atof(argv[i]));
-+ waitsec_final = comma? fabs(atof(comma+1)) : waitsec_nonfinal;
- }
- }
-
-@@ -1467,7 +1719,11 @@
- /* check options for validity */
-
- if (strlen(searchdir)) { /* got a search directory */
-+#ifdef AUTO_EXPAND
-+ if (Chvdir(searchdir)) {
-+#else
- if (chdir(searchdir)) {
-+#endif
- fprintf(stderr,"xv: unable to cd to directory '%s'.\n",searchdir);
- fprintf(stderr,
- " Ignoring '-dir' option and/or 'xv.searchDirectory' resource\n");
-@@ -1514,7 +1770,7 @@
- preset = 0;
- }
-
-- if (waitsec < 0) noFreeCols = 0; /* disallow nfc if not doing slideshow */
-+ if (waitsec < 0.0) noFreeCols = 0; /* disallow nfc if not doing slideshow */
- if (noFreeCols && perfect) { perfect = 0; owncmap = 1; }
-
- /* decide what default color allocation stuff we've settled on */
-@@ -1556,6 +1812,20 @@
-
- static void cmdSyntax()
- {
-+ /* GRR 19980605: added version info for most common libraries */
-+ fprintf(stderr, "XV - %s.\n", REVDATE);
-+#ifdef HAVE_JPEG
-+ VersionInfoJPEG();
-+#endif
-+#ifdef HAVE_TIFF
-+ VersionInfoTIFF();
-+#endif
-+#ifdef HAVE_PNG
-+ VersionInfoPNG();
-+#endif
-+ /* pbm/pgm/ppm support is native, not via pbmplus/netpbm libraries */
-+ fprintf(stderr, "\n");
-+
- fprintf(stderr, "Usage:\n");
- printoption(cmd);
- printoption("[-]");
-@@ -1595,6 +1865,9 @@
- printoption("[-expand exp | hexp:vexp]");
- printoption("[-fg color]");
- printoption("[-/+fixed]");
-+#ifdef ENABLE_FIXPIX_SMOOTH
-+ printoption("[-/+fixpix]");
-+#endif
- printoption("[-flist fname]");
- printoption("[-gamma val]");
- printoption("[-geometry geom]");
-@@ -1607,6 +1880,7 @@
- printoption("[-hi color]");
- printoption("[-/+hist]");
- printoption("[-/+hsv]");
-+ printoption("[-ibg color]"); /* GRR 19980314 */
- printoption("[-icgeometry geom]");
- printoption("[-/+iconic]");
- printoption("[-igeometry geom]");
-@@ -1614,9 +1888,15 @@
- printoption("[-/+lbrowse]");
- printoption("[-lo color]");
- printoption("[-/+loadclear]");
-+#ifdef MACBINARY
-+ printoption("[-/+macbinary]");
-+#endif
- printoption("[-/+max]");
- printoption("[-/+maxpect]");
- printoption("[-mfn font]");
-+#ifdef HAVE_MGCSFX
-+ printoption("[-/+mgcsfx]");
-+#endif
- printoption("[-/+mono]");
- printoption("[-name str]");
- printoption("[-ncols #]");
-@@ -1624,13 +1904,25 @@
- printoption("[-/+nodecor]");
- printoption("[-/+nofreecols]");
- printoption("[-/+nolimits]");
-+#ifdef HAVE_MGCSFX
-+ printoption("[-/+nomgcsfx]");
-+#endif
-+#if defined(HAVE_PIC) || defined(HAVE_PIC2)
-+ printoption("[-/+nopicadjust]");
-+#endif
- printoption("[-/+nopos]");
- printoption("[-/+noqcheck]");
- printoption("[-/+noresetroot]");
- printoption("[-/+norm]");
- printoption("[-/+nostat]");
- printoption("[-/+owncmap]");
-+#ifdef HAVE_PCD
-+ printoption("[-pcd size(0=192*128,1,2,3,4=3072*2048)]");
-+#endif
- printoption("[-/+perfect]");
-+#ifdef HAVE_PIC2
-+ printoption("[-/+pic2split]");
-+#endif
- printoption("[-/+pkludge]");
- printoption("[-/+poll]");
- printoption("[-preset #]");
-@@ -1649,17 +1941,22 @@
- printoption("[-/+rw]");
- printoption("[-slow24]");
- printoption("[-/+smooth]");
-+ printoption("[-/+startgrab]");
- printoption("[-/+stdcmap]");
- printoption("[-tgeometry geom]");
- printoption("[-/+vflip]");
- printoption("[-/+viewonly]");
- printoption("[-visual type]");
-+#ifdef VS_ADJUST
-+ printoption("[-/+vsadjust]");
-+#endif
- printoption("[-/+vsdisable]");
- printoption("[-vsgeometry geom]");
- printoption("[-/+vsmap]");
- printoption("[-/+vsperfect]");
-- printoption("[-wait seconds]");
-+ printoption("[-wait secs[,final_secs]]");
- printoption("[-white color]");
-+ printoption("[-windowid windowid]");
- printoption("[-/+wloop]");
- printoption("[filename ...]");
- fprintf(stderr,"\n\n");
-@@ -1682,6 +1979,7 @@
- fprintf(stderr,"\t7: centered on a 'brick' background\n");
- fprintf(stderr,"\t8: symmetrical tiling\n");
- fprintf(stderr,"\t9: symmetrical mirrored tiling\n");
-+ fprintf(stderr,"\t10: upper left corner\n");
- fprintf(stderr,"\n");
- Quit(1);
- }
-@@ -1694,7 +1992,7 @@
- int *plusminus;
- {
- /* does a string compare between a1 and a2. To return '0', a1 and a2
-- must match to the length of a2, and that length has to
-+ must match to the length of a1, and that length has to
- be at least 'minlen'. Otherwise, return non-zero. plusminus set to '1'
- if '-option', '0' if '+option' */
-
-@@ -1734,6 +2032,10 @@
- char *tmp;
- char *fullname, /* full name of the original file */
- filename[512]; /* full name of file to load (could be /tmp/xxx)*/
-+#ifdef MACBINARY
-+ char origname[512]; /* file name of original file (NO processing) */
-+ origname[0] = '\0';
-+#endif
-
- xvbzero((char *) &pinfo, sizeof(PICINFO));
-
-@@ -1866,8 +2168,22 @@
- frompipe = 1;
- }
- }
-+#ifdef AUTO_EXPAND
-+ else {
-+ fullname = (char *) malloc(MAXPATHLEN+2);
-+ strcpy(fullname, namelist[filenum]);
-+ freename = 1;
-+ }
-+ tmp = (char *) rindex(fullname, '/');
-+ if (tmp) {
-+ *tmp = '\0';
-+ Mkvdir(fullname);
-+ *tmp = '/';
-+ }
-+ Dirtovd(fullname);
-+#else
- else fullname = namelist[filenum];
--
-+#endif
-
- strcpy(fullfname, fullname);
- tmp = BaseName(fullname);
-@@ -1875,18 +2191,20 @@
-
-
- /* chop off trailing ".Z", ".z", or ".gz" from displayed basefname, if any */
-- if (strlen(basefname) > (size_t) 2 &&
-- strcmp(basefname+strlen(basefname)-2,".Z")==0)
-+ if (strlen(basefname)>2 && strcmp(basefname+strlen(basefname)-2,".Z")==0)
- basefname[strlen(basefname)-2]='\0';
- else {
- #ifdef GUNZIP
-- if (strlen(basefname)>2 && strcmp(basefname+strlen(basefname)-2,".Z")==0)
-+ if (strlen(basefname)>2 && strcmp(basefname+strlen(basefname)-2,".z")==0)
- basefname[strlen(basefname)-2]='\0';
--
-- else if (strlen(basefname)>3 &&
-- strcmp(basefname+strlen(basefname)-3,".gz")==0)
-+ else
-+ if (strlen(basefname)>3 && strcmp(basefname+strlen(basefname)-3,".gz")==0)
- basefname[strlen(basefname)-3]='\0';
--#endif /* GUNZIP */
-+#endif
-+#ifdef BUNZIP2
-+ if (strlen(basefname)>4 && strcmp(basefname+strlen(basefname)-4,".bz2")==0)
-+ basefname[strlen(basefname)-4]='\0';
-+#endif
- }
-
-
-@@ -1973,6 +2291,9 @@
-
- if (strcmp(filename,STDINSTR)==0) {
- FILE *fp = NULL;
-+#ifndef USE_MKSTEMP
-+ int tmpfd;
-+#endif
-
- #ifndef VMS
- sprintf(filename,"%s/xvXXXXXX",tmpdir);
-@@ -1984,13 +2305,18 @@
- fp = fdopen(mkstemp(filename), "w");
- #else
- mktemp(filename);
-- fp = fopen(filename, "w");
-+ tmpfd = open(filename,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) FatalError("openPic(): can't create temporary file");
-+ fp = fdopen(tmpfd,"w");
- #endif
- if (!fp) FatalError("openPic(): can't write temporary file");
-
- clearerr(stdin);
- while ( (i=getchar()) != EOF) putc(i,fp);
- fclose(fp);
-+#ifndef USE_MKSTEMP
-+ close(tmpfd);
-+#endif
-
- /* and remove it from list, since we can never reload from stdin */
- if (strcmp(namelist[0], STDINSTR)==0) deleteFromList(0);
-@@ -2005,15 +2331,21 @@
- (no pipes or stdin, though it could be compressed) to be loaded */
- filetype = ReadFileType(filename);
-
-+#ifdef HAVE_MGCSFX
-+ if (mgcsfx && filetype == RFT_UNKNOWN){ /* force use MgcSfx */
-+ if(getInputCom() != 0) filetype = RFT_MGCSFX;
-+ }
-+#endif
-
-- if (filetype == RFT_COMPRESS) { /* a compressed file. uncompress it */
-+ /* if it's a compressed file, uncompress it: */
-+ if ((filetype == RFT_COMPRESS) || (filetype == RFT_BZIP2)) {
- char tmpname[128];
-
- if (
- #ifndef VMS
-- UncompressFile(filename, tmpname)
-+ UncompressFile(filename, tmpname, filetype)
- #else
-- UncompressFile(basefname, tmpname)
-+ UncompressFile(basefname, tmpname, filetype)
- #endif
- ) {
-
-@@ -2029,6 +2361,57 @@
- WaitCursor();
- }
-
-+#ifdef MACBINARY
-+ if (handlemacb && macb_file == True) {
-+ char tmpname[128];
-+
-+ if (RemoveMacbinary(filename, tmpname)) {
-+ if (strcmp(fullname,filename)!=0) unlink(filename);
-+ strcpy(origname, filename);
-+ strcpy(filename, tmpname);
-+ }
-+ else filetype = RFT_ERROR;
-+
-+ WaitCursor();
-+ }
-+#endif
-+
-+#ifdef HAVE_MGCSFX_AUTO
-+ if (filetype == RFT_MGCSFX) {
-+ char tmpname[128], tmp[256];
-+ char *icom;
-+
-+ if ((icom = mgcsfx_auto_input_com(filename)) != NULL) {
-+ sprintf(tmpname, "%s/xvmsautoXXXXXX", tmpdir);
-+#ifdef USE_MKSTEMP
-+ close(mkstemp(tmpname));
-+#else
-+ mktemp(tmpname);
-+#endif
-+ SetISTR(ISTR_INFO, "Converting to known format by MgcSfx auto...");
-+ sprintf(tmp,"%s >%s", icom, tmpname);
-+ }
-+ else goto ms_auto_no;
-+
-+#ifndef VMS
-+ if (system(tmp))
-+#else
-+ if (!system(tmp))
-+#endif
-+ {
-+ SetISTR(ISTR_INFO, "Unable to convert '%s' by MgcSfx auto.",
-+ BaseName(filename));
-+ Warning();
-+ filetype = RFT_ERROR;
-+ goto ms_auto_no;
-+ }
-+
-+ filetype = ReadFileType(tmpname);
-+ if (strcmp(fullname,filename)!=0) unlink(filename);
-+ strcpy(filename, tmpname);
-+ }
-+ms_auto_no:
-+#endif /* HAVE_MGCSFX_AUTO */
-
- if (filetype == RFT_ERROR) {
- char foostr[512];
-@@ -2042,10 +2425,16 @@
-
- if (filetype == RFT_UNKNOWN) {
- /* view as a text/hex file */
-- TextView(filename);
-+#ifdef MACBINARY
-+ if (origname[0])
-+ i = TextView(origname);
-+ else
-+#endif
-+ i = TextView(filename);
- SetISTR(ISTR_INFO,"'%s' not in a recognized format.", basefname);
- /* Warning(); */
-- goto SHOWN_AS_TEXT;
-+ if (i) goto SHOWN_AS_TEXT;
-+ else goto FAILED;
- }
-
- if (filetype < RFT_ERROR) {
-@@ -2073,8 +2462,9 @@
- if (filetype == RFT_XBM && (!i || pinfo.w==0 || pinfo.h==0)) {
- /* probably just a '.h' file or something... */
- SetISTR(ISTR_INFO," ");
-- TextView(filename);
-- goto SHOWN_AS_TEXT;
-+ i = TextView(filename);
-+ if (i) goto SHOWN_AS_TEXT;
-+ else goto FAILED;
- }
-
- if (!i) {
-@@ -2209,12 +2599,15 @@
- if (fullname && strcmp(fullname,filename)!=0) unlink(filename);
-
-
-- SetISTR(ISTR_INFO,formatStr);
-+ SetISTR(ISTR_INFO, "%s", formatStr);
-
- SetInfoMode(INF_PART);
-- SetISTR(ISTR_FILENAME, "%s",
-- (filenum==DFLTPIC || filenum==GRABBED || frompipe) ?
-- "<none>" : basefname);
-+ if (filenum==DFLTPIC || filenum==GRABBED || frompipe)
-+ SetISTR(ISTR_FILENAME, "<none>");
-+ else if (numPages > 1)
-+ SetISTR(ISTR_FILENAME, "%s Page %d of %d", basefname, curPage+1, numPages);
-+ else
-+ SetISTR(ISTR_FILENAME, "%s", basefname);
-
- SetISTR(ISTR_RES,"%d x %d",pWIDE,pHIGH);
- SetISTR(ISTR_COLOR, "");
-@@ -2424,7 +2817,7 @@
- if (autodither && ncols>0) epicMode = EM_DITH;
-
- /* if in CM_STDCMAP mode, and *not* in '-wait 0', then autodither */
-- if (colorMapMode == CM_STDCMAP && waitsec != 0) epicMode = EM_DITH;
-+ if (colorMapMode == CM_STDCMAP && waitsec != 0.0) epicMode = EM_DITH;
-
- /* if -smooth or image has been shrunk to fit screen */
- if (autosmooth || (pWIDE >maxWIDE || pHIGH>maxHIGH)
-@@ -2510,7 +2903,11 @@
- to generate the correct exposes (particularly with 'BitGravity' turned
- on */
-
-- if (mainW && !useroot) GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
-+ /*Brian T. Schellenberger: fix for X 4.2 refresh problem*/
-+ if (mainW && !useroot) {
-+ XSync(theDisp, False);
-+ GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
-+ }
-
- return 1;
-
-@@ -2542,6 +2939,9 @@
- }
-
-
-+extern byte ZXheader[128]; /* [JCE] Spectrum screen magic number is
-+ defined in xvzx.c */
-+
-
- /********************************/
- int ReadFileType(fname)
-@@ -2554,76 +2954,105 @@
-
- FILE *fp;
- byte magicno[30]; /* first 30 bytes of file */
-- int rv, n;
-+ int rv=RFT_UNKNOWN, n;
-+#ifdef MACBINARY
-+ int macbin_alrchk = False;
-+#endif
-
- if (!fname) return RFT_ERROR; /* shouldn't happen */
-
- fp = xv_fopen(fname, "r");
- if (!fp) return RFT_ERROR;
-
-+ if (strlen(fname) > 4 &&
-+ strcasecmp(fname+strlen(fname)-5, ".wbmp")==0) rv = RFT_WBMP;
-+
- n = fread(magicno, (size_t) 1, (size_t) 30, fp);
- fclose(fp);
-
-- if (n<30) return RFT_UNKNOWN; /* files less than 30 bytes long... */
-+ if (n<30) return rv; /* files less than 30 bytes long... */
-
-- rv = RFT_UNKNOWN;
-+#ifdef MACBINARY
-+ macb_file = False;
-+ while (1) {
-+#endif
-
-- if (strncmp((char *) magicno,"GIF87a", (size_t) 6)==0 ||
-- strncmp((char *) magicno,"GIF89a", (size_t) 6)==0) rv = RFT_GIF;
-+#ifdef HAVE_MGCSFX
-+ if (is_mgcsfx(fname, magicno, 30) != 0) rv = RFT_MGCSFX;
-+ else
-+#endif
-+ if (strncmp((char *) magicno,"GIF87a", (size_t) 6)==0 ||
-+ strncmp((char *) magicno,"GIF89a", (size_t) 6)==0) rv = RFT_GIF;
-
- else if (strncmp((char *) magicno,"VIEW", (size_t) 4)==0 ||
-- strncmp((char *) magicno,"WEIV", (size_t) 4)==0) rv = RFT_PM;
-+ strncmp((char *) magicno,"WEIV", (size_t) 4)==0) rv = RFT_PM;
-+
-+#ifdef HAVE_PIC2
-+ else if (magicno[0]=='P' && magicno[1]=='2' &&
-+ magicno[2]=='D' && magicno[3]=='T') rv = RFT_PIC2;
-+#endif
-
- else if (magicno[0] == 'P' && magicno[1]>='1' &&
-- magicno[1]<='6') rv = RFT_PBM;
-+ (magicno[1]<='6' || magicno[1]=='8')) rv = RFT_PBM;
-
- /* note: have to check XPM before XBM, as first 2 chars are the same */
- else if (strncmp((char *) magicno, "/* XPM */", (size_t) 9)==0) rv = RFT_XPM;
-
- else if (strncmp((char *) magicno,"#define", (size_t) 7)==0 ||
-- (magicno[0] == '/' && magicno[1] == '*')) rv = RFT_XBM;
-+ (magicno[0] == '/' && magicno[1] == '*')) rv = RFT_XBM;
-
- else if (magicno[0]==0x59 && (magicno[1]&0x7f)==0x26 &&
-- magicno[2]==0x6a && (magicno[3]&0x7f)==0x15) rv = RFT_SUNRAS;
-+ magicno[2]==0x6a && (magicno[3]&0x7f)==0x15) rv = RFT_SUNRAS;
-
-- else if (magicno[0] == 'B' && magicno[1] == 'M') rv = RFT_BMP;
-+ else if (magicno[0] == 'B' && magicno[1] == 'M') rv = RFT_BMP;
-
-- else if (magicno[0]==0x52 && magicno[1]==0xcc) rv = RFT_UTAHRLE;
-+ else if (magicno[0]==0x52 && magicno[1]==0xcc) rv = RFT_UTAHRLE;
-
- else if ((magicno[0]==0x01 && magicno[1]==0xda) ||
-- (magicno[0]==0xda && magicno[1]==0x01)) rv = RFT_IRIS;
-+ (magicno[0]==0xda && magicno[1]==0x01)) rv = RFT_IRIS;
-
-- else if (magicno[0]==0x1f && magicno[1]==0x9d) rv = RFT_COMPRESS;
-+ else if (magicno[0]==0x1f && magicno[1]==0x9d) rv = RFT_COMPRESS;
-
- #ifdef GUNZIP
-- else if (magicno[0]==0x1f && magicno[1]==0x8b) rv = RFT_COMPRESS;
-+ else if (magicno[0]==0x1f && magicno[1]==0x8b) rv = RFT_COMPRESS;
- #endif
-
-- else if (magicno[0]==0x0a && magicno[1] <= 5) rv = RFT_PCX;
-+#ifdef BUNZIP2
-+ else if (magicno[0]==0x42 && magicno[1]==0x5a) rv = RFT_BZIP2;
-+#endif
-+
-+ else if (magicno[0]==0x0a && magicno[1] <= 5) rv = RFT_PCX;
-
- else if (strncmp((char *) magicno, "FORM", (size_t) 4)==0 &&
-- strncmp((char *) magicno+8, "ILBM", (size_t) 4)==0) rv = RFT_IFF;
-+ strncmp((char *) magicno+8, "ILBM", (size_t) 4)==0) rv = RFT_IFF;
-
- else if (magicno[0]==0 && magicno[1]==0 &&
- magicno[2]==2 && magicno[3]==0 &&
- magicno[4]==0 && magicno[5]==0 &&
-- magicno[6]==0 && magicno[7]==0) rv = RFT_TARGA;
-+ magicno[6]==0 && magicno[7]==0) rv = RFT_TARGA;
-
- else if (magicno[4]==0x00 && magicno[5]==0x00 &&
-- magicno[6]==0x00 && magicno[7]==0x07) rv = RFT_XWD;
-+ magicno[6]==0x00 && magicno[7]==0x07) rv = RFT_XWD;
-
- else if (strncmp((char *) magicno,"SIMPLE ", (size_t) 8)==0 &&
-- magicno[29] == 'T') rv = RFT_FITS;
-+ magicno[29] == 'T') rv = RFT_FITS;
-
-+ /* [JCE] Spectrum screen */
-+ else if (memcmp(magicno, ZXheader, (size_t) 18)==0) rv = RFT_ZX;
-
- #ifdef HAVE_JPEG
- else if (magicno[0]==0xff && magicno[1]==0xd8 &&
-- magicno[2]==0xff) rv = RFT_JFIF;
-+ magicno[2]==0xff) rv = RFT_JFIF;
- #endif
-
- #ifdef HAVE_TIFF
- else if ((magicno[0]=='M' && magicno[1]=='M') ||
-- (magicno[0]=='I' && magicno[1]=='I')) rv = RFT_TIFF;
-+ (magicno[0]=='I' && magicno[1]=='I')) rv = RFT_TIFF;
-+#endif
-+
-+#ifdef HAVE_PNG
-+ else if (magicno[0]==0x89 && magicno[1]=='P' &&
-+ magicno[2]=='N' && magicno[3]=='G') rv = RFT_PNG;
- #endif
-
- #ifdef HAVE_PDS
-@@ -2635,11 +3064,59 @@
- rv = RFT_PDSVICAR;
- #endif
-
--#ifdef GS_PATH
-+#ifdef GS_PATH /* Ghostscript handles both PostScript and PDF */
- else if (strncmp((char *) magicno, "%!", (size_t) 2)==0 ||
-- strncmp((char *) magicno, "\004%!", (size_t) 3)==0) rv = RFT_PS;
-+ strncmp((char *) magicno, "\004%!", (size_t) 3)==0 ||
-+ strncmp((char *) magicno, "%PDF", (size_t) 4)==0) rv = RFT_PS;
- #endif
-
-+#ifdef HAVE_MAG
-+ else if (strncmp((char *) magicno,"MAKI02 ", (size_t) 8)==0) rv = RFT_MAG;
-+#endif
-+
-+#ifdef HAVE_MAKI
-+ else if (strncmp((char *) magicno,"MAKI01A ", (size_t) 8)==0 ||
-+ strncmp((char *) magicno,"MAKI01B ", (size_t) 8)==0) rv = RFT_MAKI;
-+#endif
-+
-+#ifdef HAVE_PIC
-+ else if (magicno[0]=='P' && magicno[1]=='I'&&magicno[2]=='C') rv = RFT_PIC;
-+#endif
-+
-+#ifdef HAVE_PI
-+ else if (magicno[0]=='P' && magicno[1]=='i') rv = RFT_PI;
-+#endif
-+
-+#ifdef HAVE_HIPS
-+ else if (strstr((char *) magicno, "./digest")) rv = RFT_HIPS;
-+#endif
-+
-+#ifdef HAVE_PCD
-+ else if (magicno[0]==0xff && magicno[1]==0xff &&
-+ magicno[2]==0xff && magicno[3]==0xff) rv = RFT_PCD;
-+#endif
-+
-+#ifdef MACBINARY
-+ /* Now we try to handle MacBinary files, but the method is VERY dirty... */
-+ if (macbin_alrchk == True) {
-+ macb_file = True;
-+ break;
-+ }
-+
-+ if (rv != RFT_UNKNOWN)
-+ break;
-+
-+ /* Skip MACBSIZE and recheck */
-+ macbin_alrchk = True;
-+ fp = xv_fopen(fname, "r");
-+ if (!fp) return RFT_ERROR;
-+ fseek(fp, MACBSIZE, SEEK_SET);
-+ n = fread(magicno, (size_t) 1, (size_t) 30, fp);
-+ fclose(fp);
-+
-+ if (n<30) return RFT_UNKNOWN; /* files less than 30 bytes long... */
-+ }
-+#endif
- return rv;
- }
-
-@@ -2652,9 +3129,10 @@
- PICINFO *pinfo;
- {
- /* if quick is set, we're being called to generate icons, or something
-- like that. We should load the image as quickly as possible. Currently,
-- this only affects the LoadPS routine, which, if quick is set, only
-- generates the page file for the first page of the document */
-+ like that. We should load the image as quickly as possible. Previously,
-+ this affected only the LoadPS routine, which, if quick is set, only
-+ generates the page file for the first page of the document. Now it
-+ also affects PCD, which loads only a thumbnail. */
-
- int rv = 0;
-
-@@ -2665,7 +3143,11 @@
- switch (ftype) {
- case RFT_GIF: rv = LoadGIF (fname, pinfo); break;
- case RFT_PM: rv = LoadPM (fname, pinfo); break;
-+#ifdef HAVE_MGCSFX
-+ case RFT_PBM: rv = LoadPBM (fname, pinfo, -1); break;
-+#else
- case RFT_PBM: rv = LoadPBM (fname, pinfo); break;
-+#endif
- case RFT_XBM: rv = LoadXBM (fname, pinfo); break;
- case RFT_SUNRAS: rv = LoadSunRas(fname, pinfo); break;
- case RFT_BMP: rv = LoadBMP (fname, pinfo); break;
-@@ -2677,21 +3159,60 @@
- case RFT_XPM: rv = LoadXPM (fname, pinfo); break;
- case RFT_XWD: rv = LoadXWD (fname, pinfo); break;
- case RFT_FITS: rv = LoadFITS (fname, pinfo, quick); break;
-+ case RFT_ZX: rv = LoadZX (fname, pinfo); break; /* [JCE] */
-+ case RFT_WBMP: rv = LoadWBMP (fname, pinfo); break;
-+
-+#ifdef HAVE_PCD
-+ /* if quick is switched on, use the smallest image size; don't ask the user */
-+ case RFT_PCD: rv = LoadPCD (fname, pinfo, quick ? 0 : PcdSize); break;
-+#endif
-
- #ifdef HAVE_JPEG
-- case RFT_JFIF: rv = LoadJFIF (fname, pinfo, quick); break;
-+ case RFT_JFIF: rv = LoadJFIF (fname, pinfo, quick); break;
- #endif
-
- #ifdef HAVE_TIFF
-- case RFT_TIFF: rv = LoadTIFF (fname, pinfo, quick); break;
-+ case RFT_TIFF: rv = LoadTIFF (fname, pinfo, quick); break;
-+#endif
-+
-+#ifdef HAVE_PNG
-+ case RFT_PNG: rv = LoadPNG (fname, pinfo); break;
- #endif
-
- #ifdef HAVE_PDS
-- case RFT_PDSVICAR: rv = LoadPDS (fname, pinfo); break;
-+ case RFT_PDSVICAR: rv = LoadPDS (fname, pinfo); break;
- #endif
-
- #ifdef GS_PATH
-- case RFT_PS: rv = LoadPS (fname, pinfo, quick); break;
-+ case RFT_PS: rv = LoadPS (fname, pinfo, quick); break;
-+#endif
-+
-+#ifdef HAVE_MAG
-+ case RFT_MAG: rv = LoadMAG (fname, pinfo); break;
-+#endif
-+
-+#ifdef HAVE_MAKI
-+ case RFT_MAKI: rv = LoadMAKI (fname, pinfo); break;
-+#endif
-+
-+#ifdef HAVE_PIC
-+ case RFT_PIC: rv = LoadPIC (fname, pinfo); break;
-+#endif
-+
-+#ifdef HAVE_PI
-+ case RFT_PI: rv = LoadPi (fname, pinfo); break;
-+#endif
-+
-+#ifdef HAVE_PIC2
-+ case RFT_PIC2: rv = LoadPIC2 (fname, pinfo, quick); break;
-+#endif
-+
-+#ifdef HAVE_HIPS
-+ case RFT_HIPS: rv = LoadHIPS (fname, pinfo); break;
-+#endif
-+
-+#ifdef HAVE_MGCSFX
-+ case RFT_MGCSFX: rv = LoadMGCSFX (fname, pinfo); break;
- #endif
-
- }
-@@ -2700,13 +3221,17 @@
-
-
- /********************************/
--int UncompressFile(name, uncompname)
-+int UncompressFile(name, uncompname, filetype)
- char *name, *uncompname;
-+ int filetype;
- {
- /* returns '1' on success, with name of uncompressed file in uncompname
- returns '0' on failure */
-
- char namez[128], *fname, buf[512];
-+#ifndef USE_MKSTEMP
-+ int tmpfd;
-+#endif
-
- fname = name;
- namez[0] = '\0';
-@@ -2746,15 +3271,23 @@
- close(mkstemp(uncompname));
- #else
- mktemp(uncompname);
-+ tmpfd = open(uncompname,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) FatalError("UncompressFile(): can't create temporary file");
-+ close(tmpfd);
- #endif
-
- #ifndef VMS
-- sprintf(buf,"%s -c %s >%s", UNCOMPRESS, fname, uncompname);
-+ if (filetype == RFT_COMPRESS)
-+ sprintf(buf,"%s -c '%s' > '%s'", UNCOMPRESS, fname, uncompname);
-+# ifdef BUNZIP2
-+ else if (filetype == RFT_BZIP2)
-+ sprintf(buf,"%s -c '%s' > '%s'", BUNZIP2, fname, uncompname);
-+# endif
- #else /* it IS VMS */
- # ifdef GUNZIP
-- sprintf(buf,"%s %s %s", UNCOMPRESS, fname, uncompname);
-+ sprintf(buf,"%s '%s' '%s'", UNCOMPRESS, fname, uncompname);
- # else
-- sprintf(buf,"%s %s", UNCOMPRESS, fname);
-+ sprintf(buf,"%s '%s'", UNCOMPRESS, fname);
- # endif
- #endif
-
-@@ -2797,6 +3330,62 @@
- }
-
-
-+#ifdef MACBINARY
-+/********************************/
-+int RemoveMacbinary(src, dst)
-+ char *src, *dst;
-+{
-+ char buffer[8192]; /* XXX */
-+ int n, eof;
-+#ifndef USE_MKSTEMP
-+ int tmpfd;
-+#endif
-+ FILE *sfp, *dfp;
-+
-+ sprintf(dst, "%s/xvmXXXXXX", tmpdir);
-+#ifdef USE_MKSTEMP
-+ close(mkstemp(dst));
-+#else
-+ mktemp(dst);
-+ tmpfd = open(dst,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) FatalError("RemoveMacbinary(): can't create temporary file");
-+#endif
-+
-+ SetISTR(ISTR_INFO, "Removing MacBinary...");
-+
-+ sfp = xv_fopen(src, "r");
-+#ifdef USE_MKSTEMP
-+ dfp = xv_fopen(dst, "w");
-+#else
-+ dfp = fdopen(tmpfd, "w");
-+#endif
-+ if (!sfp || !dfp) {
-+ SetISTR(ISTR_INFO, "Unable to remove a InfoFile header form '%s'.", src);
-+ Warning();
-+ return 0;
-+ }
-+ fseek(sfp, MACBSIZE, SEEK_SET);
-+ while ((n = fread(buffer, 1, sizeof(buffer), sfp)) == 8192) /* XXX */
-+ fwrite(buffer, 1, n, dfp);
-+ if ((eof = feof(sfp)))
-+ fwrite(buffer, 1, n, dfp);
-+ fclose(sfp);
-+ fflush(dfp);
-+ fclose(dfp);
-+#ifndef USE_MKSTEMP
-+ close(tmpfd);
-+#endif
-+ if (!eof) {
-+ SetISTR(ISTR_INFO, "Unable to remove a InfoFile header form '%s'.", src);
-+ Warning();
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+#endif
-+
-+
- /********************************/
- void KillPageFiles(bname, numpages)
- char *bname;
-@@ -2918,6 +3507,9 @@
-
- char fullcmd[512], tmpname[64], str[512];
- int i;
-+#ifndef USE_MKSTEMP
-+ int tmpfd;
-+#endif
-
- if (!cmd || (strlen(cmd) < (size_t) 2)) return 1;
-
-@@ -2926,6 +3518,9 @@
- close(mkstemp(tmpname));
- #else
- mktemp(tmpname);
-+ tmpfd = open(tmpname,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) FatalError("openPic(): can't create temporary file");
-+ close(tmpfd);
- #endif
- if (tmpname[0] == '\0') { /* mktemp() or mkstemp() blew up */
- sprintf(str,"Unable to create temporary filename.");
-@@ -2966,26 +3561,21 @@
- {
- int i;
-
-+ waitsec = (numnames <= 1)? waitsec_final : waitsec_nonfinal;
-+
- if (!numnames) { openPic(DFLTPIC); return; }
-
- i = 0;
-- if (!randomShow) {
-- while (numnames>0) {
-- if (openPic(0)) return; /* success */
-- else {
-- if (polling && !i)
-- fprintf(stderr,"%s: POLLING: Waiting for file '%s' \n\tto %s\n",
-- cmd, namelist[0], "be created, or whatever...");
-- i = 1;
-- }
-+ while (numnames>0) {
-+ if (openPic(0)) return; /* success */
-+ else {
-+ if (polling && !i)
-+ fprintf(stderr,"%s: POLLING: Waiting for file '%s' \n\tto %s\n",
-+ cmd, namelist[0], "be created, or whatever...");
-+ i = 1;
- }
- }
-
-- else { /* pick random first picture */
-- for (i=findRandomPic(); i>=0; i=findRandomPic())
-- if (openPic(i)) return; /* success */
-- }
--
- if (numnames>1) FatalError("couldn't open any pictures");
- else Quit(-1);
- }
-@@ -3014,19 +3604,15 @@
- {
- int i;
-
-- if (!randomShow) {
-- if (curname>=0) i = curname+1;
-- else if (nList.selected >= 0 && nList.selected < numnames)
-- i = nList.selected;
-- else i = 0;
-+ if (curname>=0) i = curname+1;
-+ else if (nList.selected >= 0 && nList.selected < numnames)
-+ i = nList.selected;
-+ else i = 0;
-
-- while (i<numnames && !openPic(i));
-- if (i<numnames) return; /* success */
-- }
-- else {
-- for (i=findRandomPic(); i>=0; i=findRandomPic())
-- if (openPic(i)) return;
-- }
-+ waitsec = (i == numnames-1)? waitsec_final : waitsec_nonfinal;
-+
-+ while (i<numnames && !openPic(i));
-+ if (i<numnames) return; /* success */
-
- Quit(0);
- }
-@@ -3039,25 +3625,21 @@
-
- j = loop = 0;
- while (1) {
-- if (!randomShow) {
-
-- if (curname>=0) i = curname+1;
-- else if (nList.selected >= 0 && nList.selected < numnames)
-- i = nList.selected;
-- else i = 0;
-+ if (curname>=0) i = curname+1;
-+ else if (nList.selected >= 0 && nList.selected < numnames)
-+ i = nList.selected;
-+ else i = 0;
-
-- if (loop) { i = 0; loop = 0; }
-+ if (loop) { i = 0; loop = 0; }
-
-- while (i<numnames && !openPic(i));
-- if (i<numnames) return;
-- }
-- else {
-- for (i=findRandomPic(); i>=0; i=findRandomPic())
-- if (openPic(i)) return;
-- }
-+ waitsec = (i == numnames-1)? waitsec_final : waitsec_nonfinal;
-+
-+ while (i<numnames && !openPic(i));
-+ if (i<numnames) return;
-
- loop = 1; /* back to top of list */
-- if (j) break; /* we're in a 'failure loop' */
-+ if (j) break; /* we're in a 'failure loop' */
- j++;
- }
-
-@@ -3090,47 +3672,6 @@
- openPic(LOADPIC);
- }
-
--
--
--
--/****************/
--static int findRandomPic()
--/****************/
--{
-- static byte *loadList;
-- static int left_to_load, listLen = -1;
-- int k;
-- time_t t;
--
-- /* picks a random name out of the list, and returns it's index. If there
-- are no more names to pick, it returns '-1' and resets itself */
--
-- if (!loadList || numnames!=listLen) {
-- if (loadList) free(loadList);
-- else {
-- time(&t);
-- srandom((unsigned int) t); /* seed the random */
-- }
--
-- left_to_load = listLen = numnames;
-- loadList = (byte *) malloc((size_t) listLen);
-- for (k=0; k<listLen; k++) loadList[k] = 0;
-- }
--
-- if (left_to_load <= 0) { /* we've loaded all the pics */
-- for (k=0; k<listLen; k++) loadList[k] = 0; /* clear flags */
-- left_to_load = listLen;
-- return -1; /* 'done' return */
-- }
--
-- for (k=abs(random()) % listLen; loadList[k]; k = (k+1) % listLen);
--
-- left_to_load--;
-- loadList[k] = TRUE;
--
-- return k;
--}
--
- /****************/
- static void mainLoop()
- {
-@@ -3144,10 +3685,11 @@
- selected file (or the 0th file, if no selection either), and 'Prev' means
- view the one right before the selected file */
-
-- openFirstPic(); /* find first displayable picture, exit if none */
-+ /* find first displayable picture, exit if none */
-+ if (!startGrab) openFirstPic();
-
- if (!pic) { /* must've opened a text file... display dflt pic */
-- openPic(DFLTPIC);
-+ if (!startGrab) openPic(DFLTPIC);
- if (mainW && !useroot) RaiseTextWindows();
- }
-
-@@ -3224,8 +3766,16 @@
- hints.flags = 0;
- if ((i&XValue || i&YValue)) hints.flags = USPosition;
-
-- if (i&XValue && i&XNegative) x = vrWIDE - eWIDE - abs(x);
-- if (i&YValue && i&YNegative) y = vrHIGH - eHIGH - abs(y);
-+ hints.win_gravity = NorthWestGravity;
-+ if (i&XValue && i&XNegative) {
-+ hints.win_gravity = NorthEastGravity;
-+ x = vrWIDE - (eWIDE + 2 * bwidth) - abs(x);
-+ }
-+ if (i&YValue && i&YNegative) {
-+ hints.win_gravity = (hints.win_gravity == NorthWestGravity) ?
-+ SouthWestGravity : SouthEastGravity;
-+ y = vrHIGH - (eHIGH + 2 * bwidth) - abs(y);
-+ }
-
- if (x+eWIDE > vrWIDE) x = vrWIDE - eWIDE; /* keep on screen */
- if (y+eHIGH > vrHIGH) y = vrHIGH - eHIGH;
-@@ -3245,7 +3795,7 @@
- hints.x = x; hints.y = y;
- hints.width = eWIDE; hints.height = eHIGH;
- hints.max_width = maxWIDE; hints.max_height = maxHIGH;
-- hints.flags |= USSize | PMaxSize;
-+ hints.flags |= USSize | PMaxSize | PWinGravity;
-
- xswa.bit_gravity = StaticGravity;
- xswa.background_pixel = bg;
-@@ -3294,10 +3844,6 @@
- }
- }
-
--
-- XSetStandardProperties(theDisp,mainW,"","",None,NULL,0,&hints);
-- setWinIconNames(name);
--
- xwmh.input = True;
- xwmh.flags = InputHint;
-
-@@ -3322,12 +3868,13 @@
- }
- }
- }
-- XSetWMHints(theDisp, mainW, &xwmh);
-
- classh.res_name = "xv";
- classh.res_class = "XVroot";
-- XSetClassHint(theDisp, mainW, &classh);
-
-+ XmbSetWMProperties(theDisp, mainW, NULL, NULL, NULL, 0, &hints, &xwmh,
-+ &classh);
-+ setWinIconNames(name);
-
- if (nodecor) { /* turn of image window decorations (in MWM) */
- Atom mwm_wm_hints;
-@@ -4070,16 +4617,30 @@
- unsigned long nitems, nleft;
- byte *data;
-
-- i = XGetWindowProperty(theDisp, RootWindow(theDisp, 0),
-- resAtom, 0L, 1L, False,
-- XA_STRING, &actType, &actFormat, &nitems, &nleft,
-- (unsigned char **) &data);
-+ if (spec_window) {
-+ i = XGetWindowProperty(theDisp, spec_window,
-+ resAtom, 0L, 1L, False,
-+ XA_STRING, &actType, &actFormat, &nitems, &nleft,
-+ (unsigned char **) &data);
-+ } else {
-+ i = XGetWindowProperty(theDisp, RootWindow(theDisp, 0),
-+ resAtom, 0L, 1L, False,
-+ XA_STRING, &actType, &actFormat, &nitems, &nleft,
-+ (unsigned char **) &data);
-+ }
- if (i==Success && actType==XA_STRING && actFormat==8) {
- if (nitems>0 && data) XFree(data);
-- i = XGetWindowProperty(theDisp, RootWindow(theDisp, 0), resAtom, 0L,
-- (long) ((nleft+4+3)/4),
-- False, XA_STRING, &actType, &actFormat,
-- &nitems, &nleft, (unsigned char **) &data);
-+ if (spec_window) {
-+ i = XGetWindowProperty(theDisp, spec_window, resAtom, 0L,
-+ (long) ((nleft+4+3)/4),
-+ False, XA_STRING, &actType, &actFormat,
-+ &nitems, &nleft, (unsigned char **) &data);
-+ } else {
-+ i = XGetWindowProperty(theDisp, RootWindow(theDisp, 0), resAtom, 0L,
-+ (long) ((nleft+4+3)/4),
-+ False, XA_STRING, &actType, &actFormat,
-+ &nitems, &nleft, (unsigned char **) &data);
-+ }
- if (i==Success && actType==XA_STRING && actFormat==8 && data) {
- def_resource = XrmGetStringDatabase((char *) data);
- XFree(data);
-diff -ruN xv-3.10a-bugfixes/xv.h xv-3.10a-enhancements/xv.h
---- xv-3.10a-bugfixes/xv.h 2005-04-10 09:37:18.000000000 -0700
-+++ xv-3.10a-enhancements/xv.h 2005-05-01 13:32:10.000000000 -0700
-@@ -14,8 +14,9 @@
- /* GRR orig jumbo enhancements patch: 20000220 */
- /* GRR 1st public jumbo F+E patches: 20040531 */
- /* GRR 2nd public jumbo F+E patches: 20050410 */
--#define REVDATE "version 3.10a-jumboFix of 20050410"
--#define VERSTR "3.10a-20050410"
-+/* GRR 3rd public jumbo F+E patches: 20050501 */
-+#define REVDATE "version 3.10a-jumboFix+Enh of 20050501"
-+#define VERSTR "3.10a-20050501"
-
- /*
- * uncomment the following, and modify for your site, but only if you've
-@@ -49,6 +50,10 @@
- /* START OF MACHINE-DEPENDENT CONFIGURATION INFO */
- /*************************************************/
-
-+
-+#define ENABLE_FIXPIX_SMOOTH /* GRR 19980607 */
-+
-+
- /* Things to make xv more likely to just build, without the user tweaking
- the makefile */
-
-@@ -67,6 +72,14 @@
- # define SVR4
- #endif
-
-+#if defined(__sony_news) && defined(bsd43) && !defined(__bsd43)
-+# define __bsd43
-+#elif defined(__sony_news) && (defined(SYSTYPE_BSD) || defined(__SYSTYPE_BSD)) && !defined(bsd43) && !defined(__bsd43)
-+# define bsd43
-+# define __bsd43
-+#endif
-+
-+#include <signal.h> /* for interrupt handling */
-
- /* at least on Linux, the following file (1) includes sys/types.h and
- * (2) defines __USE_BSD (which was not defined before here), so __linux__
-@@ -78,7 +91,9 @@
- # ifndef _LINUX_LIMITS_H
- # include <linux/limits.h>
- # endif
--# define USLEEP
-+# ifndef USLEEP
-+# define USLEEP
-+# endif
- /* want only one or the other defined, not both: */
- # if !defined(BSDTYPES) && !defined(__USE_BSD)
- # define BSDTYPES
-@@ -117,6 +132,16 @@
- #endif
-
-
-+#if defined(__sony_news) && defined(__bsd43)
-+# include <unistd.h>
-+#endif
-+
-+
-+#if defined(__FreeBSD__)
-+# include <sys/param.h>
-+#endif
-+
-+
- /* include files */
- #include <stdio.h>
- #include <math.h>
-@@ -132,9 +157,11 @@
-
- #ifndef VMS
- # include <errno.h>
-- extern int errno; /* SHOULD be in errno.h, but often isn't */
--# if !defined(__NetBSD__) && !(defined(__linux__) && defined(__USE_BSD))
-- extern char *sys_errlist[]; /* this too... */
-+# ifndef __NetBSD__
-+# if !(defined __GLIBC__ && __GLIBC__ >= 2)
-+ extern int errno; /* SHOULD be in errno.h, but often isn't */
-+ extern char *sys_errlist[]; /* this too... */
-+# endif
- # endif
- #endif
-
-@@ -203,9 +230,10 @@
- #include <X11/Xatom.h>
- #include <X11/Xmd.h>
-
-+#ifdef TV_L10N
-+# include <X11/Xlocale.h>
-+#endif
-
--#undef SIGCHLD /* defined in both Xos.h and signal.h */
--#include <signal.h> /* for interrupt handling */
-
- #include <sys/types.h>
-
-@@ -316,7 +344,9 @@
- # endif
- #endif
-
--
-+#ifndef S_IRWUSR
-+# define S_IRWUSR (S_IRUSR|__S_IWRITE)
-+#endif
-
- #ifndef MAXPATHLEN
- # define MAXPATHLEN 256
-@@ -343,13 +373,36 @@
- #endif
-
-
--/* GRR 20040430: This is new and still only partially implemented. No doubt
-- * there are many other systems that have mkstemp() (SUSv3),
-- * but let's start small... */
--#if defined(__linux__) || defined(__OpenBSD__)
--# define USE_MKSTEMP /* use 'mkstemp()' instead of 'mktemp()' */
-+/* GRR 20040430: This is new and still not fully deployed. No doubt there
-+ * are other systems that have mkstemp() (SUSv3); we can add
-+ * them later. */
-+#ifndef VMS /* VMS hates multi-line definitions */
-+# if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
-+ defined(__bsdi__)
-+# ifndef USE_MKSTEMP
-+# define USE_MKSTEMP /* use 'mkstemp()' instead of 'mktemp()' */
-+# endif /* >> SECURITY ISSUE << */
-+# endif
-+#endif
-+
-+
-+/* GRR 20040503: This is new and so far tested only under Linux. But it
-+ * allows -wait to work with subsecond values as long as
-+ * times() exists and clock_t is a long int (latter matters
-+ * only if/when clocks wrap, which for Linux is multiples of
-+ * 497.11 days since the last reboot). */
-+#if defined(__linux__)
-+# define USE_TICKS /* use times()/Timer(), not time()/sleep() */
-+# include <limits.h> /* LONG_MAX (really want CLOCK_T_MAX) */
-+# include <sys/times.h> /* times() */
-+# ifndef CLK_TCK /* can be undefined in strict-ANSI mode */
-+# define CLK_TCK CLOCKS_PER_SEC /* claimed to be same thing in time.h */
-+# endif
- #endif
-
-+#if (defined(SYSV) || defined(SVR4) || defined(linux)) && !defined(USE_GETCWD)
-+# define USE_GETCWD
-+#endif
-
- /*****************************/
- /* END OF CONFIGURATION INFO */
-@@ -363,17 +416,21 @@
- # define HAVE_TIFF
- #endif
-
-+#ifdef DOPNG
-+# define HAVE_PNG
-+#endif
-+
- #ifdef DOPDS
- # define HAVE_PDS
- #endif
-
-
-
--#define PROGNAME "xv" /* used in resource database */
-+#define PROGNAME "xv" /* used in resource database */
-
--#define MAXNAMES 4096 /* max # of files in ctrlW list */
-+#define MAXNAMES 32768 /* max # of files in ctrlW list */
-
--#define MAXBRWIN 4 /* max # of vis browser windows */
-+#define MAXBRWIN 16 /* max # of vis browser windows */
-
- /* strings in the INFOBOX (used in SetISTR and GetISTR) */
- #define NISTR 10 /* number of ISTRs */
-@@ -494,24 +551,80 @@
- #define F_TIFINC 0
- #endif
-
-+#ifdef HAVE_PNG
-+#define F_PNGINC 1
-+#else
-+#define F_PNGINC 0
-+#endif
-+
-+#ifdef HAVE_MAG
-+# define F_MAGINC 1
-+#else
-+# define F_MAGINC 0
-+#endif
-+
-+#ifdef HAVE_PIC
-+# define F_PICINC 1
-+#else
-+# define F_PICINC 0
-+#endif
+
-+#ifdef HAVE_MAKI
-+# define F_MAKINC 1
-+#else
-+# define F_MAKINC 0
-+#endif
++cd $BUILD
++rm -rf xv-3.10
++tar xzvf $SOURCE/xv-3.10.tar.gz
++cd xv-3.10
++zcat $SOURCE/xv-3.10a.patch.gz | patch -p0 $PFLAGS || \
++ bail $SOURCE/xv-3.10a.patch.gz
++bzcat $SOURCE/xv-3.10a-jumbo-fix-patch-20050410.txt.bz2 | patch -p1 $PFLAGS || \
++ bail $SOURCE/xv-3.10a-jumbo-fix-patch-20050410.txt.bz2
++bzcat $SOURCE/xv-3.10a-jumbo-enh-patch-20050501.txt.bz2 | patch -p1 $PFLAGS || \
++ bail $SOURCE/xv-3.10a-jumbo-enh-patch-20050501.txt.bz2
++zcat $SOURCE/xv.prefix.diff.gz | patch -p1 $PFLAGS || \
++ bail $SOURCE/xv.prefix.diff.gz
++make -f Makefile.std || bail make
++strip --strip-unneeded bggen vdcomp xcmap xv xvpictoppm || bail strip
++
++exit $?
++
++# vi:set ts=4:
+diff -u -r --new-file xv-3.10a.orig/contrib/fedora/README xv-3.10a/contrib/fedora/README
+--- xv-3.10a.orig/contrib/fedora/README 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/contrib/fedora/README 2006-06-01 10:12:47.000000000 -0500
+@@ -0,0 +1,16 @@
++Greg,
++ After winding up in dark lonely places trying to
++get xv-3.10a to build on FC5 I suspected I was missing
++something. Then I happened on your patch manifest
++in Slackware 10.2.
++
++I bandsawed the script a bit to use in propagating XV
++to a handful of personal FC5 machines. Attached for
++reference.
+
-+#ifdef HAVE_PI
-+# define F_PAIINC 1
-+#else
-+# define F_PAIINC 0
-+#endif
++Thanks for your effort!
+
-+#ifdef HAVE_PIC2
-+# define F_PC2INC 1
-+#else
-+# define F_PC2INC 0
-+#endif
-+
-+#ifdef HAVE_MGCSFX
-+# define F_MGCSFXINC 1
-+#else
-+# define F_MGCSFXINC 0
-+#endif
-+
-+#ifdef MACBINARY
-+# define MACBSIZE 128
-+#endif
-
- #define F_GIF 0
- #define F_JPEG ( 0 + F_JPGINC)
- #define F_TIFF ( 0 + F_JPGINC + F_TIFINC)
--#define F_PS ( 1 + F_JPGINC + F_TIFINC)
--#define F_PBMRAW ( 2 + F_JPGINC + F_TIFINC)
--#define F_PBMASCII ( 3 + F_JPGINC + F_TIFINC)
--#define F_XBM ( 4 + F_JPGINC + F_TIFINC)
--#define F_XPM ( 5 + F_JPGINC + F_TIFINC)
--#define F_BMP ( 6 + F_JPGINC + F_TIFINC)
--#define F_SUNRAS ( 7 + F_JPGINC + F_TIFINC)
--#define F_IRIS ( 8 + F_JPGINC + F_TIFINC)
--#define F_TARGA ( 9 + F_JPGINC + F_TIFINC)
--#define F_FITS (10 + F_JPGINC + F_TIFINC)
--#define F_PM (11 + F_JPGINC + F_TIFINC)
--#define F_DELIM1 (12 + F_JPGINC + F_TIFINC) /* ----- */
--#define F_FILELIST (13 + F_JPGINC + F_TIFINC)
--#define F_MAXFMTS (14 + F_JPGINC + F_TIFINC) /* 15, normally */
-+#define F_PNG ( 0 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define F_PS ( 1 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define F_PBMRAW ( 2 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define F_PBMASCII ( 3 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define F_XBM ( 4 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define F_XPM ( 5 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define F_BMP ( 6 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define F_SUNRAS ( 7 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define F_IRIS ( 8 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define F_TARGA ( 9 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define F_FITS (10 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define F_PM (11 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define F_ZX (12 + F_JPGINC + F_TIFINC + F_PNGINC) /* [JCE] */
-+#define F_WBMP (13 + F_JPGINC + F_TIFINC + F_PNGINC)
-+#define JP_EXT_F (F_WBMP)
-+#define F_MAG (JP_EXT_F + F_MAGINC)
-+#define F_PIC (JP_EXT_F + F_MAGINC + F_PICINC)
-+#define F_MAKI (JP_EXT_F + F_MAGINC + F_PICINC + F_MAKINC)
-+#define F_PI (JP_EXT_F + F_MAGINC + F_PICINC + F_MAKINC + F_PAIINC)
-+#define F_PIC2 (JP_EXT_F + F_MAGINC + F_PICINC + F_MAKINC + F_PAIINC + F_PC2INC)
-+#define F_MGCSFX (JP_EXT_F + F_MAGINC + F_PICINC + F_MAKINC + F_PAIINC + F_PC2INC + F_MGCSFXINC)
-+#define JP_EXT_F_END (F_MGCSFX)
-+#define F_DELIM1 (JP_EXT_F_END + 1) /* ----- */
-+#define F_FILELIST (JP_EXT_F_END + 2)
-+#define F_MAXFMTS (JP_EXT_F_END + 3) /* 23, normally */
-
-
-
-@@ -541,6 +654,19 @@
- #define RFT_XPM 17
- #define RFT_XWD 18
- #define RFT_FITS 19
-+#define RFT_PNG 20
-+#define RFT_ZX 21 /* [JCE] */
-+#define RFT_WBMP 22
-+#define RFT_PCD 23
-+#define RFT_HIPS 24
-+#define RFT_BZIP2 25
-+#define JP_EXT_RFT (RFT_BZIP2)
-+#define RFT_MAG (JP_EXT_RFT + 1)
-+#define RFT_MAKI (JP_EXT_RFT + 2)
-+#define RFT_PIC (JP_EXT_RFT + 3)
-+#define RFT_PI (JP_EXT_RFT + 4)
-+#define RFT_PIC2 (JP_EXT_RFT + 5)
-+#define RFT_MGCSFX (JP_EXT_RFT + 6)
-
- /* definitions for page up/down, arrow up/down list control */
- #define LS_PAGEUP 0
-@@ -599,7 +725,8 @@
- #define RM_CBRICK 7 /* centered on a 'brick' bg */
- #define RM_ECENTER 8 /* symmetrical tiled */
- #define RM_ECMIRR 9 /* symmetrical mirror tiled */
--#define RM_MAX RM_ECMIRR
-+#define RM_UPLEFT 10 /* just in upper left corner */
-+#define RM_MAX RM_UPLEFT
-
-
- /* values of colorMapMode */
-@@ -649,7 +776,8 @@
- #define RMB_CBRICK 8
- #define RMB_ECENTER 9
- #define RMB_ECMIRR 10
--#define RMB_MAX 11
-+#define RMB_UPLEFT 11
-+#define RMB_MAX 12
-
-
- /* indicies into conv24MB */
-@@ -784,9 +912,9 @@
- int len; /* length of major axis */
- int vert; /* true if vertical, else horizontal */
- int active; /* true if scroll bar can do anything*/
-- int min,max; /* min/max values 'pos' can take */
-- int val; /* 'value' of scrollbar */
-- int page; /* amt val change on pageup/pagedown */
-+ double min,max; /* min/max values 'pos' can take */
-+ double val; /* 'value' of scrollbar */
-+ double page; /* amt val change on pageup/pagedown */
- int tpos; /* thumb pos. (pixels from tmin) */
- int tmin,tmax; /* min/max thumb offsets (from 0,0) */
- int tsize; /* size of thumb (in pixels) */
-@@ -801,9 +929,10 @@
- typedef struct { Window win; /* window ID */
- int x,y,w,h; /* window coords in parent */
- int active; /* true if can do anything*/
-- int min,max; /* min/max values 'pos' can take */
-- int val; /* 'value' of dial */
-- int page; /* amt val change on pageup/pagedown */
-+ double min,max; /* min/max values 'pos' can take */
-+ double val; /* 'value' of dial */
-+ double inc; /* amt val change on up/down */
-+ double page; /* amt val change on pageup/pagedown */
- char *title; /* title for this guage */
- char *units; /* string appended to value */
- u_long fg,bg,hi,lo; /* colors */
-@@ -971,15 +1100,19 @@
- WHERE unsigned int ncells, dispWIDE, dispHIGH, dispDEEP;
- WHERE unsigned int vrWIDE, vrHIGH, maxWIDE, maxHIGH;
- WHERE Colormap theCmap, LocalCmap;
--WHERE Window rootW, mainW, vrootW;
-+WHERE Window spec_window, rootW, mainW, vrootW;
- WHERE GC theGC;
- WHERE u_long black, white, fg, bg, infofg, infobg;
- WHERE u_long hicol, locol;
- WHERE u_long blkRGB, whtRGB;
- WHERE Font mfont, monofont;
- WHERE XFontStruct *mfinfo, *monofinfo;
-+#ifdef TV_L10N
-+WHERE XFontSet monofset;
-+WHERE XFontSetExtents *monofsetinfo;
-+#endif
- WHERE Visual *theVisual;
--WHERE Cursor arrow, cross, tcross, zoom, inviso;
-+WHERE Cursor arrow, cross, tcross, zoom, inviso, tlcorner;
- WHERE Pixmap iconPix, iconmask;
- WHERE Pixmap riconPix, riconmask;
- WHERE int showzoomcursor;
-@@ -996,6 +1129,10 @@
- WHERE int picType; /* CONV24_8BIT,CONV24_24BIT,etc.*/
- WHERE char *picComments; /* text comments on current pic */
-
-+#ifdef TV_L10N
-+WHERE int xlocale; /* true if Xlib supports locale */
-+#endif
-+
- WHERE int numPages, curPage; /* for multi-page files */
- WHERE char pageBaseName[64]; /* basename for multi-page files */
-
-@@ -1029,6 +1166,23 @@
- WHERE unsigned long cols[256]; /* maps pic pixel values to X pixel vals */
- WHERE int fc2pcol[256]; /* maps freecols into pic pixel values */
- WHERE int numcols; /* # of desired colors in picture */
-+#ifdef MACBINARY
-+WHERE char macb_file; /* True if this file type is MacBinary */
-+WHERE int handlemacb; /* True if we want to handle MacBinary */
-+#endif
-+#if defined(HAVE_PIC) || defined(HAVE_PIC2)
-+WHERE int nopicadjust; /* True if we don't want to adjust aspect */
-+#endif
-+#ifdef HAVE_PIC2
-+WHERE int pic2split; /* True if we want to split multiblocks */
-+#endif
-+#ifdef VS_ADJUST
-+WHERE int vsadjust; /* True if we want to adjust aspect of icons */
-+#endif
-+#ifdef HAVE_MGCSFX
-+WHERE int mgcsfx; /* True if we want to force use MgcSfx */
-+WHERE int nomgcsfx; /* True if we don't want to use MgcSfx */
-+#endif
-
- /* Std Cmap stuff */
- WHERE byte stdr[256], stdg[256], stdb[256]; /* std 3/3/2 cmap */
-@@ -1083,42 +1237,47 @@
- noFreeCols, /* don't free colors when loading new pic */
- autoquit, /* quit in '-root' or when click on win */
- xerrcode, /* errorcode of last X error */
-- grabDelay; /* # of seconds to sleep at start of Grab */
-+ grabDelay, /* # of seconds to sleep at start of Grab */
-+ startGrab; /* start immediate grab ? */
-
- WHERE int state824; /* displays warning when going 8->24 */
-
- WHERE float defaspect, /* default aspect ratio to use */
- normaspect; /* normal aspect ratio of this picture */
-
--WHERE unsigned long rootbg, rootfg; /* fg/bg for root border */
--WHERE int waitsec; /* secs btwn pics. -1=wait for event */
--WHERE int waitloop; /* loop at end of slide show? */
--WHERE int automax; /* maximize pic on open */
--WHERE int rootMode; /* mode used for -root images */
-+WHERE u_long rootbg, rootfg; /* fg/bg for root border */
-+WHERE u_short imagebgR;
-+WHERE u_short imagebgG; /* GRR 19980308: bg for transpar. images */
-+WHERE u_short imagebgB;
-+WHERE int have_imagebg;
-+WHERE double waitsec; /* secs btwn pics. -1.0=wait for event */
-+WHERE int waitloop; /* loop at end of slide show? */
-+WHERE int automax; /* maximize pic on open */
-+WHERE int rootMode; /* mode used for -root images */
-
--WHERE int nostat; /* if true, don't stat() in LdCurDir */
-+WHERE int nostat; /* if true, don't stat() in LdCurDir */
-
--WHERE int ctrlColor; /* whether or not to use colored butts */
-+WHERE int ctrlColor; /* whether or not to use colored butts */
-
--WHERE char *def_str; /* used by rd_*() routines */
-+WHERE char *def_str; /* used by rd_*() routines */
- WHERE int def_int;
--WHERE char *tmpdir; /* equal to "/tmp" or $TMPDIR env var */
--WHERE Pixmap gray25Tile, /* used for 3d effect on 1-bit disp's */
-+WHERE char *tmpdir; /* equal to "/tmp" or $TMPDIR env var */
-+WHERE Pixmap gray25Tile, /* used for 3d effect on 1-bit disp's */
- gray50Tile;
--WHERE int autoDelete; /* delete cmd-line files on exit? */
-+WHERE int autoDelete; /* delete cmd-line files on exit? */
-
- #define PRINTCMDLEN 256
- WHERE char printCmd[PRINTCMDLEN];
-
- /* stuff used for 'info' box */
- WHERE Window infoW;
--WHERE int infoUp; /* boolean: whether infobox is visible */
-+WHERE int infoUp; /* boolean: whether infobox is visible */
- WHERE int infoMode;
-
-
- /* stuff used for 'ctrl' box */
- WHERE Window ctrlW;
--WHERE int ctrlUp; /* boolean: whether ctrlbox is visible */
-+WHERE int ctrlUp; /* boolean: whether ctrlbox is visible */
- WHERE char *namelist[MAXNAMES]; /* list of file names from argv */
- WHERE char *origlist[MAXNAMES]; /* only names from argv (autoDelete)*/
- WHERE int orignumnames;
-@@ -1157,25 +1316,30 @@
-
-
- /* stuff used for 'browse' box */
--WHERE int anyBrowUp; /* whether *any* browser visible */
-+WHERE int anyBrowUp; /* whether *any* browser visible */
-
- /* stuff used for textview windows */
--WHERE int anyTextUp; /* are any text windows visible? */
--WHERE int commentUp; /* comment window up? */
-+WHERE int anyTextUp; /* are any text windows visible? */
-+WHERE int commentUp; /* comment window up? */
-
- /* stuff used for xvcut.c */
--WHERE int forceClipFile; /* don't use property clipboard */
--WHERE int clearR, clearG, clearB; /* clear color in 24-bit mode */
-+WHERE int forceClipFile; /* don't use property clipboard */
-+WHERE int clearR, clearG, clearB; /* clear color in 24-bit mode */
-
-
- /* stuff used for 'ps' box */
- WHERE Window psW;
--WHERE int psUp; /* is psW mapped, or what? */
-+WHERE int psUp; /* is psW mapped, or what? */
- WHERE CBUTT encapsCB, pscompCB;
- WHERE char *gsDev, *gsGeomStr;
- WHERE int gsRes;
-
-
-+/* stuff used for 'pcd' box */
-+WHERE Window pcdW;
-+WHERE int pcdUp; /* is pcdW mapped, or what? */
-+
-+
- #ifdef HAVE_JPEG
- /* stuff used for 'jpeg' box */
- WHERE Window jpegW;
-@@ -1190,6 +1354,91 @@
- #endif
-
-
-+#ifdef HAVE_PNG
-+/* stuff used for 'png' box */
-+WHERE Window pngW;
-+WHERE int pngUp; /* is pngW mapped, or what? */
-+#endif
++-john
+
++--
++john.cooper@third-harmonic.com
+diff -u -r --new-file xv-3.10a.orig/contrib/fnkey-scripts/README xv-3.10a/contrib/fnkey-scripts/README
+--- xv-3.10a.orig/contrib/fnkey-scripts/README 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/contrib/fnkey-scripts/README 2007-01-16 02:41:51.000000000 -0600
+@@ -0,0 +1,111 @@
++-- License and Disclaimer --
++
++This patch & script package was written by Alexey Spiridonov, and is
++licensed under the GNU GPLv2. There is NO WARRANTY.
++
++XV is copyrighted by John Bradley.
+
-+#ifdef ENABLE_FIXPIX_SMOOTH
-+WHERE int do_fixpix_smooth; /* GRR 19980607: runtime FS dithering */
-+#endif
++-- What is this? --
++
++This is a small patch for XV that allows you to run scripts by pressing
++a key from F1 through F12 (or more, just change 12 to your number in the
++patch file).
++
++The patch enables a number of useful features. Here is a my set-up:
++
++F1: Losslessly rotate JPEG 90 degrees to the right.
++F2: Losslessly rotate JPEG 90 degrees to the left.
++
++F3: Print the current selection rectangle (on the terminal where xv was
++ launched). This is useful for quickly recording a bunch of positions in
++ an image. Use case:
++ I'm annotating face positions.
++ 1) Select Joe in picture, hit F3, type "Joe" in the terminal.
++ 2) Select Jane in the picture, ...
++ ...
++ n) Copy the text visible in the terminal, and paste it into the
++ JPEG comment.
++ Of course, i would write a more convenient script if I annotated faces
++ with any any frequency.
++
++F4: Edit JPEG comment (I use it for annotations/tags).
++
++F5: Log a 'losslessly rotate right' command for batch processing. This
++ writes the rotation command for the current file into a shell script
++ somewhere ("~/photos/bin/rotscript" by default). This is great for
++ slower computers because you don't have to wait for each image to
++ rotate; instead, you just rotate them all at once by running the
++ resulting script.
++F6: Log a 'losslessly rotate left' batch command.
++
++F8: Crop image on disk, but back-up the uncropped version. You can make
++ a succession of crops this way, with a backup made at every step.
++ This wastes disk space, so be sure to clean up once you get a crop you
++ like.
++F7: Undo the last crop done on this image. This can be repeated until you're
++ back at the original.
++
++-- Installation --
++
++I'll tell you how to get the set-up I described above. Of course, you can
++customize it to your heart's content.
++
++(( 1 ))
++
++Go to:
++
++ http://www.sonic.net/~roelofs/greg_xv.html
++
++and follow the XV install instructions there. If you are okay with
++reading shell scripts, you might also give this a shot:
++
++ http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/media-gfx/xv/xv-3.10a-r12.ebuild
++
++When you're ready to type "make install", do the following to apply my patch:
++
++ $ cd WHEREVER_YOU_COMPILED_XV
++ $ patch -p1 --dry-run < PATH/TO/xv-3.10a-fkey-command-patch.greg-xv
++
++Hopefully, the above command won't complain; if it does, Greg Roelofs
++probably changed his patchset, and my patch has become out of date -- let me
++know. If that went well, run:
++
++ $ patch -p1 < PATH/TO/xv-3.10a-fkey-command-patch.greg-xv
++
++Now, simply recompile and install as described in the other instructions.
++
++(( 2 ))
++
++Copy 'jpegcrop.sh', 'jpegeditcom.sh', 'jpegundocrop.sh', 'jpegrot.sh',
++'jpeglogrot.sh' to some convenient directory.
++
++Suggestions: ~/photos/bin, /usr/local/bin, etc...
++
++Edit 'jpeglogrot.sh' and 'jpegeditcom.sh'. In the former, you need to
++customize the path to 'jpegrot.sh'. In the latter, you should make set
++your favorite editor. The spots to customize are marked as such.
++
++(( 3 ))
++
++Open .Xdefaults in your favorite text editor, and paste the following lines
++there:
++
++xv.F1command: ~/photos/bin/jpegrot.sh 90 %s
++xv.F2command: ~/photos/bin/jpegrot.sh 270 %s
++xv.F3command: @echo "The selection rect for '%s' is at (%d, %d) of size %dx%d."
++xv.F4command: @~/photos/bin/jpegeditcom.sh %s &
++xv.F5command: @~/photos/bin/jpeglogrot.sh 90 %s
++xv.F6command: @~/photos/bin/jpeglogrot.sh 270 %s
++xv.F7command: ~/photos/bin/jpegundocrop.sh %s
++xv.F8command: ~/photos/bin/jpegcrop.sh %s %d %d %d %d
++
++Change '~/photos/bin/' to the directory you chose in (( 2 )). In case you're
++wondering what the '@' symbol means, it tells XV not to reload the file
++after running this command. The default is to reload the file.
++
++-- Apologies --
++
++I didn't get a chance to run through the above instructions and check
++that they work. I know they're right in spirit, but I might've made a typo
++or two. Even if it's obvious to you, would you please let me know by writing
++to lesha at mit dot edu?
+diff -u -r --new-file xv-3.10a.orig/contrib/fnkey-scripts/jpegcrop.sh xv-3.10a/contrib/fnkey-scripts/jpegcrop.sh
+--- xv-3.10a.orig/contrib/fnkey-scripts/jpegcrop.sh 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/contrib/fnkey-scripts/jpegcrop.sh 2006-03-11 21:30:03.000000000 -0600
+@@ -0,0 +1,33 @@
++#!/bin/bash
++FILE=$1
++WIDTH=$4
++HEIGHT=$5
++XPOS=$2
++YPOS=$3
++if [[ $XPOS -lt 0 ]]; then
++ echo "Negative x position $XPOS converted to zero, width adjusted."
++ WIDTH=$((WIDTH+XPOS))
++ XPOS=0
++fi
++if [[ $YPOS -lt 0 ]]; then
++ echo "Negative y position $YPOS converted to zero, height adjusted."
++ HEIGHT=$((HEIGHT+YPOS))
++ YPOS=0
++fi
++if [[ $(($WIDTH+$HEIGHT)) == 0 ]]; then
++ echo "Refusing to crop $FILE with an empty rectangle."
++ exit 1
++fi
++
++TMPFILE=`mktemp $FILE.tmp-jpeg-rot-XXXXXXXX`
++if jpegtran -optimize -progressive -crop ${WIDTH}x${HEIGHT}+${XPOS}+${YPOS} \
++ -copy all $FILE > $TMPFILE; then
++ COUNT=`echo $FILE-uncropped | wc -c`
++ NEXT=$((`ls $FILE-uncropped* | cut -b $COUNT- | grep '^[0-9]*$' \
++ | sed 's/^0*/'/ | sort -n | tail -n 1`+1))
++ # the targets shouldn't exist, but -i just in case
++ mv -i $FILE $FILE-uncropped$NEXT
++ mv -i $TMPFILE $FILE
++else
++ rm $TMPFILE
++fi
+diff -u -r --new-file xv-3.10a.orig/contrib/fnkey-scripts/jpegeditcom.sh xv-3.10a/contrib/fnkey-scripts/jpegeditcom.sh
+--- xv-3.10a.orig/contrib/fnkey-scripts/jpegeditcom.sh 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/contrib/fnkey-scripts/jpegeditcom.sh 2007-01-16 00:23:04.000000000 -0600
+@@ -0,0 +1,12 @@
++#!/bin/bash
++CFILE=`mktemp $1.tmp-jpeg-comments-XXXXXXXX`
++TMPFILE=`mktemp $1.tmp-jpeg-XXXXXXXX`
++rdjpgcom $1 > $CFILE
++INITIAL=`md5sum $CFILE`
++xterm -e "$EDITOR" "$CFILE" # customize your editor here
++MODIFIED=`md5sum $CFILE`
++if [[ "$INITIAL" != "$MODIFIED" ]]; then
++ mv $1 $TMPFILE
++ wrjpgcom -replace -cfile $CFILE $TMPFILE > $1
++fi
++rm $TMPFILE $CFILE $CFILE~
+diff -u -r --new-file xv-3.10a.orig/contrib/fnkey-scripts/jpeglogrot.sh xv-3.10a/contrib/fnkey-scripts/jpeglogrot.sh
+--- xv-3.10a.orig/contrib/fnkey-scripts/jpeglogrot.sh 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/contrib/fnkey-scripts/jpeglogrot.sh 2007-01-16 00:55:18.000000000 -0600
+@@ -0,0 +1,10 @@
++#!/bin/bash
++curdir="`pwd`"
++LOG=~/photos/bin/rotscript # customize your install dir here
++if [[ ! -e "$LOG" ]]; then
++ echo '#!/bin/bash' >> "$LOG"
++ chmod u+x "$LOG"
++fi
++echo "# following entry made on `date`" >> "$LOG"
++# also customize the following line
++echo ~/photos/bin/jpegrot \""$1"\" \""$curdir/$2"\" >> "$LOG"
+diff -u -r --new-file xv-3.10a.orig/contrib/fnkey-scripts/jpegrot.sh xv-3.10a/contrib/fnkey-scripts/jpegrot.sh
+--- xv-3.10a.orig/contrib/fnkey-scripts/jpegrot.sh 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/contrib/fnkey-scripts/jpegrot.sh 2006-07-18 23:10:43.000000000 -0500
+@@ -0,0 +1,7 @@
++#!/bin/bash
++TMPFILE="`mktemp "$2".tmp-jpeg-rot-XXXXXXXX`"
++if jpegtran -perfect -optimize -progressive -rotate "$1" -copy all "$2" > "$TMPFILE"; then
++ mv "$TMPFILE" "$2"
++else
++ rm "$TMPFILE"
++fi
+diff -u -r --new-file xv-3.10a.orig/contrib/fnkey-scripts/jpegundocrop.sh xv-3.10a/contrib/fnkey-scripts/jpegundocrop.sh
+--- xv-3.10a.orig/contrib/fnkey-scripts/jpegundocrop.sh 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/contrib/fnkey-scripts/jpegundocrop.sh 2006-03-11 21:30:04.000000000 -0600
+@@ -0,0 +1,8 @@
++#!/bin/bash
++FILE=$1
++COUNT=`echo $FILE-uncropped | wc -c`
++LATEST=$((`ls $FILE-uncropped* | cut -b $COUNT- | grep '^[0-9]*$' \
++ | sed 's/^0*/'/ | sort -n | tail -n 1`))
++if [[ -f $FILE-uncropped$LATEST ]]; then
++ mv $FILE-uncropped$LATEST $FILE
++fi
+diff -u -r --new-file xv-3.10a.orig/tiff/RANLIB.sh xv-3.10a/tiff/RANLIB.sh
+--- xv-3.10a.orig/tiff/RANLIB.sh 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/tiff/RANLIB.sh 2004-05-11 01:31:38.000000000 -0500
+@@ -0,0 +1,22 @@
++#!/bin/sh -f
++#
++# tests to see if the program 'ranlib' exists. If it does, runs ranlib on
++# the first argument (a library name). Otherwise, does nothing, and returns
++#
++# written by John Bradley for the XV 3.00 release
++# thanks to John Hagan for shell-script hackery
++#
+
-+#ifdef HAVE_PIC2
-+/* stuff used for 'pic2' box */
-+WHERE Window pic2W;
-+WHERE int pic2Up; /* is pic2W mapped, or what? */
-+#endif /* HAVE_PIC2 */
++echo "executing 'ranlib $1'..."
+
-+#ifdef HAVE_PCD
-+/* stuff used for 'pcd' box */
-+WHERE Window pcdW;
-+WHERE int pcdUp; /* is pcdW mapped, or what? */
-+#endif /* HAVE_PCD */
++# Is there a ranlib? Let's try and then suffer the consequences...
++ranlib $1 >& /dev/null
+
-+#ifdef HAVE_MGCSFX
-+/* stuff used for 'mgcsfx' box */
-+WHERE Window mgcsfxW;
-+WHERE Window mgcsfxNameW;
-+WHERE int mgcsfxUp; /* is mgcsfxW mapped, or what? */
-+#endif /* HAVE_MGCSFX */
++if [ $? -ne 0 ]; then
++ echo "There doesn't seem to be a ranlib on this system..."
++ echo "Don't worry about it."
++fi
+
-+#ifdef TV_L10N
-+/* stuff used for TextViewer Japanization */
-+# define LOCALE_USASCII 0
-+# define LOCALE_EUCJ 1
-+# define LOCALE_JIS 2
-+# define LOCALE_MSCODE 3
-+
-+# ifndef LOCALE_DEFAULT
-+# define LOCALE_DEFAULT 0
-+# endif /* !LOCALE_DEFAULT */
-+
-+# ifndef MAIN
-+ extern char *localeList[];
-+# else
-+# ifndef LOCALE_NAME_EUC
-+# ifndef X_LOCALE
-+# if defined(__FreeBSD__)
-+ char *localeList[] = {"", "ja_JP.EUC", "none", "none"};
-+# elif defined(__linux__)
-+ char *localeList[] = {"", "ja_JP.eucJP", "none", "ja_JP.SJIS"};
-+# elif defined(__sun) || defined(sun)
-+ char *localeList[] = {"", "ja", "none", "none"};
-+# elif defined(__sgi) /* sgi, __sgi, __sgi__ (gcc) */
-+ char *localeList[] = {"", "ja_JP.EUC", "none", "none"};
-+# elif defined(sony_news)
-+ char *localeList[] = {"", "ja_JP.EUC", "none", "ja_JP.SJIS"};
-+# elif defined(nec)
-+ char *localeList[] = {"", "japan", "none", "none"};
-+# elif defined(__hpux)
-+ char *localeList[] = {"", "japanese.euc", "none", "japanese"};
-+# elif defined(__osf__)
-+ char *localeList[] = {"", "ja_JP.deckanji", "none", "ja_JP.SJIS"};
-+# elif defined(_AIX)
-+ char *localeList[] = {"", "ja_JP", "none", "Ja_JP" };
-+# elif defined(__bsdi)
-+ char *localeList[] = {"", "Japanese-EUC", "none", "none" };
-+# else
-+ char *localeList[] = {"", "ja_JP.EUC", "ja_JP.JIS", "ja_JP.SJIS"};
-+# endif
-+# else
-+# if (XlibSpecificationRelease > 5)
-+ char *localeList[] = {"", "ja_JP.eucJP", "ja_JP.JIS7",
-+ "ja_JP.SJIS"};
-+# else
-+ char *localeList[] = {"", "ja_JP.ujis", "ja_JP.jis7",
-+ "ja_JP.mscode"};
-+# endif
-+# endif /* X_LOCALE */
-+# else
-+ char *localeList[] = {"", LOCALE_NAME_EUC,
-+ LOCALE_NAME_JIS, LOCALE_NAME_MSCODE};
-+# endif /* LOCALE_NAME_EUC */
-+# endif /* MAIN */
-+#endif /* TV_L10N */
-+
- #undef WHERE
-
-
-@@ -1199,8 +1448,11 @@
- /****************************** XV.C ****************************/
- int ReadFileType PARM((char *));
- int ReadPicFile PARM((char *, int, PICINFO *, int));
--int UncompressFile PARM((char *, char *));
-+int UncompressFile PARM((char *, char *, int));
- void KillPageFiles PARM((char *, int));
-+#ifdef MACBINARY
-+int RemoveMacbinary PARM((char *, char *));
-+#endif
-
- void NewPicGetColors PARM((int, int));
- void FixAspect PARM((int, int *, int *));
-@@ -1429,6 +1681,9 @@
- int CheckPoll PARM((int));
- void DIRDeletedFile PARM((char *));
- void DIRCreatedFile PARM((char *));
-+FILE *pic2_OpenOutFile PARM((char *, int *));
-+void pic2_KillNullFile PARM((FILE *));
-+int OpenOutFileDesc PARM((char *));
-
-
- /*************************** XVBROWSE.C ************************/
-@@ -1448,7 +1703,7 @@
-
- /*************************** XVTEXT.C ************************/
- void CreateTextWins PARM((char *, char *));
--void TextView PARM((char *));
-+int TextView PARM((char *));
- void OpenTextView PARM((char *, int, char *, int));
-
- void OpenCommentText PARM((void));
-@@ -1466,6 +1721,8 @@
- int TextCheckEvent PARM((XEvent *, int *, int *));
- int TextDelWin PARM((Window));
-
-+int CharsetCheckEvent PARM((XEvent *));
-+int CharsetDelWin PARM((Window));
-
-
- /**************************** XVGAM.C **************************/
-@@ -1502,12 +1759,12 @@
-
-
- /*************************** XVDIAL.C ***************************/
--void DCreate PARM((DIAL *, Window, int, int, int, int, int,
-- int, int, int, u_long, u_long, u_long,
-- u_long, char *, char *));
-+void DCreate PARM((DIAL *, Window, int, int, int, int, double,
-+ double, double, double, double, u_long,
-+ u_long, u_long, u_long, char *, char *));
-
--void DSetRange PARM((DIAL *, int, int, int, int));
--void DSetVal PARM((DIAL *, int));
-+void DSetRange PARM((DIAL *, double,double,double,double,double));
-+void DSetVal PARM((DIAL *, double));
- void DSetActive PARM((DIAL *, int));
- void DRedraw PARM((DIAL *));
- int DTrack PARM((DIAL *, int, int));
-@@ -1585,7 +1842,11 @@
- byte *, byte *, int, int, char *));
-
- /**************************** XVPBM.C ***************************/
-+#ifdef HAVE_MGCSFX
-+int LoadPBM PARM((char *, PICINFO *, int));
-+#else
- int LoadPBM PARM((char *, PICINFO *));
-+#endif
- int WritePBM PARM((FILE *, byte *, int, int, int, byte *,
- byte *, byte *, int, int, int, char *));
-
-@@ -1604,6 +1865,11 @@
- int WriteBMP PARM((FILE *, byte *, int, int, int, byte *,
- byte *, byte *, int, int));
-
-+/**************************** XVWBMP.C ***************************/
-+int LoadWBMP PARM((char *, PICINFO *));
-+int WriteWBMP PARM((FILE *, byte *, int, int, int, byte *,
-+ byte *, byte *, int, int));
-+
- /**************************** XVRLE.C ***************************/
- int LoadRLE PARM((char *, PICINFO *));
-
-@@ -1642,6 +1908,7 @@
- void JPEGDialog PARM((int));
- int JPEGCheckEvent PARM((XEvent *));
- void JPEGSaveParams PARM((char *, int));
-+void VersionInfoJPEG PARM((void)); /* GRR 19980605 */
-
- /**************************** XVTIFF.C ***************************/
- int LoadTIFF PARM((char *, PICINFO *, int));
-@@ -1649,6 +1916,15 @@
- void TIFFDialog PARM((int));
- int TIFFCheckEvent PARM((XEvent *));
- void TIFFSaveParams PARM((char *, int));
-+void VersionInfoTIFF PARM((void)); /* GRR 19980605 */
-+
-+/**************************** XVPNG.C ***************************/
-+int LoadPNG PARM((char *, PICINFO *));
-+void CreatePNGW PARM((void));
-+void PNGDialog PARM((int));
-+int PNGCheckEvent PARM((XEvent *));
-+void PNGSaveParams PARM((char *, int));
-+void VersionInfoPNG PARM((void)); /* GRR 19980605 */
-
- /**************************** XVPDS.C ***************************/
- int LoadPDS PARM((char *, PICINFO *));
-@@ -1661,6 +1937,87 @@
- void PSResize PARM((void));
- int LoadPS PARM((char *, PICINFO *, int));
-
-+/************************ [JCE] XVZX.C ***************************/
-+
-+int LoadZX PARM((char *, PICINFO *));
-+int WriteZX PARM((FILE *, byte *, int, int, int, byte *,
-+ byte *, byte *, int, int, char *));
-+
-+/**************************** XVPCD.C ***************************/
-+int LoadPCD PARM((char *, PICINFO *, int));
-+void CreatePCDW PARM((void));
-+void PCDDialog PARM((int));
-+int PCDCheckEvent PARM((XEvent *));
-+void PCDSetParamOptions PARM((char *));
-+
-+/*************************** XVMAG.C ***************************/
-+int LoadMAG PARM((char *, PICINFO *));
-+int WriteMAG PARM((FILE *, byte *, int, int, int,
-+ byte *, byte *, byte *, int, int, char *));
-+
-+/*************************** XVMAKI.C ***************************/
-+int LoadMAKI PARM((char *, PICINFO *));
-+int WriteMAKI PARM((FILE *, byte *, int, int, int,
-+ byte *, byte *, byte *, int, int));
-+
-+/*************************** XVPIC.C ***************************/
-+int LoadPIC PARM((char *, PICINFO *));
-+int WritePIC PARM((FILE *, byte *, int, int, int,
-+ byte *, byte *, byte *, int, int, char *));
-+
-+/*************************** XVPI.C ***************************/
-+int LoadPi PARM((char *, PICINFO *));
-+int WritePi PARM((FILE *, byte *, int, int, int,
-+ byte *, byte *, byte *, int, int, char *));
-+
-+/*************************** XVPIC2.C ***************************/
-+int LoadPIC2 PARM((char *, PICINFO *, int));
-+void CreatePIC2W PARM((void));
-+void PIC2Dialog PARM((int));
-+int PIC2CheckEvent PARM((XEvent *));
-+int PIC2SetParamOptions PARM((char *));
-+
-+/**************************** XVPCD.C ***************************/
-+int LoadPCD PARM((char *, PICINFO *,int));
-+void CreatePCDW PARM((void));
-+void PCDDialog PARM((int));
-+int PCDCheckEvent PARM((XEvent *));
-+void PCDSetParamOptions PARM((char *));
-+
-+/**************************** XVHIPS.C ***************************/
-+int LoadHIPS PARM((char *, PICINFO *));
-+
-+/*************************** XVMGCSFX.C ***************************/
-+int is_mgcsfx PARM((char *, unsigned char *, int));
-+char *mgcsfx_auto_input_com PARM((char *));
-+int LoadMGCSFX PARM((char *, PICINFO *));
-+void CreateMGCSFXW PARM((void));
-+void MGCSFXDialog PARM((int));
-+int MGCSFXCheckEvent PARM((XEvent *));
-+int MGCSFXSaveParams PARM((char *, int));
++echo ""
++echo ""
+
-+int getInputCom PARM((void));
-+int getOutputCom PARM((void));
-+
-+/**************************** XVVD.C ****************************/
-+void Vdinit PARM((void));
-+void Vdsettle PARM((void));
-+int Chvdir PARM((char *));
-+void Dirtovd PARM((char *));
-+void Vdtodir PARM((char *));
-+void Dirtosubst PARM((char *));
-+int Mkvdir PARM((char *));
-+void Mkvdir_force PARM((char *));
-+int Rmvdir PARM((char *));
-+int Movevdir PARM((char *, char *));
-+int Isarchive PARM((char *));
-+int Isvdir PARM((char *));
-+void vd_HUPhandler PARM((void));
-+void vd_handler PARM((int));
-+int vd_Xhandler PARM((Display *, XErrorEvent *));
-+int vd_XIOhandler PARM((Display *));
-+void vd_handler_setup PARM((void));
-+
- /*************************** XVPOPUP.C ***************************/
- void CenterMapWindow PARM((Window, int, int, int, int));
- int PopUp PARM((char *, char **, int));
-@@ -1714,3 +2071,13 @@
- void CoordP2E PARM((int, int, int *, int *));
- void CoordE2P PARM((int, int, int *, int *));
-
-+#if defined(__mips) && defined(__SYSTYPE_BSD43)
-+# define strstr(A,B) pds_strstr((A),(B))
-+# undef S_IFIFO
-+#endif /* !mips_bsd */
-+
-+#ifndef SEEK_SET
-+# define SEEK_SET 0
-+# define SEEK_CUR 1
-+# define SEEK_END 2
-+#endif
-diff -ruN xv-3.10a-bugfixes/xv_mgcsfx.sample xv-3.10a-enhancements/xv_mgcsfx.sample
---- xv-3.10a-bugfixes/xv_mgcsfx.sample 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xv_mgcsfx.sample 2005-04-17 14:04:22.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/xv_mgcsfx.sample xv-3.10a/xv_mgcsfx.sample
+--- xv-3.10a.orig/xv_mgcsfx.sample 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xv_mgcsfx.sample 2005-04-17 16:04:22.000000000 -0500
@@ -0,0 +1,125 @@
+#/*
+# Configuration file for XV with recognition of 'Magic and Suffix'
@@ -4344,4166 +1538,9 @@ diff -ruN xv-3.10a-bugfixes/xv_mgcsfx.sample xv-3.10a-enhancements/xv_mgcsfx.sam
+# /* SGI(1):magic:0:\x01\xda:.rgb:::: */
+# /* SGI(2):magic:0:\xda\x01:.rgb:::: */
+# /* XWD:magic:0:\0\0\0\7: :::: */
-diff -ruN xv-3.10a-bugfixes/xvbmp.c xv-3.10a-enhancements/xvbmp.c
---- xv-3.10a-bugfixes/xvbmp.c 2005-03-27 18:12:17.000000000 -0800
-+++ xv-3.10a-enhancements/xvbmp.c 2005-04-17 13:56:31.000000000 -0700
-@@ -1,5 +1,5 @@
- /*
-- * xvbmp.c - i/o routines for .BMP files (MS Windows 3.x)
-+ * xvbmp.c - I/O routines for .BMP files (MS Windows 3.x and later; OS/2)
- *
- * LoadBMP(fname, numcols)
- * WriteBMP(fp, pic, ptype, w, h, r, g, b, numcols, style);
-@@ -9,30 +9,39 @@
-
- #include "xv.h"
-
--/* comments on error handling:
-- a truncated file is not considered a Major Error. The file is loaded, the
-- rest of the pic is filled with 0's.
--
-- a file with garbage characters in it is an unloadable file. All allocated
-- stuff is tossed, and LoadBMP returns non-zero
--
-- not being able to malloc is a Fatal Error. The program is aborted. */
--
--
--#define BI_RGB 0
--#define BI_RLE8 1
--#define BI_RLE4 2
-+/* Comments on error-handling:
-+ A truncated file is not considered a Major Error. The file is loaded,
-+ and the rest of the pic is filled with 0's.
-+
-+ A file with garbage characters in it is an unloadable file. All allocated
-+ stuff is tossed, and LoadBMP returns non-zero.
-+
-+ Not being able to malloc is a Fatal Error. The program is aborted. */
-+
-+
-+#define BI_RGB 0 /* a.k.a. uncompressed */
-+#define BI_RLE8 1
-+#define BI_RLE4 2
-+#define BI_BITFIELDS 3 /* BMP version 4 */
-+#define BI_JPEG 4 /* BMP version 5 (not yet supported) */
-+#define BI_PNG 5 /* BMP version 5 (not yet supported) */
-
- #define WIN_OS2_OLD 12
- #define WIN_NEW 40
- #define OS2_NEW 64
-
-+#if (defined(UINT_MAX) && UINT_MAX != 0xffffffffU)
-+# error XV's BMP code requires 32-bit unsigned integer type, but u_int isn't
-+#endif
-+
- static long filesize;
-
- static int loadBMP1 PARM((FILE *, byte *, u_int, u_int));
- static int loadBMP4 PARM((FILE *, byte *, u_int, u_int, u_int));
- static int loadBMP8 PARM((FILE *, byte *, u_int, u_int, u_int));
--static int loadBMP24 PARM((FILE *, byte *, u_int, u_int));
-+static int loadBMP16 PARM((FILE *, byte *, u_int, u_int, u_int *));
-+static int loadBMP24 PARM((FILE *, byte *, u_int, u_int, u_int));
-+static int loadBMP32 PARM((FILE *, byte *, u_int, u_int, u_int *));
- static u_int getshort PARM((FILE *));
- static u_int getint PARM((FILE *));
- static void putshort PARM((FILE *, int));
-@@ -52,15 +61,14 @@
- PICINFO *pinfo;
- /*******************************************/
- {
-- FILE *fp;
-- int i, c, c1, rv;
-- u_int bfSize, bfOffBits, biSize, biWidth, biHeight, biPlanes;
-- u_int biBitCount, biCompression, biSizeImage, biXPelsPerMeter;
-- u_int biYPelsPerMeter, biClrUsed, biClrImportant;
-- int bPad;
-- char *cmpstr;
-- byte *pic24, *pic8;
-- char buf[512], *bname;
-+ FILE *fp;
-+ int i, c, c1, rv, bPad;
-+ u_int bfSize, bfOffBits, biSize, biWidth, biHeight, biPlanes;
-+ u_int biBitCount, biCompression, biSizeImage, biXPelsPerMeter;
-+ u_int biYPelsPerMeter, biClrUsed, biClrImportant;
-+ u_int colormask[3];
-+ char buf[512], *bname, *cmpstr, rgb_bits[16];
-+ byte *pic24, *pic8;
-
- /* returns '1' on success */
-
-@@ -98,14 +106,13 @@
- biClrUsed = getint(fp);
- biClrImportant = getint(fp);
- }
--
- else { /* old bitmap format */
- biWidth = getshort(fp); /* Types have changed ! */
- biHeight = getshort(fp);
- biPlanes = getshort(fp);
- biBitCount = getshort(fp);
-
-- /* Not in old versions so have to compute them*/
-+ /* not in old versions, so have to compute them */
- biSizeImage = (((biPlanes * biBitCount*biWidth)+31)/32)*4*biHeight;
-
- biCompression = BI_RGB;
-@@ -126,25 +133,39 @@
- if (FERROR(fp)) { bmpError(bname,"EOF reached in file header"); goto ERROR; }
-
-
-- /* error checking */
-- if ((biBitCount!=1 && biBitCount!=4 && biBitCount!=8 && biBitCount!=24) ||
-- biPlanes!=1 || biCompression>BI_RLE4 ||
-+ /* error-checking */
-+ if ((biBitCount!=1 && biBitCount!=4 && biBitCount!=8 &&
-+ biBitCount!=16 && biBitCount!=24 && biBitCount!=32) ||
-+ biPlanes!=1 || biCompression>BI_PNG ||
- biWidth<=0 || biHeight<=0 ||
- (biClrUsed && biClrUsed > (1 << biBitCount))) {
-
- sprintf(buf,
-- "Bogus BMP File! (%dx%d, Bits=%d, Colors=%d, Planes=%d, Compr=%d)",
-+ "Unsupported BMP type (%dx%d, Bits=%d, Colors=%d, Planes=%d, "
-+ "Compr=%d)",
- biWidth, biHeight, biBitCount, biClrUsed, biPlanes, biCompression);
-
- bmpError(bname, buf);
- goto ERROR;
- }
-
-+ if (biCompression>BI_BITFIELDS) {
-+ sprintf(buf, "Unsupported BMP compression method (%s)",
-+ biCompression == BI_JPEG? "JPEG" :
-+ biCompression == BI_PNG? "PNG" :
-+ "unknown/newer than v5");
-+
-+ bmpError(bname, buf);
-+ goto ERROR;
-+ }
-+
- if (((biBitCount==1 || biBitCount==24) && biCompression != BI_RGB) ||
-- (biBitCount==4 && biCompression==BI_RLE8) ||
-- (biBitCount==8 && biCompression==BI_RLE4)) {
-+ (biBitCount==4 && biCompression!=BI_RGB && biCompression!=BI_RLE4) ||
-+ (biBitCount==8 && biCompression!=BI_RGB && biCompression!=BI_RLE8) ||
-+ ((biBitCount==16 || biBitCount==32) &&
-+ biCompression!=BI_RGB && biCompression!=BI_BITFIELDS)) {
-
-- sprintf(buf,"Bogus BMP File! (bitCount=%d, Compression=%d)",
-+ sprintf(buf,"Unsupported BMP type (bitCount=%d, Compression=%d)",
- biBitCount, biCompression);
-
- bmpError(bname, buf);
-@@ -156,20 +177,23 @@
- if (biSize != WIN_OS2_OLD) {
- /* skip ahead to colormap, using biSize */
- c = biSize - 40; /* 40 bytes read from biSize to biClrImportant */
-- for (i=0; i<c; i++) getc(fp);
--
-+ for (i=0; i<c; i++)
-+ getc(fp);
- bPad = bfOffBits - (biSize + 14);
- }
-
-+ /* 16-bit or 32-bit color mask */
-+ if (biCompression==BI_BITFIELDS) {
-+ colormask[0] = getint(fp);
-+ colormask[1] = getint(fp);
-+ colormask[2] = getint(fp);
-+ bPad -= 12;
-+ }
-+
- /* load up colormap, if any */
-- if (biBitCount!=24) {
-+ if (biBitCount == 1 || biBitCount == 4 || biBitCount == 8) {
- int i, cmaplen;
-
--/* this is superfluous; see identical test in "error checking" block above
-- if (biClrUsed > (1 << biBitCount))
-- biClrUsed = (1 << biBitCount);
-- */
--
- cmaplen = (biClrUsed) ? biClrUsed : 1 << biBitCount;
- for (i=0; i<cmaplen; i++) {
- pinfo->b[i] = getc(fp);
-@@ -205,7 +229,7 @@
-
- /* create pic8 or pic24 */
-
-- if (biBitCount==24) {
-+ if (biBitCount==16 || biBitCount==24 || biBitCount==32) {
- u_int npixels = biWidth * biHeight;
- u_int count = 3 * npixels;
-
-@@ -227,19 +251,35 @@
- WaitCursor();
-
- /* load up the image */
-- if (biBitCount == 1) rv = loadBMP1(fp,pic8,biWidth,biHeight);
-- else if (biBitCount == 4) rv = loadBMP4(fp,pic8,biWidth,biHeight,
-- biCompression);
-- else if (biBitCount == 8) rv = loadBMP8(fp,pic8,biWidth,biHeight,
-- biCompression);
-- else rv = loadBMP24(fp,pic24,biWidth,biHeight);
-+ switch (biBitCount) {
-+ case 1:
-+ rv = loadBMP1(fp, pic8, biWidth, biHeight);
-+ break;
-+ case 4:
-+ rv = loadBMP4(fp, pic8, biWidth, biHeight, biCompression);
-+ break;
-+ case 8:
-+ rv = loadBMP8(fp, pic8, biWidth, biHeight, biCompression);
-+ break;
-+ case 16:
-+ rv = loadBMP16(fp, pic24, biWidth, biHeight, /* v-- BI_RGB */
-+ biCompression == BI_BITFIELDS? colormask : NULL);
-+ break;
-+ default:
-+ if (biBitCount == 32 && biCompression == BI_BITFIELDS)
-+ rv = loadBMP32(fp, pic24, biWidth, biHeight, colormask);
-+ else /* 24 or (32 and BI_RGB) */
-+ rv = loadBMP24(fp, pic24, biWidth, biHeight, biBitCount);
-+ break;
-+ }
-
- if (rv) bmpError(bname, "File appears truncated. Winging it.");
-
-+
- fclose(fp);
-
-
-- if (biBitCount == 24) {
-+ if (biBitCount > 8) {
- pinfo->pic = pic24;
- pinfo->type = PIC24;
- }
-@@ -251,6 +291,22 @@
- cmpstr = "";
- if (biCompression == BI_RLE4) cmpstr = ", RLE4 compressed";
- else if (biCompression == BI_RLE8) cmpstr = ", RLE8 compressed";
-+ else if (biCompression == BI_BITFIELDS) {
-+ int bit, c[3], i;
-+ u_int mask;
-+
-+ for (i = 0; i < 3; ++i) {
-+ mask = colormask[i];
-+ c[i] = 0;
-+ for (bit = 0; bit < 32; ++bit) {
-+ if (mask & 1)
-+ ++c[i];
-+ mask >>= 1;
-+ }
-+ }
-+ sprintf(rgb_bits, ", RGB%d%d%d", c[0], c[1], c[2]);
-+ cmpstr = rgb_bits;
-+ }
-
- pinfo->w = biWidth; pinfo->h = biHeight;
- pinfo->normw = pinfo->w; pinfo->normh = pinfo->h;
-@@ -282,12 +338,13 @@
- u_int w,h;
- {
- int i,j,c,bitnum,padw;
-- byte *pp;
-+ byte *pp = pic8 + ((h - 1) * w);
-+ size_t l = w*h;
-
- c = 0;
- padw = ((w + 31)/32) * 32; /* 'w', padded to be a multiple of 32 */
-
-- for (i=h-1; i>=0; i--) {
-+ for (i=h-1; i>=0 && (pp - pic8 <= l); i--) {
- pp = pic8 + (i * w);
- if ((i&0x3f)==0) WaitCursor();
- for (j=bitnum=0; j<padw; j++,bitnum++) {
-@@ -316,8 +373,8 @@
- u_int w,h,comp;
- {
- int i,j,c,c1,x,y,nybnum,padw,rv;
-- byte *pp;
--
-+ byte *pp = pic8 + ((h - 1) * w);
-+ size_t l = w*h;
-
- rv = 0;
- c = c1 = 0;
-@@ -325,7 +382,7 @@
- if (comp == BI_RGB) { /* read uncompressed data */
- padw = ((w + 7)/8) * 8; /* 'w' padded to a multiple of 8pix (32 bits) */
-
-- for (i=h-1; i>=0; i--) {
-+ for (i=h-1; i>=0 && (pp - pic8 <= l); i--) {
- pp = pic8 + (i * w);
- if ((i&0x3f)==0) WaitCursor();
-
-@@ -353,7 +410,7 @@
-
- if (c) { /* encoded mode */
- c1 = getc(fp);
-- for (i=0; i<c; i++,x++,pp++)
-+ for (i=0; i<c && (pp - pic8 <= l); i++,x++,pp++)
- *pp = (i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f);
- }
-
-@@ -373,7 +430,7 @@
- }
-
- else { /* absolute mode */
-- for (i=0; i<c; i++, x++, pp++) {
-+ for (i=0; i<c && (pp - pic8 <= l); i++, x++, pp++) {
- if ((i&1) == 0) c1 = getc(fp);
- *pp = (i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f);
- }
-@@ -402,14 +459,18 @@
- u_int w,h,comp;
- {
- int i,j,c,c1,padw,x,y,rv;
-- byte *pp;
-+ byte *pp = pic8 + ((h - 1) * w);
-+ size_t l = w*h;
-+ byte *pend;
-
- rv = 0;
-
-+ pend = pic8 + w * h;
-+
- if (comp == BI_RGB) { /* read uncompressed data */
- padw = ((w + 3)/4) * 4; /* 'w' padded to a multiple of 4pix (32 bits) */
-
-- for (i=h-1; i>=0; i--) {
-+ for (i=h-1; i>=0 && (pp - pic8 <= l); i--) {
- pp = pic8 + (i * w);
- if ((i&0x3f)==0) WaitCursor();
-
-@@ -425,12 +486,12 @@
- x = y = 0;
- pp = pic8 + x + (h-y-1)*w;
-
-- while (y<h) {
-+ while (y<h && pp<=pend) {
- c = getc(fp); if (c == EOF) { rv = 1; break; }
-
- if (c) { /* encoded mode */
- c1 = getc(fp);
-- for (i=0; i<c; i++,x++,pp++) *pp = c1;
-+ for (i=0; i<c && pp<=pend; i++,x++,pp++) *pp = c1;
- }
-
- else { /* c==0x00 : escape codes */
-@@ -449,7 +510,7 @@
- }
-
- else { /* absolute mode */
-- for (i=0; i<c; i++, x++, pp++) {
-+ for (i=0; i<c && pp<=pend; i++, x++, pp++) {
- c1 = getc(fp);
- *pp = c1;
- }
-@@ -472,26 +533,133 @@
-
-
- /*******************************************/
--static int loadBMP24(fp, pic24, w, h)
-+static int loadBMP16(fp, pic24, w, h, mask)
-+ FILE *fp;
-+ byte *pic24;
-+ u_int w, h, *mask;
-+{
-+ int x, y;
-+ byte *pp = pic24 + ((h - 1) * w * 3);
-+ size_t l = w*h*3;
-+ u_int buf, colormask[6];
-+ int i, bit, bitshift[6], colorbits[6], bitshift2[6];
-+
-+ if (mask == NULL) { /* RGB555 */
-+ colormask[0] = 0x00007c00;
-+ colormask[1] = 0x000003e0;
-+ colormask[2] = 0x0000001f;
-+ colormask[3] = 0x7c000000;
-+ colormask[4] = 0x03e00000;
-+ colormask[5] = 0x001f0000;
-+ bitshift[0] = 7; bitshift2[0] = 0;
-+ bitshift[1] = 2; bitshift2[1] = 0;
-+ bitshift[2] = 0; bitshift2[2] = 3;
-+ bitshift[3] = 23; bitshift2[3] = 0;
-+ bitshift[4] = 18; bitshift2[4] = 0;
-+ bitshift[5] = 13; bitshift2[5] = 0;
-+ } else {
-+ colormask[0] = mask[0];
-+ colormask[1] = mask[1];
-+ colormask[2] = mask[2];
-+ colormask[3] = (mask[0] & 0xffff) << 16;
-+ colormask[4] = (mask[1] & 0xffff) << 16;
-+ colormask[5] = (mask[2] & 0xffff) << 16;
-+
-+ for (i = 0; i < 3; ++i) {
-+ buf = colormask[i];
-+
-+ bitshift[i] = 0;
-+ for (bit = 0; bit < 32; ++bit) {
-+ if (buf & 1)
-+ break;
-+ else
-+ ++bitshift[i];
-+ buf >>= 1;
-+ }
-+ bitshift[i+3] = bitshift[i] + 16;
-+
-+ colorbits[i] = 0;
-+ for (; bit < 32; ++bit) {
-+ if (buf & 1)
-+ ++colorbits[i];
-+ else
-+ break;
-+ buf >>= 1;
-+ }
-+ if (colorbits[i] > 8) { /* over 8-bit depth */
-+ bitshift[i] += (colorbits[i] - 8);
-+ bitshift[i+3] = bitshift[i] + 16;
-+ bitshift2[i] = bitshift2[i+3] = 0;
-+ } else
-+ bitshift2[i] = bitshift2[i+3] = 8 - colorbits[i];
-+ }
-+ }
-+
-+ if (DEBUG > 1)
-+ fprintf(stderr, "loadBMP16: bitfields\n"
-+ "\tR: bits = %2d, mask = %08x, shift >>%2d, <<%2d\n"
-+ "\t (mask = %08x, shift >>%2d, <<%2d)\n"
-+ "\tG: bits = %2d, mask = %08x, shift >>%2d, <<%2d\n"
-+ "\t (mask = %08x, shift >>%2d, <<%2d)\n"
-+ "\tB: bits = %2d, mask = %08x, shift >>%2d, <<%2d\n"
-+ "\t (mask = %08x, shift >>%2d, <<%2d)\n",
-+ colorbits[0], colormask[0], bitshift[0], bitshift2[0],
-+ colormask[3], bitshift[3], bitshift2[3],
-+ colorbits[1], colormask[1], bitshift[1], bitshift2[1],
-+ colormask[4], bitshift[4], bitshift2[4],
-+ colorbits[2], colormask[2], bitshift[2], bitshift2[2],
-+ colormask[5], bitshift[5], bitshift2[5]);
-+
-+ for (y = h-1; y >= 0 && (pp - pic24 <= l); y--) {
-+ pp = pic24 + (3 * w * y);
-+ if ((y&0x3f)==0) WaitCursor();
-+
-+ for (x = w; x > 1; x -= 2) {
-+ buf = getint(fp);
-+ *(pp++) = (buf & colormask[0]) >> bitshift[0] << bitshift2[0];
-+ *(pp++) = (buf & colormask[1]) >> bitshift[1] << bitshift2[1];
-+ *(pp++) = (buf & colormask[2]) >> bitshift[2] << bitshift2[2];
-+ *(pp++) = (buf & colormask[3]) >> bitshift[3] << bitshift2[3];
-+ *(pp++) = (buf & colormask[4]) >> bitshift[4] << bitshift2[4];
-+ *(pp++) = (buf & colormask[5]) >> bitshift[5] << bitshift2[5];
-+ }
-+ if (w & 1) { /* padded to 2 pix */
-+ buf = getint(fp);
-+ *(pp++) = (buf & colormask[0]) >> bitshift[0];
-+ *(pp++) = (buf & colormask[1]) >> bitshift[1];
-+ *(pp++) = (buf & colormask[2]) >> bitshift[2];
-+ }
-+ }
-+
-+ return FERROR(fp)? 1 : 0;
-+}
-+
-+
-+
-+/*******************************************/
-+static int loadBMP24(fp, pic24, w, h, bits) /* also handles 32-bit BI_RGB */
- FILE *fp;
- byte *pic24;
-- u_int w,h;
-+ u_int w,h, bits;
- {
- int i,j,padb,rv;
-- byte *pp;
-+ byte *pp = pic24 + ((h - 1) * w * 3);
-+ size_t l = w*h*3;
-
- rv = 0;
-
- padb = (4 - ((w*3) % 4)) & 0x03; /* # of pad bytes to read at EOscanline */
-+ if (bits==32) padb = 0;
-
- for (i=h-1; i>=0; i--) {
- pp = pic24 + (i * w * 3);
- if ((i&0x3f)==0) WaitCursor();
-
-- for (j=0; j<w; j++) {
-+ for (j=0; j<w && (pp - pic24 <= l); j++) {
- pp[2] = getc(fp); /* blue */
- pp[1] = getc(fp); /* green */
- pp[0] = getc(fp); /* red */
-+ if (bits==32) getc(fp);
- pp += 3;
- }
-
-@@ -507,6 +675,70 @@
-
-
- /*******************************************/
-+static int loadBMP32(fp, pic24, w, h, colormask) /* 32-bit BI_BITFIELDS only */
-+ FILE *fp;
-+ byte *pic24;
-+ u_int w, h, *colormask;
-+{
-+ int x, y;
-+ byte *pp;
-+ u_int buf;
-+ int i, bit, bitshift[3], colorbits[3], bitshift2[3];
-+
-+ for (i = 0; i < 3; ++i) {
-+ buf = colormask[i];
-+
-+ bitshift[i] = 0;
-+ for (bit = 0; bit < 32; ++bit) {
-+ if (buf & 1)
-+ break;
-+ else
-+ ++bitshift[i];
-+ buf >>= 1;
-+ }
-+
-+ colorbits[i] = 0;
-+ for (; bit < 32; ++bit) {
-+ if (buf & 1)
-+ ++colorbits[i];
-+ else
-+ break;
-+ buf >>= 1;
-+ }
-+ if (colorbits[i] > 8) { /* over 8-bit depth */
-+ bitshift[i] += (colorbits[i] - 8);
-+ bitshift2[i] = 0;
-+ } else
-+ bitshift2[i] = 8 - colorbits[i];
-+ }
-+
-+ if (DEBUG > 1)
-+ fprintf(stderr, "loadBMP32: bitfields\n"
-+ "\tR: bits = %2d, mask = %08x, shift >>%2d, <<%2d\n"
-+ "\tG: bits = %2d, mask = %08x, shift >>%2d, <<%2d\n"
-+ "\tB: bits = %2d, mask = %08x, shift >>%2d, <<%2d\n",
-+ colorbits[0], colormask[0], bitshift[0], bitshift2[0],
-+ colorbits[1], colormask[1], bitshift[1], bitshift2[1],
-+ colorbits[2], colormask[2], bitshift[2], bitshift2[2]);
-+
-+ for (y = h-1; y >= 0; y--) {
-+ pp = pic24 + (3 * w * y);
-+ if ((y&0x3f)==0) WaitCursor();
-+
-+ for(x = w; x > 0; x --) {
-+ buf = getint(fp);
-+ *(pp++) = (buf & colormask[0]) >> bitshift[0] << bitshift2[0];
-+ *(pp++) = (buf & colormask[1]) >> bitshift[1] << bitshift2[1];
-+ *(pp++) = (buf & colormask[2]) >> bitshift[2] << bitshift2[2];
-+ }
-+ }
-+
-+ return FERROR(fp)? 1 : 0;
-+}
-+
-+
-+
-+/*******************************************/
- static u_int getshort(fp)
- FILE *fp;
- {
-@@ -523,7 +755,7 @@
- int c, c1, c2, c3;
- c = getc(fp); c1 = getc(fp); c2 = getc(fp); c3 = getc(fp);
- return ((u_int) c) +
-- (((u_int) c1) << 8) +
-+ (((u_int) c1) << 8) +
- (((u_int) c2) << 16) +
- (((u_int) c3) << 24);
- }
-diff -ruN xv-3.10a-bugfixes/xvbrowse.c xv-3.10a-enhancements/xvbrowse.c
---- xv-3.10a-bugfixes/xvbrowse.c 2004-05-16 18:01:25.000000000 -0700
-+++ xv-3.10a-enhancements/xvbrowse.c 2005-04-25 23:30:27.000000000 -0700
-@@ -24,6 +24,10 @@
- typedef unsigned int mode_t; /* file mode bits */
- #endif
-
-+#ifndef MAX
-+# define MAX(a,b) (((a)>(b))?(a):(b)) /* used only for wheelmouse support */
-+#endif
-+
-
- /* load up built-in icons */
- #include "bits/br_file"
-@@ -36,6 +40,7 @@
- #include "bits/br_error"
- /* #include "bits/br_unknown" commented out (near line 492) */
- #include "bits/br_cmpres"
-+#include "bits/br_bzip2"
-
- #include "bits/br_gif"
- #include "bits/br_pm"
-@@ -50,11 +55,20 @@
- #include "bits/br_tiff"
- #include "bits/br_pds"
- #include "bits/br_ps"
-+#include "bits/br_pcd"
- #include "bits/br_iff"
- #include "bits/br_targa"
- #include "bits/br_xpm"
- #include "bits/br_xwd"
- #include "bits/br_fits"
-+#include "bits/br_png"
-+#include "bits/br_zx" /* [JCE] The Spectrum+3 icon */
-+#include "bits/br_mag"
-+#include "bits/br_maki"
-+#include "bits/br_pic"
-+#include "bits/br_pi"
-+#include "bits/br_pic2"
-+#include "bits/br_mgcsfx"
-
- #include "bits/br_trash"
- #include "bits/fcurs"
-@@ -94,14 +108,23 @@
- #define BF_XPM 25
- #define BF_XWD 26
- #define BF_FITS 27
--#define BF_MAX 28 /* # of built-in icons */
-+#define BF_PNG 28
-+#define BF_ZX 29 /* [JCE] Spectrum SCREEN$ */
-+#define BF_PCD 30
-+#define BF_BZIP2 31
-+#define JP_EXT_BF (BF_BZIP2)
-+#define BF_MAG (JP_EXT_BF + 1)
-+#define BF_MAKI (JP_EXT_BF + 2)
-+#define BF_PIC (JP_EXT_BF + 3)
-+#define BF_PI (JP_EXT_BF + 4)
-+#define BF_PIC2 (JP_EXT_BF + 5)
-+#define BF_MGCSFX (JP_EXT_BF + 6)
-+#define JP_EXT_BF_END (BF_MGCSFX)
-+#define BF_MAX (JP_EXT_BF_END + 1) /* # of built-in icons */
-
- #define ISLOADABLE(ftyp) (ftyp!=BF_DIR && ftyp!=BF_CHR && ftyp!=BF_BLK && \
- ftyp!=BF_SOCK && ftyp!=BF_FIFO)
-
--#define DEF_BROWWIDE 615 /* default size of window */
--#define DEF_BROWHIGH 356
--
- #define SCROLLVERT 8 /* height of scroll region at top/bottom of iconw */
- #define PAGEVERT 40 /* during rect drag, if further than this, page */
-
-@@ -113,16 +136,35 @@
- #define BOTMARGIN 58 /* room for a row of buttons and a line of text */
- #define LRMARGINS 5 /* left and right margins */
-
--#define ISIZE_WIDE 80 /* maximum size of an icon */
--#define ISIZE_HIGH 60
-+/* some people like bigger icons; 4:3 aspect ratio is recommended
-+ * (NOTE: standard XV binaries will not be able to read larger icons!) */
-+#ifndef ISIZE_WIDE
-+# define ISIZE_WIDE 80 /* maximum size of an icon */
-+#endif
-+#ifndef ISIZE_HIGH
-+# define ISIZE_HIGH 60
-+#endif
-
--#define ISPACE_WIDE (ISIZE_WIDE+16) /* icon spacing */
-+#ifndef ISIZE_WPAD
-+# define ISIZE_WPAD 16 /* extra horizontal padding between icons */
-+#endif
-+
-+#ifndef INUM_WIDE
-+# define INUM_WIDE 6 /* size initial window to hold this many icons */
-+#endif
-+#ifndef INUM_HIGH
-+# define INUM_HIGH 3
-+#endif
-+
-+#define ISPACE_WIDE (ISIZE_WIDE+ISIZE_WPAD) /* icon spacing */
- #define ISPACE_TOP 4 /* dist btwn top of ISPACE and ISIZE */
- #define ISPACE_TTOP 4 /* dist btwn bot of icon and title */
- #define ISPACE_HIGH (ISIZE_HIGH+ISPACE_TOP+ISPACE_TTOP+16+4)
-
- #define DBLCLICKTIME 300 /* milliseconds */
-
-+#define COUNT(x) (sizeof (x) / sizeof (x)[0])
-+
- /* button/menu indicies */
- #define BR_CHDIR 0
- #define BR_DELETE 1
-@@ -140,12 +182,23 @@
- #define BR_NBUTTS 13 /* # of command buttons */
- #define BR_SEP1 13 /* separator */
- #define BR_HIDDEN 14
-+#ifdef AUTO_EXPAND
-+#define BR_CLEARVD 15
-+#define BR_SELFILES 16
-+#define BR_NCMDS 17 /* # of menu commands */
-+#else
- #define BR_SELFILES 15
- #define BR_NCMDS 16 /* # of menu commands */
-+#endif
-
- #define BUTTW 80
- #define BUTTH 24
-
-+/* original size of window was 615 x 356 (for 80x60 thumbnails in 6x3 array) */
-+#define DEF_BROWWIDE (ISPACE_WIDE * INUM_WIDE + LRMARGINS * 2 + 29)
-+#define DEF_BROWHIGH (ISPACE_HIGH * INUM_HIGH + BUTTH * 2 + 16 + 28)
-+/* last number is a fudge--e.g., extra spaces, borders, etc. -----^ */
-+
- static char *showHstr = "Show hidden files";
- static char *hideHstr = "Hide 'hidden' files";
-
-@@ -164,6 +217,9 @@
- "Close window\t^c",
- MBSEP,
- "Show hidden files", /* no equiv */
-+#ifdef AUTO_EXPAND
-+ "Clear virtual directory",
-+#endif
- "Select files...\t^f"
- };
-
-@@ -209,6 +265,13 @@
- } BROWINFO;
-
-
-+/* keep track of last icon visible in each path */
-+typedef struct IVIS IVIS;
-+ struct IVIS { IVIS *next;
-+ char *name;
-+ int icon;
-+ };
-+
- static Cursor movecurs, copycurs, delcurs;
- static BROWINFO binfo[MAXBRWIN];
- static Pixmap bfIcons[BF_MAX], trashPix;
-@@ -294,10 +357,16 @@
- static void cp_special PARM((struct stat *, int));
- static void cp_fifo PARM((struct stat *, int));
-
-+#ifdef AUTO_EXPAND
-+static int stat2bf PARM((u_int, char *));
-+#else
- static int stat2bf PARM((u_int));
-+#endif
-
- static int selmatch PARM((char *, char *));
- static int selmatch1 PARM((char *, char *));
-+static void recIconVisible PARM((char *, int));
-+static void restIconVisible PARM((BROWINFO *));
-
-
-
-@@ -511,9 +580,10 @@
- bfIcons[BF_JFIF]=MakePix1(br->win,br_jfif_bits,br_jfif_width,br_jfif_height);
- bfIcons[BF_TIFF]=MakePix1(br->win,br_tiff_bits,br_tiff_width,br_tiff_height);
- bfIcons[BF_PDS] =MakePix1(br->win,br_pds_bits, br_pds_width, br_pds_height);
--
-- bfIcons[BF_COMPRESS]= MakePix1(br->win, br_cmpres_bits,
-- br_cmpres_width, br_cmpres_height);
-+ bfIcons[BF_COMPRESS] = MakePix1(br->win, br_cmpres_bits,
-+ br_cmpres_width, br_cmpres_height);
-+ bfIcons[BF_BZIP2] = MakePix1(br->win, br_bzip2_bits,
-+ br_bzip2_width, br_bzip2_height);
-
- bfIcons[BF_PS] =MakePix1(br->win,br_ps_bits, br_ps_width, br_ps_height);
- bfIcons[BF_IFF] =MakePix1(br->win,br_iff_bits, br_iff_width, br_iff_height);
-@@ -524,6 +594,16 @@
- bfIcons[BF_XPM] =MakePix1(br->win,br_xpm_bits, br_xpm_width, br_xpm_height);
- bfIcons[BF_XWD] =MakePix1(br->win,br_xwd_bits, br_xwd_width, br_xwd_height);
- bfIcons[BF_FITS]=MakePix1(br->win,br_fits_bits,br_fits_width,br_fits_height);
-+ bfIcons[BF_PNG] =MakePix1(br->win,br_png_bits, br_png_width, br_png_height);
-+ bfIcons[BF_ZX] =MakePix1(br->win,br_zx_bits, br_zx_width, br_zx_height);
-+ bfIcons[BF_PCD] =MakePix1(br->win,br_pcd_bits, br_pcd_width, br_pcd_height);
-+ bfIcons[BF_MAG] =MakePix1(br->win,br_mag_bits, br_mag_width, br_mag_height);
-+ bfIcons[BF_MAKI]=MakePix1(br->win,br_maki_bits,br_maki_width,br_maki_height);
-+ bfIcons[BF_PIC] =MakePix1(br->win,br_pic_bits, br_pic_width, br_pic_height);
-+ bfIcons[BF_PI] =MakePix1(br->win,br_pi_bits, br_pi_width, br_pi_height);
-+ bfIcons[BF_PIC2]=MakePix1(br->win,br_pic2_bits,br_pic2_width,br_pic2_height);
-+ bfIcons[BF_MGCSFX] = MakePix1(br->win,br_mgcsfx_bits,
-+ br_mgcsfx_width,br_mgcsfx_height);
-
-
- /* check that they all got built */
-@@ -698,6 +778,9 @@
- }
- }
-
-+#ifdef VS_RESCMAP
-+static int _IfTempOut=0;
-+#endif
-
- /***************************************************************/
- void KillBrowseWindows()
-@@ -730,7 +813,6 @@
- return 0;
- }
-
--
- /***************************************************************/
- static int brChkEvent(br, xev)
- BROWINFO *br;
-@@ -745,15 +827,32 @@
-
- if (!hasBeenSized) return 0; /* ignore evrythng until we get 1st Resize */
-
-+
-+#ifdef VS_RESCMAP
-+ /* force change color map if have LocalCmap */
-+ if (browPerfect && browCmap && (_IfTempOut==2)) {
-+ int i;
-+ XSetWindowAttributes xswa;
-+
-+ xswa.colormap = LocalCmap? LocalCmap : theCmap;
-+ for (i=0; i<MAXBRWIN; ++i)
-+ XChangeWindowAttributes(theDisp, binfo[i].win, CWColormap, &xswa);
-+ XFlush(theDisp);
-+ _IfTempOut=1;
-+ }
-+#endif
-+
- if (xev->type == Expose) {
- int x,y,w,h;
- XExposeEvent *e = (XExposeEvent *) xev;
- x = e->x; y = e->y; w = e->width; h = e->height;
-
- /* throw away excess redraws for 'dumb' windows */
-- if (e->count > 0 && (e->window == br->scrl.win)) {}
-+ if (e->count > 0 && (e->window == br->scrl.win))
-+ ;
-
-- else if (e->window == br->scrl.win) SCRedraw(&(br->scrl));
-+ else if (e->window == br->scrl.win)
-+ SCRedraw(&(br->scrl));
-
- else if (e->window == br->win || e->window == br->iconW) { /* smart wins */
- /* group individual expose rects into a single expose region */
-@@ -806,13 +905,57 @@
- int i,x,y;
- x = e->x; y = e->y;
-
-- if (e->button == Button1) {
-+#ifdef VS_RESCMAP
-+ if (browCmap && browPerfect && (_IfTempOut!=0))
-+ {
-+ XSetWindowAttributes xswa;
-+ _IfTempOut--;
-+ xswa.colormap = browCmap;
-+ for(i=0;i<MAXBRWIN;i++)
-+ XChangeWindowAttributes(theDisp, binfo[i].win, CWColormap, &xswa);
-+ XFlush(theDisp);
-+ }
-+
-+#endif
-+
-+ if (e->button == Button1) {
- if (e->window == br->win) clickBrow(br,x,y);
- else if (e->window == br->scrl.win) SCTrack(&(br->scrl),x,y);
- else if (e->window == br->iconW) {
- i = clickIconWin(br, x,y,(unsigned long) e->time,
- (e->state&ControlMask) || (e->state&ShiftMask));
--
-+ }
-+ else rv = 0;
-+ }
-+ else if (e->button == Button4) { /* note min vs. max, + vs. - */
-+ /* scroll regardless of where we are in the browser window */
-+ if (e->window == br->win ||
-+ e->window == br->scrl.win ||
-+ e->window == br->iconW)
-+ {
-+ SCRL *sp=&(br->scrl);
-+ int halfpage=MAX(1,sp->page/2); /* user resize to 1 line? */
-+
-+ if (sp->val > sp->min+halfpage)
-+ SCSetVal(sp,sp->val-halfpage);
-+ else
-+ SCSetVal(sp,sp->min);
-+ }
-+ else rv = 0;
-+ }
-+ else if (e->button == Button5) { /* note max vs. min, - vs. + */
-+ /* scroll regardless of where we are in the browser window */
-+ if (e->window == br->win ||
-+ e->window == br->scrl.win ||
-+ e->window == br->iconW)
-+ {
-+ SCRL *sp=&(br->scrl);
-+ int halfpage=MAX(1,sp->page/2); /* user resize to 1 line? */
-+
-+ if (sp->val < sp->max-halfpage)
-+ SCSetVal(sp,sp->val+halfpage);
-+ else
-+ SCSetVal(sp,sp->max);
- }
- else rv = 0;
- }
-@@ -1101,6 +1244,10 @@
- case BR_SELFILES: doSelFilesCmd(br); break;
-
- case BR_RECURSUP: doRecurseCmd(br); break;
-+
-+#ifdef AUTO_EXPAND
-+ case BR_CLEARVD: Vdsettle(); break;
-+#endif
- }
- }
-
-@@ -1250,6 +1397,18 @@
- int i, allowtext;
-
- if (!nostr) setSelInfoStr(br, sel);
-+#ifdef AUTO_EXPAND
-+ if (Isvdir(br->path)) {
-+ BTSetActive(&br->but[BR_DELETE], 0);
-+ br->cmdMB.dim[BR_DELETE] = 1;
-+
-+ BTSetActive(&br->but[BR_RENAME], 0);
-+ br->cmdMB.dim[BR_RENAME] = 1;
-+
-+ BTSetActive(&br->but[BR_MKDIR], 0);
-+ br->cmdMB.dim[BR_MKDIR] = 1;
-+ } else {
-+#endif
- BTSetActive(&br->but[BR_DELETE], br->numlit>0);
- br->cmdMB.dim[BR_DELETE] = !(br->numlit>0);
-
-@@ -1258,6 +1417,11 @@
-
- BTSetActive(&br->but[BR_GENICON], br->numlit>0);
- br->cmdMB.dim[BR_GENICON] = !(br->numlit>0);
-+#ifdef AUTO_EXPAND
-+ BTSetActive(&br->but[BR_MKDIR], 1);
-+ br->cmdMB.dim[BR_MKDIR] = 0;
-+ }
-+#endif
-
- /* turn on 'text view' cmd if exactly one non-dir is lit */
- allowtext = 0;
-@@ -1318,8 +1482,11 @@
- struct stat st;
-
- sprintf(buf, "%s%s", br->path, bf->name); /* build filename */
-+#ifdef AUTO_EXPAND
-+ Dirtovd(buf);
-+#endif
- if (stat(buf, &st) == 0) {
-- sprintf(buf, "%s: %ld bytes", bf->name, st.st_size);
-+ sprintf(buf, "%s: %ld bytes", bf->name, (long)st.st_size);
- strcat(buf, buf1);
- }
- }
-@@ -1598,6 +1765,10 @@
- {
- int sval, first, numvis;
-
-+ /* if we know what path we have, remember last visible icon for this path */
-+ if (br->path)
-+ recIconVisible(br->path, num);
-+
- /* if icon #i isn't visible, adjust scrollbar so it *is* */
-
- sval = br->scrl.val;
-@@ -1649,29 +1820,14 @@
- return;
- }
-
--
- /***************************************************************/
--static int clickIconWin(br, mx, my, mtime, multi)
-- BROWINFO *br;
-- int mx,my,multi;
-- unsigned long mtime;
-+static int updateSel(br, sel, multi, mtime)
-+ BROWINFO *br;
-+ int sel, multi;
-+ unsigned long mtime;
- {
-- /* returns '-1' normally, returns an index into bfList[] if the user
-- double-clicks an icon */
--
-- int i,j, rv, sel, cpymode, dodel;
-- BROWINFO *destBr;
-- BFIL *bf;
-- char buf[256], *destFolderName;
--
-- rv = -1; /* default return value */
-- if (!br->bfList || !br->bfLen) return rv;
--
-- destBr = br; destFolderName = ".";
--
-- sel = mouseInWhichIcon(br, mx, my);
--
-- dodel = 0;
-+ int i;
-+ BFIL *bf;
-
- if (sel == -1) { /* clicked on nothing */
- if (!multi) { /* deselect all */
-@@ -1728,11 +1884,12 @@
-
-
- /* see if we've double-clicked something */
-- if (sel==br->lastIconClicked && mtime-br->lastClickTime < DBLCLICKTIME) {
-+ if (mtime &&
-+ sel==br->lastIconClicked && mtime-br->lastClickTime < DBLCLICKTIME) {
- br->lastIconClicked = -1; /* YES */
-
- doubleClick(br, sel);
-- return rv;
-+ return -1;
- }
-
- else {
-@@ -1741,9 +1898,36 @@
- }
- }
-
--
- changedNumLit(br, -1, 0);
-+ return 0;
-+}
-+
-
-+/***************************************************************/
-+static int clickIconWin(br, mx, my, mtime, multi)
-+ BROWINFO *br;
-+ int mx,my,multi;
-+ unsigned long mtime;
-+{
-+ /* returns '-1' normally, returns an index into bfList[] if the user
-+ double-clicks an icon */
-+
-+ int i,j, sel, cpymode, dodel;
-+ BROWINFO *destBr;
-+ BFIL *bf;
-+ char buf[256], *destFolderName;
-+
-+ if (!br->bfList || !br->bfLen) return -1;
-+
-+ destBr = br; destFolderName = ".";
-+
-+ sel = mouseInWhichIcon(br, mx, my);
-+ dodel = 0;
-+
-+ recIconVisible(br->path, sel);
-+
-+ if (updateSel(br, sel, multi, mtime))
-+ return -1;
-
-
- { /* track mouse until button1 is released */
-@@ -2098,7 +2282,7 @@
- }
- } /* end of 'tracking' sub-function */
-
-- return rv;
-+ return -1;
- }
-
- /*******************************************/
-@@ -2164,15 +2348,35 @@
- else sprintf(buf, "%s%s", br->path, br->bfList[sel].name);
- #endif
-
-+#ifdef AUTO_EXPAND
-+ if (Chvdir(buf)) {
-+#else
- if (chdir(buf)) {
-+#endif
- char str[512];
- sprintf(str,"Unable to cd to '%s'\n", br->bfList[sel].name);
- setBrowStr(br, str);
- XBell(theDisp, 50);
- }
- else {
-+#ifdef AUTO_EXPAND
-+ if (Isvdir(buf)) {
-+ BTSetActive(&br->but[BR_DELETE], 0);
-+ br->cmdMB.dim[BR_DELETE] = 1;
-+
-+ BTSetActive(&br->but[BR_RENAME], 0);
-+ br->cmdMB.dim[BR_RENAME] = 1;
-+
-+ BTSetActive(&br->but[BR_MKDIR], 0);
-+ br->cmdMB.dim[BR_MKDIR] = 1;
-+ } else {
-+ BTSetActive(&br->but[BR_MKDIR], 1);
-+ br->cmdMB.dim[BR_MKDIR] = 0;
-+ }
-+#endif
- scanDir(br);
- SCSetVal(&(br->scrl), 0); /* reset to top on a chdir */
-+ restIconVisible(br);
- }
- }
-
-@@ -2193,6 +2397,28 @@
- }
- else { *event_retP = LOADPIC; SetDirFName(buf); }
-
-+#ifdef VS_RESCMAP
-+ /* Change Colormap for browser */
-+ if (browPerfect && browCmap)
-+ {
-+ int i;
-+ XSetWindowAttributes xswa;
-+ if(LocalCmap)
-+ {
-+ xswa.colormap = LocalCmap;
-+ _IfTempOut=2;
-+ }
-+ else
-+ {
-+ xswa.colormap = theCmap;
-+ _IfTempOut=2;
-+ }
-+ for(i=0;i<MAXBRWIN;i++)
-+ XChangeWindowAttributes(theDisp, binfo[i].win, CWColormap, &xswa);
-+ XFlush(theDisp);
-+ }
-+#endif
-+
- *event_doneP = 1; /* make MainLoop load image */
- }
- }
-@@ -2347,6 +2573,9 @@
-
- /* try to open this file */
- sprintf(foo, "%s%s", br->path, br->bfList[i].name);
-+#ifdef AUTO_EXPAND
-+ Dirtovd(foo);
-+#endif
- for (j=0; j<numnames && strcmp(namelist[j],foo); j++);
- if (j<numnames) {
- curname = nList.selected = j;
-@@ -2362,6 +2591,9 @@
- else { /* not SPACE, or SPACE and lit=1 and not shift */
- for (i=0; i<br->bfLen && !br->bfList[i].lit; i++); /* find lit one */
- sprintf(fname, "%s%s", br->path, br->bfList[i].name);
-+#ifdef AUTO_EXPAND
-+ Dirtovd(fname);
-+#endif
- viewsel = !(strcmp(fname, fullfname));
-
- if (viewsel) {
-@@ -2553,7 +2785,11 @@
- }
- #endif
-
-+#ifdef AUTO_EXPAND
-+ if (Chvdir(tmppath)) {
-+#else
- if (chdir(tmppath)) {
-+#endif
- char str[512];
- sprintf(str,"Unable to cd to '%s'\n", tmppath);
- MBRedraw(&(br->dirMB));
-@@ -2561,8 +2797,24 @@
- XBell(theDisp, 50);
- }
- else {
-+#ifdef AUTO_EXPAND
-+ if (Isvdir(tmppath)) {
-+ BTSetActive(&br->but[BR_DELETE], 0);
-+ br->cmdMB.dim[BR_DELETE] = 1;
-+
-+ BTSetActive(&br->but[BR_RENAME], 0);
-+ br->cmdMB.dim[BR_RENAME] = 1;
-+
-+ BTSetActive(&br->but[BR_MKDIR], 0);
-+ br->cmdMB.dim[BR_MKDIR] = 1;
-+ } else {
-+ BTSetActive(&br->but[BR_MKDIR], 1);
-+ br->cmdMB.dim[BR_MKDIR] = 0;
-+ }
-+#endif
- scanDir(br);
- SCSetVal(&br->scrl, 0); /* reset to top of window on a chdir */
-+ restIconVisible(br);
- }
- }
- }
-@@ -2581,7 +2833,11 @@
- if ((strlen(br->path) > (size_t) 2) && br->path[strlen(br->path)-1] == '/')
- br->path[strlen(br->path)-1] = '\0';
-
-+#ifdef AUTO_EXPAND
-+ rv = Chvdir(br->path);
-+#else
- rv = chdir(br->path);
-+#endif
- if (rv) {
- char str[512];
- sprintf(str, "Unable to cd to '%s'\n", br->path);
-@@ -2589,6 +2845,23 @@
- XBell(theDisp, 50);
- }
-
-+#ifdef AUTO_EXPAND
-+ if (Isvdir(br->path)) {
-+ BTSetActive(&br->but[BR_DELETE], 0);
-+ br->cmdMB.dim[BR_DELETE] = 1;
-+
-+ BTSetActive(&br->but[BR_RENAME], 0);
-+ br->cmdMB.dim[BR_RENAME] = 1;
-+
-+ BTSetActive(&br->but[BR_MKDIR], 0);
-+ br->cmdMB.dim[BR_MKDIR] = 1;
-+ } else {
-+ BTSetActive(&br->but[BR_MKDIR], 1);
-+ br->cmdMB.dim[BR_MKDIR] = 0;
-+ }
-+#endif
-+
-+ restIconVisible(br);
- strcat(br->path, "/"); /* put trailing '/' back on */
- return rv;
- }
-@@ -2615,8 +2888,13 @@
- strcpy(dstbr->mblist[i], srcbr->mblist[i]);
- }
-
-- dstbr->dirMB.list = srcbr->mblist;
-+#if 0
-+ dstbr->dirMB.list = srcbr->mblist; /* original bug..? */
- dstbr->dirMB.nlist = srcbr->ndirs;
-+#else
-+ dstbr->dirMB.list = dstbr->mblist; /* fixed by */
-+ dstbr->dirMB.nlist = dstbr->ndirs; /* jp-extension. */
-+#endif
-
- XClearArea(theDisp, dstbr->dirMB.win, dstbr->dirMB.x, dstbr->dirMB.y,
- dstbr->dirMB.w+3, dstbr->dirMB.h+3, False);
-@@ -2974,7 +3252,11 @@
-
-
- if (stat(bf->name, &st)==0) {
-+#ifdef AUTO_EXPAND
-+ bf->ftype = stat2bf((u_int) st.st_mode , bf->name);
-+#else
- bf->ftype = stat2bf((u_int) st.st_mode);
-+#endif
- if (bf->ftype == BF_FILE && (st.st_mode & 0111)) bf->ftype = BF_EXE;
-
- switch (bf->ftype) {
-@@ -3006,6 +3288,7 @@
- case RFT_XBM: bf->ftype = BF_XBM; break;
- case RFT_SUNRAS: bf->ftype = BF_SUNRAS; break;
- case RFT_BMP: bf->ftype = BF_BMP; break;
-+ case RFT_WBMP: bf->ftype = BF_BMP; break;
- case RFT_UTAHRLE: bf->ftype = BF_UTAHRLE; break;
- case RFT_IRIS: bf->ftype = BF_IRIS; break;
- case RFT_PCX: bf->ftype = BF_PCX; break;
-@@ -3013,12 +3296,22 @@
- case RFT_TIFF: bf->ftype = BF_TIFF; break;
- case RFT_PDSVICAR: bf->ftype = BF_PDS; break;
- case RFT_COMPRESS: bf->ftype = BF_COMPRESS; break;
-+ case RFT_BZIP2: bf->ftype = BF_BZIP2; break;
- case RFT_PS: bf->ftype = BF_PS; break;
- case RFT_IFF: bf->ftype = BF_IFF; break;
- case RFT_TARGA: bf->ftype = BF_TARGA; break;
- case RFT_XPM: bf->ftype = BF_XPM; break;
- case RFT_XWD: bf->ftype = BF_XWD; break;
- case RFT_FITS: bf->ftype = BF_FITS; break;
-+ case RFT_PNG: bf->ftype = BF_PNG; break;
-+ case RFT_ZX: bf->ftype = BF_ZX; break; /* [JCE] */
-+ case RFT_PCD: bf->ftype = BF_PCD; break;
-+ case RFT_MAG: bf->ftype = BF_MAG; break;
-+ case RFT_MAKI: bf->ftype = BF_MAKI; break;
-+ case RFT_PIC: bf->ftype = BF_PIC; break;
-+ case RFT_PI: bf->ftype = BF_PI; break;
-+ case RFT_PIC2: bf->ftype = BF_PIC2; break;
-+ case RFT_MGCSFX: bf->ftype = BF_MGCSFX; break;
- }
- }
- }
-@@ -3405,7 +3698,7 @@
- double wexpand,hexpand;
- int iwide, ihigh;
- byte *icon24, *icon8;
-- char str[256], str1[256], *readname, uncompname[128];
-+ char str[256], str1[256], readname[128], uncompname[128];
- char basefname[128], *uncName;
-
-
-@@ -3414,7 +3707,7 @@
- basefname[0] = '\0';
- pinfo.pic = (byte *) NULL;
- pinfo.comment = (char *) NULL;
-- readname = bf->name;
-+ strncpy(readname, bf->name, sizeof(readname) - 1);
-
- /* free any old info in 'bf' */
- if (bf->imginfo) free (bf->imginfo);
-@@ -3431,7 +3724,7 @@
-
- filetype = ReadFileType(bf->name);
-
-- if (filetype == RFT_COMPRESS) {
-+ if ((filetype == RFT_COMPRESS) || (filetype == RFT_BZIP2)) {
- #if (defined(VMS) && !defined(GUNZIP))
- /* VMS decompress doesn't like the file to have a trailing .Z in fname
- however, GUnZip is OK with it, which we are calling UnCompress */
-@@ -3442,9 +3735,9 @@
- uncName = bf->name;
- #endif
-
-- if (UncompressFile(uncName, uncompname)) {
-+ if (UncompressFile(uncName, uncompname, filetype)) {
- filetype = ReadFileType(uncompname);
-- readname = uncompname;
-+ strncpy(readname, uncompname, sizeof(readname) - 1);
- }
- else {
- sprintf(str, "Couldn't uncompress file '%s'", bf->name);
-@@ -3453,6 +3746,56 @@
- }
- }
-
-+#ifdef MACBINARY
-+ if (handlemacb && macb_file == True && bf->ftype != BF_ERROR) {
-+ if (RemoveMacbinary(readname, uncompname)) {
-+ if (strcmp(readname, bf->name)!=0) unlink(readname);
-+ strncpy(readname, uncompname, sizeof(readname) - 1);
-+ }
-+ else {
-+ sprintf(str, "Unable to remove a InfoFile header form '%s'.", bf->name);
-+ setBrowStr(br, str);
-+ bf->ftype = BF_ERROR;
-+ }
-+ }
-+#endif
-+
-+#ifdef HAVE_MGCSFX_AUTO
-+ if (bf->ftype != BF_ERROR) {
-+ if(filetype == RFT_MGCSFX){
-+ char tmpname[128];
-+ char *icom;
-+
-+ if((icom = mgcsfx_auto_input_com(bf->name)) != NULL){
-+ sprintf(tmpname, "%s/xvmsautoXXXXXX", tmpdir);
-+#ifdef USE_MKSTEMP
-+ close(mkstemp(tmpname));
-+#else
-+ mktemp(tmpname);
-+#endif
-+ SetISTR(ISTR_INFO, "Converting to known format by MgcSfx auto...");
-+ sprintf(str,"%s >%s", icom, tmpname);
-+ }else goto ms_auto_no;
-+
-+#ifndef VMS
-+ if (system(str))
-+#else
-+ if (!system(str))
-+#endif
-+ {
-+ sprintf(str, "Unable to convert '%s' by MgcSfx auto.", bf->name);
-+ setBrowStr(br, str);
-+ bf->ftype = BF_ERROR;
-+ } else {
-+ filetype = ReadFileType(tmpname);
-+ if (strcmp(readname, bf->name)!=0) unlink(readname);
-+ strncpy(readname, tmpname, sizeof(readname) - 1);
-+ }
-+ }
-+ }
-+ms_auto_no:
-+#endif /* HAVE_MGCSFX_AUTO */
-+
- /* get rid of comments. don't need 'em */
- if (pinfo.comment) free(pinfo.comment); pinfo.comment = (char *) NULL;
-
-@@ -3470,6 +3813,9 @@
- else {
- /* otherwise it's a known filetype... do the *hard* part now... */
-
-+#ifdef VS_ADJUST
-+ normaspect = defaspect;
-+#endif
- i = ReadPicFile(readname, filetype, &pinfo, 1);
- KillPageFiles(pinfo.pagebname, pinfo.numpages);
-
-@@ -3489,7 +3835,7 @@
- }
-
- /* if we made an uncompressed file, we can rm it now */
-- if (readname != bf->name) unlink(readname);
-+ if (strcmp(readname, bf->name)!=0) unlink(readname);
-
-
- /* at this point either BF_ERROR, BF_UNKNOWN, BF_EXE or pic */
-@@ -3507,16 +3853,30 @@
-
- /* compute size of icon (iwide,ihigh) */
-
-+#ifdef VS_ADJUST
-+ if (!vsadjust) normaspect = 1;
-+
-+ wexpand = (double) (pinfo.w * normaspect) / (double) ISIZE_WIDE;
-+#else
- wexpand = (double) pinfo.w / (double) ISIZE_WIDE;
-+#endif /* VS_ADJUST */
- hexpand = (double) pinfo.h / (double) ISIZE_HIGH;
-
- if (wexpand >= 1.0 || hexpand >= 1.0) { /* don't expand small icons */
- if (wexpand>hexpand) {
-+#ifdef VS_ADJUST
-+ iwide = (int) ((pinfo.w * normaspect) / wexpand + 0.5);
-+#else
- iwide = (int) (pinfo.w / wexpand + 0.5);
-+#endif
- ihigh = (int) (pinfo.h / wexpand + 0.5);
- }
- else {
-+#ifdef VS_ADJUST
-+ iwide = (int) ((pinfo.w * normaspect) / hexpand + 0.5);
-+#else
- iwide = (int) (pinfo.w / hexpand + 0.5);
-+#endif
- ihigh = (int) (pinfo.h / hexpand + 0.5);
- }
- }
-@@ -3566,6 +3926,15 @@
- case RFT_XPM: strcat(str,"XPM file"); break;
- case RFT_XWD: strcat(str,"XWD file"); break;
- case RFT_FITS: strcat(str,"FITS file"); break;
-+ case RFT_PNG: strcat(str,"PNG file"); break;
-+ case RFT_ZX: strcat(str,"Spectrum SCREEN$"); break; /* [JCE] */
-+ case RFT_PCD: strcat(str,"PhotoCD file"); break;
-+ case RFT_MAG: strcat(str,"MAG file"); break;
-+ case RFT_MAKI: strcat(str,"MAKI file"); break;
-+ case RFT_PIC: strcat(str,"PIC file"); break;
-+ case RFT_PI: strcat(str,"PI file"); break;
-+ case RFT_PIC2: strcat(str,"PIC2 file"); break;
-+ case RFT_MGCSFX: strcat(str,"Magic Suffix file"); break;
- default: strcat(str,"file of unknown type"); break;
- }
-
-@@ -3669,6 +4038,10 @@
-
- sprintf(thFname, "%s%s/%s", br->path, THUMBDIR, bf->name);
-
-+#ifdef AUTO_EXPAND
-+ Dirtovd(thFname);
-+#endif
-+
- fp = fopen(thFname, "r");
- if (!fp) return; /* nope, it doesn't have one */
-
-@@ -3784,6 +4157,11 @@
-
- sprintf(thFname, "%s%s/%s", br->path, THUMBDIR, bf->name);
-
-+#ifdef AUTO_EXPAND
-+ Dirtovd(thFname);
-+#endif
-+
-+ unlink(thFname); /* just in case there's already an unwritable one */
- fp = fopen(thFname, "w");
- if (!fp) {
- sprintf(buf, "Can't create thumbnail file '%s': %s", thFname,
-@@ -3848,15 +4226,30 @@
-
- sprintf(thFname, "%s%s", br->path, THUMBDIRNAME);
-
-+#ifdef AUTO_EXPAND
-+ Dirtovd(thFname);
-+#endif
-+
- i = stat(thFname, &st);
- if (i) { /* failed, let's create it */
- sprintf(thFname, "%s.", br->path);
-+#ifdef AUTO_EXPAND
-+ Dirtovd(thFname);
-+#endif
- i = stat(thFname, &st); /* get permissions of parent dir */
- if (!i) perm = st.st_mode & 07777;
- else perm = 0755;
-
- sprintf(thFname, "%s%s", br->path, THUMBDIRNAME);
-+#ifdef AUTO_EXPAND
-+ Dirtovd(thFname);
-+# ifdef VIRTUAL_TD
-+ if (mkdir(thFname, (mode_t) perm) < 0)
-+ Mkvdir_force(thFname);
-+# else
- mkdir(thFname, (mode_t) perm);
-+# endif
-+#endif
- }
- }
-
-@@ -3898,7 +4291,7 @@
- for (i=0, bf=br->bfList; i<br->bfLen; i++, bf++) {
- if (bf->ftype <= BF_FILE || bf->ftype >= BF_ERROR || bf->ftype==BF_EXE) {
-
-- /* ie, not a 'special' file */
-+ /* i.e., not a 'special' file */
-
- int s1, s2;
- char thfname[256];
-@@ -3912,10 +4305,9 @@
- sprintf(thfname, "%s/%s", THUMBDIR, bf->name);
- s2 = stat(thfname, &thumbst);
-
-- if (s1 || s2 || filest.st_mtime > thumbst.st_mtime ||
-- filest.st_ctime > thumbst.st_ctime) {
-+ if (s1 || s2 || filest.st_mtime > thumbst.st_mtime) {
- /* either stat'ing the file or the thumbfile failed, or
-- both stat's succeeded and the file has a newer mod or creation
-+ both stat's succeeded and the file has a newer mod
- time than the thumbnail file */
-
- makeIconVisible(br, i);
-@@ -3927,8 +4319,12 @@
- iconsBuilt++;
- if (DEBUG)
- fprintf(stderr,"icon made:fname='%s' thfname='%s' %d,%d,%ld,%ld\n",
-- bf->name, thfname, s1,s2,filest.st_mtime,thumbst.st_mtime);
-+ bf->name, thfname, s1, s2,
-+ (long)filest.st_mtime, (long)thumbst.st_mtime);
- }
-+ } else if (filest.st_ctime > thumbst.st_ctime) {
-+ /* update protections */
-+ chmod(thfname, (mode_t) (filest.st_mode & 07777));
- }
- }
- statcount++;
-@@ -3963,7 +4359,11 @@
- sprintf(thfname, "%s/%s", THUMBDIR, dp->d_name);
- if (stat(thfname, &thumbst)==0) { /* success */
- int tmp;
-+#ifdef AUTO_EXPAND
-+ tmp = stat2bf((u_int) thumbst.st_mode , thfname);
-+#else
- tmp = stat2bf((u_int) thumbst.st_mode);
-+#endif
-
- if (tmp == BF_FILE) { /* a plain file */
- /* see if this thumbfile has an associated pic file */
-@@ -4042,6 +4442,15 @@
- static char *labels[] = { "\nOk", "\033Cancel" };
- struct stat st;
-
-+#ifdef AUTO_EXPAND
-+ if (Isvdir(br->path)) {
-+ sprintf(buf,"Sorry, you can't rename file in the virtual directory, '%s'",
-+ br->path);
-+ ErrPopUp(buf, "\nBummer!");
-+ return;
-+ }
-+#endif
-+
- if (cdBrow(br)) return;
-
- /* find the selected file */
-@@ -4129,6 +4538,15 @@
- static char *labels[] = { "\nOk", "\033Cancel" };
- struct stat st;
-
-+#ifdef AUTO_EXPAND
-+ if (Isvdir(br->path)) {
-+ sprintf(buf,"Sorry, you can't mkdir in the virtual directory, '%s'",
-+ br->path);
-+ ErrPopUp(buf, "\nBummer!");
-+ return;
-+ }
-+#endif
-+
- if (cdBrow(br)) return;
-
- buf[0] = '\0';
-@@ -4197,14 +4615,34 @@
- if (cdBrow(br)) return; /* prints its own error message */
- }
-
-+#ifdef AUTO_EXPAND
-+ if (Chvdir(buf)) {
-+#else
- if (chdir(buf)) {
-+#endif
- sprintf(str,"Unable to cd to '%s'\n", buf);
- setBrowStr(br, str);
- XBell(theDisp, 50);
- }
- else {
-+#ifdef AUTO_EXPAND
-+ if (Isvdir(buf)) {
-+ BTSetActive(&br->but[BR_DELETE], 0);
-+ br->cmdMB.dim[BR_DELETE] = 1;
-+
-+ BTSetActive(&br->but[BR_RENAME], 0);
-+ br->cmdMB.dim[BR_RENAME] = 1;
-+
-+ BTSetActive(&br->but[BR_MKDIR], 0);
-+ br->cmdMB.dim[BR_MKDIR] = 1;
-+ } else {
-+ BTSetActive(&br->but[BR_MKDIR], 1);
-+ br->cmdMB.dim[BR_MKDIR] = 0;
-+ }
-+#endif
- scanDir(br);
- SCSetVal(&(br->scrl), 0); /* reset to top on a chdir */
-+ restIconVisible(br);
- }
- }
-
-@@ -4229,6 +4667,15 @@
- char buf[512];
- static char *yesno[] = { "\004Delete", "\033Cancel" };
-
-+#ifdef AUTO_EXPAND
-+ if (Isvdir(br->path)) {
-+ sprintf(buf,"Sorry, you can't delete file at the virtual directory, '%s'",
-+ br->path);
-+ ErrPopUp(buf, "\nBummer!");
-+ return;
-+ }
-+#endif
-+
- if (!br->bfLen || !br->bfList || !br->numlit) return;
-
- if (cdBrow(br)) return; /* can't cd to this directory. screw it! */
-@@ -4251,7 +4698,11 @@
- for (i=0, bf=br->bfList; i<br->bfLen; i++,bf++) {
- if (bf->lit) {
- if (firstdel == -1) firstdel = i;
-- if (bf->ftype == BF_DIR) numdirs++;
-+ if (bf->ftype == BF_DIR
-+#ifdef AUTO_EXPAND
-+ && (!Isarchive(bf->name))
-+#endif
-+ ) numdirs++;
- else numfiles++;
- }
- }
-@@ -4265,7 +4716,12 @@
- slen = strlen(buf);
-
- for (i=0, bf=br->bfList; i<br->bfLen; i++,bf++) {
-+#ifdef AUTO_EXPAND
-+ if (bf->lit && (bf->ftype != BF_DIR || Isarchive(bf->name))) {
-+#else
- if (bf->lit && bf->ftype != BF_DIR) {
-+#endif
-+
- if ( (slen + strlen(bf->name) + 1) > 256) {
- strcat(buf,"...");
- break;
-@@ -4277,7 +4733,7 @@
- }
- }
-
-- i = PopUp(buf, yesno, 2);
-+ i = PopUp(buf, yesno, COUNT(yesno));
- if (i) return; /* cancelled */
- }
-
-@@ -4290,7 +4746,11 @@
- slen = strlen(buf);
-
- for (i=0, bf=br->bfList; i<br->bfLen; i++,bf++) {
-+#ifdef AUTO_EXPAND
-+ if (bf->lit && (bf->ftype == BF_DIR || !Isarchive(bf->name))) {
-+#else
- if (bf->lit && bf->ftype == BF_DIR) {
-+#endif
- if ( (slen + strlen(bf->name) + 1) > 256) {
- strcat(buf,"...");
- break;
-@@ -4302,7 +4762,7 @@
- }
- }
-
-- i = PopUp(buf, yesno, 2);
-+ i = PopUp(buf, yesno, COUNT(yesno));
- if (i) return; /* cancelled */
- }
-
-@@ -4311,7 +4771,11 @@
-
- for (i=0, bf=br->bfList; i<br->bfLen; i++,bf++) {
- if (bf->lit) {
-- if (bf->ftype == BF_DIR) rm_dir (br, bf->name);
-+ if (bf->ftype == BF_DIR
-+#ifdef AUTO_EXPAND
-+ && !Isarchive(bf->name)
-+#endif
-+ ) rm_dir (br, bf->name);
- else rm_file(br, bf->name);
- }
- }
-@@ -4440,7 +4904,11 @@
- xv_getwd(orgDir, sizeof(orgDir));
-
- sprintf(curDir, "%s%s", br->path, subdir);
-+#ifdef AUTO_EXPAND
-+ if (Chvdir(curDir)) {
-+#else
- if (chdir(curDir)) {
-+#endif
- char str[512];
- sprintf(str, "Unable to cd to '%s'\n", curDir);
- setBrowStr(br, str);
-@@ -4452,14 +4920,24 @@
- /* have we looped? */
- for (i=0; i<dirStackLen && strcmp(curDir, dirStack[i]); i++);
- if (i<dirStackLen) { /* YES */
-+#ifdef AUTO_EXPAND
-+ Chvdir(orgDir);
-+#else
- chdir(orgDir);
-+#endif
-+ restIconVisible(br);
- return;
- }
-
- sp = (char *) malloc((size_t) strlen(curDir) + 1);
- if (!sp) {
- setBrowStr(br, "malloc() error in recurseUpdate()\n");
-+#ifdef AUTO_EXPAND
-+ Chvdir(orgDir);
-+#else
- chdir(orgDir);
-+#endif
-+ restIconVisible(br);
- return;
- }
-
-@@ -4494,7 +4972,12 @@
-
- xv_getwd(curDir, sizeof(curDir));
- if (strcmp(orgDir, curDir)) { /* change back to orgdir */
-+#ifdef AUTO_EXPAND
-+ Chvdir(orgDir);
-+#else
- chdir(orgDir);
-+#endif
-+ restIconVisible(br);
- scanDir(br);
- }
- }
-@@ -4518,6 +5001,13 @@
- setBrowStr(br, buf);
- }
-
-+#ifdef AUTO_EXPAND
-+ if (Rmvdir(name)) {
-+ sprintf(buf, "fail to remove virturl directory: %s", name);
-+ setBrowStr(br, buf);
-+ }
-+#endif
-+
- /* try to delete a thumbnail file, as well. ignore errors */
- strcpy(buf1, name); /* tmp1 = leading path of name */
- tmp = (char *) rindex(buf1, '/');
-@@ -4586,7 +5076,14 @@
- goto done;
- }
-
-- if (stat2bf((u_int) st.st_mode) == BF_DIR) { /* skip, for now */
-+#ifdef AUTO_EXPAND
-+ if ((stat2bf((u_int) st.st_mode , rmdirPath) == BF_DIR)
-+ && !Isarchive(rmdirPath)) /* skip, for now */
-+#else
-+
-+ if (stat2bf((u_int) st.st_mode) == BF_DIR) /* skip, for now */
-+#endif
-+ {
- rmdirPath[oldpathlen] = '\0';
- continue; /* don't remove from list */
- }
-@@ -4639,9 +5136,9 @@
-
- static int overwrite;
- #define OWRT_ASK 0
--#define OWRT_NOASK 1
--#define OWRT_CANCEL 2
--
-+#define OWRT_ALWAYS 1
-+#define OWRT_NEVER 2
-+#define OWRT_CANCEL 3
-
- /*******************************************/
- static void dragFiles(srcBr, dstBr, srcpath, dstpath, dstdir,
-@@ -4676,11 +5173,26 @@
- }
- else if (strcmp(dstdir,".")!=0) sprintf(dstp, "%s%s/", dstpath, dstdir);
-
-+#ifdef AUTO_EXPAND
-+ if (Isvdir(dstp)) {
-+ sprintf(buf,"Sorry, you can't %s to the virtual directory, '%s'",
-+ cpymode ? "copy" : "move", dstp);
-+ ErrPopUp(buf, "\nBummer!");
-+ SetCursors(-1);
-+ return;
-+ }
-+ if (Isvdir(srcpath))
-+ cpymode = 1;
-+#endif
-+
-
-
- /* if there is a thumbnail directory in 'srcpath', make one for dstpath */
- sprintf(src,"%s%s", srcpath, THUMBDIR);
- dothumbs = 0;
-+#ifdef AUTO_EXPAND
-+ Dirtovd(src);
-+#endif
- if (stat(src, &st)==0) {
- sprintf(dst,"%s%s", dstp, THUMBDIR);
- mkdir(dst, st.st_mode & 07777);
-@@ -4711,6 +5223,14 @@
- if (overwrite == OWRT_CANCEL) break; /* abort move */
- if (j==1) fail++;
-
-+#ifdef AUTO_EXPAND
-+ if (!cpymode && j==0)
-+ if (Movevdir(src,dst)) {
-+ sprintf(buf, "fail to move virturl directory: %s", names[i]);
-+ setBrowStr(srcBr, buf);
-+ }
-+#endif
-+
- if (dothumbs && j==0) {
- sprintf(src,"%s%s/%s", srcpath, THUMBDIR, names[i]);
- sprintf(dst,"%s%s/%s", dstp, THUMBDIR, names[i]);
-@@ -4748,6 +5268,15 @@
- }
-
-
-+ if (!cpymode) {
-+ /* clear all lit files in the source folder (as they've been moved)
-+ note: this won't be the optimal behavior if any files failed to
-+ move, but screw it, that's not going to happen too often... */
-+ for (i=0; i<srcBr->bfLen; i++) srcBr->bfList[i].lit = 0;
-+ srcBr->numlit = 0;
-+ }
-+
-+
- /* clear all files in the destination folder */
- for (i=0; i<dstBr->bfLen; i++) {
- dstBr->bfList[i].lit = 0;
-@@ -4793,7 +5322,51 @@
- SetCursors(-1);
- }
-
-+static int recursive_remove(dir)
-+ char *dir;
-+{
-+ DIR *dp = NULL;
-+ struct dirent *di;
-+ char name[MAXPATHLEN+1];
-+
-+ strncpy(name, dir, MAXPATHLEN);
-+ name[MAXPATHLEN] = 0;
-+
-+ if (name[strlen(name) - 1] == '/')
-+ name[strlen(name) - 1] = 0;
-
-+ if ((dp = opendir(name)) == NULL)
-+ goto err;
-+
-+ while ((di = readdir(dp)) != NULL) {
-+ char buf[MAXPATHLEN+1];
-+ struct stat st;
-+
-+ if (!strcmp(di->d_name, ".") || !strcmp(di->d_name, ".."))
-+ continue;
-+
-+ snprintf(buf, MAXPATHLEN, "%s/%s", name, di->d_name);
-+
-+ if (stat(buf, &st) < 0)
-+ continue;
-+
-+ if (S_ISDIR(st.st_mode)) {
-+ if (recursive_remove(buf) < 0)
-+ goto err;
-+ } else
-+ unlink(buf);
-+ }
-+
-+ if (rmdir(name) < 0)
-+ goto err;
-+
-+ closedir(dp);
-+ return 0;
-+
-+err:
-+ if (dp) closedir(dp);
-+ return -1;
-+}
-
- /*************************************************/
- static int moveFile(src,dst)
-@@ -4811,31 +5384,45 @@
- int i, srcdir, dstdir;
- struct stat st;
- char buf[512];
-- static char *owbuts[4] = { "\nOk", "dDon't ask", "nNo", "\033Cancel" };
-+ static char *owbuts[] = { "\nOk", "aAlways", "nNo", "NNever", "\033Cancel" };
-
- if (DEBUG) fprintf(stderr,"moveFile %s %s\n", src, dst);
-
-+#ifdef AUTO_EXPAND
-+ Dirtosubst(src);
-+#endif
-+
- if (stat(src, &st)) return 0; /* src doesn't exist, it would seem */
-+#ifdef AUTO_EXPAND
-+ srcdir = (stat2bf((u_int) st.st_mode , src) == BF_DIR);
-+#else
- srcdir = (stat2bf((u_int) st.st_mode) == BF_DIR);
-+#endif
-
- /* see if destination exists */
-+
- if (stat(dst, &st)==0) {
-+ if (overwrite==OWRT_NEVER) return -1;
-+#ifdef AUTO_EXPAND
-+ dstdir = (stat2bf((u_int) st.st_mode , dst) == BF_DIR);
-+#else
- dstdir = (stat2bf((u_int) st.st_mode) == BF_DIR);
-+#endif
-
- if (overwrite==OWRT_ASK) {
-- sprintf(buf, "%s '%s' exists.\n\nOverwrite?",
-+ snprintf(buf, sizeof(buf), "%s '%s' exists.\n\nOverwrite?",
- dstdir ? "Directory" : "File", dst);
-- i = PopUp(buf, owbuts, 4);
--
-- if (i==1) overwrite = OWRT_NOASK;
-- else if (i==2) return -1;
-- else if (i==3) { overwrite = OWRT_CANCEL; return 1; }
-+ switch (PopUp(buf, owbuts, COUNT(owbuts))) {
-+ case 1: overwrite = OWRT_ALWAYS; break;
-+ case 2: return -1;
-+ case 3: overwrite = OWRT_NEVER; return -1;
-+ case 4: overwrite = OWRT_CANCEL; return 1;
-+ }
- }
-
- if (dstdir) {
- #ifndef VMS /* we don't delete directories in VMS */
-- sprintf(buf, "rm -rf %s", dst);
-- if (system(buf)) { /* okay, so it's cheating... */
-+ if (recursive_remove(dst)) { /* okay, so it's cheating... */
- SetISTR(ISTR_WARNING, "Unable to remove directory %s", dst);
- return 1;
- }
-@@ -4858,9 +5445,8 @@
- if (i == 0) { /* copied okay, kill the original */
- if (srcdir) {
- #ifndef VMS /* we don't delete directories in VMS */
-- sprintf(buf, "rm -rf %s", src);
-- if (system(buf)) { /* okay, so it's cheating... */
-- SetISTR(ISTR_WARNING, "Unable to remove directory %s", dst);
-+ if (recursive_remove(src)) { /* okay, so it's cheating... */
-+ SetISTR(ISTR_WARNING, "Unable to remove directory %s", src);
- return 1;
- }
- #endif /* VMS */
-@@ -4906,38 +5492,51 @@
- fall through: if dest doesn't exist, copy the directory, recurs */
-
-
-- int i, dstExists, srcdir, dstdir;
-+ int dstExists, srcdir, dstdir;
- struct stat srcSt, dstSt;
- char buf[1024];
-- static char *owdiff[3] = { "\nOk", "nNo", "\033Cancel" };
-- static char *owsame[4] = { "\nOk", "dDon't Ask", "nNo", "\033Cancel" };
-+ static char *owdiff[] = { "\nOk", "nNo", "\033Cancel" };
-+ static char *owsame[] = { "\nOk", "aAlways", "nNo", "NNever", "\033Cancel" };
-
- if (DEBUG) fprintf(stderr,"copyFile %s %s\n", src, dst);
-
-+#ifdef AUTO_EXPAND
-+ Dirtosubst(src);
-+#endif
-+
- if (stat(src,&srcSt)) return 0; /* source doesn't exist, it would seem */
-
- dstExists = (stat(dst, &dstSt)==0);
-
- if (dstExists) { /* ask about overwriting... */
-- srcdir = (stat2bf((u_int) srcSt.st_mode) == BF_DIR);
-- dstdir = (stat2bf((u_int) dstSt.st_mode) == BF_DIR);
-+#ifdef AUTO_EXPAND
-+ srcdir = (stat2bf((u_int) srcSt.st_mode , src) == BF_DIR);
-+ dstdir = (stat2bf((u_int) dstSt.st_mode , dst) == BF_DIR);
-+#else
-+ srcdir = (stat2bf((u_int) srcSt.st_mode) == BF_DIR);
-+ dstdir = (stat2bf((u_int) dstSt.st_mode) == BF_DIR);
-+#endif
-
- sprintf(buf, "%s '%s' already exists. Replace it with %s '%s'?",
- (dstdir) ? "Directory" : "File", dst,
- (srcdir) ? "contents of directory" : "file", src);
-
- if (srcdir == dstdir) {
-+ if (overwrite==OWRT_NEVER) return -1;
- if (overwrite==OWRT_ASK) {
-- i = PopUp(buf, owsame, 4);
-- if (i==1) overwrite = OWRT_NOASK;
-- if (i==2) return -1;
-- else if (i==3) { overwrite = OWRT_CANCEL; return 1; }
-+ switch (PopUp(buf, owsame, COUNT(owsame))) {
-+ case 1: overwrite = OWRT_ALWAYS; break;
-+ case 2: return -1;
-+ case 3: overwrite = OWRT_NEVER; return -1;
-+ case 4: overwrite = OWRT_CANCEL; return 1;
-+ }
- }
- }
- else { /* one's a dir, the other's a file. *ALWAYS* ask! */
-- i = PopUp(buf, owdiff, 3);
-- if (i==1) return -1;
-- else if (i==2) { overwrite = OWRT_CANCEL; return 1; }
-+ switch (PopUp(buf, owdiff, COUNT(owdiff))) {
-+ case 1: return -1;
-+ case 2: overwrite = OWRT_CANCEL; return 1;
-+ }
- }
-
-
-@@ -5035,8 +5634,11 @@
- havedst = 1;
- }
-
--
-+#ifdef AUTO_EXPAND
-+ switch(stat2bf((u_int) srcSt.st_mode , cpDstPath)) {
-+#else
- switch(stat2bf((u_int) srcSt.st_mode)) {
-+#endif
- /* determine how to copy, by filetype */
-
- /* NOTE: There is no S_IFLNK case here, since we're using 'stat()' and
-@@ -5052,7 +5654,11 @@
- }
- }
- else {
-+#ifdef AUTO_EXPAND
-+ if (stat2bf((u_int) dstSt.st_mode , cpDstPath) != BF_DIR) {
-+#else
- if (stat2bf((u_int) dstSt.st_mode) != BF_DIR) {
-+#endif
- SetISTR(ISTR_WARNING,"%s: not a directory", cpDstPath);
- copyerr++;
- return;
-@@ -5130,7 +5736,12 @@
- goto done;
- }
-
-- if (stat2bf((u_int) srcSt.st_mode) == BF_DIR) {
-+#ifdef AUTO_EXPAND
-+ if (stat2bf((u_int) srcSt.st_mode , cpSrcPath) == BF_DIR)
-+#else
-+ if (stat2bf((u_int) srcSt.st_mode) == BF_DIR)
-+#endif
-+ {
- cpSrcPath[oldsrclen] = '\0';
- continue; /* don't remove from list, just skip */
- }
-@@ -5189,9 +5800,9 @@
- int exists;
- /*****************************/
- {
-- register int srcFd, dstFd, rcount, wcount, i;
-+ register int srcFd, dstFd, rcount, wcount;
- char buf[8192];
-- static char *owbuts[4] = { "\nOk", "dDon't Ask", "nNo", "\033Cancel" };
-+ static char *owbuts[] = { "\nOk", "aAlways", "nNo", "NNever", "\033Cancel" };
-
- if (DEBUG) fprintf(stderr,"cp_file: src='%s', dst='%s'\n",
- cpSrcPath, cpDstPath);
-@@ -5203,13 +5814,15 @@
- }
-
- if (exists) {
-+ if (overwrite==OWRT_NEVER) return;
- if (overwrite==OWRT_ASK) {
- sprintf(buf, "File '%s' exists.\n\nOverwrite?", cpDstPath);
-- i = PopUp(buf, owbuts, 4);
--
-- if (i==1) overwrite = OWRT_NOASK;
-- else if (i==2) return;
-- else if (i==3) { overwrite = OWRT_CANCEL; return; }
-+ switch (PopUp(buf, owbuts, 4)) {
-+ case 1: overwrite = OWRT_ALWAYS; break;
-+ case 2: return;
-+ case 3: overwrite = OWRT_NEVER; return;
-+ case 4: overwrite = OWRT_CANCEL; return;
-+ }
- }
- dstFd = open(cpDstPath, O_WRONLY|O_TRUNC, 0);
- }
-@@ -5303,8 +5916,14 @@
-
-
- /*********************************/
-+#ifdef AUTO_EXPAND
-+static int stat2bf(uistmode, path)
-+ u_int uistmode;
-+ char *path;
-+#else
- static int stat2bf(uistmode)
- u_int uistmode;
-+#endif
- {
- /* given the 'st.st_mode' field from a successful stat(), returns
- BF_FILE, BF_DIR, BF_BLK, BF_CHR, BF_FIFO, or BF_SOCK. Does *NOT*
-@@ -5318,6 +5937,9 @@
- else if (S_ISBLK(stmode)) rv = BF_BLK;
- else if (S_ISFIFO(stmode)) rv = BF_FIFO;
- else if (S_ISSOCK(stmode)) rv = BF_SOCK;
-+#ifdef AUTO_EXPAND
-+ else if (Isarchive(path)) rv = BF_DIR;
-+#endif
- else rv = BF_FILE;
-
- return rv;
-@@ -5418,4 +6040,56 @@
- }
-
-
-+static IVIS *icon_vis_list = NULL;
-+
-+/***************************************************************/
-+static void recIconVisible(name, icon)
-+ char *name;
-+ int icon;
-+{
-+ IVIS *ptr, *prev = NULL;
-+
-+ for (ptr = icon_vis_list; ptr; prev = ptr, ptr = ptr->next) {
-+ if (!strcmp(ptr->name, name)) {
-+ ptr->icon = icon;
-+ return;
-+ }
-+ }
-+
-+ ptr = calloc(sizeof(IVIS), 1);
-+ if (!ptr)
-+ return;
-+
-+ ptr->name = strdup(name);
-
-+ if (!ptr->name) {
-+ free(ptr);
-+ return;
-+ }
-+
-+ if (!prev) {
-+ icon_vis_list = ptr;
-+ } else {
-+ prev->next = ptr;
-+ }
-+
-+ ptr->next = NULL;
-+ ptr->icon = icon;
-+}
-+
-+/***************************************************************/
-+static void restIconVisible(br)
-+ BROWINFO *br;
-+{
-+ IVIS *ptr;
-+
-+ for (ptr = icon_vis_list; ptr; ptr = ptr->next) {
-+ if (!strcmp(ptr->name, br->path)) {
-+ if (ptr->icon >= 0) {
-+ makeIconVisible(br, ptr->icon);
-+ updateSel(br, ptr->icon, 0, 0);
-+ }
-+ return;
-+ }
-+ }
-+}
-diff -ruN xv-3.10a-bugfixes/xvctrl.c xv-3.10a-enhancements/xvctrl.c
---- xv-3.10a-bugfixes/xvctrl.c 2004-05-23 11:56:37.000000000 -0700
-+++ xv-3.10a-enhancements/xvctrl.c 2004-05-23 12:15:18.000000000 -0700
-@@ -104,7 +104,8 @@
- "Root: centered, warp",
- "Root: centered, brick",
- "Root: symmetrical tiled",
-- "Root: symmetrical mirrored" };
-+ "Root: symmetrical mirrored",
-+ "Root: upper left corner" };
-
- static char *conv24MList[] = { "8-bit mode\t\2448",
- "24-bit mode\t\2448",
-diff -ruN xv-3.10a-bugfixes/xvdial.c xv-3.10a-enhancements/xvdial.c
---- xv-3.10a-bugfixes/xvdial.c 2004-05-16 18:01:57.000000000 -0700
-+++ xv-3.10a-enhancements/xvdial.c 2004-05-16 18:06:38.000000000 -0700
-@@ -41,20 +41,21 @@
-
-
- /* local functions */
--static int whereInDial PARM((DIAL *, int, int));
--static void drawArrow PARM((DIAL *));
--static void drawValStr PARM((DIAL *));
--static void drawButt PARM((DIAL *, int, int));
--static int computeDialVal PARM((DIAL *, int, int));
--static void dimDial PARM((DIAL *));
-+static int whereInDial PARM((DIAL *, int, int));
-+static void drawArrow PARM((DIAL *));
-+static void drawValStr PARM((DIAL *));
-+static void drawButt PARM((DIAL *, int, int));
-+static double computeDialVal PARM((DIAL *, int, int));
-+static void dimDial PARM((DIAL *));
-
-
- /***************************************************/
--void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, page,
-+void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, inc, page,
- fg, bg, hi, lo, title, units)
- DIAL *dp;
- Window parent;
--int x,y,w,h,minv,maxv,curv,page;
-+int x,y,w,h;
-+double minv,maxv,curv,inc,page;
- unsigned long fg,bg,hi,lo;
- char *title, *units;
- {
-@@ -98,18 +99,18 @@
- 1,fg,bg);
- if (!dp->win) FatalError("can't create dial window");
-
-- DSetRange(dp, minv, maxv, curv, page);
-+ DSetRange(dp, minv, maxv, curv, inc, page);
- XSelectInput(theDisp, dp->win, ExposureMask | ButtonPressMask);
- }
-
-
- /***************************************************/
--void DSetRange(dp, minv, maxv, curv, page)
--DIAL *dp;
--int minv, maxv, curv, page;
-+void DSetRange(dp, minv, maxv, curv, inc, page)
-+DIAL *dp;
-+double minv, maxv, curv, inc, page;
- {
- if (maxv<minv) maxv=minv;
-- dp->min = minv; dp->max = maxv; dp->page = page;
-+ dp->min = minv; dp->max = maxv; dp->inc = inc; dp->page = page;
- dp->active = (minv < maxv);
-
- DSetVal(dp, curv);
-@@ -118,8 +119,8 @@
-
- /***************************************************/
- void DSetVal(dp, curv)
--DIAL *dp;
--int curv;
-+DIAL *dp;
-+double curv;
- {
- RANGE(curv, dp->min, dp->max); /* make sure curv is in-range */
-
-@@ -129,7 +130,7 @@
- XSetForeground(theDisp, theGC, dp->bg);
- drawArrow(dp);
-
-- dp->val = curv;
-+ dp->val = (double)((int)(curv / dp->inc + (curv > 0 ? 0.5 : -0.5))) * dp->inc;
-
- /* draw new arrow and string */
- XSetForeground(theDisp, theGC, dp->fg);
-@@ -202,7 +203,8 @@
- int mx,my;
- {
- Window rW,cW;
-- int rx,ry, x,y, ipos, pos, lit, i, origval;
-+ int rx, ry, x, y, ipos, pos, lit;
-+ double origval;
- unsigned int mask;
-
- lit = 0;
-@@ -224,9 +226,9 @@
- if (ipos != INDIAL) {
- drawButt(dp, ipos, 1);
- switch (ipos) {
-- case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+1); break;
-+ case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->inc); break;
- case INCW2: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page); break;
-- case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1); break;
-+ case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->inc); break;
- case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page); break;
- }
- if (dp->drawobj != NULL) (dp->drawobj)();
-@@ -235,8 +237,9 @@
- }
-
- else {
-- i = computeDialVal(dp, mx, my);
-- DSetVal(dp, i);
-+ double v;
-+ v = computeDialVal(dp, mx, my);
-+ DSetVal(dp, v);
- if (dp->drawobj != NULL) (dp->drawobj)();
- }
-
-@@ -246,11 +249,11 @@
- if (!(mask & Button1Mask)) break; /* button released */
-
- if (ipos == INDIAL) {
-- int j;
-- i = computeDialVal(dp, x, y);
-- j = dp->val;
-- DSetVal(dp, i);
-- if (j != dp->val) {
-+ double v, w;
-+ v = computeDialVal(dp, x, y);
-+ w = dp->val;
-+ DSetVal(dp, v);
-+ if (w != dp->val) {
- /* track whatever dial controls */
- if (dp->drawobj != NULL) (dp->drawobj)();
- }
-@@ -266,11 +269,11 @@
-
- if (lit) {
- switch (ipos) {
-- case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+1);
-+ case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->inc);
- break;
- case INCW2: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page);
- break;
-- case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1);
-+ case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->inc);
- break;
- case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page);
- break;
-@@ -320,19 +323,20 @@
- static void drawArrow(dp)
- DIAL *dp;
- {
-- int i, rad, cx, cy;
-+ int rad, cx, cy;
-+ double v;
- XPoint arrow[4];
-
- rad = dp->rad; cx = dp->cx; cy = dp->cy;
-
- /* map pos (range minv..maxv) into degrees (range 240..-60) */
-- i = 240 + (-300 * (dp->val - dp->min)) / (dp->max - dp->min);
-- arrow[0].x = cx + (int) ((double) rad * .80 * cos(i * DEG2RAD));
-- arrow[0].y = cy - (int) ((double) rad * .80 * sin(i * DEG2RAD));
-- arrow[1].x = cx + (int) ((double) rad * .33 * cos((i+160) * DEG2RAD));
-- arrow[1].y = cy - (int) ((double) rad * .33 * sin((i+160) * DEG2RAD));
-- arrow[2].x = cx + (int) ((double) rad * .33 * cos((i-160) * DEG2RAD));
-- arrow[2].y = cy - (int) ((double) rad * .33 * sin((i-160) * DEG2RAD));
-+ v = 240 + (-300 * (dp->val - dp->min)) / (dp->max - dp->min);
-+ arrow[0].x = cx + (int) ((double) rad * .80 * cos(v * DEG2RAD));
-+ arrow[0].y = cy - (int) ((double) rad * .80 * sin(v * DEG2RAD));
-+ arrow[1].x = cx + (int) ((double) rad * .33 * cos((v+160) * DEG2RAD));
-+ arrow[1].y = cy - (int) ((double) rad * .33 * sin((v+160) * DEG2RAD));
-+ arrow[2].x = cx + (int) ((double) rad * .33 * cos((v-160) * DEG2RAD));
-+ arrow[2].y = cy - (int) ((double) rad * .33 * sin((v-160) * DEG2RAD));
- arrow[3].x = arrow[0].x;
- arrow[3].y = arrow[0].y;
- XDrawLines(theDisp, dp->win, theGC, arrow, 4, CoordModeOrigin);
-@@ -343,23 +347,37 @@
- static void drawValStr(dp)
- DIAL *dp;
- {
-- int i, x1, x2;
-+ int tot, i, x1, x2;
- char foo[60], foo1[60];
-
- /* compute longest string necessary so we can right-align this thing */
-- sprintf(foo,"%d",dp->min); x1 = strlen(foo);
-- sprintf(foo,"%d",dp->max); x2 = strlen(foo);
-+ sprintf(foo,"%d",(int)dp->min); x1 = strlen(foo);
-+ sprintf(foo,"%d",(int)dp->max); x2 = strlen(foo);
- if (dp->min < 0 && dp->max > 0) x2++; /* put '+' at beginning */
- i = x1; if (x2>x1) i = x2;
- if (dp->units) i += strlen(dp->units);
-
-- if (dp->min < 0 && dp->max > 0) sprintf(foo,"%+d", dp->val);
-- else sprintf(foo,"%d", dp->val);
-+ sprintf(foo,"%g",dp->inc); /* space for decimal values */
-+ tot = i + strlen(foo) - 1; /* Take away the 0 from the beginning */
-+
-+ if (dp->min < 0.0 && dp->max > 0.0) sprintf(foo,"%+g", dp->val);
-+ else sprintf(foo,"%g", dp->val);
-+
-+ if (dp->inc < 1.0)
-+ {
-+ int j;
-+
-+ if (dp->val == (double)((int)dp->val))
-+ strcat(foo,".");
-+
-+ for (j = strlen(foo); j < tot; j++)
-+ strcat(foo,"0");
-+ }
-
- if (dp->units) strcat(foo,dp->units);
- foo1[0] = '\0';
- if (strlen(foo) < (size_t) i) {
-- for (i = i - strlen(foo); i>0; i--) strcat(foo1," ");
-+ for (i-=strlen(foo);i>0;i--) strcat(foo1," ");
- }
- strcat(foo1, foo);
-
-@@ -411,12 +429,13 @@
-
-
- /***************************************************/
--static int computeDialVal(dp, x, y)
-+static double computeDialVal(dp, x, y)
- DIAL *dp;
- int x, y;
- {
-- int dx, dy, val;
-- double angle;
-+ int dx, dy;
-+
-+ double angle, val;
-
- /* compute dx, dy (distance from cx, cy). Note: +dy is *up* */
- dx = x - dp->cx; dy = dp->cy - y;
-@@ -436,8 +455,10 @@
- if (angle > 270.0) angle -= 360.0;
- if (angle < -90.0) angle += 360.0;
-
-- val = (int) ((dp->max - dp->min) * (240.0 - angle) / 300.0) + dp->min;
-+ val = ((dp->max - dp->min) * (240.0 - angle) / 300.0) + dp->min;
-
-+ /* round value to be an even multiple of dp->inc */
-+ val = (double)((int)(val / dp->inc + 0.5)) * dp->inc;
- return val;
- }
-
-diff -ruN xv-3.10a-bugfixes/xvdir.c xv-3.10a-enhancements/xvdir.c
---- xv-3.10a-bugfixes/xvdir.c 2005-03-20 18:38:30.000000000 -0800
-+++ xv-3.10a-enhancements/xvdir.c 2005-04-25 22:24:28.000000000 -0700
-@@ -62,6 +62,9 @@
- #ifdef HAVE_TIFF
- "TIFF",
- #endif
-+#ifdef HAVE_PNG
-+ "PNG",
-+#endif
- "PostScript",
- "PBM/PGM/PPM (raw)",
- "PBM/PGM/PPM (ascii)",
-@@ -73,9 +76,32 @@
- "Targa (24-bit)",
- "FITS",
- "PM",
-+ "Spectrum SCREEN$", /* [JCE] */
-+ "WBMP",
-+#ifdef HAVE_MAG
-+ "MAG",
-+#endif
-+#ifdef HAVE_PIC
-+ "PIC",
-+#endif
-+#ifdef HAVE_MAKI
-+ "MAKI (640x400 only)",
-+#endif
-+#ifdef HAVE_PI
-+ "PI",
-+#endif
-+#ifdef HAVE_PIC2
-+ "PIC2",
-+#endif
-+#ifdef HAVE_MGCSFX
-+ "MgcSfx",
-+#endif
- MBSEP,
- "Filename List"};
-
-+#ifdef HAVE_PIC2
-+extern int PIC2SaveParams PARM((char *, int));
-+#endif
-
- static void arrangeButts PARM((int));
- static void RedrawDList PARM((int, SCRL *));
-@@ -570,7 +596,11 @@
- }
- #endif
-
-+#ifdef AUTO_EXPAND
-+ if (Chvdir(tmppath)) {
-+#else
- if (chdir(tmppath)) {
-+#endif
- char str[512];
- sprintf(str,"Unable to cd to '%s'\n", tmppath);
- *trunc_point = '/'; /* restore the path */
-@@ -635,7 +665,11 @@
- xv_getwd(path, sizeof(path));
- #endif
-
-+#ifdef AUTO_EXPAND
-+ if (Chvdir(path)) {
-+#else
- if (chdir(path)) {
-+#endif
- ErrPopUp("Current load/save directory seems to have gone away!",
- "\nYikes!");
- #ifdef apollo
-@@ -643,7 +677,11 @@
- #else
- strcpy(path,"/");
- #endif
-+#ifdef AUTO_EXPAND
-+ Chvdir(path);
-+#else
- chdir(path);
-+#endif
- }
-
- changedDir = strcmp(path, oldpath);
-@@ -748,6 +786,9 @@
- else if (S_ISFIFO(ftype)) fnames[i][0] = C_FIFO;
- else if (S_ISSOCK(ftype)) fnames[i][0] = C_SOCK;
- else if (fnames[i][0] == C_REG && (mode&0111)) fnames[i][0] = C_EXE;
-+#ifdef AUTO_EXPAND
-+ else if (Isarchive(fnames[i]+1)) fnames[i][0] = C_DIR;
-+#endif
- }
- else {
- /* fprintf(stderr,"problems 'stat-ing' files\n");*/
-@@ -847,7 +888,7 @@
- scrollToFileName();
- }
-
-- else if (c=='\010' || c=='\177') { /* BS or DEL */
-+ else if (c=='\010') { /* BS */
- if (curPos==0) return(-1); /* at beginning of str */
- xvbcopy(&filename[curPos], &filename[curPos-1], (size_t) (len-curPos+1));
- curPos--;
-@@ -872,7 +913,7 @@
- curPos = len;
- }
-
-- else if (c=='\004') { /* ^D: delete character at curPos */
-+ else if (c=='\004' || c=='\177') { /* ^D or DEL: delete character at curPos */
- if (curPos==len) return(-1);
- xvbcopy(&filename[curPos+1], &filename[curPos], (size_t) (len-curPos));
- }
-@@ -1055,6 +1096,25 @@
-
- fullname = GetDirFullName();
-
-+#ifdef AUTO_EXPAND
-+ {
-+ char path[MAXPATHLEN];
-+
-+ GetDirPath(path);
-+ Mkvdir(path);
-+ if ((i = Isvdir(fullname)) & 01) {
-+ char buf[128];
-+ sprintf(buf,
-+ "Sorry, you can't save file in the virtual directory, '%s'",
-+ path);
-+ ErrPopUp(buf, "\nBummer!");
-+ return -1;
-+ }
-+ if (i & 06)
-+ Rmvdir(fullname);
-+ }
-+#endif
-+
- fmt = MBWhich(&fmtMB);
- col = MBWhich(&colMB);
-
-@@ -1116,7 +1176,34 @@
- }
- #endif
-
-+#ifdef HAVE_PNG
-+ else if (fmt == F_PNG) { /* PNG */
-+ PNGSaveParams(fullname, col);
-+ PNGDialog(1); /* open PNG Dialog box */
-+ dbut[S_BOK].lit = 0; BTRedraw(&dbut[S_BOK]);
-+ return 0; /* always 'succeeds' */
-+ }
-+#endif
-+
-+#ifdef HAVE_PIC2
-+ else if (fmt == F_PIC2) { /* PIC2 */
-+ if (PIC2SaveParams(fullname, col) < 0)
-+ return 0;
-+ PIC2Dialog(1); /* open PIC2 Dialog box */
-+ dbut[S_BOK].lit = 0; BTRedraw(&dbut[S_BOK]);
-+ return 0; /* always 'succeeds' */
-+ }
-+#endif /* HAVE_PIC2 */
-
-+#ifdef HAVE_MGCSFX
-+ else if (fmt == F_MGCSFX) { /* MGCSFX */
-+ if (MGCSFXSaveParams(fullname, col) < 0)
-+ return 0;
-+ MGCSFXDialog(1); /* open MGCSFX Dialog box */
-+ dbut[S_BOK].lit = 0; BTRedraw(&dbut[S_BOK]);
-+ return 0; /* always 'succeeds' */
-+ }
-+#endif /* HAVE_MGCSFX */
-
-
- WaitCursor();
-@@ -1164,6 +1251,10 @@
- rv = WriteBMP (fp, thepic, ptype, w, h, rp, gp, bp, nc, col);
- break;
-
-+ case F_WBMP:
-+ rv = WriteWBMP (fp, thepic, ptype, w, h, rp, gp, bp, nc, col);
-+ break;
-+
- case F_IRIS:
- rv = WriteIRIS (fp, thepic, ptype, w, h, rp, gp, bp, nc, col);
- break;
-@@ -1181,6 +1272,35 @@
- rv = WriteFITS (fp, thepic, ptype, w, h, rp, gp, bp, nc, col,
- picComments);
- break;
-+
-+ case F_ZX: /* [JCE] Spectrum SCREEN$ */
-+ rv = WriteZX (fp, thepic, ptype, w, h, rp, gp, bp, nc, col,
-+ picComments);
-+ break;
-+#ifdef HAVE_MAG
-+ case F_MAG:
-+ rv = WriteMAG (fp, thepic, ptype, w, h, rp, gp, bp, nc, col,
-+ picComments);
-+ break;
-+#endif /* HAVE_MAG */
-+#ifdef HAVE_PIC
-+ case F_PIC:
-+ rv = WritePIC (fp, thepic, ptype, w, h, rp, gp, bp, nc, col,
-+ picComments);
-+ break;
-+#endif /* HAVE_PIC */
-+#ifdef HAVE_MAKI
-+ case F_MAKI:
-+ rv = WriteMAKI (fp, thepic, ptype, w, h, rp, gp, bp, nc, col);
-+ break;
-+#endif /* HAVE_MAKI */
-+
-+#ifdef HAVE_PI
-+ case F_PI:
-+ rv = WritePi (fp, thepic, ptype, w, h, rp, gp, bp, nc, col,
-+ picComments);
-+ break;
-+#endif /* HAVE_PI */
- }
-
-
-@@ -1310,7 +1430,8 @@
-
- else if (group == F_FORMAT) {
- MBSelect(&fmtMB, bnum);
-- if (MBWhich(&fmtMB) == F_XBM) { /* turn off all but B/W */
-+ if (MBWhich(&fmtMB) == F_XBM ||
-+ MBWhich(&fmtMB) == F_WBMP) { /* turn off all but B/W */
- colMB.dim[F_FULLCOLOR] = 1;
- colMB.dim[F_GREYSCALE] = 1;
- colMB.dim[F_BWDITHER] = 0;
-@@ -1389,14 +1510,29 @@
- (strcmp(lowsuf,"eps" )==0) ||
- (strcmp(lowsuf,"rgb" )==0) ||
- (strcmp(lowsuf,"tga" )==0) ||
-- (strcmp(lowsuf,"xpm" )==0) ||
- (strcmp(lowsuf,"fits")==0) ||
- (strcmp(lowsuf,"fts" )==0) ||
-+#ifdef HAVE_JPEG
- (strcmp(lowsuf,"jpg" )==0) ||
- (strcmp(lowsuf,"jpeg")==0) ||
- (strcmp(lowsuf,"jfif")==0) ||
-+#endif
-+#ifdef HAVE_TIFF
- (strcmp(lowsuf,"tif" )==0) ||
-- (strcmp(lowsuf,"tiff")==0)) {
-+ (strcmp(lowsuf,"tiff")==0) ||
-+#endif
-+#ifdef HAVE_PNG
-+ (strcmp(lowsuf,"png" )==0) ||
-+#endif
-+ (strcmp(lowsuf,"wbmp")==0) ||
-+ (strcmp(lowsuf,"xpm" )==0) ||
-+ (strcmp(lowsuf,"tiff")==0) ||
-+ (strcmp(lowsuf,"mag" )==0) ||
-+ (strcmp(lowsuf,"pic" )==0) ||
-+ (strcmp(lowsuf,"mki" )==0) ||
-+ (strcmp(lowsuf,"pi" )==0) ||
-+ (strcmp(lowsuf,"p2" )==0) ||
-+ (strcmp(lowsuf,"pcd" )==0)) {
-
- /* found one. set lowsuf = to the new suffix, and tack on to filename */
-
-@@ -1419,6 +1555,7 @@
- case F_XBM: strcpy(lowsuf,"xbm"); break;
- case F_SUNRAS: strcpy(lowsuf,"ras"); break;
- case F_BMP: strcpy(lowsuf,"bmp"); break;
-+ case F_WBMP: strcpy(lowsuf,"wbmp"); break;
- case F_PS: strcpy(lowsuf,"ps"); break;
- case F_IRIS: strcpy(lowsuf,"rgb"); break;
- case F_TARGA: strcpy(lowsuf,"tga"); break;
-@@ -1432,8 +1569,33 @@
- #ifdef HAVE_TIFF
- case F_TIFF: strcpy(lowsuf,"tif"); break;
- #endif
-+
-+#ifdef HAVE_PNG
-+ case F_PNG: strcpy(lowsuf,"png"); break;
-+#endif
-+
-+#ifdef HAVE_MAG
-+ case F_MAG: strcpy(lowsuf,"mag"); break;
-+#endif
-+
-+#ifdef HAVE_PIC
-+ case F_PIC: strcpy(lowsuf,"pic"); break;
-+#endif
-+
-+#ifdef HAVE_MAKI
-+ case F_MAKI: strcpy(lowsuf,"mki"); break;
-+#endif
-+
-+#ifdef HAVE_PI
-+ case F_PI: strcpy(lowsuf,"pi"); break;
-+#endif
-+
-+#ifdef HAVE_PIC2
-+ case F_PIC2: strcpy(lowsuf,"p2"); break;
-+#endif
- }
-
-+
- if (allcaps) { /* upper-caseify lowsuf */
- for (sp=lowsuf; *sp; sp++)
- *sp = (islower(*sp)) ? toupper(*sp) : *sp;
-@@ -1499,6 +1661,11 @@
- }
- #endif
-
-+#ifdef AUTO_EXPAND
-+ Mkvdir(newpath);
-+ Dirtovd(newpath);
-+#endif
-+
- if (stat(newpath, &st)==0) {
- int isdir;
-
-@@ -1596,7 +1763,11 @@
- dopipe = 0;
-
- /* make sure we're in the correct directory */
-+#ifdef AUTO_EXPAND
-+ if (strlen(path)) Chvdir(path);
-+#else
- if (strlen(path)) chdir(path);
-+#endif
-
- if (ISPIPE(filename[0])) { /* do piping */
- /* make up some bogus temp file to put this in */
-@@ -2002,7 +2173,7 @@
- if (stat(namelist[curname], &origStat)==0) {
- haveStat = 1;
- if (DEBUG) fprintf(stderr," origStat.size=%ld, origStat.mtime=%ld\n",
-- origStat.st_size, origStat.st_mtime);
-+ (long)origStat.st_size, (long)origStat.st_mtime);
- }
- }
- }
-@@ -2027,7 +2198,7 @@
-
- if (stat(namelist[curname], &st)==0) {
- if (DEBUG) fprintf(stderr," st.size=%ld, st.mtime=%ld\n",
-- st.st_size, st.st_mtime);
-+ (long)st.st_size, (long)st.st_mtime);
-
- if ((st.st_size == origStat.st_size) &&
- (st.st_mtime == origStat.st_mtime)) return 0; /* no change */
-@@ -2080,3 +2251,164 @@
- }
-
-
-+#ifdef HAVE_PIC2
-+/**** Stuff for PIC2Dialog box ****/
-+FILE *pic2_OpenOutFile(filename, append)
-+char *filename;
-+int *append;
-+{
-+ /* opens file for output. does various error handling bits. Returns
-+ an open file pointer if success, NULL if failure */
-+
-+ FILE *fp = NULL;
-+ struct stat st;
-+
-+ if (!filename || filename[0] == '\0')
-+ return (NULL);
-+ strcpy(outFName, filename);
-+ dopipe = 0;
-+
-+ /* make sure we're in the correct directory */
-+#ifdef AUTO_EXPAND
-+ if (strlen(path)) Chvdir(path);
-+#else
-+ if (strlen(path)) chdir(path);
-+#endif
-+
-+ if (ISPIPE(filename[0])) { /* do piping */
-+ /* make up some bogus temp file to put this in */
-+#ifndef VMS
-+ sprintf(outFName, "%s/xvXXXXXX", tmpdir);
-+#else
-+ strcpy(outFName, "[]xvXXXXXX.lis");
-+#endif
-+#ifdef USE_MKSTEMP
-+ fp = fdopen(mkstemp(outFName), "w");
-+#else
-+ mktemp(outFName);
-+#endif
-+ dopipe = 1;
-+ }
-+
-+
-+ /* see if file exists (i.e., we're overwriting) */
-+ *append = 0;
-+#ifdef USE_MKSTEMP
-+ if (!dopipe)
-+#endif
-+ if (stat(outFName, &st)==0) { /* stat succeeded, file must exist */
-+ if (ReadFileType(outFName) != RFT_PIC2) {
-+ static char *foo[] = { "\nOk", "\033Cancel" };
-+ char str[512];
-+
-+ sprintf(str,"Overwrite existing file '%s'?", outFName);
-+ if (PopUp(str, foo, 2))
-+ return (NULL);
-+ } else {
-+ static char *foo[] = { "\nOk", "\033Cancel" };
-+ char str[512];
-+
-+ sprintf(str,"Append to existing file '%s'?", outFName);
-+ if (PopUp(str, foo, 2)) {
-+ sprintf(str,"Overwrite existing file '%s'?", outFName);
-+ if (PopUp(str, foo, 2))
-+ return (NULL);
-+ } else
-+ *append = 1;
-+ }
-+ }
-+
-+ /* Open file */
-+#ifdef USE_MKSTEMP
-+ if (!dopipe)
-+#endif
-+ fp = *append ? fopen(outFName, "r+") : fopen(outFName, "w");
-+ if (!fp) {
-+ char str[512];
-+ sprintf(str,"Can't write file '%s'\n\n %s.",outFName, ERRSTR(errno));
-+ ErrPopUp(str, "\nBummer");
-+ return (NULL);
-+ }
-+
-+ return (fp);
-+}
-+
-+
-+/***************************************/
-+void pic2_KillNullFile(fp)
-+FILE *fp;
-+{
-+ fseek(fp, (size_t) 0, SEEK_END);
-+ if (ftell(fp) > 0) {
-+ fclose(fp);
-+ return;
-+ } else {
-+ fclose(fp);
-+ unlink(outFName);
-+ return;
-+ }
-+}
-+#endif /* HAVE_PIC2 */
-+
-+
-+#ifdef HAVE_MGCSFX
-+/**** Stuff for MGCSFX Dialog box ****/
-+/***************************************/
-+int OpenOutFileDesc(filename)
-+ char *filename;
-+{
-+ /* opens file for output. does various error handling bits. Returns
-+ an open file pointer if success, NULL if failure */
-+
-+ int fd;
-+ struct stat st;
-+
-+ if (!filename || filename[0] == '\0') return -1;
-+ strcpy(outFName, filename);
-+ dopipe = 0;
-+
-+ /* make sure we're in the correct directory */
-+#ifdef AUTO_EXPAND
-+ if (strlen(path)) Chvdir(path);
-+#else
-+ if (strlen(path)) chdir(path);
-+#endif
-+
-+ if (ISPIPE(filename[0])) { /* do piping */
-+ /* make up some bogus temp file to put this in */
-+#ifndef VMS
-+ sprintf(outFName, "%s/xvXXXXXX", tmpdir);
-+#else
-+ strcpy(outFName, "[]xvXXXXXX.lis");
-+#endif
-+#ifdef USE_MKSTEMP
-+ close(mkstemp(outFName));
-+#else
-+ mktemp(outFName);
-+#endif
-+ dopipe = 1;
-+ }
-+
-+
-+ /* if didn't just create it, see if file exists (i.e., we're overwriting) */
-+ if (!dopipe && stat(outFName, &st)==0) { /* stat succeeded, file exists */
-+ static char *foo[] = { "\nOk", "\033Cancel" };
-+ char str[512];
-+
-+ sprintf(str,"Overwrite existing file '%s'?", outFName);
-+ if (PopUp(str, foo, 2)) return -1;
-+ }
-+
-+
-+ /* Open file */
-+ fd = open(outFName, O_WRONLY | O_CREAT | O_TRUNC, (0644));
-+ if (fd < 0) {
-+ char str[512];
-+ sprintf(str,"Can't write file '%s'\n\n %s.", outFName, ERRSTR(errno));
-+ ErrPopUp(str, "\nBummer");
-+ return -1;
-+ }
-+
-+ return fd;
-+}
-+#endif /* HAVE_MGCSFX */
-diff -ruN xv-3.10a-bugfixes/xvevent.c xv-3.10a-enhancements/xvevent.c
---- xv-3.10a-bugfixes/xvevent.c 2004-05-16 18:02:03.000000000 -0700
-+++ xv-3.10a-enhancements/xvevent.c 2005-05-01 09:33:38.000000000 -0700
-@@ -64,6 +64,8 @@
-
- static void annotatePic PARM((void));
-
-+static int debkludge_offx;
-+static int debkludge_offy;
-
- /****************/
- int EventLoop()
-@@ -71,13 +73,25 @@
- {
- XEvent event;
- int retval,done,waiting;
-- time_t orgtime, curtime;
-+#ifdef USE_TICKS
-+ clock_t waitsec_ticks=0L, orgtime_ticks=0L, curtime_ticks;
-+ clock_t elapsed_ticks=0L, remaining_interval;
-+#else
-+ time_t orgtime=0L, curtime;
-+#endif
-
-
- #ifndef NOSIGNAL
- signal(SIGQUIT, onInterrupt);
- #endif
-
-+ if (startGrab == 1) {
-+ startGrab = 2;
-+ FakeButtonPress(&but[BGRAB]);
-+ FakeKeyPress(ctrlW, XK_Return);
-+ return(1);
-+ }
-+
- /* note: there's no special event handling if we're using the root window.
- if we're using the root window, we will recieve NO events for mainW */
-
-@@ -100,18 +114,24 @@
-
- while (!done) {
-
-- if (waitsec > -1 && canstartwait && !waiting && XPending(theDisp)==0) {
-+ if (waitsec >= 0.0 && canstartwait && !waiting && XPending(theDisp)==0) {
- /* we wanna wait, we can wait, we haven't started waiting yet, and
- all pending events (ie, drawing the image the first time)
- have been dealt with: START WAITING */
-- time((time_t *) &orgtime);
-+#ifdef USE_TICKS
-+ waitsec_ticks = (clock_t)(waitsec * CLK_TCK);
-+ orgtime_ticks = times(NULL); /* unclear if NULL valid, but OK on Linux */
-+#else
-+ orgtime = time(NULL);
-+#endif
- waiting = 1;
- }
-
-
- /* if there's an XEvent pending *or* we're not doing anything
- in real-time (polling, flashing the selection, etc.) get next event */
-- if ((waitsec==-1 && !polling && !HaveSelection()) || XPending(theDisp)>0) {
-+ if ((waitsec<0.0 && !polling && !HaveSelection()) || XPending(theDisp)>0)
-+ {
- XNextEvent(theDisp, &event);
- retval = HandleEvent(&event,&done);
- }
-@@ -121,7 +141,7 @@
- DrawSelection(0);
- DrawSelection(1);
- XFlush(theDisp);
-- Timer(200);
-+ Timer(200); /* milliseconds */
- }
-
- if (polling) {
-@@ -129,13 +149,32 @@
- else if (!XPending(theDisp)) sleep(1);
- }
-
-- if (waitsec>-1 && waiting) {
-- time((time_t *) &curtime);
-- if (curtime - orgtime < waitsec) sleep(1);
-- else {
-- if (waitloop) return NEXTLOOP;
-- else return NEXTQUIT;
-- }
-+ if (waitsec>=0.0 && waiting) {
-+#ifdef USE_TICKS
-+ curtime_ticks = times(NULL); /* value in ticks */
-+ if (curtime_ticks < orgtime_ticks) {
-+ /* clock ticks rolled over: need to correct for that (i.e.,
-+ * curtime_ticks is presumably quite small, while orgtime_ticks
-+ * should be close to LONG_MAX, so do math accordingly--any way
-+ * to check whether clock_t is *not* a signed long?) */
-+ elapsed_ticks = curtime_ticks + (LONG_MAX - orgtime_ticks);
-+ } else
-+ elapsed_ticks = curtime_ticks - orgtime_ticks;
-+ remaining_interval = waitsec_ticks - elapsed_ticks;
-+ if (remaining_interval >= (clock_t)(1 * CLK_TCK))
-+ sleep(1);
-+ else {
-+ /* less than one second remaining: do delay in msec, then return */
-+ Timer((remaining_interval * 1000L) / CLK_TCK); /* can't overflow */
-+ return waitloop? NEXTLOOP : NEXTQUIT;
-+ }
-+#else
-+ curtime = time(NULL); /* value in seconds */
-+ if (curtime - orgtime < (time_t)waitsec)
-+ sleep(1);
-+ else
-+ return waitloop? NEXTLOOP : NEXTQUIT;
-+#endif
- }
- }
- } /* while (!done) */
-@@ -154,7 +193,24 @@
- int *donep;
- {
- static int wasInfoUp=0, wasCtrlUp=0, wasDirUp=0, wasGamUp=0, wasPsUp=0;
-- static int wasJpegUp=0, wasTiffUp=0;
-+#ifdef HAVE_JPEG
-+ static int wasJpegUp=0;
-+#endif
-+#ifdef HAVE_TIFF
-+ static int wasTiffUp=0;
-+#endif
-+#ifdef HAVE_PNG
-+ static int wasPngUp=0;
-+#endif
-+#ifdef HAVE_PCD
-+ static int wasPcdUp=0;
-+#endif
-+#ifdef HAVE_PIC2
-+ static int wasPic2Up=0;
-+#endif
-+#ifdef HAVE_MGCSFX
-+ static int wasMgcSfxUp=0;
-+#endif
-
- static int mainWKludge=0; /* force first mainW expose after a mainW config
- to redraw all of mainW */
-@@ -233,6 +289,28 @@
- if (TIFFCheckEvent(event)) break; /* event has been processed */
- #endif
-
-+#ifdef HAVE_PNG
-+ if (PNGCheckEvent (event)) break; /* event has been processed */
-+#endif
-+
-+ if (PCDCheckEvent(event)) break; /* event has been processed */
-+
-+#ifdef HAVE_PIC2
-+ if (PIC2CheckEvent(event)) break; /* event has been processed */
-+#endif
-+
-+#ifdef HAVE_PCD
-+ if (PCDCheckEvent (event)) break; /* event has been processed */
-+#endif
-+
-+#ifdef HAVE_MGCSFX
-+ if (MGCSFXCheckEvent(event)) break; /* event has been processed */
-+#endif
-+
-+#ifdef TV_MULTILINGUAL
-+ if (CharsetCheckEvent(event)) break; /* event has been processed */
-+#endif
-+
- if (GamCheckEvent (event)) break; /* event has been processed */
- if (BrowseCheckEvent (event, &retval, &done)) break; /* event eaten */
- if (TextCheckEvent (event, &retval, &done)) break; /* event eaten */
-@@ -344,6 +422,9 @@
-
- if (BrowseDelWin(client_event->window)) break;
- if (TextDelWin(client_event->window)) break;
-+#ifdef TV_MULTILINGUAL
-+ if (CharsetDelWin(client_event->window)) break;
-+#endif
-
- if (client_event->window == infoW) InfoBox(0);
- else if (client_event->window == gamW) GamBox(0);
-@@ -359,6 +440,24 @@
- else if (client_event->window == tiffW) TIFFDialog(0);
- #endif
-
-+#ifdef HAVE_PNG
-+ else if (client_event->window == pngW) PNGDialog(0);
-+#endif
-+
-+ else if (client_event->window == pcdW) PCDDialog(0);
-+
-+#ifdef HAVE_PIC2
-+ else if (client_event->window == pic2W) PIC2Dialog(0);
-+#endif
-+
-+#ifdef HAVE_PCD
-+ else if (client_event->window == pcdW) PCDDialog(0);
-+#endif
-+
-+#ifdef HAVE_MGCSFX
-+ else if (client_event->window == mgcsfxW) MGCSFXDialog(0);
-+#endif
-+
- else if (client_event->window == mainW) Quit(0);
- }
- }
-@@ -534,10 +633,21 @@
- #ifdef HAVE_JPEG
- if (wasJpegUp) { JPEGDialog(wasJpegUp); wasJpegUp=0; }
- #endif
--
- #ifdef HAVE_TIFF
- if (wasTiffUp) { TIFFDialog(wasTiffUp); wasTiffUp=0; }
- #endif
-+#ifdef HAVE_PNG
-+ if (wasPngUp) { PNGDialog(wasJpegUp); wasPngUp=0; }
-+#endif
-+#ifdef HAVE_PCD
-+ if (wasPcdUp) { PCDDialog(wasPcdUp); wasPcdUp=0; }
-+#endif
-+#ifdef HAVE_PIC2
-+ if (wasPic2Up) { PIC2Dialog(wasPic2Up); wasPic2Up=0; }
-+#endif
-+#ifdef HAVE_MGCSFX
-+ if (wasMgcSfxUp) { MGCSFXDialog(wasMgcSfxUp); wasMgcSfxUp=0; }
-+#endif
- }
- }
- }
-@@ -572,10 +682,21 @@
- #ifdef HAVE_JPEG
- if (jpegUp) { wasJpegUp = jpegUp; JPEGDialog(0); }
- #endif
--
- #ifdef HAVE_TIFF
- if (tiffUp) { wasTiffUp = tiffUp; TIFFDialog(0); }
- #endif
-+#ifdef HAVE_PNG
-+ if (pngUp) { wasPngUp = pngUp; PNGDialog(0); }
-+#endif
-+#ifdef HAVE_PCD
-+ if (pcdUp) { wasPcdUp = pcdUp; PCDDialog(0); }
-+#endif
-+#ifdef HAVE_PIC2
-+ if (pic2Up) { wasPic2Up = pic2Up; PIC2Dialog(0); }
-+#endif
-+#ifdef HAVE_MGCSFX
-+ if (mgcsfxUp) { wasMgcSfxUp = mgcsfxUp; MGCSFXDialog(0); }
-+#endif
- }
- }
- }
-@@ -641,6 +762,30 @@
- p_offy = xwa.y;
- }
-
-+ /* Gather info to keep right border inside */
-+ {
-+ Window current;
-+ Window root_r;
-+ Window parent_r;
-+ Window *children_r;
-+ int nchildren_r;
-+ XWindowAttributes xwa;
-+
-+ parent_r=mainW;
-+ current=mainW;
-+ do {
-+ current=parent_r;
-+ XQueryTree(theDisp, current, &root_r, &parent_r,
-+ &children_r, &nchildren_r);
-+ if (children_r!=NULL) {
-+ XFree(children_r);
-+ }
-+ } while(parent_r!=root_r);
-+ XGetWindowAttributes(theDisp, current, &xwa);
-+ debkludge_offx=eWIDE-xwa.width+p_offx;
-+ debkludge_offy=eHIGH-xwa.height+p_offy;
-+ }
-+
-
- /* move window around a bit... */
- {
-@@ -997,7 +1142,8 @@
-
- int i;
- char txt[512], str[PRINTCMDLEN + 10];
-- static char *labels[] = { " Color", " Grayscale", " B/W", "\033Cancel" };
-+ static char *labels[] = { "\03Color", "\07Grayscale", " B/W", "\033Cancel" };
-+ /* ^B ("\02") already used for moving cursor back */
-
- strcpy(txt, "Print: Enter a command that will read a PostScript file ");
- strcat(txt, "from stdin and print it to the desired printer.\n\n");
-@@ -1147,6 +1293,26 @@
- if (TIFFCheckEvent(event)) break;
- #endif
-
-+#ifdef HAVE_PNG
-+ if (PNGCheckEvent (event)) break;
-+#endif
-+
-+#ifdef HAVE_PCD
-+ if (PCDCheckEvent (event)) break; /* event has been processed */
-+#endif
-+
-+#ifdef HAVE_PIC2
-+ if (PIC2CheckEvent(event)) break;
-+#endif
-+
-+#ifdef HAVE_MGCSFX
-+ if (MGCSFXCheckEvent(event)) break;
-+#endif
-+
-+#ifdef TV_MULTILINGUAL
-+ if (CharsetCheckEvent(event)) break;
-+#endif
-+
- if (GamCheckEvent (event)) break;
- if (BrowseCheckEvent (event, &retval, &done)) break;
- if (TextCheckEvent (event, &retval, &done)) break;
-@@ -1276,6 +1442,48 @@
- else if (shift) BlurPaint();
- break;
-
-+ case Button4: /* note min vs. max, + vs. - */
-+ if (win == ctrlW || win == nList.win || win == nList.scrl.win) {
-+ SCRL *sp=&nList.scrl;
-+ int halfpage=sp->page/2;
-+
-+ if (sp->val > sp->min+halfpage)
-+ SCSetVal(sp,sp->val-halfpage);
-+ else
-+ SCSetVal(sp,sp->min);
-+ }
-+ else if (win == dirW || win == dList.win || win == dList.scrl.win) {
-+ SCRL *sp=&dList.scrl;
-+ int halfpage=sp->page/2;
-+
-+ if (sp->val > sp->min+halfpage)
-+ SCSetVal(sp,sp->val-halfpage);
-+ else
-+ SCSetVal(sp,sp->min);
-+ }
-+ break;
-+
-+ case Button5: /* note max vs. min, - vs. + */
-+ if (win == ctrlW || win == nList.win || win == nList.scrl.win) {
-+ SCRL *sp=&nList.scrl;
-+ int halfpage=sp->page/2;
-+
-+ if (sp->val < sp->max-halfpage)
-+ SCSetVal(sp,sp->val+halfpage);
-+ else
-+ SCSetVal(sp,sp->max);
-+ }
-+ else if (win == dirW || win == dList.win || win == dList.scrl.win) {
-+ SCRL *sp=&dList.scrl;
-+ int halfpage=sp->page/2;
-+
-+ if (sp->val < sp->max-halfpage)
-+ SCSetVal(sp,sp->val+halfpage);
-+ else
-+ SCSetVal(sp,sp->max);
-+ }
-+ break;
-+
- default: break;
- }
- }
-@@ -1364,16 +1572,35 @@
- if (TIFFCheckEvent(event)) break;
- #endif
-
-+#ifdef HAVE_PNG
-+ if (PNGCheckEvent (event)) break;
-+#endif
-+
-+ if (PCDCheckEvent (event)) break;
-+
-+#ifdef HAVE_PIC2
-+ if (PIC2CheckEvent(event)) break;
-+#endif
-+
-+#ifdef HAVE_PCD
-+ if (PCDCheckEvent (event)) break;
-+#endif
-+
-+#ifdef HAVE_MGCSFX
-+ if (MGCSFXCheckEvent(event)) break;
-+#endif
-+
- if (GamCheckEvent (event)) break;
- if (BrowseCheckEvent (event, &retval, &done)) break;
- if (TextCheckEvent (event, &retval, &done)) break;
-
-
-- /* check for pageup/pagedown, 'p' in main window
-- (you can use shift-up or shift-down if no crop rectangle drawn)
-- (for viewing multipage docs) */
-+ /* Support for multi-image files ("multipage docs"). Check for PgUp/PgDn
-+ or 'p' in any window but control or directory; PgUp/PgDn are already
-+ used to page through the file list in those windows. If no cropping
-+ rectangle is active, shift-Up and shift-Down also work. */
-
-- if (key_event->window == mainW) {
-+ if (key_event->window != ctrlW && key_event->window != dirW) {
- dealt = 1;
-
- ck = CursorKey(ks, shift, 0);
-@@ -1578,13 +1805,13 @@
- }
- break;
-
-- case '\010':
-- case '\177': FakeButtonPress(&but[BPREV]); break;
-+ case '\010': FakeButtonPress(&but[BPREV]); break;
-
-
- case '\014': FakeButtonPress(&but[BLOAD]); break; /* ^L */
- case '\023': FakeButtonPress(&but[BSAVE]); break; /* ^S */
- case '\020': FakeButtonPress(&but[BPRINT]); break; /* ^P */
-+ case '\177':
- case '\004': FakeButtonPress(&but[BDELETE]); break; /* ^D */
-
- /* BCOPY, BCUT, BPASTE, BCLEAR handled in 'meta' case */
-@@ -2025,6 +2252,16 @@
- if (xwa->width < dispWIDE && xwc.x < p_offx) xwc.x = p_offx;
- if (xwa->height < dispHIGH && xwc.y < p_offy) xwc.y = p_offy;
-
-+ /* Try to keep bottom right decorations inside */
-+ if (xwc.x+eWIDE-debkludge_offx>dispWIDE) {
-+ xwc.x=dispWIDE-eWIDE+debkludge_offx;
-+ if (xwc.x<0) xwc.x=0;
-+ }
-+ if (xwc.y+eHIGH-debkludge_offy>dispHIGH) {
-+ xwc.y=dispHIGH-eHIGH+debkludge_offy;
-+ if (xwc.y<0) xwc.y=0;
-+ }
-+
- xwc.width = xwa->width;
- xwc.height = xwa->height;
-
-@@ -2370,6 +2607,24 @@
- if (tiffUp) TIFFDialog(0); /* close tiff window */
- #endif
-
-+#ifdef HAVE_PNG
-+ if (pngUp) PNGDialog(0); /* close png window */
-+#endif
-+
-+ if (pcdUp) PCDDialog(0); /* close pcd window */
-+
-+#ifdef HAVE_PIC2
-+ if (pic2Up) PIC2Dialog(0); /* close pic2 window */
-+#endif
-+
-+#ifdef HAVE_PCD
-+ if (pcdUp) PCDDialog(0); /* close pcd window */
-+#endif
-+
-+#ifdef HAVE_MGCSFX
-+ if (mgcsfxUp) MGCSFXDialog(0); /* close mgcsfx window */
-+#endif
-+
- ClosePopUp();
-
- /* make the interrupt signal look like a '\n' keypress in ctrlW */
-@@ -2574,26 +2829,43 @@
- static void paintLine(x,y,x1,y1)
- int x,y,x1,y1;
- {
-- int dx,dy,i,lx,ly,adx,ady;
-+ int t,dx,dy,d,dd;
-
-- dx = x1-x; dy = y1-y;
-- adx = abs(dx); ady = abs(dy);
-+ dx = abs(x1-x); dy = abs(y1-y);
-
-- if (dx == 0 && dy == 0) paintPixel(x,y);
--
-- else if (adx > ady) { /* X is major axis */
-- for (i=0; i<=adx; i++) {
-- lx = x + (i * dx + (adx/2)) / abs(dx);
-- ly = y + (i * dy + (adx/2)) / abs(dx);
-- paintPixel(lx,ly);
-+ if (dx >= dy) { /* X is major axis */
-+ if (x > x1) {
-+ t = x; x = x1; x1 = t;
-+ t = y; y = y1; y1 = t;
-+ }
-+ d = dy + dy - dx;
-+ dd = y < y1 ? 1 : -1;
-+ while (x <= x1) {
-+ paintPixel(x,y);
-+ if (d > 0) {
-+ y += dd;
-+ d -= dx + dx;
-+ }
-+ ++x;
-+ d += dy + dy;
- }
- }
-
- else { /* Y is major axis */
-- for (i=0; i<=ady; i++) {
-- lx = x + (i * dx + (ady/2)) / ady;
-- ly = y + (i * dy + (ady/2)) / ady;
-- paintPixel(lx,ly);
-+ if (y > y1) {
-+ t = x; x = x1; x1 = t;
-+ t = y; y = y1; y1 = t;
-+ }
-+ d = dx + dx - dy;
-+ dd = x < x1 ? 1 : -1;
-+ while (y <= y1) {
-+ paintPixel(x,y);
-+ if (d > 0) {
-+ x += dd;
-+ d -= dy + dy;
-+ }
-+ ++y;
-+ d += dx + dx;
- }
- }
-
-diff -ruN xv-3.10a-bugfixes/xvfits.c xv-3.10a-enhancements/xvfits.c
---- xv-3.10a-bugfixes/xvfits.c 2005-04-02 21:08:45.000000000 -0800
-+++ xv-3.10a-enhancements/xvfits.c 2005-04-17 14:45:28.000000000 -0700
-@@ -14,7 +14,7 @@
- * provided "as is" without express or implied warranty.
- */
-
--
-+#define NEEDSDIR /* for S_IRUSR|S_IWUSR */
- #include "xv.h"
-
- #define NCARDS (36)
-@@ -228,7 +228,7 @@
- * If there was a problem writing files, then a error message will be set.
- */
-
-- int i, npixels=nx * ny, nwrt;
-+ int i, npixels=nx * ny, nwrt, tmpfd;
- FILE *fp;
- char *error;
- char filename[70];
-@@ -254,7 +254,12 @@
-
- for (i=0; i < nz && !error; i++) {
- sprintf(filename, "%s%d", basename, i+1);
-- fp = xv_fopen(filename, "w");
-+ tmpfd = open(filename,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) {
-+ error = "Unable to open temporary file";
-+ break;
-+ }
-+ fp = fdopen(tmpfd, "w");
- if (!fp) {
- error = "Unable to open temporary file";
- break;
-@@ -262,13 +267,17 @@
-
- if (wrheader(fp, nx, ny, comment)) {
- error = "I/O error writing temporary file";
-+ fflush(fp);
- fclose(fp);
- unlink(filename);
-+ close(tmpfd);
- break;
- }
-
- nwrt = fwrite(image+i*npixels, sizeof(byte), (size_t) npixels, fp);
-+ fflush(fp);
- fclose(fp);
-+ close(tmpfd);
-
- if (nwrt == 0) { /* failed to write any data */
- error = "I/O error writing temporary file";
-diff -ruN xv-3.10a-bugfixes/xvgam.c xv-3.10a-enhancements/xvgam.c
---- xv-3.10a-bugfixes/xvgam.c 2004-05-16 18:02:11.000000000 -0700
-+++ xv-3.10a-enhancements/xvgam.c 2004-05-16 18:06:48.000000000 -0700
-@@ -265,11 +265,11 @@
- BTCreate(&gbut[G_BRNDCOL], cmapF, 5 + 66 + 67 + 2, 189, 66, BUTTH,
- "Random", infofg, infobg, hicol, locol);
-
-- DCreate(&rhDial, cmapF, 5, 215, 66, 100, 0,360,180, 5,
-+ DCreate(&rhDial, cmapF, 5, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0,
- infofg, infobg, hicol, locol, "Hue", NULL);
-- DCreate(&gsDial, cmapF, 72, 215, 66, 100, 0,360,180, 5,
-+ DCreate(&gsDial, cmapF, 72, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0,
- infofg, infobg, hicol, locol, "Sat.", NULL);
-- DCreate(&bvDial, cmapF, 139, 215, 66, 100, 0,360,180, 5,
-+ DCreate(&bvDial, cmapF, 139, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0,
- infofg, infobg, hicol, locol, "Value", NULL);
-
- rhDial.drawobj = gsDial.drawobj = bvDial.drawobj = dragEditColor;
-@@ -359,7 +359,7 @@
-
- srcHD.drawobj = dstHD.drawobj = whtHD.drawobj = dragHueDial;
-
-- DCreate(&satDial, hsvF, 100, 199, 100, 121, -100, 100, 0, 5,
-+ DCreate(&satDial, hsvF, 100, 199, 100, 121, -100.0, 100.0, 0.0, 1.0, 5.0,
- infofg, infobg,hicol,locol, "Saturation", "%");
-
- hueRB = RBCreate(NULL, hsvF, 7, 153, "1",
-@@ -722,7 +722,7 @@
-
- if (whtHD.enabCB.val && whtHD.satval) hsvnonlinear++;
-
-- if (satDial.val != 0) hsvnonlinear++;
-+ if (satDial.val != 0.0) hsvnonlinear++;
-
- /* check intensity graf */
- for (i=0; i<256 && intGraf.func[i]==i; i++);
-@@ -1291,14 +1291,14 @@
- rgb2hsv(rcmap[editColor], gcmap[editColor], bcmap[editColor], &h, &s, &v);
- if (h<0) h = 0;
-
-- DSetVal(&rhDial, (int) h);
-- DSetVal(&gsDial, (int) (s*100));
-- DSetVal(&bvDial, (int) (v*100));
-+ DSetVal(&rhDial, h);
-+ DSetVal(&gsDial, s*100);
-+ DSetVal(&bvDial, v*100);
- }
- else {
-- DSetVal(&rhDial, rcmap[editColor]);
-- DSetVal(&gsDial, gcmap[editColor]);
-- DSetVal(&bvDial, bcmap[editColor]);
-+ DSetVal(&rhDial, (double)rcmap[editColor]);
-+ DSetVal(&gsDial, (double)gcmap[editColor]);
-+ DSetVal(&bvDial, (double)bcmap[editColor]);
- }
- }
-
-@@ -1310,16 +1310,15 @@
-
- if (hsvmode) {
- int rv, gv, bv;
-- hsv2rgb((double) rhDial.val, ((double) gsDial.val) / 100.0,
-- ((double) bvDial.val) / 100.0, &rv, &gv, &bv);
-+ hsv2rgb(rhDial.val, gsDial.val / 100.0, bvDial.val / 100.0, &rv, &gv, &bv);
- rcmap[editColor] = rv;
- gcmap[editColor] = gv;
- bcmap[editColor] = bv;
- }
- else {
-- rcmap[editColor] = rhDial.val;
-- gcmap[editColor] = gsDial.val;
-- bcmap[editColor] = bvDial.val;
-+ rcmap[editColor] = (int)rhDial.val;
-+ gcmap[editColor] = (int)gsDial.val;
-+ bcmap[editColor] = (int)bvDial.val;
- }
- }
-
-@@ -1561,9 +1560,9 @@
- gsDial.title = "Green";
- bvDial.title = "Blue";
-
-- DSetRange(&rhDial, 0, 255, rcmap[editColor], 16);
-- DSetRange(&gsDial, 0, 255, gcmap[editColor], 16);
-- DSetRange(&bvDial, 0, 255, bcmap[editColor], 16);
-+ DSetRange(&rhDial, 0.0, 255.0, (double)rcmap[editColor], 1.0, 16.0);
-+ DSetRange(&gsDial, 0.0, 255.0, (double)gcmap[editColor], 1.0, 16.0);
-+ DSetRange(&bvDial, 0.0, 255.0, (double)bcmap[editColor], 1.0, 16.0);
-
- XClearWindow(theDisp, rhDial.win); DRedraw(&rhDial);
- XClearWindow(theDisp, gsDial.win); DRedraw(&gsDial);
-@@ -1581,9 +1580,9 @@
- &h, &s, &v);
-
- if (h<0.0) h = 0.0;
-- DSetRange(&rhDial, 0, 360, (int) h, 5);
-- DSetRange(&gsDial, 0, 100, (int) (s*100), 5);
-- DSetRange(&bvDial, 0, 100, (int) (v*100), 5);
-+ DSetRange(&rhDial, 0.0, 360.0, h, 1.0, 5.0);
-+ DSetRange(&gsDial, 0.0, 100.0, s*100, 1.0, 5.0);
-+ DSetRange(&bvDial, 0.0, 100.0, v*100, 1.0, 5.0);
-
- XClearWindow(theDisp, rhDial.win); DRedraw(&rhDial);
- XClearWindow(theDisp, gsDial.win); DRedraw(&gsDial);
-@@ -1891,7 +1890,7 @@
- }
-
- /* apply satDial value to s */
-- s = s + ((double) satDial.val) / 100.0;
-+ s = s + satDial.val / 100.0;
- if (s<0.0) s = 0.0;
- if (s>1.0) s = 1.0;
-
-@@ -2007,7 +2006,7 @@
-
- gs->hueRBnum = RBWhich(hueRB);
-
-- gs->satval = satDial.val;
-+ gs->satval = (int)satDial.val;
- GetGrafState(&intGraf,&gs->istate);
- GetGrafState(&rGraf, &gs->rstate);
- GetGrafState(&gGraf, &gs->gstate);
-@@ -2064,8 +2063,8 @@
- changed++;
- }
-
-- if (gs->satval != satDial.val) {
-- DSetVal(&satDial,gs->satval);
-+ if (gs->satval != (int)satDial.val) {
-+ DSetVal(&satDial,(double)gs->satval);
- changed++;
- }
-
-@@ -3200,7 +3199,7 @@
-
- if (whtHD.enabCB.val && whtHD.satval) hsvmod++;
-
-- if (satDial.val != 0) hsvmod++;
-+ if (satDial.val != 0.0) hsvmod++;
-
- /* check intensity graf */
- for (i=0; i<256; i++) {
-@@ -3284,7 +3283,7 @@
- }
-
- /* apply satDial value to s */
-- s = s + satDial.val;
-+ s = s + (int)satDial.val;
- if (s< 0) s = 0;
- if (s>100) s = 100;
-
-diff -ruN xv-3.10a-bugfixes/xvgif.c xv-3.10a-enhancements/xvgif.c
---- xv-3.10a-bugfixes/xvgif.c 2005-04-03 11:53:13.000000000 -0700
-+++ xv-3.10a-enhancements/xvgif.c 2005-04-30 21:47:44.000000000 -0700
-@@ -50,6 +50,7 @@
- BytesPerScanline, /* bytes per scanline in output raster */
- ColorMapSize, /* number of colors */
- Background, /* background color */
-+ Transparent, /* transparent color (GRR 19980314) */
- CodeSize, /* Code size, read from GIF header */
- InitCodeSize, /* Starting code size, used during Clear */
- Code, /* Value returned by ReadCode */
-@@ -111,16 +112,20 @@
-
- register byte ch, *origptr;
- register int i, block;
-- int aspect, gotimage;
-+ int aspect;
-+ char tmpname[256];
-+ byte r[256], g[256], b[256];
-
- /* initialize variables */
-- BitOffset = XC = YC = OutCount = gotimage = 0;
-+ BitOffset = XC = YC = OutCount = 0;
- Pass = -1;
- RawGIF = Raster = pic8 = NULL;
- gif89 = 0;
-+ Transparent = -1;
-
- pinfo->pic = (byte *) NULL;
- pinfo->comment = (char *) NULL;
-+ pinfo->numpages= 0;
-
- bname = BaseName(fname);
- fp = xv_fopen(fname,"r");
-@@ -145,7 +150,7 @@
-
- if (fread(dataptr, (size_t) filesize, (size_t) 1, fp) != 1)
- return( gifError(pinfo, "GIF data read failed") );
--
-+ fclose(fp);
-
- origptr = dataptr;
-
-@@ -161,6 +166,7 @@
- RWidth = ch + 0x100 * NEXTBYTE; /* screen dimensions... not used. */
- ch = NEXTBYTE;
- RHeight = ch + 0x100 * NEXTBYTE;
-+ if (DEBUG) fprintf(stderr,"GIF89 logical screen = %d x %d\n",RWidth,RHeight);
-
- ch = NEXTBYTE;
- HasColormap = ((ch & COLORMAPMASK) ? True : False);
-@@ -176,6 +182,8 @@
- if (!gif89) return(gifError(pinfo,"corrupt GIF file (screen descriptor)"));
- else normaspect = (float) (aspect + 15) / 64.0; /* gif89 aspect ratio */
- if (DEBUG) fprintf(stderr,"GIF89 aspect = %f\n", normaspect);
-+ /* FIXME: apparently this _should_ apply to all frames in a multi-image
-+ * GIF (i.e., PgUp/PgDn), but it doesn't */
- }
-
-
-@@ -183,20 +191,23 @@
-
- if (HasColormap)
- for (i=0; i<ColorMapSize; i++) {
-- pinfo->r[i] = NEXTBYTE;
-- pinfo->g[i] = NEXTBYTE;
-- pinfo->b[i] = NEXTBYTE;
-+ r[i] = NEXTBYTE;
-+ g[i] = NEXTBYTE;
-+ b[i] = NEXTBYTE;
- }
- else { /* no colormap in GIF file */
- /* put std EGA palette (repeated 16 times) into colormap, for lack of
- anything better to do */
-
- for (i=0; i<256; i++) {
-- pinfo->r[i] = EGApalette[i&15][0];
-- pinfo->g[i] = EGApalette[i&15][1];
-- pinfo->b[i] = EGApalette[i&15][2];
-+ r[i] = EGApalette[i&15][0];
-+ g[i] = EGApalette[i&15][1];
-+ b[i] = EGApalette[i&15][2];
- }
- }
-+ memcpy(pinfo->r, r, sizeof r);
-+ memcpy(pinfo->g, g, sizeof g);
-+ memcpy(pinfo->b, b, sizeof b);
-
- /* possible things at this point are:
- * an application extension block
-@@ -334,12 +345,28 @@
- if (DEBUG) fprintf(stderr,"Graphic Control extension\n\n");
-
- SetISTR(ISTR_INFO, "%s: %s", bname,
-- "Graphic Control Extension in GIF file. Ignored.");
-+ "Graphic Control Extension ignored.");
-
-- /* read (and ignore) data sub-blocks */
-+ /* read (and ignore) data sub-blocks, unless compositing with
-+ * user-defined background */
- do {
-- j = 0; sbsize = NEXTBYTE;
-- while (j<sbsize) { SKIPBYTE; j++; }
-+ j = 0;
-+ sbsize = NEXTBYTE;
-+ /* GRR 19980314: get transparent index out of block */
-+ if (have_imagebg && sbsize == 4 && Transparent < 0) {
-+ byte packed_fields = NEXTBYTE;
-+
-+ j++;
-+ SKIPBYTE; j++;
-+ SKIPBYTE; j++;
-+ if (packed_fields & 1) {
-+ Transparent = NEXTBYTE;
-+ j++;
-+ }
-+ }
-+ while (j<sbsize) {
-+ SKIPBYTE; j++;
-+ }
- } while (sbsize);
- }
-
-@@ -376,36 +403,42 @@
-
-
- else if (block == IMAGESEP) {
-- if (DEBUG) fprintf(stderr,"imagesep (got=%d) ",gotimage);
-+ if (DEBUG) fprintf(stderr,"imagesep (page=%d) ",pinfo->numpages+1);
- if (DEBUG) fprintf(stderr," at start: offset=0x%x\n",dataptr-RawGIF);
-
-- if (gotimage) { /* just skip over remaining images */
-- int i,misc,ch,ch1;
-+ BitOffset = XC = YC = Pass = OutCount = 0;
-
-- /* skip image header */
-- SKIPBYTE; SKIPBYTE; /* left position */
-- SKIPBYTE; SKIPBYTE; /* top position */
-- SKIPBYTE; SKIPBYTE; /* width */
-- SKIPBYTE; SKIPBYTE; /* height */
-- misc = NEXTBYTE; /* misc. bits */
--
-- if (misc & 0x80) { /* image has local colormap. skip it */
-- for (i=0; i< 1 << ((misc&7)+1); i++) {
-- SKIPBYTE; SKIPBYTE; SKIPBYTE;
-+ if (pinfo->numpages > 0) { /* do multipage stuff */
-+ if (pinfo->numpages == 1) { /* first time only... */
-+ xv_mktemp(pinfo->pagebname, "xvpgXXXXXX");
-+ if (pinfo->pagebname[0] == '\0') {
-+ ErrPopUp("LoadGIF: Unable to create temporary filename???",
-+ "\nHow unlikely!");
-+ return 0;
- }
- }
--
-- SKIPBYTE; /* minimum code size */
--
-- /* skip image data sub-blocks */
-- do {
-- ch = ch1 = NEXTBYTE;
-- while (ch--) SKIPBYTE;
-- if ((dataptr - RawGIF) > filesize) break; /* EOF */
-- } while(ch1);
-+ sprintf(tmpname, "%s%d", pinfo->pagebname, pinfo->numpages);
-+ fp = xv_fopen(tmpname, "w");
-+ if (!fp) {
-+ ErrPopUp("LoadGIF: Unable to open temp file", "\nDang!");
-+ return 0;
-+ }
-+ if (WriteGIF(fp, pinfo->pic, pinfo->type, pinfo->w, pinfo->h, pinfo->r,
-+ pinfo->g, pinfo->b, numcols, pinfo->colType, NULL)) {
-+ fclose(fp);
-+ ErrPopUp("LoadGIF: Error writing temp file", "\nBummer!");
-+ return 0;
-+ }
-+ fclose(fp);
-+ free(pinfo->pic);
-+ pinfo->pic = (byte *) NULL;
-+ if (HasColormap) {
-+ memcpy(pinfo->r, r, sizeof r);
-+ memcpy(pinfo->g, g, sizeof g);
-+ memcpy(pinfo->b, b, sizeof b);
-+ }
- }
--
-- else if (readImage(pinfo)) gotimage = 1;
-+ if (readImage(pinfo)) pinfo->numpages++;
- if (DEBUG) fprintf(stderr," at end: dataptr=0x%x\n",dataptr-RawGIF);
- }
-
-@@ -425,7 +458,7 @@
- sprintf(str, "Unknown block type (0x%02x) at offset 0x%x",
- block, (dataptr - origptr) - 1);
-
-- if (!gotimage) return gifError(pinfo, str);
-+ if (!pinfo->numpages) return gifError(pinfo, str);
- else gifWarning(str);
- }
-
-@@ -438,8 +471,34 @@
- free(RawGIF); RawGIF = NULL;
- free(Raster); Raster = NULL;
-
-- if (!gotimage)
-+ if (!pinfo->numpages)
- return( gifError(pinfo, "no image data found in GIF file") );
-+ if (pinfo->numpages > 1) {
-+ /* write the last page temp file */
-+ int numpages = pinfo->numpages;
-+ char *comment = pinfo->comment;
-+ sprintf(tmpname, "%s%d", pinfo->pagebname, pinfo->numpages);
-+ fp = xv_fopen(tmpname, "w");
-+ if (!fp) {
-+ ErrPopUp("LoadGIF: Unable to open temp file", "\nDang!");
-+ return 0;
-+ }
-+ if (WriteGIF(fp, pinfo->pic, pinfo->type, pinfo->w, pinfo->h, pinfo->r,
-+ pinfo->g, pinfo->b, numcols, pinfo->colType, NULL)) {
-+ fclose(fp);
-+ ErrPopUp("LoadGIF: Error writing temp file", "\nBummer!");
-+ return 0;
-+ }
-+ fclose(fp);
-+ free(pinfo->pic);
-+ pinfo->pic = (byte *) NULL;
-+
-+ /* load the first page temp file */
-+ sprintf(tmpname, "%s%d", pinfo->pagebname, 1);
-+ i = LoadGIF(tmpname, pinfo);
-+ pinfo->numpages = numpages;
-+ pinfo->comment = comment;
-+ }
-
- return 1;
- }
-@@ -484,6 +543,17 @@
- }
-
-
-+ /* GRR 19980314 */
-+ /* need not worry about size of EGA palette: full 256 colors */
-+ if (have_imagebg && Transparent >= 0 &&
-+ Transparent < ((Misc&0x80)? (1 << ((Misc&7)+1)) : ColorMapSize) )
-+ {
-+ pinfo->r[Transparent] = (imagebgR >> 8);
-+ pinfo->g[Transparent] = (imagebgG >> 8);
-+ pinfo->b[Transparent] = (imagebgB >> 8);
-+ }
-+
-+
-
- /* Start reading the raster data. First we get the intial code size
- * and compute decompressor constant values, based on this code size.
-@@ -540,7 +610,7 @@
- return( gifError(pinfo, "image dimensions out of range") );
- picptr = pic8 = (byte *) malloc((size_t) maxpixels);
- if (!pic8) FatalError("LoadGIF: couldn't malloc 'pic8'");
--
-+
-
-
- /* Decompress the file, continuing until you see the GIF EOF code.
-@@ -642,11 +712,10 @@
- SetISTR(ISTR_WARNING,"%s: %s", bname,
- "This GIF file seems to be truncated. Winging it.");
- if (!Interlace) /* clear->EOBuffer */
-- xvbzero((char *) pic8+npixels, (size_t) (maxpixels-npixels));
-+ xvbzero((char *) pic8+npixels,
-+ (size_t) (maxpixels-npixels<0 ? 0 : maxpixels-npixels));
- }
-
-- fclose(fp);
--
- /* fill in the PICINFO structure */
-
- pinfo->pic = pic8;
-diff -ruN xv-3.10a-bugfixes/xvgrab.c xv-3.10a-enhancements/xvgrab.c
---- xv-3.10a-bugfixes/xvgrab.c 2004-05-16 18:03:30.000000000 -0700
-+++ xv-3.10a-enhancements/xvgrab.c 2005-04-25 23:39:32.000000000 -0700
-@@ -14,6 +14,13 @@
- #define NEEDSTIME
- #include "xv.h"
-
-+/* Allow flexibility in use of buttons JPD */
-+#define WINDOWGRABMASK Button1Mask /* JPD prefers Button2Mask */
-+#define RECTGTRACKMASK Button2Mask /* JPD prefers Button1Mask*/
-+#define CANCELGRABMASK Button3Mask
-+
-+#define DO_GRABFLASH /* JPD prefers not to do that; just a loss of time ... */
-+
-
- union swapun {
- CARD32 l;
-@@ -69,12 +76,15 @@
- 0 if cancelled */
-
- int i, x, y, x1, y1, x2, y2, ix, iy, iw, ih, rv;
-- int rx, ry, pretendGotB1, autograb;
-+ int rx, ry, GotButton, autograb;
-+ int cancelled = 0;
- Window rW, cW, clickWin;
- unsigned int mask;
-+#ifdef RECOLOR_GRAB_CURSOR
- XColor fc, bc;
-+#endif
-
-- pretendGotB1 = 0;
-+ GotButton = 0;
-
- if (grabInProgress) return 0; /* avoid recursive grabs during delay */
-
-@@ -122,15 +132,23 @@
- free(grabPic); grabPic = (byte *) NULL;
- }
-
--
-+ /* recolor cursor to indicate that grabbing is active? */
-+ /* Instead, change cursor JPD */
-+#ifdef RECOLOR_GRAB_CURSOR
- fc.flags = bc.flags = DoRed | DoGreen | DoBlue;
- fc.red = fc.green = fc.blue = 0xffff;
- bc.red = bc.green = bc.blue = 0x0000;
- XRecolorCursor(theDisp, tcross, &fc, &bc);
-+#endif
-
-
- XBell(theDisp, 0); /* beep once at start of grab */
-
-+ /* Change cursor to top_left_corner JPD */
-+ XGrabPointer(theDisp, rootW, False,
-+ PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
-+ GrabModeAsync, GrabModeAsync, None, tlcorner, CurrentTime);
-+
- if (!autograb) XGrabButton(theDisp, (u_int) AnyButton, 0, rootW, False, 0,
- GrabModeAsync, GrabModeSync, None, tcross);
-
-@@ -142,7 +160,7 @@
- rv = 0;
- goto exit;
- }
-- else { pretendGotB1 = 1; mask = Button1Mask; }
-+ else { GotButton = 1; mask = WINDOWGRABMASK; }
- }
-
- else { /* !autograb */
-@@ -170,16 +188,20 @@
- }
- }
-
-+ XUngrabPointer(theDisp, CurrentTime);
-+ /* Reset cursor to XC_tcross JPD */
-+ XGrabPointer(theDisp, rootW, False,
-+ PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
-+ GrabModeAsync, GrabModeAsync, None, tcross, CurrentTime);
-
- /***
- *** got button click (or pretending we did, if autograb)
- ***/
-
--
-- if (mask & Button3Mask || rW!=rootW) { /* Button3: CANCEL GRAB */
-+ if (mask & CANCELGRABMASK || rW!=rootW) { /* CANCEL GRAB */
- while (1) { /* wait for button to be released */
- if (XQueryPointer(theDisp,rootW,&rW,&cW,&rx,&ry,&x1,&y1,&mask)) {
-- if (!(mask & Button3Mask)) break;
-+ if (!(mask & CANCELGRABMASK)) break;
- }
- }
-
-@@ -187,19 +209,21 @@
- XBell(theDisp, 0);
- XBell(theDisp, 0);
- rv = 0;
-+ cancelled = 1;
- goto exit;
- }
-
-
--
-- if (mask & Button1Mask) { /* Button1: GRAB WINDOW (& FRAME, maybe) */
-- while (!pretendGotB1) { /* wait for button to be released, if clicked */
-+ if (mask & WINDOWGRABMASK) { /* GRAB WINDOW (& FRAME, maybe) */
-+ while (!GotButton) { /* wait for button to be released, if clicked */
- int rx,ry,x1,y1; Window rW, cW;
- if (XQueryPointer(theDisp,rootW,&rW,&cW,&rx,&ry,&x1,&y1,&mask)) {
-- if (!(mask & Button1Mask)) break;
-+ if (!(mask & WINDOWGRABMASK)) break;
- }
- }
-
-+ grabwin:
-+
- clickWin = (cW) ? cW : rootW;
-
- if (clickWin == rootW) { /* grab entire screen */
-@@ -223,7 +247,6 @@
- }
- }
-
--
- /* range checking: keep rectangle fully on-screen */
- if (ix<0) { iw += ix; ix = 0; }
- if (iy<0) { ih += iy; iy = 0; }
-@@ -244,8 +267,7 @@
- endflash();
- }
-
--
-- else { /* Button2: TRACK A RECTANGLE */
-+ else { /* TRACK A RECTANGLE */
- int origrx, origry;
-
- clickWin = rootW;
-@@ -259,7 +281,7 @@
- /* Wait for button release while tracking rectangle on screen */
- while (1) {
- if (XQueryPointer(theDisp,rootW,&rW,&cW,&rx,&ry,&x,&y,&mask)) {
-- if (!(mask & Button2Mask)) break;
-+ if (!(mask & RECTGTRACKMASK)) break;
- }
-
- flashrect(ix, iy, iw, ih, 0); /* turn off rect */
-@@ -276,6 +298,7 @@
-
- flashrect(ix, iy, iw, ih, 0); /* turn off rect */
-
-+#ifdef DO_GRABFLASH
- /* flash the rectangle a bit... */
- for (i=0; i<5; i++) {
- flashrect(ix, iy, iw, ih, 1);
-@@ -283,13 +306,26 @@
- flashrect(ix, iy, iw, ih, 0);
- XFlush(theDisp); Timer(100);
- }
-+#endif
-+
- endflash();
-
-+ /* if rectangle has zero width or height, search for child window JPD */
-+ if (iw==0 && ih==0) {
-+ int xr, yr;
-+ Window childW = 0;
-+ if (rW && cW)
-+ XTranslateCoordinates(theDisp, rW, cW, rx, ry, &xr, &yr, &childW);
-+ if (childW)
-+ cW = childW;
-+ goto grabwin;
-+ }
-+
- XUngrabServer(theDisp);
- }
-
--
- /***
-+ *** now that clickWin,ix,iy,iw,ih are known, try to grab the bits :
- *** grab screen area (ix,iy,iw,ih)
- ***/
-
-@@ -303,9 +339,16 @@
-
- SetCursors(-1);
-
--
- exit:
-
-+ XUngrabPointer(theDisp, CurrentTime);
-+ XUngrabServer(theDisp);
-+
-+ if (startGrab) {
-+ startGrab = 0;
-+ if (cancelled) Quit(0);
-+ }
-+
- if (hidewins) { /* remap XV windows */
- autoclose += 2; /* force it on once */
- if (mainW && dispMode == RMB_WINDOW) {
-@@ -1217,7 +1260,3 @@
-
- return 1;
- }
--
--
--
--
-diff -ruN xv-3.10a-bugfixes/xvhips.c xv-3.10a-enhancements/xvhips.c
---- xv-3.10a-bugfixes/xvhips.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvhips.c 2005-04-30 23:49:14.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/xvhips.c xv-3.10a/xvhips.c
+--- xv-3.10a.orig/xvhips.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvhips.c 2005-05-01 01:49:14.000000000 -0500
@@ -0,0 +1,406 @@
+/*
+ * xvhips.c - load routine for 'HIPS' format pictures
@@ -8911,9 +1948,9 @@ diff -ruN xv-3.10a-bugfixes/xvhips.c xv-3.10a-enhancements/xvhips.c
+}
+
+#endif /* HAVE_HIPS */
-diff -ruN xv-3.10a-bugfixes/xvhips.h xv-3.10a-enhancements/xvhips.h
---- xv-3.10a-bugfixes/xvhips.h 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvhips.h 2005-04-25 08:34:14.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/xvhips.h xv-3.10a/xvhips.h
+--- xv-3.10a.orig/xvhips.h 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvhips.h 2005-04-25 10:34:14.000000000 -0500
@@ -0,0 +1,154 @@
+/*
+ * HIPL Picture Header Format Standard
@@ -9069,804 +2106,1339 @@ diff -ruN xv-3.10a-bugfixes/xvhips.h xv-3.10a-enhancements/xvhips.h
+#ifndef SIGN
+# define SIGN(A,B) (((B) > 0) ? (A) : (-(A)))
+#endif /* SIGN */
-diff -ruN xv-3.10a-bugfixes/xvimage.c xv-3.10a-enhancements/xvimage.c
---- xv-3.10a-bugfixes/xvimage.c 2005-03-31 07:23:39.000000000 -0800
-+++ xv-3.10a-enhancements/xvimage.c 2005-04-17 23:00:10.000000000 -0700
-@@ -21,6 +21,16 @@
- * int LoadPad(pinfo, fname);
- */
-
-+/* The following switch should better be provided at runtime for
-+ * comparison purposes.
-+ * At the moment it's only compile time, unfortunately.
-+ * Who can make adaptions for use as a runtime switch by a menu option?
-+ * [GRR 19980607: now via do_fixpix_smooth global; macro renamed to ENABLE_]
-+ * [see http://sylvana.net/fixpix/ for home page, further info]
-+ */
-+/* #define ENABLE_FIXPIX_SMOOTH */ /* GRR 19980607: moved into xv.h */
-+
-+#define NEEDSDIR /* for S_IRUSR|S_IWUSR */
- #include "copyright.h"
-
- #include "xv.h"
-@@ -36,7 +46,9 @@
- static int doAutoCrop24 PARM((void));
- static void floydDitherize1 PARM((XImage *, byte *, int, int, int,
- byte *, byte *,byte *));
-+#if 0 /* NOTUSED */
- static int highbit PARM((unsigned long));
-+#endif
-
- static int doPadSolid PARM((char *, int, int, int, int));
- static int doPadBggen PARM((char *, int, int, int, int));
-@@ -46,6 +58,267 @@
- static int ReadImageFile1 PARM((char *, PICINFO *));
-
-
-+/* The following array represents the pixel values for each shade
-+ * of the primary color components.
-+ * If 'p' is a pointer to a source image rgb-byte-triplet, we can
-+ * construct the output pixel value simply by 'oring' together
-+ * the corresponding components:
+diff -u -r --new-file xv-3.10a.orig/xvjp2k.c xv-3.10a/xvjp2k.c
+--- xv-3.10a.orig/xvjp2k.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvjp2k.c 2007-05-13 20:04:37.000000000 -0500
+@@ -0,0 +1,1326 @@
++/*
++ * xvjp2k.c - I/O subroutines for JPEG 2000 format pictures
+ *
-+ * unsigned char *p;
-+ * unsigned long pixval;
++ * This module is a "shim" between XV and a JPEG 2000 CODEC in the open-source
++ * JasPer Library created by Michael D. Adams; for more information, see the URL
++ * "http://www.ece.uvic.ca/~mdadams/jasper". We don't use most of the other
++ * facilities in this library, so it's better to link XV with a UNIX "archive"
++ * representation of it, not a DLL.
+ *
-+ * pixval = screen_rgb[0][*p++];
-+ * pixval |= screen_rgb[1][*p++];
-+ * pixval |= screen_rgb[2][*p++];
++ * JPEG 2000 files can be represented in either of two general ways: The
++ * simplest representation is a "code stream", which often has a ".jpc" file
++ * name suffix and is organized much like a classical JPEG file, except that
++ * unfortunately, JPEG 2000 code streams indicate the no. of colors in an image
++ * but no longer give any clues about its color space (e.g., RGB or YCbCr).
++ * Instead, there is now a semantically higher-level representation, which often
++ * has a ".jp2" file name suffix and encapsulates a "code stream" with (possibly
++ * a lot of) color-space information, optionally including things like ICC
++ * correction tables.
+ *
-+ * This is both efficient and generic, since the only assumption
-+ * is that the primary color components have separate bits.
-+ * The order and distribution of bits does not matter, and we
-+ * don't need additional variables and shifting/masking code.
-+ * The array size is 3 KBytes total and thus very reasonable.
-+ */
-+
-+static unsigned long screen_rgb[3][256];
-+
-+/* The following array holds the exact color representations
-+ * reported by the system.
-+ * This is useful for less than 24 bit deep displays as a base
-+ * for additional dithering to get smoother output.
-+ */
-+
-+static byte screen_set[3][256];
-+
-+/* The following routine initializes the screen_rgb and screen_set
-+ * arrays.
-+ * Since it is executed only once per program run, it does not need
-+ * to be super-efficient.
++ * Compared to the IJG JPEG Library used in file "xvjpeg.c", one must solve
++ * several problems for color images when marrying JasPer to XV.
++ *
++ * 1. JPEG 2000 files can represent a wide range of image sizes, resolutions,
++ * and color spaces, not all of which can be easily rendered "as is" on a
++ * normal "X Windows" display, so we must carefully check a decoded image's
++ * parameters in order to reject anything that we can't handle gracefully.
++ *
++ * 2. JasPer prefers to decode/encode images using color-plane "slices", instead
++ * of interleaved pixels needed by "X Windows", so we must (de)interleave
++ * copies of the image buffer here.
++ *
++ * XXX Things to do:
+ *
-+ * The method is to draw points in a pixmap with the specified shades
-+ * of primary colors and then get the corresponding XImage pixel
-+ * representation.
-+ * Thus we can get away with any Bit-order/Byte-order dependencies.
++ * 1. In "LoadJP{2,C}()" try to handle the "quick" option, which requests
++ * faster loading of a reduced-size image for the visual schnauzer. The
++ * schnauzer's icon size is currently 80x60, so the old "xvjpeg.c" module tries
++ * to produce a 2X (160x120) image. Can we do the same?
+ *
-+ * The routine uses some global X variables: theDisp, theScreen,
-+ * and dispDEEP. Adapt these to your application as necessary.
-+ * I've not passed them in as parameters, since for other platforms
-+ * than X these may be different (see vfixpix.c), and so the
-+ * screen_init() interface is unique.
++ * 2. In "StoreJP2K()", JasPer Library Version 1.701 apparently has no API to
++ * let the XV global "picComments" string be inserted in a JPEG 2000 comment
++ * record. If the library ever gets fixed, enhance our code accordingly.
+ *
-+ * BUG: I've read in the "Xlib Programming Manual" from O'Reilly &
-+ * Associates, that the DefaultColormap in TrueColor might not
-+ * provide the full shade representation in XAllocColor.
-+ * In this case one had to provide a 'best' colormap instead.
-+ * However, my tests with Xaccel on a Linux-Box with a Mach64
-+ * card were fully successful, so I leave that potential problem
-+ * to you at the moment and would appreciate any suggestions...
++ * --Scott Marovich <marovich@hpl.hp.com>, Hewlett-Packard Laboratories,
++ * January 2005.
+ */
++#include "copyright.h"
+
-+static void screen_init()
-+{
-+ static int init_flag; /* assume auto-init as 0 */
-+ Pixmap check_map;
-+ GC check_gc;
-+ XColor check_col;
-+ XImage *check_image;
-+ int ci, i;
-+
-+ if (init_flag) return;
-+ init_flag = 1;
-+
-+ check_map = XCreatePixmap(theDisp, RootWindow(theDisp,theScreen),
-+ 1, 1, dispDEEP);
-+ check_gc = XCreateGC(theDisp, check_map, 0, NULL);
-+ for (ci = 0; ci < 3; ci++) {
-+ for (i = 0; i < 256; i++) {
-+ check_col.red = 0;
-+ check_col.green = 0;
-+ check_col.blue = 0;
-+ /* Do proper upscaling from unsigned 8 bit (image data values)
-+ to unsigned 16 bit (X color representation). */
-+ ((unsigned short *)&check_col.red)[ci] = (unsigned short)((i << 8) | i);
-+ if (theVisual->class == TrueColor)
-+ XAllocColor(theDisp, theCmap, &check_col);
-+ else
-+ xvAllocColor(theDisp, theCmap, &check_col);
-+ screen_set[ci][i] =
-+ (((unsigned short *)&check_col.red)[ci] >> 8) & 0xff;
-+ XSetForeground(theDisp, check_gc, check_col.pixel);
-+ XDrawPoint(theDisp, check_map, check_gc, 0, 0);
-+ check_image = XGetImage(theDisp, check_map, 0, 0, 1, 1,
-+ AllPlanes, ZPixmap);
-+ if (check_image) {
-+ switch (check_image->bits_per_pixel) {
-+ case 8:
-+ screen_rgb[ci][i] = *(CARD8 *)check_image->data;
-+ break;
-+ case 16:
-+ screen_rgb[ci][i] = *(CARD16 *)check_image->data;
-+ break;
-+ case 24:
-+ screen_rgb[ci][i] =
-+ ((unsigned long)*(CARD8 *)check_image->data << 16) |
-+ ((unsigned long)*(CARD8 *)(check_image->data + 1) << 8) |
-+ (unsigned long)*(CARD8 *)(check_image->data + 2);
-+ break;
-+ case 32:
-+ screen_rgb[ci][i] = *(CARD32 *)check_image->data;
-+ break;
-+ }
-+ XDestroyImage(check_image);
-+ }
-+ }
-+ }
-+ XFreeGC(theDisp, check_gc);
-+ XFreePixmap(theDisp, check_map);
-+}
++#define NEEDSARGS
++#include "xv.h"
+
++#ifdef HAVE_JP2K
++
++#include <jasper/jasper.h>
++/* missing prototype in 1.701.0, sigh: */
++jas_stream_t *jas_stream_freopen PARM((const char *, const char *, FILE *));
++
++static const char *fbasename, /* File's base name, for error/warning msgs */
++ bad_samp[] = "%s: can't read %d-plane %s file!",
++ fmode[] = "rb",
++ full_msg[] = "%s %s. (%ld bytes)",
++ jp2_kind[] = "JP2",
++ jpc_kind[] = "JPEG 2000",
++ load_msg[] = "Loading %dx%d %s %s (%ld bytes)...",
++ no_mem[] = "%s: can't read %s file - out of memory",
++ pixel_size[] = "%s: can't display %d-bit pixels!",
++ shrt_msg[] = "%dx%d %s %s. ",
++ truncated[] = "%s: Unexpected end of %s file",
++ read_err[] = "%s: I/O error reading %s file",
++ bad_dims[] = "%s: error in JPEG-2000 header (bad image size)";
++
++/* We only want to override the JasPer Library's "jas_eprintf()" subroutine in
++ order to make it a "wrapper" around XV's own error-reporting subroutine, but
++ because of the way the former is currently packaged in JasPer Library Version
++ 1.701, we must override everything else packaged in the "jas_debug.o" module
++ with it, otherwise we get "duplicate definition" messages from the linker.
++*/
++int jas_getdbglevel(void) {return 0;}
++int jas_setdbglevel(int n) {return 0;}
++int jas_memdump(FILE *fp,void *data,size_t len) {return 0;}
++
++int jas_eprintf(const char *fmt,...) /* Handle JasPer Library message */
++{
++ static char error[] = "error: ", warning[]= "warning: ";
++ va_list ap;
++ int kind = ISTR_WARNING;
++ char buffer[512];
++ register char *p;
++
++ /* Unlike the IJG JPEG Library, the JasPer Library current has no graceful way
++ for an application (= us!) to intercept its diagnostic messages and output
++ them using our own subroutines, so this ugly replacement for its output
++ subroutine will have to suffice. At Version 1.701, lthough the library's
++ own "jas_eprintf()" is a varargs subroutine, all calls currently pass just
++ 1 string with a Line Feed at the end and no "printf(3C)" arguments. Most
++ strings begin with "error: " or "warning: ", although a few have neither.
++ We try to translate these into the format preferred by XV, trimming any
++ trailing Line Feed character (ugh!).
++ */
++ va_start(ap, fmt);
++ vsnprintf(p = buffer,512,fmt,ap);
++ va_end(ap);
++ while (*p++);
++ if (p[-2] == '\n') p[-2] = '\0';
++ p = buffer;
++ if (strncmp(p,error,sizeof error) == 0) /* "error: ... " */
++ {
++ kind = ISTR_WARNING;
++ p += sizeof error;
++ }
++ else /* "warning: ... " */
++ if (strncmp(p,warning,sizeof warning) == 0)
++ {
++ kind = ISTR_INFO;
++ p += sizeof warning;
++ };
++ SetISTR(kind,"%s: %s",fbasename,p);
++ return strlen(fmt);
++}
++
++static char *SetBuf(FILE *f)
++{
++ char *buf;
++ register char *p;
++
++ /* JPEG 2000 image files are apt to be large, but the buffer size allocated by
++ most implementations of the "C" Standard I/O Library is still ridiculously
++ small, typically 1 KB. We want to allocate a much larger buffer for higher
++ I/O efficiency, but the details are unfortunately a bit platform-specific.
++ Under UNIX systems with virtual memory, we want to encourage its internal
++ "physio()" subroutine by making the buffer an integral number of pages,
++ aligned on a page-multiple memory address boundary. Under HP-UX 11.1+ and
++ perhaps other operating-systems, a Standard I/O buffer is preceded by a
++ header whose size must also be taken into account.
++ */
++# ifndef IOBUFSIZ
++# define IOBUFSIZ 65536
++# endif /* IOBUFSIZ */
++# ifdef __hpux
++# define OVERHEAD sizeof(mbstate_t)
++# endif /* __hpux */
++# ifndef OVERHEAD
++# define OVERHEAD 0
++# endif /* OVERHEAD */
++
++# ifdef NBPG
++ if (!(buf = p = malloc(NBPG+OVERHEAD+IOBUFSIZ))) return 0;
++ p = (char *)((unsigned long)p+NBPG-1 & ~(NBPG-1));
++ p -= OVERHEAD;
++# else /* not NBPG */
++ if (!(buf = p = malloc(OVERHEAD+IOBUFSIZ))) return 0;
++ p += OVERHEAD;
++# endif /* NBPG */
++ setvbuf(f,p,_IOFBF,OVERHEAD+IOBUFSIZ);
++ return buf;
++# undef OVERHEAD
++# undef IOBUFSIZ
++}
++
++int LoadJPC(char *fname,register PICINFO *pinfo,int quick)
++{
++ jas_image_t *img;
++ jas_stream_t *str;
++ FILE *fp;
++ char *iobuf;
++ const char *s;
++ unsigned long filesize;
++ long w, h, npixels, bufsize;
++ int ok = 0, vstride;
++ register int i;
++
++ /* Load a JPEG 2000 "code stream" image file into a pixel buffer for XV.
++ Unlike classical JPEG files, they have no clue about the image's color
++ space, so we check for 8-bit data samples but make no effort to check or
++ convert color spaces, and "what you see is what you get". For now, ignore
++ the "quick" option to return a reduced-resolution or -size image. Return 1
++ on success, or 0 on failure.
++ */
++ if (!(fp = xv_fopen(fname,fmode))) return 0;
++ fbasename = BaseName(fname); /* Input file's base name, for message(s) */
++ if (!(iobuf = SetBuf(fp)))
++ {
++ (void)fclose(fp);
++ SetISTR(ISTR_WARNING,no_mem,fbasename,jpc_kind);
++ goto L3;
++ }
+
-+#ifdef ENABLE_FIXPIX_SMOOTH
++ /* Before telling the JasPer Library about this file, get its size for display
++ purposes. Non-UNIX systems don't necessarily simulate "stat(2)", so do it
++ crudely but portably by seeking to the end, then back to the beginning.
++ */
++ fseek(fp,0L,2);
++ filesize = ftell(fp);
++ fseek(fp,0L,0);
+
-+/* The following code is based in part on:
-+ *
-+ * jquant1.c
-+ *
-+ * Copyright (C) 1991-1996, Thomas G. Lane.
-+ * This file is part of the Independent JPEG Group's software.
-+ * For conditions of distribution and use, see the accompanying README file.
-+ *
-+ * This file contains 1-pass color quantization (color mapping) routines.
-+ * These routines provide mapping to a fixed color map using equally spaced
-+ * color values. Optional Floyd-Steinberg or ordered dithering is available.
++ /* "jas_stream_close()" will eventually close the input file, so only do it
++ explicitly if no stream can be created:
+ */
++ if (!(str = jas_stream_freopen(fname,fmode,fp))) /* nice if prototype... */
++ {
++ (void)fclose(fp);
++ goto L3;
++ }
+
-+/* Declarations for Floyd-Steinberg dithering.
-+ *
-+ * Errors are accumulated into the array fserrors[], at a resolution of
-+ * 1/16th of a pixel count. The error at a given pixel is propagated
-+ * to its not-yet-processed neighbors using the standard F-S fractions,
-+ * ... (here) 7/16
-+ * 3/16 5/16 1/16
-+ * We work left-to-right on even rows, right-to-left on odd rows.
-+ *
-+ * We can get away with a single array (holding one row's worth of errors)
-+ * by using it to store the current row's errors at pixel columns not yet
-+ * processed, but the next row's errors at columns already processed. We
-+ * need only a few extra variables to hold the errors immediately around the
-+ * current column. (If we are lucky, those variables are in registers, but
-+ * even if not, they're probably cheaper to access than array elements are.)
-+ *
-+ * We provide (#columns + 2) entries per component; the extra entry at each
-+ * end saves us from special-casing the first and last pixels.
++ /* It's not clear to me whether the following represents a JasPer Library "bug"
++ but it sure looks goofy: Unless a stream buffer is marked "read only",
++ which only happens when the stream's "fillbuf" method is called, even though
++ our buffers are always "read only", the library will try to flush out buffer
++ contents when the stream is destroyed, which makes it die a horrible death.
++ So, mark the stream buffer proactively:
+ */
++ str->bufmode_ |= JAS_STREAM_RDBUF; /* We will only read the stream buffer */
++ if (!(img = jpc_decode(str,0))) goto L2;
++ if ((vstride = jas_image_numcmpts(img))) /* num. color planes */
++ {
+
-+typedef INT16 FSERROR; /* 16 bits should be enough */
-+typedef int LOCFSERROR; /* use 'int' for calculation temps */
++ /* After the image-component streams created, they are left in a "write"
++ state with the streams' cursors positioned at their ends, so "seek" in
++ order to "read" each stream from its beginning.
++ */
++ i = vstride;
++ while (--i >= 0)
++ if (jas_stream_seek(img->cmpts_[i]->stream_,0L,0))
++ {
++ SetISTR(ISTR_WARNING,read_err,fbasename,jpc_kind);
++ goto L1;
++ }
++ }
++ w = jas_image_width(img);
++ h = jas_image_height(img);
+
-+typedef struct { byte *colorset;
-+ FSERROR *fserrors;
-+ } FSBUF;
++ /* avoid buffer overflow */
++ npixels = w * h;
++ bufsize = vstride * npixels;
++ if (w <= 0 || h <= 0 || npixels/w != h || bufsize/vstride != npixels)
++ {
++ (void)fclose(fp);
++ SetISTR(ISTR_WARNING,bad_dims,fbasename);
++ goto L1;
++ }
++ pinfo->normw = pinfo->w = w;
++ pinfo->normh = pinfo->h = h;
+
-+/* Floyd-Steinberg initialization function.
-+ *
-+ * It is called 'fs2_init' since it's specialized for our purpose and
-+ * could be embedded in a more general FS-package.
-+ *
-+ * Returns a malloced FSBUF pointer which has to be passed as first
-+ * parameter to subsequent 'fs2_dither' calls.
-+ * The FSBUF structure does not need to be referenced by the calling
-+ * application, it can be treated from the app like a void pointer.
-+ *
-+ * The current implementation does only require to free() this returned
-+ * pointer after processing.
-+ *
-+ * Returns NULL if malloc fails.
-+ *
-+ * NOTE: The FSBUF structure is designed to allow the 'fs2_dither'
-+ * function to work with an *arbitrary* number of color components
-+ * at runtime! This is an enhancement over the IJG code base :-).
-+ * Only fs2_init() specifies the (maximum) number of components.
++ /* Sanity-check the image's color space and no. of colors. For now, accept
++ only "generic" color spaces, not files needing image-specific color
++ correction, but fix that someday...
+ */
++ switch (vstride)
++ {
++ default:
++ SetISTR(ISTR_WARNING,bad_samp,fbasename,vstride,jpc_kind);
++ goto L1;
++ case 1:
++ if ((i = jas_image_cmptprec(img,0)) != 8) /* not 8-bit pixels */
++ {
++ SetISTR(ISTR_WARNING,pixel_size,fbasename,i);
++ goto L1;
++ }
++ s = "Greyscale";
++ pinfo->type = PIC8;
++ pinfo->colType = F_GREYSCALE;
++ i = 256; /* Return fake indexed-color "map" */
++ while (--i >= 0) pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i;
++ break;
++ case 3:
++
++ /* BEWARE OF KLUDGE: If the image's color space is RGB, assume that the
++ data-sample precision for all color planes is the
++ same. If the color space is YCbCr, assume the luminance (Y = 0th)
++ component has the greatest precision, although the chrominance
++ (Cr = 1st, Cb = 2nd) components are usually sub-sampled.
++ */
++ if ((i = jas_image_cmptprec(img,0)) != 8) /* not 24-bit pixels */
++ {
++ SetISTR(ISTR_WARNING,pixel_size,fbasename,i*3);
++ goto L1;
++ }
++ s = "Color";
++ pinfo->type = PIC24;
++ pinfo->colType = F_FULLCOLOR;
++
++ /* XXX Unlike the IJG JPEG Library, the JasPer Library is apparently
++ unable to quantize colors or tell us whether the image's colors
++ were quantized by its creator, so it seems that we can't return a
++ color map for XV to potentially use 8-bit indexed color. If there
++ *is* an easy way to do it that escapes me, put the code here someday.
++ */
++ }
++ if (!(pinfo->pic = (byte *)malloc(bufsize))) /* image buffer for XV */
++ {
++ SetISTR(ISTR_WARNING,no_mem,fbasename,jpc_kind);
++ goto L1;
++ }
++ pinfo->frmType = F_JPC;
++ sprintf(pinfo->fullInfo,full_msg,s,jpc_kind,filesize);
++ sprintf(pinfo->shrtInfo,shrt_msg,pinfo->w,pinfo->h,s,jpc_kind);
++ SetISTR(ISTR_INFO,load_msg,pinfo->normw,pinfo->normh,s,jpc_kind,filesize);
++ if (vstride == 1) /* gray-scale image */
++ { register jas_stream_t *c = img->cmpts_[0]->stream_;
++ register byte *p = pinfo->pic;
++
++ /* Since this is a 1-plane image, avoid a lot of errant nonsense in the
++ JasPer Library by sequentially reading all of the data into our buffer
++ directly.
++ */
++ do if ((i = (*c->ops_->read_)(c->obj_,(char *)p,bufsize)) <= 0)
++ {
++ SetISTR(ISTR_WARNING,i < 0 ? read_err : truncated,fbasename,
++ jpc_kind);
++ goto L1;
++ }
++ while ((p += i),(bufsize -= i) > 0);
++ }
++ else /* RGB color image */
++ {
+
-+static FSBUF *fs2_init(width)
-+int width;
++ /* Reading color images is inefficient because JPEG 2000 wants to partition
++ file data into separate image planes (colors), while XV wants data
++ samples from each plane to be interleaved as 3-byte pixels. Apparently
++ the fastest method consists of 3 passes through the XV image buffer,
++ into which we insert the bytes of each component.
++ */
++ i = 0;
++ do /* each color component */
++ { long npix = npixels;
++ register jas_stream_t *c = img->cmpts_[i]->stream_;
++ register byte *p = pinfo->pic + i;
++
++ do /* each pixel */
++ { register int b;
++
++ if ((b = jas_stream_getc(c)) < 0)
++ {
++ SetISTR(ISTR_WARNING,
++ (c->flags_ & JAS_STREAM_EOF) ? truncated : read_err,
++ fbasename,jpc_kind);
++ goto L1;
++ }
++ *p = b;
++ }
++ while ((p += 3),--npix > 0);
++ }
++ while (++i <= 2);
++ }
++ ok = 1; /* Success! */
++L1: jas_image_destroy(img);
++L2: (void)jas_stream_close(str);
++ free(iobuf);
++L3: return ok;
++}
++
++int LoadJP2(char *fname,register PICINFO *pinfo,int quick)
+{
-+ FSBUF *fs;
-+ FSERROR *p;
++ jas_image_t *img;
++ jas_stream_t *str;
++ FILE *fp;
++ char *iobuf;
++ const char *s;
++ unsigned long filesize;
++ long w, h, npixels, bufsize;
++ int ok = 0, vstride;
++ register int i;
++
++ /* Load a JPEG 2000 JP2 image file into a pixel buffer for XV, doing any
++ necessary color-space conversion to end up with 8-bit gray scale or 24-bit
++ RGB. For now, ignore the "quick" option to return a reduced-resolution
++ or -size image. Return 1 on success, or 0 on failure.
++ */
++ if (!(fp = xv_fopen(fname,fmode))) return 0;
++ fbasename = BaseName(fname); /* Input file's base name, for message(s) */
++ if (!(iobuf = SetBuf(fp)))
++ {
++ (void)fclose(fp);
++ SetISTR(ISTR_WARNING,no_mem,fbasename,jpc_kind);
++ goto L3;
++ }
+
-+ fs = (FSBUF *)
-+ malloc(sizeof(FSBUF) * 3 + ((size_t)width + 2) * sizeof(FSERROR) * 3);
-+ if (fs == 0) return fs;
++ /* Before telling the JasPer Library about this file, get its size for display
++ purposes. Non-UNIX systems don't necessarily simulate "stat(2)", so do it
++ crudely but portably by seeking to the end, then back to the beginning.
++ */
++ fseek(fp,0L,2);
++ filesize = ftell(fp);
++ fseek(fp,0L,0);
+
-+ fs[0].colorset = screen_set[0];
-+ fs[1].colorset = screen_set[1];
-+ fs[2].colorset = screen_set[2];
++ /* "jas_stream_close()" will eventually close the input file, so only do it
++ explicitly if no stream can be created:
++ */
++ if (!(str = jas_stream_freopen(fname,fmode,fp)))
++ {
++ (void)fclose(fp);
++ goto L3;
++ }
+
-+ p = (FSERROR *)(fs + 3);
-+ memset(p, 0, ((size_t)width + 2) * sizeof(FSERROR) * 3);
++ /* It's not clear to me whether the following represents a JasPer Library "bug"
++ but it sure looks goofy: Unless a stream buffer is marked "read only",
++ which only happens when the stream's "fillbuf" method is called, even though
++ our buffers are always "read only", the library will try to flush out buffer
++ contents when the stream is destroyed, which makes it die a horrible death.
++ So, mark the stream buffer proactively:
++ */
++ str->bufmode_ |= JAS_STREAM_RDBUF; /* We will only read the stream buffer */
++ if (!(img = jp2_decode(str,0))) goto L2;
++ if ((vstride = jas_image_numcmpts(img))) /* num. color planes */
++ {
+
-+ fs[0].fserrors = p;
-+ fs[1].fserrors = p + 1;
-+ fs[2].fserrors = p + 2;
++ /* After the image-component streams created, they are left in a "write"
++ state with the streams' cursors positioned at their ends, so "seek" in
++ order to "read" each stream from its beginning.
++ */
++ i = vstride;
++ while (--i >= 0)
++ if (jas_stream_seek(img->cmpts_[i]->stream_,0L,0))
++ {
++ SetISTR(ISTR_WARNING,read_err,fbasename,jp2_kind);
++ goto L1;
++ }
++ }
++ w = jas_image_width(img);
++ h = jas_image_height(img);
+
-+ return fs;
-+}
++ /* avoid buffer overflow */
++ npixels = w * h;
++ bufsize = vstride * npixels;
++ if (w <= 0 || h <= 0 || npixels/w != h || bufsize/vstride != npixels)
++ {
++ (void)fclose(fp);
++ SetISTR(ISTR_WARNING,bad_dims,fbasename);
++ goto L1;
++ }
++ pinfo->normw = pinfo->w = w;
++ pinfo->normh = pinfo->h = h;
+
-+/* Floyd-Steinberg dithering function.
-+ *
-+ * NOTE:
-+ * (1) The image data referenced by 'ptr' is *overwritten* (input *and*
-+ * output) to allow more efficient implementation.
-+ * (2) Alternate FS dithering is provided by the sign of 'nc'. Pass in
-+ * a negative value for right-to-left processing. The return value
-+ * provides the right-signed value for subsequent calls!
-+ * (3) This particular implementation assumes *no* padding between lines!
-+ * Adapt this if necessary.
++ /* Sanity-check the image's color space and no. of colors. For now, accept
++ only "generic" color spaces, not files needing image-specific color
++ correction, but fix that someday...
+ */
++ switch (vstride)
++ { static char color_space[]={"%s: invalid color space!"};
++
++ default:
++ SetISTR(ISTR_WARNING,bad_samp,fbasename,vstride,jp2_kind);
++ goto L1;
++ case 1:
++ if ( !jas_clrspc_isunknown(i = jas_image_clrspc(img))
++ && jas_clrspc_fam(i) != JAS_CLRSPC_FAM_GRAY
++ )
++ {
++ SetISTR(ISTR_WARNING,color_space,fbasename);
++ goto L1;
++ }
++ if ((i = jas_image_cmptprec(img,0)) != 8) /* not 8-bit pixels */
++ {
++ SetISTR(ISTR_WARNING,pixel_size,fbasename,i);
++ goto L1;
++ }
++ s = "Greyscale";
++ pinfo->type = PIC8;
++ pinfo->colType = F_GREYSCALE;
++ i = 256; /* Return fake indexed-color "map" */
++ while (--i >= 0) pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i;
++ break;
++ case 3:
++ if (jas_clrspc_isunknown(i = jas_image_clrspc(img)))
++ {
++ SetISTR(ISTR_WARNING,color_space,fbasename);
++ goto L1;
++ }
++ if (jas_clrspc_fam(i) != JAS_CLRSPC_FAM_RGB)
++ { jas_image_t *oimg;
++ jas_cmprof_t *profile;
++
++ /* Here's where the JasPer Library really shines. The only color
++ space that XV handles is RGB, so if that's not what our image
++ uses, then to quote Capt. Kirk: "Make it so!"
++ */
++ if (!(profile = jas_cmprof_createfromclrspc(JAS_CLRSPC_SRGB)))
++ {
++ SetISTR(ISTR_WARNING,"%s: can't create RGB profile",
++ fbasename);
++ goto L1;
++ }
++ img = jas_image_chclrspc( oimg = img
++ , profile
++ , JAS_CMXFORM_INTENT_PER
++ );
++ jas_cmprof_destroy(profile);
++ if (!img) /* Oops! We failed, so restore original image */
++ {
++ img = oimg;
++ SetISTR(ISTR_WARNING,"%s: can't convert to RGB",fbasename);
++ goto L1;
++ }
++ jas_image_destroy(oimg);
++ }
+
-+static int fs2_dither(fs, ptr, nc, num_rows, num_cols)
-+FSBUF *fs;
-+byte *ptr;
-+int nc, num_rows, num_cols;
-+{
-+ int abs_nc, ci, row, col;
-+ LOCFSERROR delta, cur, belowerr, bpreverr;
-+ byte *dataptr, *colsetptr;
-+ FSERROR *errorptr;
-+
-+ if ((abs_nc = nc) < 0) abs_nc = -abs_nc;
-+ for (row = 0; row < num_rows; row++) {
-+ for (ci = 0; ci < abs_nc; ci++, ptr++) {
-+ dataptr = ptr;
-+ colsetptr = fs[ci].colorset;
-+ errorptr = fs[ci].fserrors;
-+ if (nc < 0) {
-+ dataptr += (num_cols - 1) * abs_nc;
-+ errorptr += (num_cols + 1) * abs_nc;
++ /* BEWARE OF KLUDGE: If the image's color space is RGB, assume that the
++ data-sample precision for all color planes is the
++ same. If the color space is YCbCr, assume the luminance (Y = 0th)
++ component has the greatest precision, although the chrominance
++ (Cr = 1st, Cb = 2nd) components are usually sub-sampled.
++ */
++ if ((i = jas_image_cmptprec(img,0)) != 8) /* not 24-bit pixels */
++ {
++ SetISTR(ISTR_WARNING,pixel_size,fbasename,i*3);
++ goto L1;
++ }
++ s = "Color";
++ pinfo->type = PIC24;
++ pinfo->colType = F_FULLCOLOR;
++
++ /* XXX Unlike the IJG JPEG Library, the JasPer Library is apparently
++ unable to quantize colors or tell us whether the image's colors
++ were quantized by its creator, so it seems that we can't return a
++ color map for XV to potentially use 8-bit indexed color. If there
++ *is* an easy way to do it that escapes me, put the code here someday.
++ */
+ }
-+ cur = belowerr = bpreverr = 0;
-+ for (col = 0; col < num_cols; col++) {
-+ cur += errorptr[nc];
-+ cur += 8; cur >>= 4;
-+ if ((cur += *dataptr) < 0) cur = 0;
-+ else if (cur > 255) cur = 255;
-+ *dataptr = cur & 0xff;
-+ cur -= colsetptr[cur];
-+ delta = cur << 1; cur += delta;
-+ bpreverr += cur; cur += delta;
-+ belowerr += cur; cur += delta;
-+ errorptr[0] = (FSERROR)bpreverr;
-+ bpreverr = belowerr;
-+ belowerr = delta >> 1;
-+ dataptr += nc;
-+ errorptr += nc;
++ if (!(pinfo->pic = (byte *)malloc(bufsize))) /* image buffer for XV */
++ {
++ SetISTR(ISTR_WARNING,no_mem,fbasename,jp2_kind);
++ goto L1;
+ }
-+ errorptr[0] = (FSERROR)bpreverr;
-+ }
-+ ptr += (num_cols - 1) * abs_nc;
-+ nc = -nc;
-+ }
-+ return nc;
-+}
-+
-+#endif /* ENABLE_FIXPIX_SMOOTH */
-+
-
- #define DO_CROP 0
- #define DO_ZOOM 1
-@@ -1348,7 +1621,7 @@
- SetISTR(ISTR_WARNING, "Invalid image dimensions for dithering");
- return (byte *)NULL;
- }
--
-+
- outpic = (byte *) malloc((size_t) npixels);
- if (!outpic) return outpic;
-
-@@ -1838,7 +2111,7 @@
- unsigned int wide, high;
- {
- /*
-- * this has to do the none-to-simple bit of converting the data in 'pic24'
-+ * This has to do the none-too-simple bit of converting the data in 'pic24'
- * into something usable by X.
- *
- * There are two major approaches: if we're displaying on a TrueColor
-@@ -1852,7 +2125,7 @@
- * mode. (In that by this point, a 3/3/2 standard colormap has been
- * created for our use (though all 256 colors may not be unique...), and
- * we're just going to display the 24-bit picture by dithering with those
-- * colors
-+ * colors.)
- *
- */
-
-@@ -1890,33 +2163,17 @@
- /* Non-ColorMapped Visuals: TrueColor, DirectColor */
- /************************************************************************/
-
-- unsigned long r, g, b, rmask, gmask, bmask, xcol;
-- int rshift, gshift, bshift, bperpix, bperline, border, cshift;
-- int maplen;
-+ unsigned long xcol;
-+ int bperpix, bperline;
- byte *imagedata, *lip, *ip, *pp;
-
-
-- /* compute various shifting constants that we'll need... */
--
-- rmask = theVisual->red_mask;
-- gmask = theVisual->green_mask;
-- bmask = theVisual->blue_mask;
--
-- rshift = 7 - highbit(rmask);
-- gshift = 7 - highbit(gmask);
-- bshift = 7 - highbit(bmask);
--
-- maplen = theVisual->map_entries;
-- if (maplen>256) maplen=256;
-- cshift = 7 - highbit((u_long) (maplen-1));
--
- xim = XCreateImage(theDisp, theVisual, dispDEEP, ZPixmap, 0, NULL,
- wide, high, 32, 0);
- if (!xim) FatalError("couldn't create X image!");
-
- bperline = xim->bytes_per_line;
- bperpix = xim->bits_per_pixel;
-- border = xim->byte_order;
-
- imagedata = (byte *) malloc((size_t) (high * bperline));
- if (!imagedata) FatalError("couldn't malloc imagedata");
-@@ -1930,85 +2187,141 @@
- FatalError(buf);
- }
-
-+ screen_init();
-
-- lip = imagedata; pp = pic24;
-- for (i=0; i<high; i++, lip+=bperline) {
-- for (j=0, ip=lip; j<wide; j++) {
-- r = *pp++; g = *pp++; b = *pp++;
--
-- /* shift r,g,b so that high bit of 8-bit color specification is
-- * aligned with high bit of r,g,b-mask in visual,
-- * AND each component with its mask,
-- * and OR the three components together
-- */
--
-- if (theVisual->class == DirectColor) {
-- r = (u_long) directConv[(r>>cshift) & 0xff] << cshift;
-- g = (u_long) directConv[(g>>cshift) & 0xff] << cshift;
-- b = (u_long) directConv[(b>>cshift) & 0xff] << cshift;
-- }
--
--
-- /* shift the bits around */
-- if (rshift<0) r = r << (-rshift);
-- else r = r >> rshift;
--
-- if (gshift<0) g = g << (-gshift);
-- else g = g >> gshift;
--
-- if (bshift<0) b = b << (-bshift);
-- else b = b >> bshift;
--
-- r = r & rmask;
-- g = g & gmask;
-- b = b & bmask;
--
-- xcol = r | g | b;
--
-- if (bperpix == 32) {
-- if (border == MSBFirst) {
-- *ip++ = (xcol>>24) & 0xff;
-- *ip++ = (xcol>>16) & 0xff;
-- *ip++ = (xcol>>8) & 0xff;
-- *ip++ = xcol & 0xff;
-- }
-- else { /* LSBFirst */
-- *ip++ = xcol & 0xff;
-- *ip++ = (xcol>>8) & 0xff;
-- *ip++ = (xcol>>16) & 0xff;
-- *ip++ = (xcol>>24) & 0xff;
-- }
-- }
--
-- else if (bperpix == 24) {
-- if (border == MSBFirst) {
-- *ip++ = (xcol>>16) & 0xff;
-- *ip++ = (xcol>>8) & 0xff;
-- *ip++ = xcol & 0xff;
-- }
-- else { /* LSBFirst */
-- *ip++ = xcol & 0xff;
-- *ip++ = (xcol>>8) & 0xff;
-- *ip++ = (xcol>>16) & 0xff;
-- }
-- }
-+#ifdef ENABLE_FIXPIX_SMOOTH
-+ if (do_fixpix_smooth) {
-+#if 0
-+ /* If we wouldn't have to save the original pic24 image data,
-+ * the following code would do the dither job by overwriting
-+ * the image data, and the normal render code would then work
-+ * without any change on that data.
-+ * Unfortunately, this approach would hurt the xv assumptions...
-+ */
-+ if (bperpix < 24) {
-+ FSBUF *fs = fs2_init(wide);
-+ if (fs) {
-+ fs2_dither(fs, pic24, 3, high, wide);
-+ free(fs);
-+ }
++ pinfo->frmType = F_JP2;
++ sprintf(pinfo->fullInfo,full_msg,s,jp2_kind,filesize);
++ sprintf(pinfo->shrtInfo,shrt_msg,pinfo->w,pinfo->h,s,jp2_kind);
++ SetISTR(ISTR_INFO,load_msg,pinfo->normw,pinfo->normh,s,jp2_kind,filesize);
++ if (vstride == 1) /* gray-scale image */
++ { register jas_stream_t *c = img->cmpts_[0]->stream_;
++ register byte *p = pinfo->pic;
++
++ /* Since this is a 1-plane image, avoid a lot of errant nonsense in the
++ JasPer Library by sequentially reading all of the data into our buffer
++ directly.
++ */
++ do if ((i = (*c->ops_->read_)(c->obj_,(char *)p,bufsize)) <= 0)
++ {
++ SetISTR(ISTR_WARNING,i < 0 ? read_err : truncated,fbasename,
++ jp2_kind);
++ goto L1;
++ }
++ while ((p += i),(bufsize -= i) > 0);
+ }
-+#else
-+ /* ...so we have to take a different approach with linewise
-+ * dithering/rendering in a loop using a temporary line buffer.
-+ */
-+ if (bperpix < 24) {
-+ FSBUF *fs = fs2_init(wide);
-+ if (fs) {
-+ byte *row_buf = malloc((size_t)wide * 3);
-+ if (row_buf) {
-+ int nc = 3;
-+ byte *picp = pic24; lip = imagedata;
-+
-+ switch (bperpix) {
-+ case 8:
-+ for (i=0; i<high; i++, lip+=bperline, picp+=(size_t)wide*3) {
-+ memcpy(row_buf, picp, (size_t)wide * 3);
-+ nc = fs2_dither(fs, row_buf, nc, 1, wide);
-+ for (j=0, ip=lip, pp=row_buf; j<wide; j++) {
-+ xcol = screen_rgb[0][*pp++];
-+ xcol |= screen_rgb[1][*pp++];
-+ xcol |= screen_rgb[2][*pp++];
-+ *ip++ = xcol & 0xff;
-+ }
-+ }
-+ break;
++ else /* RGB color image */
++ {
+
-+ case 16:
-+ for (i=0; i<high; i++, lip+=bperline, picp+=(size_t)wide*3) {
-+ CARD16 *ip16 = (CARD16 *)lip;
-+ memcpy(row_buf, picp, (size_t)wide * 3);
-+ nc = fs2_dither(fs, row_buf, nc, 1, wide);
-+ for (j=0, pp=row_buf; j<wide; j++) {
-+ xcol = screen_rgb[0][*pp++];
-+ xcol |= screen_rgb[1][*pp++];
-+ xcol |= screen_rgb[2][*pp++];
-+ *ip16++ = (CARD16)xcol;
-+ }
-+ }
-+ break;
-+ } /* end switch */
-+
-+ free(row_buf);
-+ free(fs);
-
-- else if (bperpix == 16) {
-- if (border == MSBFirst) {
-- *ip++ = (xcol>>8) & 0xff;
-- *ip++ = xcol & 0xff;
-- }
-- else { /* LSBFirst */
-- *ip++ = xcol & 0xff;
-- *ip++ = (xcol>>8) & 0xff;
-+ return xim;
- }
-- }
--
-- else if (bperpix == 8) {
-- *ip++ = xcol & 0xff;
-- }
-+ free(fs);
-+ }
- }
-+#endif /* 0? */
- }
-+#endif /* ENABLE_FIXPIX_SMOOTH */
-+
-+ lip = imagedata; pp = pic24;
-+
-+ switch (bperpix) {
-+ case 8:
-+ for (i=0; i<high; i++, lip+=bperline) {
-+ for (j=0, ip=lip; j<wide; j++) {
-+ xcol = screen_rgb[0][*pp++];
-+ xcol |= screen_rgb[1][*pp++];
-+ xcol |= screen_rgb[2][*pp++];
-+ *ip++ = xcol & 0xff;
++ /* Reading color images is inefficient because JPEG 2000 wants to partition
++ file data into separate image planes (colors), while XV wants data
++ samples from each plane to be interleaved as 3-byte pixels. Apparently
++ the fastest method consists of 3 passes through the XV image buffer,
++ into which we insert the bytes of each component.
++ */
++ i = 0;
++ do /* each color component */
++ { long npix = npixels;
++ register jas_stream_t *c = img->cmpts_[i]->stream_;
++ register byte *p = pinfo->pic + i;
++
++ do /* each pixel */
++ { register int b;
++
++ if ((b = jas_stream_getc(c)) < 0)
++ {
++ SetISTR(ISTR_WARNING,
++ (c->flags_ & JAS_STREAM_EOF) ? truncated : read_err,
++ fbasename,jp2_kind);
++ goto L1;
++ }
++ *p = b;
++ }
++ while ((p += 3),--npix > 0);
+ }
-+ }
-+ break;
++ while (++i <= 2);
++ }
++ ok = 1; /* Success! */
++L1: jas_image_destroy(img);
++L2: (void)jas_stream_close(str);
++ free(iobuf);
++L3: return ok;
++}
++
++/* The following variables and subroutines are used when writing a JPEG 2000
++ file, which is done mainly using call-backs from "X Windows" widgets. The
++ most complicated part of this interface is: managing interactions with a
++ window to request the boat-loads of options that the JasPer Library supports.
++ Start by defining subwindow sizes, plus indices into several arrays of
++ corresponding widget-state variables.
++
++ IMPLEMENTATION NOTES: The following dimensions create a tall, thin window
++ which appears to have considerable empty space at the
++ bottom. Before you complain, click the Precinct Height menu button in order
++ to the tall pop-up subwindow that it generates. If the parent window is made
++ shorter, then this pop-up will be clipped, which is an ugly nuisance. I
++ don't know how to make the pop-up visible outside its parent's borders; do
++ you? If there's some way to make "X Windows" do this, then we might consider
++ making the parent shorter.
++
++ Note that there is currently no mechanism to program the no. of intermediate
++ layers used by the encoder, or their rates. This is potentially a large and
++ complicated data-entry problem, and perhaps someday we can invent a clever
++ solution using the rest of the parent window's space.
++*/
++# define JP2KW 275 /* Window width, in pixels */
++# define JP2KH 400 /* Window height, in pixels */
++# define BUTTW 51 /* Button width, in pixels (odd for half-toning) */
++# define BUTTH 20 /* Button height, in pixels */
++# define MENUW 75 /* Menu-button width, in pixels (odd for half-toning) */
++# define MENUH 24 /* Menu-button height, in pixels */
++# define RBUTH 20 /* Radio button height, in pixels */
++# define RBUTW 51 /* Radio button width, in pixels (odd for half-toning) */
++# define TEXTH (LINEHIGH+5) /* Text subwindow height, in pixels */
++# define TEXTW 75 /* Text subwindow width, in pixels */
++
++# define J_BOK 0 /* Boolean "Ok" button */
++# define J_BCANC 1 /* Boolean "Cancel" button */
++# define J_NBUTT 2 /* No. of regular button widgets */
++
++# define J_CSOP 0 /* Boolean encoding-style option buttons */
++# define J_CEPH 1
++# define J_CLAZY 2
++# define J_CTERM 3
++# define J_CSEGS 4
++# define J_CVCAU 5
++# define J_CPTRM 6
++# define J_CRSTP 7
++# define J_NCHKB 8 /* No. of check-box button widgets */
++
++# define J_MCBXW 0 /* 1-of-N menu-selection buttons */
++# define J_MCBXH 1
++# define J_MPREW 2
++# define J_MPREH 3
++# define J_MPROG 4
++# define J_NMENU 5 /* No. of menu-button widgets */
++
++# define J_TGBIT 0 /* (Unsigned numeric) string subwindows */
++# define J_TRES 1
++# define J_TRATE 2
++# define J_NTEXT 3 /* No. of text subwindows */
++
++static BUTT button[J_NBUTT];
++static CBUTT chkbut[J_NCHKB];
++static MBUTT menu[J_NMENU];
++static RBUTT *radio;
++static Window text[J_NTEXT];
++static int colorType, format, textval[J_NTEXT];
++static const char *ProgList[]={"lrcp","rlcp","rpcl","pcrl","cprl"};
++
++void CreateJP2KW(void)
++{
++ static const char EXP2_0[] ={ "1"}, /* Successive powers of 2 */
++ EXP2_1[] ={ "2"},
++ EXP2_2[] ={ "4"},
++ EXP2_3[] ={ "8"},
++ EXP2_4[] ={ "16"},
++ EXP2_5[] ={ "32"},
++ EXP2_6[] ={ "64"},
++ EXP2_7[] ={ "128"},
++ EXP2_8[] ={ "256"},
++ EXP2_9[] ={ "512"},
++ EXP2_10[]={ "1024"},
++ EXP2_11[]={ "2048"},
++ EXP2_12[]={ "4096"},
++ EXP2_13[]={ "8192"},
++ EXP2_14[]={"16384"},
++ EXP2_15[]={"32768"};
++ static const char *CBoxList[]=
++ {
++ EXP2_1 ,EXP2_2 ,EXP2_3 ,EXP2_4 ,EXP2_5,EXP2_6 ,EXP2_7 ,EXP2_8 ,EXP2_9,
++ EXP2_10,EXP2_11
++ };
++ static const char *PrecList[]=
++ {
++ EXP2_0,EXP2_1,EXP2_2 ,EXP2_3 ,EXP2_4 ,EXP2_5 ,EXP2_6 ,EXP2_7 ,
++ EXP2_8,EXP2_9,EXP2_10,EXP2_11,EXP2_12,EXP2_13,EXP2_14,EXP2_15
++ };
++ static const char hstr[]={"Height"}, wstr[]={"Width"};
++
++ if (!(jp2kW = CreateWindow( "xvjp2k"
++ , "XVjp2k"
++ , 0
++ , JP2KW
++ , JP2KH
++ , infofg
++ , infobg
++ , 0
++ )
++ )
++ ) FatalError("can't create JPEG 2000 window!");
++ XSelectInput(theDisp,jp2kW,ExposureMask|ButtonPressMask|KeyPressMask);
++
++ /* Create a row of 2 boolean-valued, regular buttons ("Ok" and "Cancel") in the
++ window's bottom right corner.
++ */
++ BTCreate(&button[J_BOK ],jp2kW,
++ JP2KW-2*BUTTW-20,JP2KH-10-BUTTH-1,BUTTW,BUTTH,
++ "Ok" ,infofg,infobg,hicol,locol);
++ BTCreate(&button[J_BCANC],jp2kW,
++ JP2KW- BUTTW-10,JP2KH-10-BUTTH-1,BUTTW,BUTTH,
++ "Cancel",infofg,infobg,hicol,locol);
++
++ /* Create a vertical column of 8 boolean-valued, check-box buttons (for
++ encoding-style options) down the window's left side.
++ */
++ CBCreate(&chkbut[J_CSOP] ,jp2kW,
++ 10,10+ASCENT+SPACING+2*LINEHIGH+0*BUTTH,
++ "sop" ,infofg,infobg,hicol,locol);
++ CBCreate(&chkbut[J_CEPH] ,jp2kW,
++ 10,10+ASCENT+SPACING+2*LINEHIGH+1*BUTTH,
++ "eph" ,infofg,infobg,hicol,locol);
++ CBCreate(&chkbut[J_CLAZY],jp2kW,
++ 10,10+ASCENT+SPACING+2*LINEHIGH+2*BUTTH,
++ "lazy" ,infofg,infobg,hicol,locol);
++ CBCreate(&chkbut[J_CTERM],jp2kW,
++ 10,10+ASCENT+SPACING+2*LINEHIGH+3*BUTTH,
++ "termall" ,infofg,infobg,hicol,locol);
++ CBCreate(&chkbut[J_CSEGS],jp2kW,
++ 10,10+ASCENT+SPACING+2*LINEHIGH+4*BUTTH,
++ "segsym" ,infofg,infobg,hicol,locol);
++ CBCreate(&chkbut[J_CVCAU],jp2kW,
++ 10,10+ASCENT+SPACING+2*LINEHIGH+5*BUTTH,
++ "vcausal" ,infofg,infobg,hicol,locol);
++ CBCreate(&chkbut[J_CPTRM],jp2kW,
++ 10,10+ASCENT+SPACING+2*LINEHIGH+6*BUTTH,
++ "pterm" ,infofg,infobg,hicol,locol);
++ CBCreate(&chkbut[J_CRSTP],jp2kW,
++ 10,10+ASCENT+SPACING+2*LINEHIGH+7*BUTTH,
++ "resetprob",infofg,infobg,hicol,locol);
++ /* Create text subwindows for unsigned decimal integer values. */
++
++ text[J_TGBIT] = XCreateSimpleWindow(theDisp,jp2kW,
++ JP2KW-TEXTW-10,10+ASCENT+SPACING+2*LINEHIGH+3*MENUH+0*TEXTH,TEXTW,TEXTH,
++ 1,infofg,infobg);
++ XSelectInput(theDisp,text[J_TGBIT],ExposureMask|KeyPressMask);
++ text[J_TRES ] = XCreateSimpleWindow(theDisp,jp2kW,
++ JP2KW-TEXTW-10,10+ASCENT+SPACING+2*LINEHIGH+3*MENUH+1*TEXTH,TEXTW,TEXTH,
++ 1,infofg,infobg);
++ XSelectInput(theDisp,text[J_TRES ],ExposureMask|KeyPressMask);
++ text[J_TRATE] = XCreateSimpleWindow(theDisp,jp2kW,
++ JP2KW-TEXTW-10,10+ASCENT+SPACING+2*LINEHIGH+3*MENUH+2*TEXTH,TEXTW,TEXTH,
++ 1,infofg,infobg);
++ XSelectInput(theDisp,text[J_TRATE],ExposureMask|KeyPressMask);
++
++ /* Create a row of 2 boolean-valued radio buttons (for the "Rate" subwindow
++ value's unit of measure). The 1st button is "selected" by default.
++ */
++ radio = RBCreate(0,jp2kW,
++ JP2KW-19*RBUTW/8-10,10+ASCENT+SPACING+2*LINEHIGH+3*MENUH+3*TEXTH+4,
++ "Percent",infofg,infobg,hicol,locol);
++ (void)RBCreate(radio,jp2kW,
++ JP2KW-1*RBUTW-10 ,10+ASCENT+SPACING+2*LINEHIGH+3*MENUH+3*TEXTH+4,
++ "Bytes",infofg,infobg,hicol,locol);
++
++ /* Create pop-up menu-selection buttons after mapping the above subwindows,
++ since we don't want the pop-up menus mapped unless the corresponding button
++ is selected.
++ */
++ XMapSubwindows(theDisp,jp2kW);
++ MBCreate(&menu[J_MCBXW],jp2kW,
++ JP2KW-2*MENUW-10,10+ASCENT+SPACING+2*LINEHIGH+0*MENUH,MENUW,MENUH,
++ wstr ,CBoxList,sizeof CBoxList/sizeof *CBoxList,infofg,infobg,
++ hicol,locol);
++ MBCreate(&menu[J_MCBXH],jp2kW,
++ JP2KW-2*MENUW-10,10+ASCENT+SPACING+2*LINEHIGH+1*MENUH,MENUW,MENUH,
++ hstr ,CBoxList,sizeof CBoxList/sizeof *CBoxList,infofg,infobg,
++ hicol,locol);
++ MBCreate(&menu[J_MPREW],jp2kW,
++ JP2KW-1*MENUW-10,10+ASCENT+SPACING+2*LINEHIGH+0*MENUH,MENUW,MENUH,
++ wstr ,PrecList,sizeof PrecList/sizeof *PrecList,infofg,infobg,
++ hicol,locol);
++ MBCreate(&menu[J_MPREH],jp2kW,
++ JP2KW-1*MENUW-10,10+ASCENT+SPACING+2*LINEHIGH+1*MENUH,MENUW,MENUH,
++ hstr ,PrecList,sizeof PrecList/sizeof *PrecList,infofg,infobg,
++ hicol,locol);
++ MBCreate(&menu[J_MPROG],jp2kW,
++ JP2KW-1*MENUW-10,10+ASCENT+SPACING+2*LINEHIGH+2*MENUH,MENUW,MENUH,
++ "Order",ProgList,sizeof ProgList/sizeof *ProgList,infofg,infobg,
++ hicol,locol);
++
++ /* Initialize values represented by widgets, which should correspond to default
++ compiled into the JasPer Library. Unfortunately, as of Version 1.701 there
++ is no easy way for an application to extract these from the library, so the
++ following code might get out of sync over time:
++ */
++ menu[J_MCBXW].hascheck = 1; menu[J_MCBXW].flags[ 5] = 1;
++ menu[J_MCBXH].hascheck = 1; menu[J_MCBXH].flags[ 5] = 1;
++ menu[J_MPREW].hascheck = 1; menu[J_MPREW].flags[15] = 1;
++ menu[J_MPREH].hascheck = 1; menu[J_MPREH].flags[15] = 1;
++ menu[J_MPROG].hascheck = 1; menu[J_MPROG].flags[ 0] = 1;
++ textval[J_TGBIT] = 2; /* No. of guard bits */
++ textval[J_TRES ] = 6; /* Max. no. of resolution levels */
++ textval[J_TRATE] = 100; /* Rate = 100% */
++}
++
++void JP2KSaveParams(int fmt,char *fname,int col) /* Save output-file parms */
++{
++ format = fmt; /* Desired file format: F_JPC|F_JP2 */
++ fbasename = fname; /* ->Output file path */
++ colorType = col; /* Desired color space: F_GREYSCALE|... */
++}
++
++static void StoreJP2K(char *options)
++{
++ static jas_image_cmptparm_t parm[3]= /* Image parameters */
++ {{0,0,1,1,0,0,8,0},{0,0,1,1,0,0,8,0},{0,0,1,1,0,0,8,0}};
++ static char nomem[]={"StoreJP2K: out of memory\n"},
++ write[]={"w"};
++ jas_image_t *img;
++ jas_stream_t *str;
++ FILE *fp, *fp2;
++ byte *pic, *r, *g, *b;
++ const char *filename;
++ char *iobuf = 0;
++ unsigned long imagesize;
++ jas_clrspc_t color_space;
++ int nc, w, h, pfree, ptype, error = 1;
++ register int i;
++
++ /* This is a generic subroutine for writing JPEG 2000 image files using the
++ JasPer Library. Our argument is an ASCII string, containing a Space (" ")-
++ separated sequence of encoder options that currently aren't well documented.
++ Most of the work is identical for both ".jpc" and ".jp2" files. Start by
++ verifying that the output file can be opened, then get an image buffer from
++ XV and begin crunching it into a suitable form for the JasPer Library.
++ */
++ if (!(fp = OpenOutFile(filename = fbasename))) return; /* Oops! */
++ setbuf(fp,0); /* We don't really use this file pointer for I/O; see below */
++ fbasename = BaseName(filename);
++ WaitCursor();
++ pic = GenSavePic(&ptype,&w,&h,&pfree,&nc,&r,&g,&b);
++ imagesize = w*h;
++ if (ptype == PIC24) imagesize *= 3;
+
-+ case 16:
-+ for (i=0; i<high; i++, lip+=bperline) {
-+ CARD16 *ip16 = (CARD16 *)lip;
-+ for (j=0; j<wide; j++) {
-+ xcol = screen_rgb[0][*pp++];
-+ xcol |= screen_rgb[1][*pp++];
-+ xcol |= screen_rgb[2][*pp++];
-+ *ip16++ = (CARD16)xcol;
++ /* As an optimization to save file space, even if our user didn't ask to store
++ a gray-scale image, check whether we could and, if so, do it anyway.
++ */
++ if (colorType != F_GREYSCALE) /* can we force a gray-scale image? */
++ {
++ if (ptype == PIC8)
++ {
++ i = nc;
++ while (--i >= 0 && r[i] == g[i] && r[i] == b[i]);
+ }
-+ }
-+ break;
++ else /* PIC24 */
++ { register byte *p = pic + imagesize;
+
-+ case 24:
-+ for (i=0; i<high; i++, lip+=bperline) {
-+ for (j=0, ip=lip; j<wide; j++) {
-+ xcol = screen_rgb[0][*pp++];
-+ xcol |= screen_rgb[1][*pp++];
-+ xcol |= screen_rgb[2][*pp++];
-+#ifdef USE_24BIT_ENDIAN_FIX
-+ if (border == MSBFirst) {
-+ *ip++ = (xcol>>16) & 0xff;
-+ *ip++ = (xcol>>8) & 0xff;
-+ *ip++ = xcol & 0xff;
-+ }
-+ else { /* LSBFirst */
-+ *ip++ = xcol & 0xff;
-+ *ip++ = (xcol>>8) & 0xff;
-+ *ip++ = (xcol>>16) & 0xff;
-+ }
-+#else /* GRR: this came with the FixPix patch, but I don't think it's right */
-+ *ip++ = (xcol >> 16) & 0xff; /* (no way to test, however, so */
-+ *ip++ = (xcol >> 8) & 0xff; /* it's left enabled by default) */
-+ *ip++ = xcol & 0xff;
-+#endif
-+ }
-+ }
-+ break;
++ while ((p -= 3) >= pic && p[0] == p[1] && p[0] == p[2]);
++ i = p-pic;
++ };
++ if (i < 0) colorType = F_GREYSCALE; /* We made it all the way through */
++ };
++
++ /* If XV is currently color-mapping the image, make a color-mapped copy so that
++ the map needn't be transmitted in the output file.
++ */
++ if ((i = (colorType != F_GREYSCALE) << 1 | (ptype != PIC8)) != 3)
++ { byte *tmp = pic, *last = pic + imagesize;
++ register byte *from = tmp, *to = pic;
++
++ if (!(pic = (byte *)malloc(imagesize))) FatalError(nomem);
++ switch (i)
++ {
+
-+ case 32:
-+ for (i=0; i<high; i++, lip+=bperline) {
-+ CARD32 *ip32 = (CARD32 *)lip;
-+ for (j=0; j<wide; j++) {
-+ xcol = screen_rgb[0][*pp++];
-+ xcol |= screen_rgb[1][*pp++];
-+ xcol |= screen_rgb[2][*pp++];
-+ *ip32++ = (CARD32)xcol;
++ /* Color-map 8->8 bit image. */
++
++ case 0: do
++ {
++ i = *from;
++ *to++ = MONO(r[i],g[i],b[i]);
++ }
++ while (++from < last);
++ break;
++
++ /* Color-map 24->8 bit image. */
++
++ case 1: do *to++ = MONO(from[0],from[1],from[2]);
++ while ((from += 3) < last);
++ break;
++
++ /* Color-map 8->24 bit image. */
++
++ case 2: do
++ {
++ i = *from;
++ *to++ = r[i]; *to++ = g[i]; *to++ = b[i];
++ }
++ while (++from < last);
++ break;
++ };
++ if (pfree) free(tmp); /* Release the original image buffer if we can */
++ pfree = 1; /* Let the modified buffer be released later */
++ };
++
++ /* Initialize various image-file parameter variables. */
++
++ parm[0].width = w;
++ parm[0].height = h;
++ if (colorType == F_GREYSCALE) /* gray-scale image */
++ {
++ ptype = 1; /* No. of color planes */
++ color_space = JAS_CLRSPC_SGRAY;
++ }
++ else /* RGB color image */
++ {
++ ptype = 3; /* No. of color planes */
++ color_space = JAS_CLRSPC_SRGB;
++ parm[2].width = parm[1].width = parm[0].width;
++ parm[2].height = parm[1].height = parm[0].height;
++ };
++
++ /* Now comes a egregious hack: The JasPer Library will eventually want to
++ close the output file that it writes, but since XV opened the file, XV also
++ thinks it has the right to close the file! In order to pacify them both,
++ we duplicate the file pointer and let the JasPer Library have it, while we
++ retain the original for XV.
++
++ XXX This code is very UNIX-specific; what's an equivalent hack for Windows?
++ */
++ if (!(fp2 = (i = dup(fileno(fp))) >= 0 ? fdopen(i,write) : 0))
++ FatalError("StoreJP2K: can't duplicate output file pointer\n");
++ if (!(iobuf = SetBuf(fp2)))
++ {
++ (void)fclose(fp2);
++ FatalError(nomem);
++ };
++
++ /* Hand our output file to the JasPer Library and create an image object.
++ "jas_stream_close()" will eventually close our output file, so only do it
++ explicitly if no stream can be created. If everything looks copacetic,
++ then write our buffer contents to the image components' streams.
++ */
++ if (!(str = jas_stream_freopen(filename,write,fp2)))
++ {
++ (void)fclose(fp2);
++ FatalError("StoreJP2K: can't open output stream\n");
++ };
++ if (!(img = jas_image_create(ptype,parm,color_space))) goto L2;
++ if (ptype == 1)
++ { register jas_stream_t *c = img->cmpts_[0]->stream_;
++ register byte *p = pic;
++
++ /* Since this is a 1-plane image, avoid a lot of errant nonsense in the
++ JasPer Library by sequentially writing all of the data directly from our
++ buffer.
++ */
++ jas_image_setcmpttype(img,0,JAS_IMAGE_CT_GRAY_Y);
++ img->cmpts_[0]->type_ = JAS_IMAGE_CT_GRAY_Y;
++ do if ((i = (*c->ops_->write_)(c->obj_,(char *)p,imagesize)) <= 0)
++ goto L1;
++ while ((p += i),(imagesize -= i) > 0);
++ if (jas_stream_flush(c) < 0) goto L1;
++ }
++ else /* RGB color image */
++ {
++
++ /* Writing color images is inefficient because JPEG 2000 wants to partition
++ file data into separate image planes (colors), while XV wants data
++ samples from each plane to be interleaved as 3-byte pixels. Apparently
++ the fastest method consists of 3 passes through the XV image buffer,
++ from which we extract the bytes of each component.
++ */
++ i = 0;
++ do /* each color component */
++ { long npix = imagesize/3;
++ register jas_stream_t *c = img->cmpts_[i]->stream_;
++ register byte *p = pic + i;
++
++ jas_image_setcmpttype(img,i,i+JAS_IMAGE_CT_RGB_R);
++ do if (jas_stream_putc(c,*p) < 0) goto L1;
++ while ((p += 3),--npix > 0);
++ if (jas_stream_flush(c) < 0) goto L1;
+ }
-+ }
-+ break;
-+ } /* end switch */
- }
-
- else {
-@@ -2458,6 +2771,7 @@
-
-
- /***********************/
-+#if 0 /* NOTUSED */
- static int highbit(ul)
- unsigned long ul;
- {
-@@ -2470,6 +2784,7 @@
- for (i=31; ((ul & hb) == 0) && i>=0; i--, ul<<=1);
- return i;
- }
-+#endif /* 0 - NOTUSED */
-
-
-
-@@ -2680,6 +2995,9 @@
- char *str;
- int wide, high, opaque,omode;
- {
-+#ifndef USE_MKSTEMP
-+ int tmpfd;
-+#endif
- int i;
- byte *bgpic24;
- char syscmd[512], fname[128], errstr[512];
-@@ -2705,6 +3023,13 @@
- close(mkstemp(fname));
- #else
- mktemp(fname);
-+ tmpfd = open(fname, O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) {
-+ sprintf(errstr, "Error: can't create temporary file %s", fname);
-+ ErrPopUp(errstr, "\nDoh!");
-+ return 0;
-+ }
-+ close(tmpfd);
- #endif
-
- /* run bggen to generate the background */
-@@ -2978,7 +3303,7 @@
-
- ftype = ReadFileType(name);
-
-- if (ftype == RFT_COMPRESS) { /* handle compressed/gzipped files */
-+ if ((ftype == RFT_COMPRESS) || (ftype == RFT_BZIP2)) { /* handle .Z,gz,bz2 */
- #ifdef VMS
- basefname[0] = '\0';
- strcpy(basefname, name); /* remove trailing .Z */
-@@ -2988,7 +3313,7 @@
- uncName = name;
- #endif
-
-- if (UncompressFile(uncName, uncompname)) {
-+ if (UncompressFile(uncName, uncompname, ftype)) {
- ftype = ReadFileType(uncompname);
- readname = uncompname;
- }
-@@ -3029,9 +3354,3 @@
-
- return 1;
- }
--
--
--
--
--
--
-diff -ruN xv-3.10a-bugfixes/xvinfo.c xv-3.10a-enhancements/xvinfo.c
---- xv-3.10a-bugfixes/xvinfo.c 2004-05-16 18:03:43.000000000 -0700
-+++ xv-3.10a-enhancements/xvinfo.c 2005-05-01 00:05:53.000000000 -0700
-@@ -265,7 +265,7 @@
- if (stnum == ISTR_WARNING && !ctrlUp && !infoUp && !anyBrowUp &&
- strlen(istrs[stnum])) {
- OpenAlert(istrs[stnum]);
-- sleep(3);
-+ sleep(1); /* was 3, but _really_ slow for TIFFs with unknown tags... */
- CloseAlert();
- }
- }
-diff -ruN xv-3.10a-bugfixes/xvjpeg.c xv-3.10a-enhancements/xvjpeg.c
---- xv-3.10a-bugfixes/xvjpeg.c 2005-03-27 16:23:06.000000000 -0800
-+++ xv-3.10a-enhancements/xvjpeg.c 2005-04-17 14:45:28.000000000 -0700
-@@ -51,11 +51,21 @@
- static void clickJD PARM((int, int));
- static void doCmd PARM((int));
- static void writeJPEG PARM((void));
-+#if JPEG_LIB_VERSION > 60
-+METHODDEF(void) xv_error_exit PARM((j_common_ptr));
-+METHODDEF(void) xv_error_output PARM((j_common_ptr));
-+METHODDEF(void) xv_prog_meter PARM((j_common_ptr));
-+#else
- METHODDEF void xv_error_exit PARM((j_common_ptr));
- METHODDEF void xv_error_output PARM((j_common_ptr));
- METHODDEF void xv_prog_meter PARM((j_common_ptr));
-+#endif
- static unsigned int j_getc PARM((j_decompress_ptr));
-+#if JPEG_LIB_VERSION > 60
-+METHODDEF(boolean) xv_process_comment PARM((j_decompress_ptr));
-+#else
- METHODDEF boolean xv_process_comment PARM((j_decompress_ptr));
-+#endif
- static int writeJFIF PARM((FILE *, byte *, int,int,int));
-
-
-@@ -85,10 +95,10 @@
-
- XSelectInput(theDisp, jpegW, ExposureMask | ButtonPressMask | KeyPressMask);
-
-- DCreate(&qDial, jpegW, 10, 10, 80, 100, 1, 100, 75, 5,
-+ DCreate(&qDial, jpegW, 10, 10, 80, 100, 1.0, 100.0, 75.0, 1.0, 5.0,
- infofg, infobg, hicol, locol, "Quality", "%");
-
-- DCreate(&smDial, jpegW, 120, 10, 80, 100, 0, 100, 0, 5,
-+ DCreate(&smDial, jpegW, 120, 10, 80, 100, 0.0, 100.0, 0.0, 1.0, 5.0,
- infofg, infobg, hicol, locol, "Smoothing", "%");
-
- BTCreate(&jbut[J_BOK], jpegW, JWIDE-180-1, JHIGH-10-BUTTH-1, 80, BUTTH,
-@@ -415,7 +425,11 @@
-
-
- /**************************************************/
--METHODDEF void xv_error_exit(cinfo)
-+#if JPEG_LIB_VERSION > 60
-+METHODDEF(void) xv_error_exit(cinfo)
-+#else
-+METHODDEF void xv_error_exit(cinfo)
-+#endif
- j_common_ptr cinfo;
- {
- my_error_ptr myerr;
-@@ -427,7 +441,11 @@
-
-
- /**************************************************/
--METHODDEF void xv_error_output(cinfo)
-+#if JPEG_LIB_VERSION > 60
-+METHODDEF(void) xv_error_output(cinfo)
-+#else
-+METHODDEF void xv_error_output(cinfo)
-+#endif
- j_common_ptr cinfo;
- {
- my_error_ptr myerr;
-@@ -441,7 +459,11 @@
-
-
- /**************************************************/
--METHODDEF void xv_prog_meter(cinfo)
-+#if JPEG_LIB_VERSION > 60
-+METHODDEF(void) xv_prog_meter(cinfo)
-+#else
-+METHODDEF void xv_prog_meter(cinfo)
-+#endif
- j_common_ptr cinfo;
- {
- struct jpeg_progress_mgr *prog;
-@@ -706,7 +728,11 @@
-
-
- /**************************************************/
--METHODDEF boolean xv_process_comment(cinfo)
-+#if JPEG_LIB_VERSION > 60
-+METHODDEF(boolean) xv_process_comment(cinfo)
-+#else
-+METHODDEF boolean xv_process_comment(cinfo)
-+#endif
- j_decompress_ptr cinfo;
- {
- int length, hasnull;
-@@ -794,8 +820,8 @@
-
-
- jpeg_set_defaults(&cinfo);
-- jpeg_set_quality(&cinfo, qDial.val, TRUE);
-- cinfo.smoothing_factor = smDial.val;
-+ jpeg_set_quality(&cinfo, (int)qDial.val, TRUE);
-+ cinfo.smoothing_factor = (int)smDial.val;
-
-
- jpeg_start_compress(&cinfo, TRUE);
-@@ -804,7 +830,7 @@
- /*** COMMENT HANDLING ***/
-
- sprintf(xvcmt, "%sXV %s Quality = %d, Smoothing = %d\n",
-- CREATOR_STR, REVDATE, qDial.val, smDial.val);
-+ CREATOR_STR, REVDATE, (int)qDial.val, (int)smDial.val);
-
- if (picComments) { /* append XV comment */
- char *sp, *sp1; int done;
-@@ -866,4 +892,27 @@
-
-
-
++ while (++i <= 2);
++ };
++ if ( (*(format == F_JPC ? jpc_encode : jp2_encode))(img,str,options) >= 0
++ && jas_stream_flush(str) >= 0
++ ) error = 0; /* Success! */
++L1: jas_image_destroy(img);
++L2: (void)jas_stream_close(str);
++ if (iobuf) free(iobuf);
++ if (pfree) free(pic);
++ if (!CloseOutFile(fp,filename,error)) DirBox(0);
++ SetCursors(-1);
++}
+
-+/*******************************************/
-+void
-+VersionInfoJPEG() /* GRR 19980605, 19980607 */
++void JP2KDialog(int vis)
+{
-+ int major = JPEG_LIB_VERSION / 10;
-+ int minor = JPEG_LIB_VERSION % 10;
-+ char minoralpha[2];
++ if ((jp2kUp = vis)) CenterMapWindow(jp2kW,0,0,JP2KW,JP2KH);
++ else XUnmapWindow(theDisp,jp2kW);
++}
++
++static void TWRedraw(Window w,unsigned int val)
++{
++ char buf[11];
++ register int i;
+
-+ if (minor) {
-+ minoralpha[0] = (char)(minor - 1 + 'a');
-+ minoralpha[1] = '\0';
-+ } else
-+ minoralpha[0] = '\0';
++ /* Draw a 1-line numeric text string in the specified window, representing the
++ argument value as a left-justified unsigned decimal integer, followed by a
++ "cursor" icon.
++ */
++ sprintf(buf,"%u",val);
++ if (ctrlColor) XClearArea(theDisp,w,2,2,TEXTW-4,TEXTH-4,False);
++ else XClearWindow(theDisp,w);
++ Draw3dRect(w,0,0,TEXTW-1,TEXTH-1,R3D_IN,2,hicol,locol,infobg);
++ XSetForeground(theDisp,theGC,infofg);
++ XDrawString(theDisp,w,theGC,3,ASCENT+3,buf,i = strlen(buf));
+
-+/* fprintf(stderr, " Compiled with libjpeg %d.%d.\n", major, minor); */
-+ fprintf(stderr, " Compiled with libjpeg %d%s.\n", major, minoralpha);
++ /* Draw a "cursor" icon after the numeric string. */
++
++ i = XTextWidth(mfinfo,buf,i);
++ XDrawLine(theDisp,w,theGC,i+3,2 ,i+3,2+CHIGH+1);
++ XDrawLine(theDisp,w,theGC,i+3,2+CHIGH+1,i+5,2+CHIGH+3);
++ XDrawLine(theDisp,w,theGC,i+3,2+CHIGH+1,i+1,2+CHIGH+3);
+}
+
++int JP2KCheckEvent(register XEvent *xev)
++{
++ int ok = 0;
++
++ /* Check whether the argument "X Windows" event is for one of our subwindows.
++ If it is, handle the event and return 1; otherwise, return 0.
++ */
++ if (!jp2kUp) return 0;
++ switch (xev->type)
++ { KeySym ks;
++ int len;
++ char buf[128];
++ register int i;
++
++ /* Throw away excess "expose" events for "dumb" windows. */
++
++ case Expose :
++# define E ((XExposeEvent *)xev)
++ if (E->window == jp2kW)
++ { XRectangle rect;
++
++ rect.x = E->x ; rect.y = E->y ;
++ rect.width = E->width; rect.height = E->height;
++ XSetClipRectangles(theDisp,theGC,0,0,&rect,1,Unsorted);
++ XSetForeground(theDisp,theGC,infofg);
++ XSetBackground(theDisp,theGC,infobg);
++ i = sizeof button/sizeof *button;
++ while (--i >= 0) BTRedraw(&button[i]);
++ i = sizeof chkbut/sizeof *chkbut;
++ while (--i >= 0) CBRedraw(&chkbut[i]);
++ i = sizeof menu/sizeof *menu;
++ while (--i >= 0) MBRedraw(&menu[i]);
++ RBRedraw(radio,-1);
++ DrawString(jp2kW,10,10+ASCENT,"Save JPEG 2000 File...");
++ DrawString(jp2kW,10,10+ASCENT+2*LINEHIGH,"Style options:");
++ DrawString(jp2kW,JP2KW-2*MENUW-10,10+ASCENT+2*LINEHIGH,
++ "Coding Blk");
++ DrawString(jp2kW,JP2KW-1*MENUW-10,10+ASCENT+2*LINEHIGH,
++ " Precinct");
++ DrawString(jp2kW,
++ JP2KW-2*MENUW-10,10+ASCENT+SPACING+3*LINEHIGH+2*MENUH,
++ "Progression:");
++ DrawString(jp2kW,
++ JP2KW-2*TEXTW-10,10+ASCENT+SPACING+3*LINEHIGH+3*MENUH+0*TEXTH,
++ "Guard bits:");
++ DrawString(jp2kW,
++ JP2KW-2*TEXTW-10,10+ASCENT+SPACING+3*LINEHIGH+3*MENUH+1*TEXTH,
++ "Res levels:");
++ DrawString(jp2kW,
++ JP2KW-2*TEXTW-10,10+ASCENT+SPACING+3*LINEHIGH+3*MENUH+2*TEXTH,
++ "Rate:");
++ XSetClipMask(theDisp,theGC,None);
++ ok = 1;
++ break;
++ };
++ i = sizeof text/sizeof *text;
++ while (--i >= 0 && E->window != text[i]);
++ if (i >= 0)
++ {
++ TWRedraw(E->window,textval[i]);
++ ok = 1;
++ };
++ break;
++# undef E
++
++ /* Check whether the user pressed one of our buttons. */
++
++ case ButtonPress:
++# define E ((XButtonEvent *)xev)
++ if (E->button == Button1 && E->window == jp2kW)
++ { register int j;
++
++ ok = 1; /* Check whether a regular button was pressed */
++ i = sizeof button/sizeof *button;
++ while ( --i >= 0
++ && !PTINRECT(E->x,E->y,button[i].x,button[i].y,button[i].w,button[i].h)
++ );
++ if (i >= 0) /* our button was pressed */
++ { char options[1024];
++ register char *p;
++ register const char *q;
++
++ if (!BTTrack(&button[i])) break; /* Ignore it */
++ if (i != J_BOK) /* must be "Cancel" button */
++ {
++ JP2KDialog(0);
++ break;
++ };
++
++ /* Our user hit the "Ok" button. At this point, we have an ugly
++ job to do: JasPer Library encoder options must be specified
++ as an ASCII string of Space (" ")-separated <tag>[=<value>]
++ entries, so we must collect the values of all of our widgets
++ and subwindows, determine whether our user has requested any
++ non-default values, then build the string only for the JasPer
++ Library to immediately tear it apart again. Yechh!
++ */
++ if ((unsigned)textval[J_TGBIT]-1 > 7)
++ {
++ OpenAlert("No. of guard bits must be 1-8");
++ sleep(3);
++ CloseAlert();
++ break;
++ };
++ if ((unsigned)textval[J_TRES ] <= 0)
++ {
++ OpenAlert("Maximum resolution levels must be >= 1");
++ sleep(3);
++ CloseAlert();
++ break;
++ };
++
++ /* XXX Should we check and complain if the rate is zero?
++ JasPer Library Version 1.701 apparently accepts that
++ value, even though it seems kinda weird.
++ */
++ p = options;
++ i = 0;
++ do if ((j = MBWhich(&menu[i])) != 5)
++ { static const char *parm[2] =
++ {"cblkwidth=%u", "cblkheight=%u"};
++
++ if (p > options) *p++ = ' ';
++ sprintf(p,parm[i-J_MCBXW],++j);
++ while (*++p);
++ }
++ while (++i <= J_MCBXH);
++ do if ((j = MBWhich(&menu[i])) < 15)
++ { static const char *parm[2] =
++ {"prcwidth=%u", "prcheight=%u"};
++
++ if (p > options) *p++ = ' ';
++ sprintf(p,parm[i-J_MPREW],j);
++ while (*++p);
++ }
++ while (++i <= J_MPREH);
++ if ((j = MBWhich(&menu[i])))
++ {
++ if (p > options) *p++ = ' ';
++ *p++ = 'p'; *p++ = 'r'; *p++ = 'g'; *p = '=';
++ q = ProgList[j];
++ while ((*++p = *q++));
++ };
++ if ((i = textval[J_TRES ]) != 6)
++ {
++ if (p > options) *p++ = ' ';
++ sprintf(p,"numrlvls=%u",i);
++ while (*++p);
++ };
++ i = 0;
++ do if (chkbut[i].val) /* append this encoding option */
++ {
++ if (p > options) *p++ = ' ';
++ q = chkbut[i].str;
++ while ((*p++ = *q++));
++ *--p = '\000';
++ }
++ while (++i < sizeof chkbut/sizeof *chkbut);
++ if ((i = textval[J_TGBIT]) != 2)
++ {
++ if (p > options) *p++ = ' ';
++ sprintf(p,"numgbits=%u",i);
++ while (*++p);
++ };
++ if ((i = textval[J_TRATE]) != 100)
++ {
++ if (p > options) *p++ = ' ';
++ *p++ = 'r'; *p++ = 'a'; *p++ = 't'; *p++ = 'e';
++ *p++ = '=';
++ if (i) /* non-zero rate */
++ {
++ if (RBWhich(radio)) sprintf(p,"%uB",i); /* # Bytes */
++ else /* the value is a percentage */
++ {
++ if (i > 100) i = 200; /* => Raw size + 1 */
++ sprintf(p,"%u.%.2u",i/100,i%100);
++ }
++ while (*++p);
++ }
++ else /* rate = 0 */
++ {
++
++ /* XXX This is apparently valid, since JasPer Library
++ Version 1.701 doesn't complain about it.
++ */
++ *p++ = '0';
++ *p = '\000';
++ }
++ };
++ StoreJP2K(options); /* Finally, do the *real* work! */
++ JP2KDialog(0);
++ p = GetDirFullName();
++ if (!ISPIPE(*p))
++ {
++ XVCreatedFile(p);
++ StickInCtrlList(0);
++ };
++ break;
++ };
++
++ /* See whether a check-box button was pressed. */
+
++ i = sizeof chkbut/sizeof *chkbut;
++ while (--i >= 0 && !CBClick(&chkbut[i],E->x,E->y));
++ if (i >= 0) /* our button was pressed */
++ {
++ (void)CBTrack(&chkbut[i]);
++ break;
++ };
++
++ /* See whether a menu button was pressed. */
++
++ i = sizeof menu/sizeof *menu;
++ while (--i >= 0 && !MBClick(&menu[i],E->x,E->y));
++ if (i >= 0) /* our button was pressed */
++ { register int j;
++
++ if ((j = MBTrack(&menu[i])) >= 0)
++ {
++ switch (i)
++ {
++
++ /* The JasPer Library constrains a coding box's area
++ (width x height) to be <= 4096 pixels, so if this
++ button-press would violate that condition, then
++ quietly limit the box's orthogonal dimension by just
++ enough to compensate.
++ */
++ case J_MCBXH:
++ case J_MCBXW: if (MBWhich(&menu[!i]) + j >= 10)
++ MBSelect(&menu[!i],10 - j);
++ };
++ MBSelect(&menu[i],j);
++ MBSetActive(&menu[i],1);
++ };
++ break;
++ };
++
++ /* See whether a radio button was pressed. */
++
++ if ( (i = RBClick(radio,E->x,E->y)) >= 0 /* button pressed */
++ && RBTrack(radio,i)
++ )
++ {
++ RBSelect(radio,i);
++ RBSetActive(radio,i,1);
++ };
++ break;
++ };
++ XBell(theDisp,50);
++ break;
++# undef E
++
++ /* Translate a few key-press events into simulated button events. */
++
++ case KeyPress :
++# define E ((XKeyEvent *)xev)
++ buf[len = XLookupString(E,buf,sizeof buf,&ks,0)] = '\000';
++ RemapKeyCheck(ks,buf,&len);
++ if (E->window == jp2kW)
++ {
++ ok = 1;
++ if (len > 0)
++ switch (buf[0])
++ {
++ case '\r' :
++ case '\n' : FakeButtonPress(&button[J_BOK ]);
++ break;
++ case '\033': FakeButtonPress(&button[J_BCANC]);
++ };
++ break;
++ };
++ i = sizeof text/sizeof *text;
++ while (--i >= 0 && E->window != text[i]);
++ if (i >= 0) /* a key was pressed in our text window */
++ { int oldval = textval[i]; /* Save this subwindow's old value */
++ register int c, j = 0;
++
++ /* This is a *very* simple text-input editing loop that assembles an
++ an unsigned integer from successive ASCII decimal digits, typed
++ into one of our 1-line subwindows. For convenience, the only
++ character recognized is Backspace.
++ */
++ ok = 1;
++ L: if (j >= len) break;
++ if ((unsigned)(c = buf[j++] - '0') <= 9)
++ {
++ TWRedraw(text[i],textval[i] = textval[i]*10 + c);
++ goto L;
++ };
++ if ((c += '0') == '\b')
++ {
++ TWRedraw(text[i],textval[i] = textval[i]/10);
++ goto L;
++ };
++ textval[i] = oldval;
++ };
++ XBell(theDisp,50);
++# undef E
++ };
++ return ok;
++}
+
+
++/*******************************************/
++void
++VersionInfoJP2K() /* GRR 20070304 */
++{
++ fprintf(stderr, " Compiled with libjasper %s; using libjasper %s.\n",
++ JAS_VERSION, jas_getversion());
++}
+
- #endif /* HAVE_JPEG */
-diff -ruN xv-3.10a-bugfixes/xvmag.c xv-3.10a-enhancements/xvmag.c
---- xv-3.10a-bugfixes/xvmag.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvmag.c 2005-04-17 22:56:58.000000000 -0700
++#endif /* HAVE_JP2K */
+diff -u -r --new-file xv-3.10a.orig/xvmag.c xv-3.10a/xvmag.c
+--- xv-3.10a.orig/xvmag.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvmag.c 2005-04-18 00:56:58.000000000 -0500
@@ -0,0 +1,866 @@
+/*
+ * xvmag.c - load routine for `MAG' format pictures.
@@ -10734,9 +4306,9 @@ diff -ruN xv-3.10a-bugfixes/xvmag.c xv-3.10a-enhancements/xvmag.c
+ return r;
+}
+#endif /* HAVE_MAG */
-diff -ruN xv-3.10a-bugfixes/xvmaki.c xv-3.10a-enhancements/xvmaki.c
---- xv-3.10a-bugfixes/xvmaki.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvmaki.c 2005-04-17 22:57:01.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/xvmaki.c xv-3.10a/xvmaki.c
+--- xv-3.10a.orig/xvmaki.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvmaki.c 2005-04-18 00:57:01.000000000 -0500
@@ -0,0 +1,794 @@
+/*
+ * xvmaki.c - load routine for `MAKI' format pictures.
@@ -11532,9 +5104,9 @@ diff -ruN xv-3.10a-bugfixes/xvmaki.c xv-3.10a-enhancements/xvmaki.c
+ return r;
+}
+#endif /* HAVE_MAKI */
-diff -ruN xv-3.10a-bugfixes/xvmgcsfx.c xv-3.10a-enhancements/xvmgcsfx.c
---- xv-3.10a-bugfixes/xvmgcsfx.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvmgcsfx.c 2005-05-01 10:20:12.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/xvmgcsfx.c xv-3.10a/xvmgcsfx.c
+--- xv-3.10a.orig/xvmgcsfx.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvmgcsfx.c 2007-04-15 17:02:32.000000000 -0500
@@ -0,0 +1,2276 @@
+/*
+ * $Id: xvmgcsfx.c,v 1.23 95/11/27 19:03:36 tin329 Exp Locker: tin329 $
@@ -13759,8 +7331,8 @@ diff -ruN xv-3.10a-bugfixes/xvmgcsfx.c xv-3.10a-enhancements/xvmgcsfx.c
+/*******************************************/
+int getInputCom()
+{
-+ static char *labels[] = { "\nOk", "\033Cancel" };
-+ int i;
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ int i;
+
+ strcpy(input_command_ex, MGCSFX_DEFAULT_INPUT_COMMAND);
+ i = GetStrPopUp("Input External Command (Input is PNM):", labels, 2,
@@ -13776,8 +7348,8 @@ diff -ruN xv-3.10a-bugfixes/xvmgcsfx.c xv-3.10a-enhancements/xvmgcsfx.c
+
+int getOutputCom()
+{
-+ static char *labels[] = { "\nOk", "\033Cancel" };
-+ int i;
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ int i;
+
+ strcpy(output_command_ex, MGCSFX_DEFAULT_OUTPUT_COMMAND);
+ i = GetStrPopUp("Input External Command (Output is PNM_RAW):", labels, 2,
@@ -13812,180 +7384,9 @@ diff -ruN xv-3.10a-bugfixes/xvmgcsfx.c xv-3.10a-enhancements/xvmgcsfx.c
+#endif
+
+#endif /* HAVE_MGCSFX */
-diff -ruN xv-3.10a-bugfixes/xvmisc.c xv-3.10a-enhancements/xvmisc.c
---- xv-3.10a-bugfixes/xvmisc.c 2005-03-20 22:47:06.000000000 -0800
-+++ xv-3.10a-enhancements/xvmisc.c 2005-04-17 14:45:28.000000000 -0700
-@@ -103,10 +103,18 @@
- if (!usesize || !(i&WidthValue)) w = defw;
- if (!usesize || !(i&HeightValue)) h = defh;
-
-- hints.flags |= USSize;
-+ hints.flags |= USSize | PWinGravity;
-
-- if (i&XValue && i&XNegative) x = dispWIDE - w - abs(x);
-- if (i&YValue && i&YNegative) y = dispHIGH - h - abs(y);
-+ hints.win_gravity = NorthWestGravity;
-+ if (i&XValue && i&XNegative) {
-+ hints.win_gravity = NorthEastGravity;
-+ x = dispWIDE - (w + 2 * bwidth) - abs(x);
-+ }
-+ if (i&YValue && i&YNegative) {
-+ hints.win_gravity = (hints.win_gravity == NorthWestGravity) ?
-+ SouthWestGravity : SouthEastGravity;
-+ y = dispHIGH - (h + 2 * bwidth) - abs(y);
-+ }
-
-
- #define VROOT_TRANS
-@@ -142,20 +150,19 @@
- if (!win) return(win); /* leave immediately if couldn't create */
-
-
-- XSetStandardProperties(theDisp, win, name, name, None, NULL, 0, &hints);
--
- xwmh.input = True;
- xwmh.flags = InputHint;
- if (iconPix) { xwmh.icon_pixmap = iconPix; xwmh.flags |= IconPixmapHint; }
-- XSetWMHints(theDisp, win, &xwmh);
-
- if (clname && strlen(clname)) {
- classh.res_name = "xv";
- classh.res_class = clname;
-- XSetClassHint(theDisp, win, &classh);
- StoreDeleteWindowProp(win);
- }
-
-+ XmbSetWMProperties(theDisp, win, name, name, NULL, 0, &hints, &xwmh,
-+ clname ? &classh : NULL);
-+
- return(win);
- }
-
-@@ -232,28 +239,28 @@
- int i = CK_NONE;
-
- if (ks==XK_Up || ks==XK_KP_Up ||
-- ks==XK_KP_8 || ks==XK_F28) i=CK_UP;
-+ ks==XK_F28) i=CK_UP;
-
- else if (ks==XK_Down || ks==XK_KP_Down ||
-- ks==XK_KP_2 || ks==XK_F34) i=CK_DOWN;
-+ ks==XK_F34) i=CK_DOWN;
-
- else if (ks==XK_Left || ks==XK_KP_Left ||
-- ks==XK_KP_4 || ks==XK_F30) i=CK_LEFT;
-+ ks==XK_F30) i=CK_LEFT;
-
- else if (ks==XK_Right || ks==XK_KP_Right ||
-- ks==XK_KP_6 || ks==XK_F32) i=CK_RIGHT;
-+ ks==XK_F32) i=CK_RIGHT;
-
- else if (ks==XK_Prior || ks==XK_KP_Prior ||
-- ks==XK_KP_9 || ks==XK_F29) i=CK_PAGEUP;
-+ ks==XK_F29) i=CK_PAGEUP;
-
- else if (ks==XK_Next || ks==XK_KP_Next ||
-- ks==XK_KP_3 || ks==XK_F35) i=CK_PAGEDOWN;
-+ ks==XK_F35) i=CK_PAGEDOWN;
-
- else if (ks==XK_Home || ks==XK_KP_Home ||
-- ks==XK_KP_7 || ks==XK_F27) i=CK_HOME;
-+ ks==XK_F27) i=CK_HOME;
-
- else if (ks==XK_End || ks==XK_KP_End ||
-- ks==XK_KP_1 || ks==XK_F33) i=CK_END;
-+ ks==XK_F33) i=CK_END;
-
- else i = CK_NONE;
-
-@@ -503,6 +510,11 @@
- as we have to keep the alloc'd colors around, but we don't want anything
- else to stay */
-
-+#ifdef AUTO_EXPAND
-+ chdir(initdir);
-+ Vdsettle();
-+#endif
-+
- if (!theDisp) exit(i); /* called before connection opened */
-
- if (useroot && i==0) { /* save the root info */
-@@ -526,6 +538,26 @@
- if (tiffW) XDestroyWindow(theDisp, tiffW);
- #endif
-
-+#ifdef HAVE_PNG
-+ if (pngW) XDestroyWindow(theDisp, pngW);
-+#endif
-+
-+#ifdef HAVE_PCD
-+ if (pcdW) XDestroyWindow(theDisp, pcdW);
-+#endif
-+
-+#ifdef HAVE_PIC2
-+ if (pic2W) XDestroyWindow(theDisp, pic2W);
-+#endif
-+
-+#ifdef HAVE_MGCSFX
-+ if (mgcsfxW) XDestroyWindow(theDisp, mgcsfxW);
-+#endif
-+
-+#ifdef HAVE_PNG
-+ if (pngW) XDestroyWindow(theDisp, pngW);
-+#endif
-+
- /* if NOT using stdcmap for images, free stdcmap */
- if (colorMapMode != CM_STDCMAP) {
- int j;
-@@ -722,6 +754,26 @@
- #ifdef HAVE_TIFF
- if (tiffW) XDefineCursor(theDisp, tiffW, otherc);
- #endif
-+
-+#ifdef HAVE_PNG
-+ if (pngW) XDefineCursor(theDisp, pngW, otherc);
-+#endif
-+
-+#ifdef HAVE_PNG
-+ if (pngW) XDefineCursor(theDisp, pngW, otherc);
-+#endif
-+
-+#ifdef HAVE_PCD
-+ if (pcdW) XDefineCursor(theDisp, pcdW, otherc);
-+#endif
-+
-+#ifdef HAVE_PIC2
-+ if (pic2W) XDefineCursor(theDisp, pic2W, otherc);
-+#endif
-+
-+#ifdef HAVE_MGCSFX
-+ if (mgcsfxW) XDefineCursor(theDisp, mgcsfxW, otherc);
-+#endif
- }
-
-
-@@ -921,7 +973,7 @@
- void XVCreatedFile(fullname)
- char *fullname;
- {
-- /* called whenever a file has been deleted. Updates browser & dir windows,
-+ /* called whenever a file has been created. Updates browser & dir windows,
- if necessary */
-
- BRCreatedFile(fullname);
-@@ -1006,6 +1058,9 @@
- ((rv=(char *) getenv("cwd"))==NULL)) rv = "./";
- strcpy(buf, rv);
- }
-+#ifdef AUTO_EXPAND
-+ Vdtodir(buf);
-+#endif
- }
-
-
-diff -ruN xv-3.10a-bugfixes/xvml.c xv-3.10a-enhancements/xvml.c
---- xv-3.10a-bugfixes/xvml.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvml.c 2005-04-17 22:57:34.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/xvml.c xv-3.10a/xvml.c
+--- xv-3.10a.orig/xvml.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvml.c 2005-04-18 00:57:34.000000000 -0500
@@ -0,0 +1,989 @@
+/*
+ * xvml.c - makes text item structure for multi-lingual textviewer.
@@ -14976,9 +8377,9 @@ diff -ruN xv-3.10a-bugfixes/xvml.c xv-3.10a-enhancements/xvml.c
+}
+
+#endif /* TV_MULTILINGUAL */
-diff -ruN xv-3.10a-bugfixes/xvml.h xv-3.10a-enhancements/xvml.h
---- xv-3.10a-bugfixes/xvml.h 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvml.h 2005-04-17 22:57:45.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/xvml.h xv-3.10a/xvml.h
+--- xv-3.10a.orig/xvml.h 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvml.h 2005-04-18 00:57:45.000000000 -0500
@@ -0,0 +1,96 @@
+#ifndef MLVIEW_H
+#define MLVIEW_H
@@ -15076,346 +8477,10 @@ diff -ruN xv-3.10a-bugfixes/xvml.h xv-3.10a-enhancements/xvml.h
+struct design lookup_design PARM((char *, int));
+
+#endif
-diff -ruN xv-3.10a-bugfixes/xvpbm.c xv-3.10a-enhancements/xvpbm.c
---- xv-3.10a-bugfixes/xvpbm.c 2005-04-03 14:25:28.000000000 -0700
-+++ xv-3.10a-enhancements/xvpbm.c 2005-04-17 14:04:22.000000000 -0700
-@@ -23,6 +23,15 @@
- */
-
-
-+typedef unsigned short ush;
-+typedef unsigned char uch;
-+
-+#define alpha_composite(composite, fg, alpha, bg) { \
-+ ush temp = ((ush)(fg)*(ush)(alpha) + \
-+ (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
-+ (composite) = (uch)((temp + (temp >> 8)) >> 8); \
-+}
-+
- #define TRUNCSTR "File appears to be truncated."
-
- static int garbage;
-@@ -31,6 +40,7 @@
- static int loadpbm PARM((FILE *, PICINFO *, int));
- static int loadpgm PARM((FILE *, PICINFO *, int, int));
- static int loadppm PARM((FILE *, PICINFO *, int, int));
-+static int loadpam PARM((FILE *, PICINFO *, int, int));
- static int getint PARM((FILE *, PICINFO *));
- static int getbit PARM((FILE *, PICINFO *));
- static int getshort PARM((FILE *));
-@@ -38,10 +48,83 @@
-
- static char *bname;
-
-+
-+#ifdef HAVE_MGCSFX
-+/*
-+ * When file read or file write is fail, probably it's caused by
-+ * reading from pipe which has no data yet, or writing to pipe
-+ * which is not ready yet.
-+ * Then we can use system call select() on descriptor of pipe and wait.
-+ * If you want, change 'undef' to 'define' in the following line.
-+ * This feature is performance-killer.
-+ */
-+#undef FIX_PIPE_ERROR
-+
-+#ifdef __osf__
-+# ifdef __alpha
-+# define FIX_PIPE_ERROR
-+# endif
-+#endif
-+
-+#endif /* HAVE_MGCSFX */
-+
-+
-+#ifdef FIX_PIPE_ERROR
-+
-+int pipefdr;
-+
-+struct timeval timeout;
-+int width;
-+fd_set fds;
-+
-+static void ready_read()
-+{
-+ if(pipefdr < 0) return; /* if file descriptor is not pipe, OK */
-+ WaitCursor();
-+
-+reselect:
-+ /* setting of timeout */
-+ timeout.tv_sec = 1; /* 1 sec */
-+ timeout.tv_usec = 0; /* 0 usec */
-+
-+ FD_ZERO(&fds); /* clear bits */
-+ FD_SET(pipefdr, &fds); /* set bit of fd in fds */
-+
-+ /* number of file descriptor to want check (0 $B!A(B width-1) */
-+ width = pipefdr + 1;
-+
-+ /* select returns number of file descriptors */
-+ if (select(width, &fds, NULL, NULL, &timeout) < 0){
-+ if(DEBUG){
-+ fprintf(stderr, "No file descriptors can't selected, waiting...\n");
-+ }
-+ goto reselect;
-+ }
-+
-+ if (FD_ISSET(pipefdr, &fds)){
-+ /* Now, descriptor of pipe is ready to read */
-+ return;
-+ }else{
-+ if(DEBUG){
-+ fprintf(stderr, "Can't read from pipe yet, waiting...\n");
-+ }
-+ goto reselect;
-+ }
-+
-+}
-+#endif /* FIX_PIPE_ERROR */
-+
- /*******************************************/
-+#ifdef HAVE_MGCSFX
-+int LoadPBM(fname, pinfo, fd)
-+ char *fname;
-+ PICINFO *pinfo;
-+ int fd;
-+#else
- int LoadPBM(fname, pinfo)
- char *fname;
- PICINFO *pinfo;
-+#endif /* HAVE_MGCSFX */
- /*******************************************/
- {
- /* returns '1' on success */
-@@ -50,6 +133,10 @@
- int c, c1;
- int maxv, rv;
-
-+#ifdef FIX_PIPE_ERROR
-+ pipefdr = fd;
-+#endif
-+
- garbage = maxv = rv = 0;
- bname = BaseName(fname);
-
-@@ -57,6 +144,22 @@
- pinfo->comment = (char *) NULL;
-
-
-+#ifdef HAVE_MGCSFX
-+ if(fd < 0){
-+ /* open the file */
-+ fp = xv_fopen(fname,"r");
-+ if (!fp) return (pbmError(bname, "can't open file"));
-+
-+ /* compute file length */
-+ fseek(fp, 0L, 2);
-+ filesize = ftell(fp);
-+ fseek(fp, 0L, 0);
-+ }else{
-+ fp = fdopen(fd, "r");
-+ if (!fp) return (pbmError(bname, "can't open file"));
-+ filesize = 0; /* dummy */
-+ }
-+#else
- /* open the file */
- fp = xv_fopen(fname,"r");
- if (!fp) return (pbmError(bname, "can't open file"));
-@@ -65,6 +168,7 @@
- fseek(fp, 0L, 2);
- filesize = ftell(fp);
- fseek(fp, 0L, 0);
-+#endif /* HAVE_MGCSFX */
-
-
- /* read the first two bytes of the file to determine which format
-@@ -73,7 +177,8 @@
- "P6" = raw pixmap */
-
- c = getc(fp); c1 = getc(fp);
-- if (c!='P' || c1<'1' || c1>'6') return(pbmError(bname, "unknown format"));
-+ if (c!='P' || c1<'1' || (c1>'6' && c1!='8')) /* GRR alpha */
-+ return(pbmError(bname, "unknown format"));
-
- /* read in header information */
- pinfo->w = getint(fp, pinfo); pinfo->h = getint(fp, pinfo);
-@@ -104,6 +209,7 @@
- if (c1=='1' || c1=='4') rv = loadpbm(fp, pinfo, c1=='4' ? 1 : 0);
- else if (c1=='2' || c1=='5') rv = loadpgm(fp, pinfo, c1=='5' ? 1 : 0, maxv);
- else if (c1=='3' || c1=='6') rv = loadppm(fp, pinfo, c1=='6' ? 1 : 0, maxv);
-+ else if (c1=='8') rv = loadpam(fp, pinfo, 1 , maxv);
-
- fclose(fp);
-
-@@ -248,7 +354,20 @@
- }
- }
- else {
-+#ifdef FIX_PIPE_ERROR
-+ reread:
-+ numgot += fread(pic8 + numgot, (size_t) 1, (size_t) w*h - numgot, fp); /* read raw data */
-+ if(errno == EINTR){
-+ if(DEBUG){
-+ fprintf(stderr,
-+ "Can't read all data from pipe, call select and waiting...\n");
-+ }
-+ ready_read();
-+ goto reread;
-+ }
-+#else
- numgot = fread(pic8, (size_t)1, (size_t)npixels, fp); /* read raw data */
-+#endif
- }
- }
-
-@@ -315,7 +434,20 @@
- }
- }
- else {
-+#ifdef FIX_PIPE_ERROR
-+ reread:
-+ numgot += fread(pic24 + numgot, (size_t) 1, (size_t) w*h*3 - numgot, fp); /* read data */
-+ if(errno == EINTR){
-+ if(DEBUG){
-+ fprintf(stderr,
-+ "Can't read all data from pipe, call select and waiting...\n");
-+ }
-+ ready_read();
-+ goto reread;
-+ }
-+#else
- numgot = fread(pic24, (size_t) 1, (size_t) bufsize, fp); /* read data */
-+#endif
- }
- }
-
-@@ -341,6 +473,122 @@
- }
-
-
-+/*******************************************/
-+static int loadpam(fp, pinfo, raw, maxv) /* unofficial RGBA extension */
-+ FILE *fp;
-+ PICINFO *pinfo;
-+ int raw, maxv;
-+{
-+ byte *p, *pix, *pic24, *linebuf, scale[256], bgR, bgG, bgB, r, g, b, a;
-+ int i, j, bitshift, w, h, npixels, bufsize, linebufsize, holdmaxv;
-+
-+ w = pinfo->w;
-+ h = pinfo->h;
-+
-+ npixels = w * h;
-+ bufsize = 3*npixels;
-+ linebufsize = 4*w;
-+ if (w <= 0 || h <= 0 || npixels/w != h || bufsize/3 != npixels ||
-+ linebufsize/4 != w)
-+ return pbmError(bname, "image dimensions too large");
-+
-+ /* allocate 24-bit image */
-+ pic24 = (byte *) calloc((size_t) bufsize, (size_t) 1);
-+ if (!pic24) FatalError("couldn't malloc 'pic24' for PAM");
-+
-+ /* allocate line buffer for pre-composited RGBA data */
-+ linebuf = (byte *) malloc((size_t) linebufsize);
-+ if (!linebuf) {
-+ free(pic24);
-+ FatalError("couldn't malloc 'linebuf' for PAM");
-+ }
-+
-+ pinfo->pic = pic24;
-+ pinfo->type = PIC24;
-+ sprintf(pinfo->fullInfo, "PAM, %s format. (%ld bytes)",
-+ (raw) ? "raw" : "ascii", filesize);
-+ sprintf(pinfo->shrtInfo, "%dx%d PAM.", w, h);
-+ pinfo->colType = F_FULLCOLOR;
-+
-+
-+ /* if maxv>255, keep dropping bits until it's reasonable */
-+ holdmaxv = maxv;
-+ bitshift = 0;
-+ while (maxv>255) { maxv = maxv>>1; bitshift++; }
-+
-+
-+ numgot = 0;
-+
-+ if (!raw) { /* GRR: not alpha-ready */
-+ return pbmError(bname, "can't handle non-raw PAM image");
-+/*
-+ for (i=0, pix=pic24; i<h; i++) {
-+ if ((i&0x3f)==0) WaitCursor();
-+ for (j=0; j<w*3; j++, pix++)
-+ *pix = (byte) (getint(fp, pinfo) >> bitshift);
-+ }
-+ */
-+ }
-+ else { /* raw */
-+ if (holdmaxv>255) { /* GRR: not alpha-ready */
-+ return pbmError(bname, "can't handle PAM image with maxval > 255");
-+/*
-+ for (i=0, pix=pic24; i<h; i++) {
-+ if ((i&0x3f)==0) WaitCursor();
-+ for (j=0; j<w*3; j++,pix++)
-+ *pix = (byte) (getshort(fp) >> bitshift);
-+ }
-+ */
-+ }
-+ else {
-+ if (have_imagebg) { /* GRR: alpha-ready */
-+ bgR = (imagebgR >> 8);
-+ bgG = (imagebgG >> 8);
-+ bgB = (imagebgB >> 8);
-+ } else {
-+ bgR = bgG = bgB = 0;
-+ }
-+ for (i=0, pix=pic24; i<h; i++) {
-+ numgot += fread(linebuf, (size_t) 1, (size_t) linebufsize, fp); /* read data */
-+ if ((i&0x3f)==0) WaitCursor();
-+ for (j=0, p=linebuf; j<w; j++) {
-+ r = *p++;
-+ g = *p++;
-+ b = *p++;
-+ a = *p++;
-+ alpha_composite(*pix++, r, a, bgR)
-+ alpha_composite(*pix++, g, a, bgG)
-+ alpha_composite(*pix++, b, a, bgB)
-+ }
-+ }
-+ }
-+ }
-+
-+ free(linebuf);
-+
-+ /* in principle this could overflow, but not critical */
-+ if (numgot != w*h*4) pbmError(bname, TRUNCSTR);
-+
-+ if (garbage)
-+ return(pbmError(bname, "Garbage characters in image data."));
-+
-+
-+ /* have to scale up all RGB values (Conv24to8 expects RGB values to
-+ range from 0-255) */
-+
-+ if (maxv<255) {
-+ for (i=0; i<=maxv; i++) scale[i] = (i * 255) / maxv;
-+
-+ for (i=0, pix=pic24; i<h; i++) {
-+ if ((i&0x3f)==0) WaitCursor();
-+ for (j=0; j<w*3; j++, pix++) *pix = scale[*pix];
-+ }
-+ }
-+
-+ return 1;
-+}
-+
-+
-
- /*******************************************/
- static int getint(fp, pinfo)
-diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
---- xv-3.10a-bugfixes/xvpcd.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvpcd.c 2005-04-26 00:25:13.000000000 -0700
-@@ -0,0 +1,1307 @@
+diff -u -r --new-file xv-3.10a.orig/xvpcd.c xv-3.10a/xvpcd.c
+--- xv-3.10a.orig/xvpcd.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvpcd.c 2007-05-13 20:02:13.000000000 -0500
+@@ -0,0 +1,1311 @@
+/*
+ * xvpcd.c - load routine for 'PhotoCD' format pictures
+ *
@@ -15444,11 +8509,15 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+ */
+
+#include "xv.h"
-+#include <memory.h>
+
+#ifdef HAVE_PCD
+
-+#define TRACE 0
++#include <memory.h>
++#ifndef alloca
++# include <alloca.h> /* "not in POSIX or SUSv3" according to Linux man page */
++#endif /* ...but required for Sun C compiler (alloca = macro) */
++
++#define TRACE 0
+#if TRACE
+# define trace(x) fprintf x
+#else
@@ -15464,7 +8533,7 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+
+#ifdef __STDC__
+static void magnify(int, int, int, int, int, byte *);
-+static int pcdError(char *, char *);
++static int pcdError(const char *, const char *);
+static int gethuffdata(byte *, byte *, byte *, int, int);
+#else
+static void magnify();
@@ -15472,12 +8541,12 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+static int gethuffdata();
+#endif
+
-+#define wcurfactor 16 /* Call WaitCursor() every n rows */
++#define wcurfactor 16 /* Call WaitCursor() every n rows */
+
-+static int size; /* Set by window routines */
-+static int leaveitup;/* Cleared by docmd() when OK or CANCEL pressed */
-+static int goforit; /* Set to 1 if OK or 0 if CANCEL */
-+static FILE *fp;
++static int size; /* Set by window routines */
++static int leaveitup;/* Cleared by docmd() when OK or CANCEL pressed */
++static int goforit; /* Set to 1 if OK or 0 if CANCEL */
++static FILE *fp;
+static CBUTT lutCB;
+
+/*
@@ -15485,47 +8554,47 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+ * Why there are 351 entries and not 346 as per Kodak documentation
+ * is a mystery.
+ */
-+static double rscale = 1.00,
-+ gscale = 1.00,
-+ bscale = 1.00;
-+
-+static byte Y[351] = {
-+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
-+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
-+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
-+ 30, 32, 33, 34, 35, 36, 37, 38, 39, 40,
-+ 41, 42, 43, 45, 46, 47, 48, 49, 50, 51,
-+ 52, 53, 54, 56, 57, 58, 59, 60, 61, 62,
-+ 63, 64, 66, 67, 68, 69, 70, 71, 72, 73,
-+ 74, 76, 77, 78, 79, 80, 81, 82, 83, 84,
-+ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
-+ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
-+ 107, 108, 110, 111, 112, 113, 114, 115, 116, 117,
-+ 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
-+ 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
-+ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
-+ 149, 150, 151, 152, 153, 154, 155, 156, 157, 158,
-+ 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
-+ 169, 170, 171, 172, 173, 174, 175, 176, 176, 177,
-+ 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
-+ 188, 189, 190, 191, 192, 193, 193, 194, 195, 196,
-+ 197, 198, 199, 200, 201, 201, 202, 203, 204, 205,
-+ 206, 207, 207, 208, 209, 210, 211, 211, 212, 213,
-+ 214, 215, 215, 216, 217, 218, 218, 219, 220, 221,
-+ 221, 222, 223, 224, 224, 225, 226, 226, 227, 228,
-+ 228, 229, 230, 230, 231, 232, 232, 233, 234, 234,
-+ 235, 236, 236, 237, 237, 238, 238, 239, 240, 240,
-+ 241, 241, 242, 242, 243, 243, 244, 244, 245, 245,
-+ 245, 246, 246, 247, 247, 247, 248, 248, 248, 249,
-+ 249, 249, 249, 250, 250, 250, 250, 251, 251, 251,
-+ 251, 251, 252, 252, 252, 252, 252, 253, 253, 253,
-+ 253, 253, 253, 253, 253, 253, 253, 253, 253, 253,
-+ 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-+ 254, 254, 254, 254, 254, 254, 254, 254, 254, 255,
-+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
-+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
-+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
-+ 255
++static double rscale = 1.00,
++ gscale = 1.00,
++ bscale = 1.00;
++
++static byte Y[351] = {
++ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
++ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
++ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
++ 30, 32, 33, 34, 35, 36, 37, 38, 39, 40,
++ 41, 42, 43, 45, 46, 47, 48, 49, 50, 51,
++ 52, 53, 54, 56, 57, 58, 59, 60, 61, 62,
++ 63, 64, 66, 67, 68, 69, 70, 71, 72, 73,
++ 74, 76, 77, 78, 79, 80, 81, 82, 83, 84,
++ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
++ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
++ 107, 108, 110, 111, 112, 113, 114, 115, 116, 117,
++ 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
++ 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
++ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
++ 149, 150, 151, 152, 153, 154, 155, 156, 157, 158,
++ 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
++ 169, 170, 171, 172, 173, 174, 175, 176, 176, 177,
++ 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
++ 188, 189, 190, 191, 192, 193, 193, 194, 195, 196,
++ 197, 198, 199, 200, 201, 201, 202, 203, 204, 205,
++ 206, 207, 207, 208, 209, 210, 211, 211, 212, 213,
++ 214, 215, 215, 216, 217, 218, 218, 219, 220, 221,
++ 221, 222, 223, 224, 224, 225, 226, 226, 227, 228,
++ 228, 229, 230, 230, 231, 232, 232, 233, 234, 234,
++ 235, 236, 236, 237, 237, 238, 238, 239, 240, 240,
++ 241, 241, 242, 242, 243, 243, 244, 244, 245, 245,
++ 245, 246, 246, 247, 247, 247, 248, 248, 248, 249,
++ 249, 249, 249, 250, 250, 250, 250, 251, 251, 251,
++ 251, 251, 252, 252, 252, 252, 252, 253, 253, 253,
++ 253, 253, 253, 253, 253, 253, 253, 253, 253, 253,
++ 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
++ 254, 254, 254, 254, 254, 254, 254, 254, 254, 255,
++ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
++ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
++ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
++ 255
+};
+
+/*******************************************/
@@ -15537,128 +8606,128 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+{
+ long offset;
+ int mag;
-+ int rotate;
-+ byte header[3*0x800];
-+ byte *pic24, *luma, *chroma1, *chroma2, *ptr, *lptr, *c1ptr, *c2ptr;
++ int rotate;
++ byte header[3*0x800];
++ byte *pic24, *luma, *chroma1, *chroma2, *ptr, *lptr, *c1ptr, *c2ptr;
+ int w, h, npixels, bufsize;
+ int row, col;
-+ int huffplanes;
-+ char *bname;
++ int huffplanes;
++ const char *bname;
+
-+ bname = BaseName(fname);
-+ pinfo->pic = NULL;
-+ pinfo->comment = NULL;
++ bname = BaseName(fname);
++ pinfo->pic = NULL;
++ pinfo->comment = NULL;
+
+
-+ /*
-+ * open the file
-+ */
-+ if((fp=fopen(fname,"r")) == NULL)
-+ return pcdError(bname, "can't open file");
++ /*
++ * open the file
++ */
++ if((fp=fopen(fname,"r")) == NULL)
++ return pcdError(bname, "can't open file");
+
-+ /*
-+ * inspect the header
-+ */
-+ if(fread(&header[0], 1, sizeof(header), fp) != sizeof(header))
-+ return pcdError(bname, "could not load PCD header");
-+ if(strncmp(&header[0x800], "PCD_", 4) != 0)
-+ return pcdError(bname, "not a PCD file");
-+ rotate = header[0x0E02] & 0x03;
++ /*
++ * inspect the header
++ */
++ if(fread(&header[0], 1, sizeof(header), fp) != sizeof(header))
++ return pcdError(bname, "could not load PCD header");
++ if(strncmp((char *)&header[0x800], "PCD_", 4) != 0)
++ return pcdError(bname, "not a PCD file");
++ rotate = header[0x0E02] & 0x03;
+
+/* base/16
-+ - plain data starts at sector 1+2+1=4
-+ (numbered from 0, ie. the 5th sector)
-+ - luma 192*128 = 24576 bytes (12 sectors)
-+ + chroma1 96*64 = 6144 bytes (3 sectors)
-+ + chroma2 96*64 = 6144 bytes (3 sectors)
-+ = total 18 sectors
++ - plain data starts at sector 1+2+1=4
++ (numbered from 0, ie. the 5th sector)
++ - luma 192*128 = 24576 bytes (12 sectors)
++ + chroma1 96*64 = 6144 bytes (3 sectors)
++ + chroma2 96*64 = 6144 bytes (3 sectors)
++ = total 18 sectors
+
-+ - NB. "Plain" data is interleaved - 2 luma rows 192 wide,
-+ then 1 of each of the chroma rows 96 wide !
++ - NB. "Plain" data is interleaved - 2 luma rows 192 wide,
++ then 1 of each of the chroma rows 96 wide !
+
+ base/4
-+ - plain data starts at sector 1+2+1+18+1=23
-+ - luma 384*256 = 98304 bytes (48 sectors)
-+ + chroma1 192*128 = 24576 bytes (12 sectors)
-+ + chroma2 192*128 = 24576 bytes (12 sectors)
-+ = total 72 sectors
++ - plain data starts at sector 1+2+1+18+1=23
++ - luma 384*256 = 98304 bytes (48 sectors)
++ + chroma1 192*128 = 24576 bytes (12 sectors)
++ + chroma2 192*128 = 24576 bytes (12 sectors)
++ = total 72 sectors
+
-+ - NB. "Plain" data is interleaved - 2 luma rows 384 wide,
-+ then 1 of each of the chroma rows 192 wide !
++ - NB. "Plain" data is interleaved - 2 luma rows 384 wide,
++ then 1 of each of the chroma rows 192 wide !
+
+ base
-+ - plain data starts at sector 1+2+1+18+1+72+1=96
++ - plain data starts at sector 1+2+1+18+1+72+1=96
+
-+ - luma 768*512 = 393216 bytes (192 sectors)
-+ + chroma1 384*256 = 98304 bytes (48 sectors)
-+ + chroma2 384*256 = 98304 bytes (48 sectors)
-+ = total 288 sectors
++ - luma 768*512 = 393216 bytes (192 sectors)
++ + chroma1 384*256 = 98304 bytes (48 sectors)
++ + chroma2 384*256 = 98304 bytes (48 sectors)
++ = total 288 sectors
+
-+ - NB. "Plain" data is interleaved - 2 luma rows 768 wide,
-+ then 1 of each of the chroma rows 384 wide !
++ - NB. "Plain" data is interleaved - 2 luma rows 768 wide,
++ then 1 of each of the chroma rows 384 wide !
+
+ 4base
-+ - plain data for base is read
-+ - luma data interpolated *2
-+ - chroma data interpolated *4
++ - plain data for base is read
++ - luma data interpolated *2
++ - chroma data interpolated *4
+
-+ - cd_offset is 1+2+1+18+1+72+1+288=384
-+ - at cd_offset+4 (388) is huffman table
-+ - at cd_offset+5 (389) is 4base luma plane
++ - cd_offset is 1+2+1+18+1+72+1+288=384
++ - at cd_offset+4 (388) is huffman table
++ - at cd_offset+5 (389) is 4base luma plane
+
-+ (the sector at cd_offset+3 seems to contain 256 words each of
-+ which is an offset presumably to the sector containing certain
-+ rows ? rows/4 given 1024 possible rows. The rest of this sector
-+ is filled with zeroes)
++ (the sector at cd_offset+3 seems to contain 256 words each of
++ which is an offset presumably to the sector containing certain
++ rows ? rows/4 given 1024 possible rows. The rest of this sector
++ is filled with zeroes)
+
+
+ 16base
-+ - plain data for base is read
-+ - luma data interpolated *2
-+ - chroma data interpolated *4
-+
-+ - cd_offset is 1+2+1+18+1+72+1+288=384
-+ - at cd_offset+4 (388) is huffman table for 4 base
-+ - at cd_offset+5 (389) is 4base luma plane
-+ - luma plane interpolated *2
-+
-+ - cd_offset is set to current position (should be start of sector)
-+ - at cd_offset+12 is huffman table for 16 base
-+ - at cd_offset+14 is 16 base luma & 2 chroma planes which are read
++ - plain data for base is read
++ - luma data interpolated *2
++ - chroma data interpolated *4
++
++ - cd_offset is 1+2+1+18+1+72+1+288=384
++ - at cd_offset+4 (388) is huffman table for 4 base
++ - at cd_offset+5 (389) is 4base luma plane
++ - luma plane interpolated *2
++
++ - cd_offset is set to current position (should be start of sector)
++ - at cd_offset+12 is huffman table for 16 base
++ - at cd_offset+14 is 16 base luma & 2 chroma planes which are read
+ (note that the luma plane comes first, with a sync pattern
+ announcing each row from 0 to 2047, then the two chroma planes
+ are interleaved by row, the row # being even from 0 to 2046, with
+ each row containing 1536 values, the chroma1 row coming first,
+ finally followed by a sync pattern with a row of 2048 announcing
+ the end (its plane seems to be set to 3, ie. chroma2)
-+ - chroma planes interpolated *2
++ - chroma planes interpolated *2
+
-+ (the sector at cd_offset+10 & 11 seem to contain 1024 pairs of words
++ (the sector at cd_offset+10 & 11 seem to contain 1024 pairs of words
+ the first for luma and the second for chroma, each of
-+ which is an offset presumably to the sector containing certain
-+ rows ? rows/2 given 2048 possible rows)
++ which is an offset presumably to the sector containing certain
++ rows ? rows/2 given 2048 possible rows)
+
+Not yet implemented:
+
+In order to do overskip for base and 4base, one has to reach the chroma
+data for 16 base:
+
-+ - for 4base, after reading the 4base luma plane (and presumably
-+ skipping the chroma planes) one sets cd_offset to the start of
-+ the "current" sector
++ - for 4base, after reading the 4base luma plane (and presumably
++ skipping the chroma planes) one sets cd_offset to the start of
++ the "current" sector
+
-+ - for base, one has to skip the 4base data first:
-+ - cd_offset is set to 384
-+ - at (cd_offset+3 sectors)[510] is a 16 bit word high byte 1st
-+ containing an offset to the beginning of the 16base stuff
-+ though there is then a loop until >30 0xff's start a sector !
++ - for base, one has to skip the 4base data first:
++ - cd_offset is set to 384
++ - at (cd_offset+3 sectors)[510] is a 16 bit word high byte 1st
++ containing an offset to the beginning of the 16base stuff
++ though there is then a loop until >30 0xff's start a sector !
+
-+ - being now positioned after the end of the 4base stuff,
-+ - at (cd_offset+10 sectors)[2] is a 16 bit word high byte 1st
-+ containing an offset to the chroma planes.
-+ - at cd_offset+12 is the set of huffman tables
++ - being now positioned after the end of the 4base stuff,
++ - at (cd_offset+10 sectors)[2] is a 16 bit word high byte 1st
++ containing an offset to the chroma planes.
++ - at cd_offset+12 is the set of huffman tables
+
-+ - for base, the 16base chroma planes are then halved
++ - for base, the 16base chroma planes are then halved
+*/
+
+ PCDSetParamOptions(bname);
@@ -15668,7 +8737,7 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+ SetCursors(-1); /* Somebody has already set it to wait :( */
+ leaveitup=1;
+ goforit=0;
-+ size = 1;
++ size = 1;
+ /* block until the popup window gets closed */
+ while (leaveitup) {
+ int i;
@@ -15689,268 +8758,268 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+ goforit = 1;
+ }
+
-+ if(lutCB.val)
-+ rscale = gscale = bscale = 255.0/346.0;
-+ else
-+ rscale = gscale = bscale = 1.0;
++ if(lutCB.val)
++ rscale = gscale = bscale = 255.0/346.0;
++ else
++ rscale = gscale = bscale = 1.0;
++
++ switch (size) {
++ case 0:
++ pinfo->w = 192;
++ pinfo->h = 128;
++ offset=4*0x800;
++ mag=1;
++ huffplanes=0;
++ sprintf(pinfo->fullInfo, "PhotoCD, base/16 resolution");
++ break;
+
-+ switch (size) {
-+ case 0:
-+ pinfo->w = 192;
-+ pinfo->h = 128;
-+ offset=4*0x800;
-+ mag=1;
-+ huffplanes=0;
-+ sprintf(pinfo->fullInfo, "PhotoCD, base/16 resolution");
-+ break;
++ case 1:
++ pinfo->w = 384;
++ pinfo->h = 256;
++ offset=23*0x800;
++ mag=1;
++ huffplanes=0;
++ sprintf(pinfo->fullInfo, "PhotoCD, base/4 resolution");
++ break;
+
-+ case 1:
-+ pinfo->w = 384;
-+ pinfo->h = 256;
-+ offset=23*0x800;
-+ mag=1;
-+ huffplanes=0;
-+ sprintf(pinfo->fullInfo, "PhotoCD, base/4 resolution");
-+ break;
++ case 2:
++ default:
++ pinfo->w = 768;
++ pinfo->h = 512;
++ offset=96*0x800;
++ mag=1;
++ huffplanes=0;
++ sprintf(pinfo->fullInfo, "PhotoCD, base resolution");
++ break;
+
-+ case 2:
-+ default:
-+ pinfo->w = 768;
-+ pinfo->h = 512;
-+ offset=96*0x800;
-+ mag=1;
-+ huffplanes=0;
-+ sprintf(pinfo->fullInfo, "PhotoCD, base resolution");
-+ break;
++ case 3:
++ pinfo->w = 1536;
++ pinfo->h = 1024;
++ offset=96*0x800;
++ mag=2;
++ huffplanes=1;
++ sprintf(pinfo->fullInfo, "PhotoCD, 4base resolution");
++ break;
+
-+ case 3:
-+ pinfo->w = 1536;
-+ pinfo->h = 1024;
-+ offset=96*0x800;
-+ mag=2;
-+ huffplanes=1;
-+ sprintf(pinfo->fullInfo, "PhotoCD, 4base resolution");
-+ break;
++ case 4:
++ pinfo->w=3072;
++ pinfo->h=2048;
++ offset=96*0x800;
++ mag=4;
++ huffplanes=2;
++ sprintf(pinfo->fullInfo, "PhotoCD, 16base resolution");
++ break;
++ }
+
-+ case 4:
-+ pinfo->w=3072;
-+ pinfo->h=2048;
-+ offset=96*0x800;
-+ mag=4;
-+ huffplanes=2;
-+ sprintf(pinfo->fullInfo, "PhotoCD, 16base resolution");
-+ break;
-+ }
++ /*
++ * rotate?
++ */
++ w = pinfo->w;
++ h = pinfo->h;
++ switch(rotate) {
++ case 0:
++ break;
+
-+ /*
-+ * rotate?
-+ */
-+ w = pinfo->w;
-+ h = pinfo->h;
-+ switch(rotate) {
-+ case 0:
-+ break;
++ case 1:
++ case 3:
++ pinfo->w = h;
++ pinfo->h = w;
++ break;
+
-+ case 1:
-+ case 3:
-+ pinfo->w = h;
-+ pinfo->h = w;
-+ break;
++ default:
++ fprintf(stderr, "unknown image rotate %d; assuming none\n",
++ rotate);
++ rotate = 0;
++ }
+
-+ default:
-+ fprintf(stderr, "unknown image rotate %d; assuming none\n",
-+ rotate);
-+ rotate = 0;
-+ }
++ /*
++ * allocate 24-bit image
++ */
++ npixels = pinfo->w * pinfo->h;
++ bufsize = 3 * npixels;
++ if (pinfo->w <= 0 || pinfo->h <= 0 || npixels/pinfo->w != pinfo->h ||
++ bufsize/3 != npixels)
++ FatalError("image dimensions out of range");
+
-+ /*
-+ * allocate 24-bit image
-+ */
-+ npixels = pinfo->w * pinfo->h;
-+ bufsize = 3 * npixels;
-+ if (pinfo->w <= 0 || pinfo->h <= 0 || npixels/pinfo->w != pinfo->h ||
-+ bufsize/3 != npixels)
-+ FatalError("image dimensions out of range");
++ pinfo->pic = (byte *)malloc((size_t) bufsize);
++ if(!pinfo->pic)
++ FatalError("couldn't malloc '24-bit RGB plane'");
+
-+ pinfo->pic = (byte *)malloc((size_t) bufsize);
-+ if(!pinfo->pic)
-+ FatalError("couldn't malloc '24-bit RGB plane'");
++ pinfo->type = PIC24;
++ sprintf(pinfo->shrtInfo, "%dx%d PhotoCD.", pinfo->w, pinfo->h);
++ pinfo->colType = F_FULLCOLOR;
++ pinfo->frmType = -1;
+
-+ pinfo->type = PIC24;
-+ sprintf(pinfo->shrtInfo, "%dx%d PhotoCD.", pinfo->w, pinfo->h);
-+ pinfo->colType = F_FULLCOLOR;
-+ pinfo->frmType = -1;
++ if(fseek(fp, offset, SEEK_SET) == -1) {
++ free(pinfo->pic);
++ return pcdError(bname,"Can't find start of data.");
++ }
+
-+ if(fseek(fp, offset, SEEK_SET) == -1) {
-+ free(pinfo->pic);
-+ return pcdError(bname,"Can't find start of data.");
-+ }
++ pic24 = pinfo->pic;
+
-+ pic24 = pinfo->pic;
++ luma=(byte *)calloc(npixels,1);
++ if(!luma) {
++ free(pinfo->pic);
++ FatalError("couldn't malloc 'luma plane'");
++ }
+
-+ luma=(byte *)calloc(npixels,1);
-+ if(!luma) {
-+ free(pinfo->pic);
-+ FatalError("couldn't malloc 'luma plane'");
-+ }
++ chroma1=(byte *)calloc(npixels/4,1);
++ if(!chroma1) {
++ free(pinfo->pic);
++ free(luma);
++ FatalError("couldn't malloc 'chroma1 plane'");
++ }
+
-+ chroma1=(byte *)calloc(npixels/4,1);
-+ if(!chroma1) {
-+ free(pinfo->pic);
-+ free(luma);
-+ FatalError("couldn't malloc 'chroma1 plane'");
-+ }
++ chroma2=(byte *)calloc(npixels/4,1);
++ if(!chroma2) {
++ free(pinfo->pic);
++ free(luma);
++ free(chroma1);
++ FatalError("couldn't malloc 'chroma2 plane'");
++ }
+
-+ chroma2=(byte *)calloc(npixels/4,1);
-+ if(!chroma2) {
-+ free(pinfo->pic);
-+ free(luma);
-+ free(chroma1);
-+ FatalError("couldn't malloc 'chroma2 plane'");
-+ }
++ /* Read 2 luma rows length w, then one of each chroma rows w/2 */
++ /* If a mag factor is active, the small image is read into the */
++ /* top right hand corner of the larger allocated image */
+
-+ /* Read 2 luma rows length w, then one of each chroma rows w/2 */
-+ /* If a mag factor is active, the small image is read into the */
-+ /* top right hand corner of the larger allocated image */
++ trace((stderr, "base image: start @ 0x%08lx (sector %ld.%ld)\n",
++ ftell(fp), ftell(fp)/0x800, ftell(fp) % 0x800));
++ for(row=0,lptr=luma,c1ptr=chroma1,c2ptr=chroma2; row <h/mag;
++ row+=2,lptr+=w*2,c1ptr+=w/2,c2ptr+=w/2) {
++ if(fread(lptr, 1, w/mag, fp) != w/mag) {
++ pcdError(bname, "Luma plane too short.");
++ break;
++ }
++ if(fread(lptr+w, 1, w/mag, fp) != w/mag) {
++ pcdError(bname, "Luma plane too short.");
++ break;
++ }
++ if(fread(c1ptr, 1, w/2/mag, fp) != w/2/mag) {
++ pcdError(bname, "Chroma1 plane too short.");
++ break;
++ }
++ if(fread(c2ptr, 1, w/2/mag, fp) != w/2/mag) {
++ pcdError(bname, "Chroma2 plane too short.");
++ break;
++ }
++ if(row%wcurfactor == 0)
++ WaitCursor();
++ }
++ trace((stderr, "base image: done @ 0x%08lx (sector %ld.%ld)\n",
++ ftell(fp), ftell(fp)/0x800, ftell(fp) % 0x800));
+
-+ trace((stderr, "base image: start @ 0x%08lx (sector %ld.%ld)\n",
-+ ftell(fp), ftell(fp)/0x800, ftell(fp) % 0x800));
-+ for(row=0,lptr=luma,c1ptr=chroma1,c2ptr=chroma2; row <h/mag;
-+ row+=2,lptr+=w*2,c1ptr+=w/2,c2ptr+=w/2) {
-+ if(fread(lptr, 1, w/mag, fp) != w/mag) {
-+ pcdError(bname, "Luma plane too short.");
-+ break;
-+ }
-+ if(fread(lptr+w, 1, w/mag, fp) != w/mag) {
-+ pcdError(bname, "Luma plane too short.");
-+ break;
-+ }
-+ if(fread(c1ptr, 1, w/2/mag, fp) != w/2/mag) {
-+ pcdError(bname, "Chroma1 plane too short.");
-+ break;
-+ }
-+ if(fread(c2ptr, 1, w/2/mag, fp) != w/2/mag) {
-+ pcdError(bname, "Chroma2 plane too short.");
-+ break;
-+ }
-+ if(row%wcurfactor == 0)
-+ WaitCursor();
-+ }
-+ trace((stderr, "base image: done @ 0x%08lx (sector %ld.%ld)\n",
-+ ftell(fp), ftell(fp)/0x800, ftell(fp) % 0x800));
-+
-+ if(huffplanes) {
-+ if(fseek(fp, 388*0x800, SEEK_SET) == -1)
-+ return pcdError(bname,
-+ "Can't find start of huffman tables.");
-+
-+ magnify(2, h/mag, w/mag, h, w, luma);
-+ magnify(2, h/2/mag, w/2/mag, h/2, w/2, chroma1);
-+ magnify(2, h/2/mag, w/2/mag, h/2, w/2, chroma2);
-+
-+ /*
-+ * doesn't really touch the chroma planes which aren't
-+ * present in 4base
-+ */
-+ gethuffdata(luma, chroma1, chroma2, w, h/mag*2);
-+
-+ /*
-+ * if only doing 4base should probably fetch 16bases
-+ * chroma planes here
-+ */
-+ if(huffplanes == 2) {
-+ /*
-+ * This depends on gethuffdata() having grabbed
-+ * things in 0x800 sectors AND still being
-+ * positioned in the "last" sector of the data
-+ * (cf. Hadmut's code which is positioned at start
-+ * of the next sector)
-+ */
-+ long offset = ftell(fp)/0x800+12;
-+
-+ if(fseek(fp, offset*0x800, SEEK_SET) == 0) {
-+ magnify(2,h/2,w/2,h,w,luma);
-+ magnify(2,h/4,w/4,h/2,w/2,chroma1);
-+ magnify(2,h/4,w/4,h/2,w/2,chroma2);
-+ gethuffdata(luma,chroma1,chroma2,w,h);
-+ } else
-+ fprintf(stderr, "can't seek to 2nd huffman tables\n");
-+ }
-+ }
-+ fclose(fp);
++ if(huffplanes) {
++ if(fseek(fp, 388*0x800, SEEK_SET) == -1)
++ return pcdError(bname,
++ "Can't find start of huffman tables.");
+
-+ /*
-+ * YCC -> R'G'B' and image rotate
-+ */
-+ ptr=pic24;
-+ lptr=luma; c1ptr=chroma1; c2ptr=chroma2;
-+ for(row = 0; row < h; ++row) {
-+ byte *rowc1ptr = c1ptr,
-+ *rowc2ptr = c2ptr;
-+ int k = 0;
-+
-+ switch(rotate) {
-+ case 1:
-+ ptr = &pic24[row*3 + (w - 1)*h*3];
-+ k = -3*(h + 1);
-+ break;
++ magnify(2, h/mag, w/mag, h, w, luma);
++ magnify(2, h/2/mag, w/2/mag, h/2, w/2, chroma1);
++ magnify(2, h/2/mag, w/2/mag, h/2, w/2, chroma2);
+
-+ case 3:
-+ ptr = &pic24[(h - 1 - row)*3];
-+ k = 3*(h - 1);
-+ break;
++ /*
++ * doesn't really touch the chroma planes which aren't
++ * present in 4base
++ */
++ gethuffdata(luma, chroma1, chroma2, w, h/mag*2);
+
-+ default:
-+ ptr = &pic24[row*w*3];
-+ k = 0;
-+ break;
-+ }
-+ for(col = 0; col < w; ++col) {
-+ double L = 1.3584*(double) *lptr++,
-+ C1 = 2.2179*(double) (*c1ptr - 156),
-+ C2 = 1.8215*(double) (*c2ptr - 137);
-+ int r = rscale*(L + C2),
-+ g = gscale*(L - 0.194*C1 - 0.509*C2),
-+ b = bscale*(L + C1);
-+
-+ if(lutCB.val) {
-+ if(r < 0) r = 0; else if(r >= 255) r = 255;
-+ if(g < 0) g = 0; else if(g >= 255) g = 255;
-+ if(b < 0) b = 0; else if(b >= 255) b = 255;
-+ } else {
-+ if(r < 0) r = 0; else if(r >= 351) r = 350;
-+ if(g < 0) g = 0; else if(g >= 351) g = 350;
-+ if(b < 0) b = 0; else if(b >= 351) b = 350;
-+ r = Y[r]; g = Y[g]; b = Y[b];
-+ }
-+ *ptr++ = r;
-+ *ptr++ = g;
-+ *ptr++ = b;
-+ ptr += k;
-+ if(col & 1) {
-+ ++c1ptr;
-+ ++c2ptr;
-+ }
-+ }
-+ if((row & 1) == 0) {
-+ c1ptr = rowc1ptr;
-+ c2ptr = rowc2ptr;
-+ }
-+ if(row%wcurfactor == 0)
-+ WaitCursor();
-+ }
-+ free(luma); free(chroma1); free(chroma2);
-+ return 1;
++ /*
++ * if only doing 4base should probably fetch 16bases
++ * chroma planes here
++ */
++ if(huffplanes == 2) {
++ /*
++ * This depends on gethuffdata() having grabbed
++ * things in 0x800 sectors AND still being
++ * positioned in the "last" sector of the data
++ * (cf. Hadmut's code which is positioned at start
++ * of the next sector)
++ */
++ long offset = ftell(fp)/0x800+12;
++
++ if(fseek(fp, offset*0x800, SEEK_SET) == 0) {
++ magnify(2,h/2,w/2,h,w,luma);
++ magnify(2,h/4,w/4,h/2,w/2,chroma1);
++ magnify(2,h/4,w/4,h/2,w/2,chroma2);
++ gethuffdata(luma,chroma1,chroma2,w,h);
++ } else
++ fprintf(stderr, "can't seek to 2nd huffman tables\n");
++ }
++ }
++ fclose(fp);
++
++ /*
++ * YCC -> R'G'B' and image rotate
++ */
++ ptr=pic24;
++ lptr=luma; c1ptr=chroma1; c2ptr=chroma2;
++ for(row = 0; row < h; ++row) {
++ byte *rowc1ptr = c1ptr,
++ *rowc2ptr = c2ptr;
++ int k = 0;
++
++ switch(rotate) {
++ case 1:
++ ptr = &pic24[row*3 + (w - 1)*h*3];
++ k = -3*(h + 1);
++ break;
++
++ case 3:
++ ptr = &pic24[(h - 1 - row)*3];
++ k = 3*(h - 1);
++ break;
++
++ default:
++ ptr = &pic24[row*w*3];
++ k = 0;
++ break;
++ }
++ for(col = 0; col < w; ++col) {
++ double L = 1.3584*(double) *lptr++,
++ C1 = 2.2179*(double) (*c1ptr - 156),
++ C2 = 1.8215*(double) (*c2ptr - 137);
++ int r = rscale*(L + C2),
++ g = gscale*(L - 0.194*C1 - 0.509*C2),
++ b = bscale*(L + C1);
++
++ if(lutCB.val) {
++ if(r < 0) r = 0; else if(r >= 255) r = 255;
++ if(g < 0) g = 0; else if(g >= 255) g = 255;
++ if(b < 0) b = 0; else if(b >= 255) b = 255;
++ } else {
++ if(r < 0) r = 0; else if(r >= 351) r = 350;
++ if(g < 0) g = 0; else if(g >= 351) g = 350;
++ if(b < 0) b = 0; else if(b >= 351) b = 350;
++ r = Y[r]; g = Y[g]; b = Y[b];
++ }
++ *ptr++ = r;
++ *ptr++ = g;
++ *ptr++ = b;
++ ptr += k;
++ if(col & 1) {
++ ++c1ptr;
++ ++c2ptr;
++ }
++ }
++ if((row & 1) == 0) {
++ c1ptr = rowc1ptr;
++ c2ptr = rowc2ptr;
++ }
++ if(row%wcurfactor == 0)
++ WaitCursor();
++ }
++ free(luma); free(chroma1); free(chroma2);
++ return 1;
+}
+
+/*
+ * derived from Hadmut Danisch's interpolate()
+ */
+static void
-+magnify(int mag, /* power of 2 by which to magnify in place */
-+ int h, int w, /* the "start" unmag'd dimensions of the array */
-+ int mh, int mw, /* the real (maximum) dimensions of the array */
-+ byte *p) /* pointer to the data */
++magnify(int mag, /* power of 2 by which to magnify in place */
++ int h, int w, /* the "start" unmag'd dimensions of the array */
++ int mh, int mw, /* the real (maximum) dimensions of the array */
++ byte *p) /* pointer to the data */
+{
+ int x,y,yi;
+ byte *optr,*nptr,*uptr; /* MUST be unsigned, else averaging fails */
@@ -15964,7 +9033,7 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+
+ for(y=0;y<h;y++) {
+ yi=h-1-y;
-+ optr=p+ yi*mw + (w-1); /* last pixel of an old row */
++ optr=p+ yi*mw + (w-1); /* last pixel of an old row */
+ nptr=p+2*yi*mw + (2*w - 2); /* last pixel of a new row */
+
+ nptr[0]=nptr[1]=optr[0]; /* special cases */
@@ -16000,18 +9069,18 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+ ((int)*(uptr++))+1)>>1; /* last pixel */
+ }
+
-+ xvbcopy(p + (2*h-2)*mw, /* 2nd last row */
-+ p + (2*h-1)*mw, /* the last row */
-+ 2*w); /* length of a new row */
++ xvbcopy((char *)(p + (2*h-2)*mw), /* 2nd last row */
++ (char *)(p + (2*h-1)*mw), /* the last row */
++ 2*w); /* length of a new row */
+
+ h*=2; w*=2;
-+ mag>>=1; /* Obviously mag must be a power of 2 ! */
++ mag>>=1; /* Obviously mag must be a power of 2 ! */
+ }
+}
+
+/*******************************************/
+static int
-+pcdError(char *fname, char *st)
++pcdError(const char *fname, const char *st)
+{
+ SetISTR(ISTR_WARNING,"%s: %s", fname, st);
+ return 0;
@@ -16041,19 +9110,19 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+/***************************************************/
+void CreatePCDW()
+{
-+ int y;
++ int y;
+
+ pcdW = CreateWindow("xv pcd", "XVpcd", NULL,
-+ TWIDE, THIGH, infofg, infobg, 0);
++ TWIDE, THIGH, infofg, infobg, 0);
+ if (!pcdW) FatalError("can't create pcd window!");
+
+ XSelectInput(theDisp, pcdW, ExposureMask | ButtonPressMask | KeyPressMask);
+
+ BTCreate(&tbut[T_BOK], pcdW, TWIDE-140-1, THIGH-10-BUTTH-1, 60, BUTTH,
-+ "Ok", infofg, infobg, hicol, locol);
++ "Ok", infofg, infobg, hicol, locol);
+
+ BTCreate(&tbut[T_BCANC], pcdW, TWIDE-70-1, THIGH-10-BUTTH-1, 60, BUTTH,
-+ "Cancel", infofg, infobg, hicol, locol);
++ "Cancel", infofg, infobg, hicol, locol);
+
+ y = 55;
+ resnRB = RBCreate(NULL, pcdW, 36, y, "192*128 Base/16",
@@ -16082,7 +9151,7 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+{
+ if (vis) {
+ CenterMapWindow(pcdW, tbut[T_BOK].x + tbut[T_BOK].w/2,
-+ tbut[T_BOK].y + tbut[T_BOK].h/2, TWIDE, THIGH);
++ tbut[T_BOK].y + tbut[T_BOK].h/2, TWIDE, THIGH);
+ }
+ else XUnmapWindow(theDisp, pcdW);
+ pcdUp = vis;
@@ -16135,12 +9204,12 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+
+ if (e->window == pcdW) {
+ if (stlen) {
-+ if (buf[0] == '\r' || buf[0] == '\n') { /* enter */
-+ FakeButtonPress(&tbut[T_BOK]);
-+ }
-+ else if (buf[0] == '\033') { /* ESC */
-+ FakeButtonPress(&tbut[T_BCANC]);
-+ }
++ if (buf[0] == '\r' || buf[0] == '\n') { /* enter */
++ FakeButtonPress(&tbut[T_BOK]);
++ }
++ else if (buf[0] == '\033') { /* ESC */
++ FakeButtonPress(&tbut[T_BCANC]);
++ }
+ }
+ }
+ else rv = 0;
@@ -16158,7 +9227,7 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+
+/***************************************************/
+void
-+PCDSetParamOptions(char *fname)
++PCDSetParamOptions(const char *fname)
+{
+ int cur;
+ cur = RBWhich(resnRB);
@@ -16176,9 +9245,9 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+static void
+drawTD(int x, int y, int w, int h)
+{
-+ char *title = "Load PhotoCD file...";
-+ int i;
-+ XRectangle xr;
++ const char *title = "Load PhotoCD file...";
++ int i;
++ XRectangle xr;
+
+ xr.x = x; xr.y = y; xr.width = w; xr.height = h;
+ XSetClipRectangles(theDisp, theGC, 0,0, &xr, 1, Unsorted);
@@ -16237,12 +9306,12 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+ leaveitup=0;
+ goforit=0;
+ switch (cmd) {
-+ case T_BOK: PCDSetParams();
++ case T_BOK: PCDSetParams();
+ goforit=1;
-+ case T_BCANC: PCDDialog(0);
++ case T_BCANC: PCDDialog(0);
+ break;
+
-+ default: break;
++ default: break;
+ }
+}
+
@@ -16268,7 +9337,7 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+ *
+ * Store the huffman table into tree type structure:
+ *
-+ * int int[n of entries*2]
++ * int int[n of entries*2]
+ *
+ * Each entry consists of two words (the 1st for zero and the 2nd for one).
+ *
@@ -16283,171 +9352,171 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+static void
+dumphufftab(int n, const byte *h, int m, const int *t)
+{
-+ int j;
++ int j;
+
-+ for(j = 0; j < n || j < m; ++j) {
-+ if(j < m)
-+ fprintf(stderr, "%04x %04x ::", 0xffff & t[2*j + 0],
-+ 0xffff & t[2*j + 1]);
-+ else
-+ fprintf(stderr, "%s %s ::", " ", " ");
-+ if(j < n) {
-+ int k;
-+ unsigned l = (h[4*j + 1] << 8) | h[4*j + 2];
-+
-+ fprintf(stderr, " %02x %2d ", h[4*j + 3], h[4*j + 0]);
-+ for(k = 0; k <= h[4*j + 0]; ++k, l *= 2)
-+ fprintf(stderr, "%c", '0'+((l & 0x8000) != 0));
-+ }
-+ fprintf(stderr, "\n");
-+ }
++ for(j = 0; j < n || j < m; ++j) {
++ if(j < m)
++ fprintf(stderr, "%04x %04x ::", 0xffff & t[2*j + 0],
++ 0xffff & t[2*j + 1]);
++ else
++ fprintf(stderr, "%s %s ::", " ", " ");
++ if(j < n) {
++ int k;
++ unsigned l = (h[4*j + 1] << 8) | h[4*j + 2];
++
++ fprintf(stderr, " %02x %2d ", h[4*j + 3], h[4*j + 0]);
++ for(k = 0; k <= h[4*j + 0]; ++k, l *= 2)
++ fprintf(stderr, "%c", '0'+((l & 0x8000) != 0));
++ }
++ fprintf(stderr, "\n");
++ }
+}
+
+static int *
+gethufftable(void)
+{
-+ int *hufftab, *h, i, j, N, num, bufsize, huffptr, hufftop;
-+ byte *huf;
-+
-+ /*
-+ * absorb the entirety of the table in one chunk (for better
-+ * dumps in case of error)
-+ */
-+ trace((stderr, "hufftab 0x%08lx ", ftell(fp)));
-+ num = 1 + fgetc(fp); /* 256 max */
-+ huf = (byte *)alloca(4*num*sizeof(byte));
-+ if((i = fread(huf, 1, 4*num, fp)) != 4*num) {
-+ fprintf(stderr, "unexpected EOF: got %d bytes, wanted %d\n",
-+ i, 4*num);
-+ return NULL;
-+ }
++ int *hufftab, *h, i, j, N, num, bufsize, huffptr, hufftop;
++ byte *huf;
+
-+ /*
-+ * guess an initial size and prepare the initial entry
-+ */
-+ trace((stderr, "length %u\n", num));
-+ N = 2*num; /* 512 max */
-+ bufsize = N * sizeof(int);
-+/* this case can't happen, but added for symmetry with loop below
-+ if (N/2 != num || bufsize/N != sizeof(int)) {
-+ SetISTR(ISTR_WARNING, "Huffman table size out of range");
-+ return NULL;
-+ }
++ /*
++ * absorb the entirety of the table in one chunk (for better
++ * dumps in case of error)
++ */
++ trace((stderr, "hufftab 0x%08lx ", ftell(fp)));
++ num = 1 + fgetc(fp); /* 256 max */
++ huf = (byte *)alloca(4*num*sizeof(byte));
++ if((i = fread(huf, 1, 4*num, fp)) != 4*num) {
++ fprintf(stderr, "unexpected EOF: got %d bytes, wanted %d\n",
++ i, 4*num);
++ return NULL;
++ }
++
++ /*
++ * guess an initial size and prepare the initial entry
++ */
++ trace((stderr, "length %u\n", num));
++ N = 2*num; /* 512 max */
++ bufsize = N * sizeof(int);
++/* this case can't happen, but added for symmetry with loop below
++ if (N/2 != num || bufsize/N != sizeof(int)) {
++ SetISTR(ISTR_WARNING, "Huffman table size out of range");
++ return NULL;
++ }
+ */
-+ if((hufftab = (int *)malloc(bufsize)) == NULL)
-+ FatalError("couldn't malloc initial Huffman table");
-+ hufftab[0] = hufftab[1] = 0;
-+
-+ /*
-+ * we check the table for reasonableness; there is a lack of detailed
-+ * documentation on this format. in particular, for the base16,
-+ * the position of the huffman tables is uncertain to within one
-+ * "sector", and we have to detect his before trying to read
-+ * bogusness.
-+ */
-+ hufftop = 0;
-+ for(i = 0; i < num; ++i) {
-+ unsigned length = huf[4*i + 0],
-+ codeword = (huf[4*i + 1] << 8) | huf[4*i + 2];
-+
-+ /*
-+ * some sanity checks
-+ */
-+ if(length >= 16) {
-+ fprintf(stderr,
-+ "gethufftable: improbable length @ %d/%d\n",
-+ i, num);
-+ dumphufftab(num, huf, hufftop/2, hufftab);
-+ free(hufftab);
-+ return NULL;
-+ }
++ if((hufftab = (int *)malloc(bufsize)) == NULL)
++ FatalError("couldn't malloc initial Huffman table");
++ hufftab[0] = hufftab[1] = 0;
+
-+ /*
-+ * walk the whole set of codes
-+ */
-+ huffptr = 0;
-+ for(j = 0; j < 16; ++j, codeword *= 2) {
-+ /*
-+ * choose the child node
-+ */
-+ if(codeword & 0x8000)
-+ ++huffptr;
-+
-+ /*
-+ * store value at end-of-code
-+ */
-+ if(j == length) {
-+ /*
-+ * more sanity
-+ */
-+ if((codeword *= 2) & 0xffff) {
-+ fprintf(stderr,
-+ "gethufftable: "
-+ ":probable invalid code @ %d\n",
-+ i);
-+ dumphufftab(num, huf,
-+ hufftop/2, hufftab);
-+ free(hufftab);
-+ return NULL;
-+ }
-+ hufftab[huffptr] = 1 + (int) huf[4*i + 3];
-+ break;
-+ }
++ /*
++ * we check the table for reasonableness; there is a lack of detailed
++ * documentation on this format. in particular, for the base16,
++ * the position of the huffman tables is uncertain to within one
++ * "sector", and we have to detect his before trying to read
++ * bogusness.
++ */
++ hufftop = 0;
++ for(i = 0; i < num; ++i) {
++ unsigned length = huf[4*i + 0],
++ codeword = (huf[4*i + 1] << 8) | huf[4*i + 2];
+
-+ /*
-+ * otherwise, follow the tree to date
-+ */
-+ if(hufftab[huffptr] < 0) {
-+ huffptr -= hufftab[huffptr];
-+ continue;
-+ } else if(hufftab[huffptr] > 0) {
-+ fprintf(stderr, "duplicate code %d %d/%d\n",
-+ huffptr, i, num);
-+ dumphufftab(num, huf, hufftop/2, hufftab);
-+ free(hufftab);
-+ return NULL;
-+ }
++ /*
++ * some sanity checks
++ */
++ if(length >= 16) {
++ fprintf(stderr,
++ "gethufftable: improbable length @ %d/%d\n",
++ i, num);
++ dumphufftab(num, huf, hufftop/2, hufftab);
++ free(hufftab);
++ return NULL;
++ }
++
++ /*
++ * walk the whole set of codes
++ */
++ huffptr = 0;
++ for(j = 0; j < 16; ++j, codeword *= 2) {
++ /*
++ * choose the child node
++ */
++ if(codeword & 0x8000)
++ ++huffptr;
++
++ /*
++ * store value at end-of-code
++ */
++ if(j == length) {
++ /*
++ * more sanity
++ */
++ if((codeword *= 2) & 0xffff) {
++ fprintf(stderr,
++ "gethufftable: "
++ ":probable invalid code @ %d\n",
++ i);
++ dumphufftab(num, huf,
++ hufftop/2, hufftab);
++ free(hufftab);
++ return NULL;
++ }
++ hufftab[huffptr] = 1 + (int) huf[4*i + 3];
++ break;
++ }
++
++ /*
++ * otherwise, follow the tree to date
++ */
++ if(hufftab[huffptr] < 0) {
++ huffptr -= hufftab[huffptr];
++ continue;
++ } else if(hufftab[huffptr] > 0) {
++ fprintf(stderr, "duplicate code %d %d/%d\n",
++ huffptr, i, num);
++ dumphufftab(num, huf, hufftop/2, hufftab);
++ free(hufftab);
++ return NULL;
++ }
+
-+ /*
-+ * and if necessary, make the tree bigger
-+ */
-+ if((hufftop += 2) >= N) {
-+ int oldN = N;
++ /*
++ * and if necessary, make the tree bigger
++ */
++ if((hufftop += 2) >= N) {
++ int oldN = N;
+#if TRACE
-+ dumphufftab(num, huf, hufftop/2, hufftab);
-+#endif
-+ N *= 2;
-+ bufsize = N*sizeof(int);
-+ if (N/2 != oldN || bufsize/N != sizeof(int)) {
-+ SetISTR(ISTR_WARNING,
-+ "new Huffman table is too large");
-+ free(hufftab);
-+ return NULL;
-+ }
-+ h = (int *)realloc(hufftab, bufsize);
-+ if(h == NULL) {
-+ fprintf(stderr,
-+ "Table overflow %d/%d\n",
-+ i, num);
-+ dumphufftab(num, huf,
-+ hufftop/2, hufftab);
-+ free(hufftab);
-+ FatalError(
-+ "couldn't realloc Huffman table");
-+ }
-+ hufftab = h;
-+ }
++ dumphufftab(num, huf, hufftop/2, hufftab);
++#endif
++ N *= 2;
++ bufsize = N*sizeof(int);
++ if (N/2 != oldN || bufsize/N != sizeof(int)) {
++ SetISTR(ISTR_WARNING,
++ "new Huffman table is too large");
++ free(hufftab);
++ return NULL;
++ }
++ h = (int *)realloc(hufftab, bufsize);
++ if(h == NULL) {
++ fprintf(stderr,
++ "Table overflow %d/%d\n",
++ i, num);
++ dumphufftab(num, huf,
++ hufftop/2, hufftab);
++ free(hufftab);
++ FatalError(
++ "couldn't realloc Huffman table");
++ }
++ hufftab = h;
++ }
+
-+ /*
-+ * then add new ptr
-+ */
-+ hufftab[huffptr] = huffptr - hufftop;
-+ huffptr = hufftop;
-+ hufftab[huffptr + 0] =
-+ hufftab[huffptr + 1] = 0;
-+ }
-+ }
-+ return hufftab;
++ /*
++ * then add new ptr
++ */
++ hufftab[huffptr] = huffptr - hufftop;
++ huffptr = hufftop;
++ hufftab[huffptr + 0] =
++ hufftab[huffptr + 1] = 0;
++ }
++ }
++ return hufftab;
+}
+
+/* WORDTYPE & char buffer must be unsigned else */
@@ -16559,501 +9628,173 @@ diff -ruN xv-3.10a-bugfixes/xvpcd.c xv-3.10a-enhancements/xvpcd.c
+#define skip24() (skipnn(24))
+
+static int
-+gethuffdata( byte *luma,
-+ byte *chroma1,
-+ byte *chroma2,
-+ int realrowwidth,
-+ int maxrownumber)
-+{
-+static byte clip[3*256];
-+ int *hufftable[3], *huffstart = NULL, *huffptr = NULL;
-+ int row, col, plane, i, result = 1;
++gethuffdata( byte *luma,
++ byte *chroma1,
++ byte *chroma2,
++ int realrowwidth,
++ int maxrownumber)
++{
++static byte clip[3*256];
++ int *hufftable[3], *huffstart = NULL, *huffptr = NULL;
++ int row, col, plane, i, result = 1;
+#if TRACE
-+ int uflow = 0, oflow = 0;
++ int uflow = 0, oflow = 0;
+#endif
-+ byte *pixelptr = NULL;
-+
-+ trace((stderr,"gethuffdata: start @ 0x%08lx (sector %ld.%ld)\n",
-+ ftell(fp), ftell(fp)/0x800, ftell(fp) % 0x800));
-+
-+ /*
-+ * correction clipping
-+ */
-+ if(clip[256+255] == 0) {
-+ for(i = 0; i < 256; ++i)
-+ clip[i + 0] = 0x00,
-+ clip[i + 256] = (byte) i,
-+ clip[i + 512] = 0xff;
-+ }
++ byte *pixelptr = NULL;
+
-+ /*
-+ * should really only look for luma plane for 4base, but the
-+ * there are zeroes in the rest of the sector that give both
-+ * chroma tables 0 length
-+ */
-+ for(i = 0; i < 3; ++i)
-+ hufftable[i] = NULL;
-+ for(i = 0; i < 3; ++i) {
-+ if((hufftable[i] = gethufftable()) == NULL) {
-+ result = 0;
-+ break;
-+ }
-+ }
-+ if(result == 0)
-+ goto oops;
-+
-+ /*
-+ * skip remainder of current sector
-+ */
-+ i = (ftell(fp) | 0x7ff) + 1;
-+ if(fseek(fp, i, SEEK_SET) < 0) {
-+ fprintf(stderr, "gethuffdata: sector skip failed\n");
-+ return 0;
-+ }
++ trace((stderr,"gethuffdata: start @ 0x%08lx (sector %ld.%ld)\n",
++ ftell(fp), ftell(fp)/0x800, ftell(fp) % 0x800));
+
-+ /*
-+ * skip remainder of "sector"
-+ */
-+ i = 0;
-+ while (is24() != 0xfffffe) {
-+ (void)get24();
-+ if(++i == 1)
-+ trace((stderr,"gethuffdata: skipping for sync ..."));
-+ }
-+ if(i != 0)
-+ trace((stderr, " %d times\n", i));
-+
-+ while(result) {
-+ if(is24() == 0xfffffe) {
-+ skip24();
-+ plane = get2();
-+ row = get13(); col = 0;
-+ skip1();
-+ if(row >= maxrownumber) {
-+ trace((stderr,
-+ "gethuffdata: stopping at row %d\n",
-+ row));
-+ break;
-+ }
-+ switch (plane) {
-+ case 0:
-+ huffstart = hufftable[0];
-+ pixelptr = luma + row*realrowwidth;
-+ break;
++ /*
++ * correction clipping
++ */
++ if(clip[256+255] == 0) {
++ for(i = 0; i < 256; ++i)
++ clip[i + 0] = 0x00,
++ clip[i + 256] = (byte) i,
++ clip[i + 512] = 0xff;
++ }
+
-+ case 2:
-+ huffstart = hufftable[1];
-+ pixelptr = chroma1 + row/2*realrowwidth/2;
-+ break;
++ /*
++ * should really only look for luma plane for 4base, but the
++ * there are zeroes in the rest of the sector that give both
++ * chroma tables 0 length
++ */
++ for(i = 0; i < 3; ++i)
++ hufftable[i] = NULL;
++ for(i = 0; i < 3; ++i) {
++ if((hufftable[i] = gethufftable()) == NULL) {
++ result = 0;
++ break;
++ }
++ }
++ if(result == 0)
++ goto oops;
+
-+ case 3:
-+ huffstart = hufftable[2];
-+ pixelptr = chroma2 + row/2*realrowwidth/2;
-+ break;
++ /*
++ * skip remainder of current sector
++ */
++ i = (ftell(fp) | 0x7ff) + 1;
++ if(fseek(fp, i, SEEK_SET) < 0) {
++ fprintf(stderr, "gethuffdata: sector skip failed\n");
++ return 0;
++ }
+
-+ default:
-+ fprintf(stderr, "gethuffdata: bad plane %d\n",
-+ plane);
-+ result = 0;
-+ break;
-+ }
-+ WaitCursor();
-+ continue;
-+ }
++ /*
++ * skip remainder of "sector"
++ */
++ i = 0;
++ while (is24() != 0xfffffe) {
++ (void)get24();
++ if(++i == 1)
++ trace((stderr,"gethuffdata: skipping for sync ..."));
++ }
++ if(i != 0)
++ trace((stderr, " %d times\n", i));
++
++ while(result) {
++ if(is24() == 0xfffffe) {
++ skip24();
++ plane = get2();
++ row = get13(); col = 0;
++ skip1();
++ if(row >= maxrownumber) {
++ trace((stderr,
++ "gethuffdata: stopping at row %d\n",
++ row));
++ break;
++ }
++ switch (plane) {
++ case 0:
++ huffstart = hufftable[0];
++ pixelptr = luma + row*realrowwidth;
++ break;
+
-+ /*
-+ * locate correction in huffman tree
-+ */
-+ for(huffptr = huffstart;;) {
-+ huffptr += get1();
-+ if(*huffptr < 0) {
-+ huffptr -= *huffptr;
-+ } else if(*huffptr == 0) {
-+ fprintf(stderr,
-+ "gethuffdata: invalid code: "
-+ "image quality reduced\n");
-+ result = 0;
-+ break;
-+ } else
-+ break;
-+ }
-+ if(!result)
-+ break;
++ case 2:
++ huffstart = hufftable[1];
++ pixelptr = chroma1 + row/2*realrowwidth/2;
++ break;
++
++ case 3:
++ huffstart = hufftable[2];
++ pixelptr = chroma2 + row/2*realrowwidth/2;
++ break;
++
++ default:
++ fprintf(stderr, "gethuffdata: bad plane %d\n",
++ plane);
++ result = 0;
++ break;
++ }
++ WaitCursor();
++ continue;
++ }
++
++ /*
++ * locate correction in huffman tree
++ */
++ for(huffptr = huffstart;;) {
++ huffptr += get1();
++ if(*huffptr < 0) {
++ huffptr -= *huffptr;
++ } else if(*huffptr == 0) {
++ fprintf(stderr,
++ "gethuffdata: invalid code: "
++ "image quality reduced\n");
++ result = 0;
++ break;
++ } else
++ break;
++ }
++ if(!result)
++ break;
+
-+ /*
-+ * apply correction to the pixel
-+ *
-+ * eeeek!! the corrections can sometimes over or underflow!
-+ * this strongly suggested that the 'magnify' method was in
-+ * some way wrong. however, experiments showed that the
-+ * over/under flows even occured for the pixels that are
-+ * copied through magnify without change (ie, the even
-+ * row/even column case). curiously, though, the odd
-+ * column and odd row cases were about 3x more likely to have
-+ * the over/underflow, and the odd row/odd column case was
-+ * about 5x higher, so maybe the use of a bi-linear
-+ * interpolation is not correct -- just *close*?
-+ *
-+ * the other clue in this area is that the overflows are
-+ * by far most frequenct along edges of very bright
-+ * areas -- rarely in the interior of such regions.
-+ */
-+ i = (int) *pixelptr + (signed char) (*huffptr - 1);
++ /*
++ * apply correction to the pixel
++ *
++ * eeeek!! the corrections can sometimes over or underflow!
++ * this strongly suggested that the 'magnify' method was in
++ * some way wrong. however, experiments showed that the
++ * over/under flows even occured for the pixels that are
++ * copied through magnify without change (ie, the even
++ * row/even column case). curiously, though, the odd
++ * column and odd row cases were about 3x more likely to have
++ * the over/underflow, and the odd row/odd column case was
++ * about 5x higher, so maybe the use of a bi-linear
++ * interpolation is not correct -- just *close*?
++ *
++ * the other clue in this area is that the overflows are
++ * by far most frequenct along edges of very bright
++ * areas -- rarely in the interior of such regions.
++ */
++ i = (int) *pixelptr + (signed char) (*huffptr - 1);
+#if TRACE
-+ if(i > 255)
-+ ++oflow;
-+/* trace((stderr,
-+ "gethuffdata: oflow %d %d %d\n", row, col, i));*/
-+ else if(i < 0)
-+ ++uflow;
-+/* trace((stderr,
-+ "gethuffdata: uflow %d %d %d\n", row, col, i));*/
-+ ++col;
-+#endif
-+ *pixelptr++ = clip[i + 256];
-+ }
++ if(i > 255)
++ ++oflow;
++/* trace((stderr,
++ "gethuffdata: oflow %d %d %d\n", row, col, i));*/
++ else if(i < 0)
++ ++uflow;
++/* trace((stderr,
++ "gethuffdata: uflow %d %d %d\n", row, col, i));*/
++ ++col;
++#endif
++ *pixelptr++ = clip[i + 256];
++ }
+
+oops:
-+ for(i = 0; i < 3; ++i)
-+ free(hufftable[i]);
-+ trace((stderr, "gethuffdata: uflow=%d oflow=%d\n", uflow, oflow));
-+ trace((stderr, "gethuffdata: done @ 0x%08lx (sector %ld.%d)\n",
-+ ftell(fp), ftell(fp)/0x800, 0x800 - bytesleft));
-+ return result;
++ for(i = 0; i < 3; ++i)
++ free(hufftable[i]);
++ trace((stderr, "gethuffdata: uflow=%d oflow=%d\n", uflow, oflow));
++ trace((stderr, "gethuffdata: done @ 0x%08lx (sector %ld.%d)\n",
++ ftell(fp), ftell(fp)/0x800, 0x800 - bytesleft));
++ return result;
+}
+
+#endif /* HAVE_PCD */
-diff -ruN xv-3.10a-bugfixes/xvpds.c xv-3.10a-enhancements/xvpds.c
---- xv-3.10a-bugfixes/xvpds.c 2005-04-03 11:31:30.000000000 -0700
-+++ xv-3.10a-enhancements/xvpds.c 2005-04-17 21:40:40.000000000 -0700
-@@ -77,8 +77,7 @@
- * Huffman-encoded, and the encoding histogram follows the ASCII headers.
- * To decode these, we use a slightly modified version of "vdcomp.c" from the
- * NASA Viking CD-ROMS. For xv to work, you need to have vdcomp compiled
-- * and in your search path. vdcomp.c should be included with this
--distribution.
-+ * and in your search path. vdcomp.c should be included with this distribution.
- *
- * I've heard that newer discs have FITS images on them. If they do, support
- * for them will be added when I get one. Until then, you can use fitstopgm.
-@@ -102,7 +101,7 @@
- * This software is provided "as is" without any express or implied warranty.
- */
-
--
-+#define NEEDSDIR /* for S_IRUSR|S_IWUSR */
- #include "xv.h"
-
- #ifdef HAVE_PDS
-@@ -129,27 +128,32 @@
-
- /* This is arbitrary. Everything I've seen so far fits in 50 chars */
- #define COMMENTSIZE 50
-+#define INOTESIZE 1000
-
-
- static int lastwasinote = FALSE;
--static char scanbuff [MAX_SIZE],
-- rtbuff [RTBUFFSIZE],
-- inote [20*COMMENTSIZE],
-- infobuff [COMMENTSIZE],
-- spacecraft [COMMENTSIZE],
-- target [COMMENTSIZE],
-- filtname [COMMENTSIZE],
-- gainmode [COMMENTSIZE],
-- editmode [COMMENTSIZE],
-- scanmode [COMMENTSIZE],
-- exposure [COMMENTSIZE],
-- shuttermode [COMMENTSIZE],
-- mphase [COMMENTSIZE],
-- iname [COMMENTSIZE],
-- itime [COMMENTSIZE],
-- garbage [1020],
-+static char scanbuff [MAX_SIZE+1],
-+ rtbuff [RTBUFFSIZE+1],
-+ inote [INOTESIZE+1],
-+ infobuff [COMMENTSIZE+1],
-+ spacecraft [COMMENTSIZE+1],
-+ target [COMMENTSIZE+1],
-+ filtname [COMMENTSIZE+1],
-+ gainmode [COMMENTSIZE+1],
-+ editmode [COMMENTSIZE+1],
-+ scanmode [COMMENTSIZE+1],
-+ exposure [COMMENTSIZE+1],
-+ shuttermode [COMMENTSIZE+1],
-+ mphase [COMMENTSIZE+1],
-+ iname [COMMENTSIZE+1],
-+ itime [COMMENTSIZE+1],
-+ garbage [1024],
- *tmptmp,
- pdsuncompfname[FNAMESIZE];
-+
-+#define SSTR(l) "%" #l "s"
-+#define S(l) SSTR(l)
-+
- byte *image;
- static int elaphe;
-
-@@ -251,6 +255,9 @@
- /* returns '1' on success, '0' on failure */
-
- int tempnum, bytewidth, bufsize;
-+#ifndef USE_MKSTEMP
-+ int tmpfd;
-+#endif
- FILE *zf;
- static int isfixed,teco,i,j,itype,vaxbyte,
- recsize,hrecsize,irecsize,isimage,labelrecs,labelsofar,
-@@ -397,7 +404,7 @@
-
- if (strcmp(scanbuff,"END") == 0) {
- break;
-- } else if (sscanf(scanbuff," RECORD_TYPE = %s",rtbuff) == 1) {
-+ } else if (sscanf(scanbuff, " RECORD_TYPE = " S(RTBUFFSIZE), rtbuff) == 1) {
- if (strncmp(rtbuff,"VARIABLE_LENGTH", (size_t) 15) == 0) {
- /* itype=PDSVARIABLE; */
- } else if (strncmp(rtbuff,"FIXED_LENGTH", (size_t) 12) == 0) {
-@@ -416,7 +423,7 @@
- if (irecsize == 0) irecsize=recsize;
- lastwasinote=FALSE;
- continue;
-- } else if (sscanf(scanbuff," FILE_TYPE = %s", rtbuff) != 0) {
-+ } else if (sscanf(scanbuff, " FILE_TYPE = " S(RTBUFFSIZE), rtbuff) != 0) {
- lastwasinote=FALSE;
- if (strncmp(rtbuff,"IMAGE", (size_t) 5) == 0) {
- isimage=TRUE;
-@@ -445,74 +452,74 @@
- lastwasinote=FALSE; continue;
- } else if (sscanf(scanbuff," SAMPLE_BITS = %d", &samplesize) == 1) {
- lastwasinote=FALSE; continue;
-- } else if (sscanf(scanbuff," SAMPLE_TYPE = %s", sampletype) == 1) {
-+ } else if (sscanf(scanbuff, " SAMPLE_TYPE = " S(64), sampletype) == 1) {
- lastwasinote=FALSE; continue;
-- } else if (sscanf(scanbuff," SPACECRAFT_NAME = %s %s",
-+ } else if (sscanf(scanbuff," SPACECRAFT_NAME = " S(COMMENTSIZE) " " S(1023),
- spacecraft,garbage) == 2 ) {
-- strcat(spacecraft,xv_strstr(scanbuff, spacecraft)+strlen(spacecraft));
-+ const char *tmp = xv_strstr(scanbuff, spacecraft) + strlen(spacecraft);
-+ strncat(spacecraft, tmp, COMMENTSIZE - strlen(spacecraft));
- lastwasinote=FALSE; continue;
-- } else if (sscanf(scanbuff," SPACECRAFT_NAME = %s", spacecraft) == 1) {
-+ } else if (sscanf(scanbuff, " SPACECRAFT_NAME = " S(COMMENTSIZE), spacecraft) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," TARGET_NAME = %s", target) == 1) {
-+ } else if (sscanf(scanbuff, " TARGET_NAME = " S(COMMENTSIZE), target) == 1) {
- lastwasinote=FALSE; continue;
-- } else if (sscanf(scanbuff," TARGET_BODY = %s", target) == 1) {
-+ } else if (sscanf(scanbuff, " TARGET_BODY = " S(COMMENTSIZE), target) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," MISSION_PHASE_NAME = %s", mphase) == 1) {
-+ } else if (sscanf(scanbuff, " MISSION_PHASE_NAME = " S(COMMENTSIZE), mphase) == 1) {
- lastwasinote=FALSE; continue;
-- } else if (sscanf(scanbuff," MISSION_PHASE = %s", mphase) == 1) {
-+ } else if (sscanf(scanbuff, " MISSION_PHASE = " S(COMMENTSIZE), mphase) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," INSTRUMENT_NAME = %s", iname) == 1) {
-+ } else if (sscanf(scanbuff, " INSTRUMENT_NAME = " S(COMMENTSIZE), iname) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," GAIN_MODE_ID = %s", gainmode) == 1) {
-+ } else if (sscanf(scanbuff, " GAIN_MODE_ID = " S(COMMENTSIZE), gainmode) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," INSTRUMENT_GAIN_STATE = %s",gainmode)==1) {
-+ } else if (sscanf(scanbuff, " INSTRUMENT_GAIN_STATE = " S(COMMENTSIZE), gainmode) ==1 ) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," EDIT_MODE_ID = %s", editmode) == 1) {
-+ } else if (sscanf(scanbuff, " EDIT_MODE_ID = " S(COMMENTSIZE), editmode) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," INSTRUMENT_EDIT_MODE = %s", editmode)==1) {
-+ } else if (sscanf(scanbuff, " INSTRUMENT_EDIT_MODE = " S(COMMENTSIZE), editmode) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," SCAN_MODE_ID = %s", scanmode) == 1) {
-+ } else if (sscanf(scanbuff, " SCAN_MODE_ID = " S(COMMENTSIZE), scanmode) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," INSTRUMENT_SCAN_RATE = %s", scanmode)==1) {
-+ } else if (sscanf(scanbuff, " INSTRUMENT_SCAN_RATE = " S(COMMENTSIZE), scanmode) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," SHUTTER_MODE_ID = %s", shuttermode) == 1) {
-+ } else if (sscanf(scanbuff, " SHUTTER_MODE_ID = " S(COMMENTSIZE), shuttermode) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," INSTRUMENT_SHUTTER_MODE = %s",
-- shuttermode) == 1) {
-+ } else if (sscanf(scanbuff, " INSTRUMENT_SHUTTER_MODE = " S(COMMENTSIZE), shuttermode) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," SCAN_MODE_ID = %s", scanmode) == 1) {
-+ } else if (sscanf(scanbuff, " SCAN_MODE_ID = " S(COMMENTSIZE), scanmode) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," INSTRUMENT_SCAN_RATE = %s", scanmode)==1) {
-+ } else if (sscanf(scanbuff, " INSTRUMENT_SCAN_RATE = " S(COMMENTSIZE), scanmode) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," SPACECRAFT_EVENT_TIME = %s", itime) == 1) {
-+ } else if (sscanf(scanbuff, " SPACECRAFT_EVENT_TIME = " S(COMMENTSIZE), itime) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," IMAGE_TIME = %s", itime) == 1) {
-+ } else if (sscanf(scanbuff, " IMAGE_TIME = " S(COMMENTSIZE), itime) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," FILTER_NAME = %s", filtname) == 1) {
-+ } else if (sscanf(scanbuff, " FILTER_NAME = " S(COMMENTSIZE), filtname) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff," INSTRUMENT_FILTER_NAME = %s",filtname)==1) {
-+ } else if (sscanf(scanbuff, " INSTRUMENT_FILTER_NAME = " S(COMMENTSIZE), filtname) == 1) {
- lastwasinote=FALSE; continue;
-
-- } else if ((sscanf(scanbuff," EXPOSURE_DURATION = %s", exposure) == 1)
-- || (sscanf(scanbuff," INSTRUMENT_EXPOSURE_DURATION = %s",
-- exposure) == 1)) {
-+ } else if ((sscanf(scanbuff, " EXPOSURE_DURATION = " S(COMMENTSIZE), exposure) == 1)
-+ || (sscanf(scanbuff, " INSTRUMENT_EXPOSURE_DURATION = " S(COMMENTSIZE),
-+ exposure)) == 1) {
- tmptmp = (char *) index(scanbuff,'=');
- tmptmp++;
- while((*tmptmp) == ' ')
-@@ -520,10 +527,10 @@
- strcpy(exposure,tmptmp);
- lastwasinote=FALSE; continue;
-
-- } else if (sscanf(scanbuff, "NOTE = %s", inote) == 1) {
-+ } else if (sscanf(scanbuff, "NOTE = " S(INOTESIZE), inote) == 1) {
- tmptmp = (char *) index(scanbuff,'='); tmptmp++;
- while (((*tmptmp) == ' ') || ((*tmptmp) == '"')) tmptmp++;
-- strcpy(inote,tmptmp);
-+ strncpy(inote, tmptmp, INOTESIZE - 1);
- strcat(inote," ");
-
- /* evil and somewhat risky: A "note" (really, any textual
-@@ -548,7 +555,7 @@
- } else if (lastwasinote) {
- tmptmp=scanbuff;
- while (((*tmptmp) == ' ') || ((*tmptmp) == '"')) tmptmp++;
-- strcat(inote,tmptmp);
-+ strncat(inote, tmptmp, INOTESIZE - strlen(inote) - 1);
- strcat(inote," ");
- if (index(tmptmp,'"') != NULL)
- lastwasinote=FALSE;
-@@ -647,27 +654,27 @@
-
- *infobuff='\0';
- if (*spacecraft) {
-- strcat(infobuff,spacecraft);
-+ strncat(infobuff, spacecraft, sizeof(infobuff) - 1);
- }
-
- if (*target) {
-- strcat(infobuff,", ");
-- strcat(infobuff,target);
-+ strncat(infobuff, ", ", sizeof(infobuff) - strlen(infobuff) - 1);
-+ strncat(infobuff, target, sizeof(infobuff) - strlen(infobuff) - 1);
- }
-
- if (*filtname) {
-- strcat(infobuff,", ");
-- strcat(infobuff,filtname);
-+ strncat(infobuff, ", ", sizeof(infobuff) - strlen(infobuff) - 1);
-+ strncat(infobuff, filtname, sizeof(infobuff) - strlen(infobuff) - 1);
- }
-
- if (*itime) {
-- strcat(infobuff,", ");
-- strcat(infobuff,itime);
-+ strncat(infobuff, ", ", sizeof(infobuff) - strlen(infobuff) - 1);
-+ strncat(infobuff, itime, sizeof(infobuff) - strlen(infobuff) - 1);
- }
-
-- SetISTR(ISTR_WARNING,infobuff);
-+ SetISTR(ISTR_WARNING, "%s", infobuff);
-
-- strcpy(pdsuncompfname,fname);
-+ strncpy(pdsuncompfname,fname,sizeof(pdsuncompfname) - 1);
- ftypstr = "";
-
- switch (itype) {
-@@ -695,7 +702,7 @@
- fclose(zf);
-
- #ifndef VMS
-- sprintf(pdsuncompfname,"%s/xvhuffXXXXXX", tmpdir);
-+ snprintf(pdsuncompfname, sizeof(pdsuncompfname) - 1, "%s/xvhuffXXXXXX", tmpdir);
- #else
- strcpy(pdsuncompfname,"sys$disk:[]xvhuffXXXXXX");
- #endif
-@@ -704,10 +711,16 @@
- close(mkstemp(pdsuncompfname));
- #else
- mktemp(pdsuncompfname);
-+ tmpfd = open(pdsuncompfname,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
-+ if (tmpfd < 0) {
-+ SetISTR(ISTR_WARNING,"Unable to create temporary file.");
-+ return 0;
-+ }
-+ close(tmpfd);
- #endif
-
- #ifndef VMS
-- sprintf(scanbuff,"%s %s - 4 >%s",PDSUNCOMP,fname,pdsuncompfname);
-+ sprintf(scanbuff,"%s '%s' - 4 > %s", PDSUNCOMP, fname, pdsuncompfname);
- #else
- sprintf(scanbuff,"%s %s %s 4",PDSUNCOMP,fname,pdsuncompfname);
- #endif
-@@ -823,26 +836,26 @@
- char tmp[256];
- *(pinfo->comment) = '\0';
-
-- sprintf(tmp, "Spacecraft: %-28sTarget: %-32s\n", spacecraft, target);
-- strcat(pinfo->comment, tmp);
-+ sprintf(tmp, "Spacecraft: %-28.28sTarget: %-32.32s\n", spacecraft, target);
-+ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
-
-- sprintf(tmp, "Filter: %-32sMission phase: %-24s\n", filtname, mphase);
-- strcat(pinfo->comment, tmp);
-+ sprintf(tmp, "Filter: %-32.32sMission phase: %-24.24s\n", filtname, mphase);
-+ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
-
-- sprintf(tmp, "Image time: %-28sGain mode: %-29s\n", itime, gainmode);
-- strcat(pinfo->comment, tmp);
-+ sprintf(tmp, "Image time: %-28.28sGain mode: %-29.29s\n", itime, gainmode);
-+ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
-
-- sprintf(tmp, "Edit mode: %-29sScan mode: %-29s\n", editmode, scanmode);
-- strcat(pinfo->comment, tmp);
-+ sprintf(tmp, "Edit mode: %-29.29sScan mode: %-29.29s\n", editmode, scanmode);
-+ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
-
-- sprintf(tmp, "Exposure: %-30sShutter mode: %-25s\n", exposure,shuttermode);
-- strcat(pinfo->comment, tmp);
-+ sprintf(tmp, "Exposure: %-30.30sShutter mode: %-25.25s\n", exposure,shuttermode);
-+ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
-
-- sprintf(tmp, "Instrument: %-28sImage time: %-28s\n", iname, itime);
-- strcat(pinfo->comment, tmp);
-+ sprintf(tmp, "Instrument: %-28.28sImage time: %-28.28s\n", iname, itime);
-+ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
-
-- sprintf(tmp, "Image Note: %-28s", inote);
-- strcat(pinfo->comment, tmp);
-+ sprintf(tmp, "Image Note: %-28.28s", inote);
-+ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
- }
-
- if (LoadPDSPalette(fname, pinfo)) return 1;
-diff -ruN xv-3.10a-bugfixes/xvpi.c xv-3.10a-enhancements/xvpi.c
---- xv-3.10a-bugfixes/xvpi.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvpi.c 2005-04-17 22:57:04.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/xvpi.c xv-3.10a/xvpi.c
+--- xv-3.10a.orig/xvpi.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvpi.c 2005-04-18 00:57:04.000000000 -0500
@@ -0,0 +1,1060 @@
+/*
+ * xvpi.c - load routine for `Pi' format pictures.
@@ -18115,9 +10856,9 @@ diff -ruN xv-3.10a-bugfixes/xvpi.c xv-3.10a-enhancements/xvpi.c
+ return r;
+}
+#endif /* HAVE_PI */
-diff -ruN xv-3.10a-bugfixes/xvpic.c xv-3.10a-enhancements/xvpic.c
---- xv-3.10a-bugfixes/xvpic.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvpic.c 2005-04-17 22:57:08.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/xvpic.c xv-3.10a/xvpic.c
+--- xv-3.10a.orig/xvpic.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvpic.c 2005-04-18 00:57:08.000000000 -0500
@@ -0,0 +1,1285 @@
+/*
+ * xvpic.c - load routine for `PIC' format pictures.
@@ -19404,9 +12145,9 @@ diff -ruN xv-3.10a-bugfixes/xvpic.c xv-3.10a-enhancements/xvpic.c
+ return r;
+}
+#endif /* HAVE_PIC */
-diff -ruN xv-3.10a-bugfixes/xvpic2.c xv-3.10a-enhancements/xvpic2.c
---- xv-3.10a-bugfixes/xvpic2.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvpic2.c 2005-04-17 22:56:07.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/xvpic2.c xv-3.10a/xvpic2.c
+--- xv-3.10a.orig/xvpic2.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvpic2.c 2007-04-15 17:02:32.000000000 -0500
@@ -0,0 +1,3608 @@
+/*
+ * $Id: xvpic2.c,v 2.9.1.14 1995/04/24 15:34:15 ikeyan Exp $
@@ -22926,11 +15667,11 @@ diff -ruN xv-3.10a-bugfixes/xvpic2.c xv-3.10a-enhancements/xvpic2.c
+{
+ switch (cmd) {
+ case T_BOK: {
-+ char *fullname;
-+ char buf[64], *x_offsetp, *y_offsetp;
-+ static char *labels[] = { "\nOk", "\033Cancel" };
-+ XEvent event;
-+ int i;
++ char *fullname;
++ char buf[64], *x_offsetp, *y_offsetp;
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ XEvent event;
++ int i;
+
+ strcpy(buf, "0,0");
+ i = GetStrPopUp("Enter offset (x,y):", labels, 2, buf, 64,
@@ -23016,10 +15757,10 @@ diff -ruN xv-3.10a-bugfixes/xvpic2.c xv-3.10a-enhancements/xvpic2.c
+ free(inpix);
+}
+#endif /* HAVE_PIC2 */
-diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
---- xv-3.10a-bugfixes/xvpng.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvpng.c 2005-04-17 15:00:08.000000000 -0700
-@@ -0,0 +1,1081 @@
+diff -u -r --new-file xv-3.10a.orig/xvpng.c xv-3.10a/xvpng.c
+--- xv-3.10a.orig/xvpng.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvpng.c 2007-05-13 19:53:28.000000000 -0500
+@@ -0,0 +1,1173 @@
+/*
+ * xvpng.c - load and write routines for 'PNG' format pictures
+ *
@@ -23034,16 +15775,19 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ */
+
+/*#include "copyright.h"*/
++
+/* (c) 1995 by Alexander Lehmann <lehmann@mathematik.th-darmstadt.de>
+ * This file is a suplement to xv and is supplied under the same copying
+ * conditions (except the shareware part).
++ * The copyright will be passed on to JB at some future point if he
++ * so desires.
++ *
+ * Modified by Andreas Dilger <adilger@enel.ucalgary.ca> to fix
+ * error handling for bad PNGs, add dialogs for interlacing and
+ * compression selection, and upgrade to libpng-0.89.
++ *
+ * Modified by Greg Roelofs, TenThumbs and others to fix bugs and add
-+ * features.
-+ * The copyright will be passed on to JB at some future point if he
-+ * so desires.
++ * features. See README.jumbo for details.
+ */
+
+#include "xv.h"
@@ -23060,13 +15804,13 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+#define COMPRESSION 6 /* default zlib compression level, not max
+ (Z_BEST_COMPRESSION) */
+
-+#define HAVE_tRNS (info_ptr->valid & PNG_INFO_tRNS)
++#define HAVE_tRNS (info_ptr->valid & PNG_INFO_tRNS)
+
-+#define DWIDE 86
++#define DWIDE 86
+#define DHIGH 104
-+#define PFX PWIDE-93
-+#define PFY 44
-+#define PFH 20
++#define PFX (PWIDE-93)
++#define PFY 44
++#define PFH 20
+
+#define P_BOK 0
+#define P_BCANC 1
@@ -23092,7 +15836,7 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+
+/*** local variables ***/
+static char *filename;
-+static char *fbasename;
++static const char *fbasename;
+static int colorType;
+static int read_anything;
+static double Display_Gamma = DISPLAY_GAMMA;
@@ -23102,6 +15846,35 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+static CBUTT interCB;
+static CBUTT FdefCB, FnoneCB, FsubCB, FupCB, FavgCB, FPaethCB;
+
++
++#ifdef PNG_NO_STDIO
++/* NOTE: Some sites configure their version of the PNG Library without
++ * Standard I/O Library interfaces in order to avoid unnecessary inter-
++ * library dependencies at link time for applications that don't need Standard
++ * I/O. If your site is one of these, the following skeletal stubs, copied
++ * from libpng code, should be enough for this module. --Scott B. Marovich,
++ * Hewlett-Packard Laboratories, March 2001.
++ */
++static void
++png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
++{
++
++ /* fread() returns 0 on error, so it is OK to store this in a png_size_t
++ * instead of an int, which is what fread() actually returns.
++ */
++ if (fread(data,1,length,(FILE *)png_ptr->io_ptr) != length)
++ png_error(png_ptr, "Read Error");
++}
++
++static void
++png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
++{
++ if (fwrite(data, 1, length, (FILE *)png_ptr->io_ptr) != length)
++ png_error(png_ptr, "Write Error");
++}
++#endif /* PNG_NO_STDIO */
++
++
+/**************************************************************************/
+/* PNG SAVE DIALOG ROUTINES ***********************************************/
+/**************************************************************************/
@@ -23258,14 +16031,14 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+static void drawPD(x, y, w, h)
+ int x, y, w, h;
+{
-+ char *title = "Save PNG file...";
++ const char *title = "Save PNG file...";
+
+ char ctitle1[20];
-+ char *ctitle2 = "Useful range";
-+ char *ctitle3 = "is 2 - 7.";
-+ char *ctitle4 = "Uncompressed = 0";
++ const char *ctitle2 = "Useful range";
++ const char *ctitle3 = "is 2 - 7.";
++ const char *ctitle4 = "Uncompressed = 0";
+
-+ char *ftitle = "Row Filters:";
++ const char *ftitle = "Row Filters:";
+
+ char gtitle[20];
+
@@ -23421,21 +16194,23 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ int ptype, w, h;
+ byte *rmap, *gmap, *bmap;
+ int numcols;
++ /* FIXME? what's diff between picComments and WriteGIF's comment arg? */
+{
+ png_struct *png_ptr;
+ png_info *info_ptr;
+ png_color palette[256];
+ png_textp text;
-+ byte remap[256];
-+ int i, filter, linesize, pass;
++ byte r1[256], g1[256], b1[256]; /* storage for deduped palette */
++ byte pc2nc[256]; /* for duplicated-color remapping (1st level) */
++ byte remap[256]; /* for bw/grayscale remapping (2nd level) */
++ int i, j, numuniqcols=0, filter, linesize, pass;
+ byte *p, *png_line;
+ char software[256];
+ char *savecmnt;
+
+ if ((png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,
+ png_xv_error, png_xv_warning)) == NULL) {
-+ sprintf(software, "png_create_write_struct() failure in WritePNG (ver. %s)",
-+ PNG_LIBPNG_VER_STRING);
++ sprintf(software, "png_create_write_struct() failure in WritePNG");
+ FatalError(software);
+ }
+
@@ -23451,7 +16226,12 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ return -1;
+ }
+
++#ifdef PNG_NO_STDIO
++ png_set_write_fn(png_ptr, fp, png_default_write_data, NULL);
++ png_set_error_fn(png_ptr, NULL, png_xv_error, png_xv_warning);
++#else
+ png_init_io(png_ptr, fp);
++#endif
+
+ png_set_compression_level(png_ptr, (int)cDial.val);
+
@@ -23485,8 +16265,39 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+
+ linesize = 0; /* quiet a compiler warning */
+
++
++ /* GRR 20070331: remap palette to eliminate duplicated colors (as in
++ * xvgifwr.c) */
++ if (ptype == PIC8) {
++ for (i=0; i<256; ++i) {
++ pc2nc[i] = r1[i] = g1[i] = b1[i] = 0;
++ }
++
++ /* compute number of unique colors */
++ numuniqcols = 0;
++
++ for (i=0; i<numcols; ++i) {
++ /* see if color #i is already used */
++ for (j=0; j<i; ++j) {
++ if (rmap[i] == rmap[j] && gmap[i] == gmap[j] && bmap[i] == bmap[j])
++ break;
++ }
++
++ if (j==i) { /* wasn't found */
++ pc2nc[i] = numuniqcols;
++ r1[numuniqcols] = rmap[i]; /* i.e., r1[pc2nc[i]] == rmap[i] */
++ g1[numuniqcols] = gmap[i];
++ b1[numuniqcols] = bmap[i];
++ ++numuniqcols;
++ }
++ else pc2nc[i] = pc2nc[j];
++ }
++ }
++
++
++ /* Appendix G.2 of user manual claims colorType will never be F_REDUCED... */
+ if (colorType == F_FULLCOLOR || colorType == F_REDUCED) {
-+ if(ptype == PIC24) {
++ if (ptype == PIC24) {
+ linesize = 3*w;
+ if (linesize/3 < w) {
+ SetISTR(ISTR_WARNING, "%s: image dimensions too large (%dx%d)",
@@ -23496,39 +16307,39 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ }
+ info_ptr->color_type = PNG_COLOR_TYPE_RGB;
+ info_ptr->bit_depth = 8;
-+ } else {
++ } else /* ptype == PIC8 */ {
+ linesize = w;
+ info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
-+ if(numcols <= 2)
++ if (numuniqcols <= 2)
+ info_ptr->bit_depth = 1;
+ else
-+ if(numcols <= 4)
++ if (numuniqcols <= 4)
+ info_ptr->bit_depth = 2;
+ else
-+ if(numcols <= 16)
++ if (numuniqcols <= 16)
+ info_ptr->bit_depth = 4;
+ else
+ info_ptr->bit_depth = 8;
+
-+ for(i = 0; i < numcols; i++) {
-+ palette[i].red = rmap[i];
-+ palette[i].green = gmap[i];
-+ palette[i].blue = bmap[i];
++ for (i = 0; i < numuniqcols; i++) {
++ palette[i].red = r1[i];
++ palette[i].green = g1[i];
++ palette[i].blue = b1[i];
+ }
-+ info_ptr->num_palette = numcols;
++ info_ptr->num_palette = numuniqcols;
+ info_ptr->palette = palette;
+ info_ptr->valid |= PNG_INFO_PLTE;
+ }
+ }
+
-+ else if(colorType == F_GREYSCALE || colorType == F_BWDITHER) {
++ else if (colorType == F_GREYSCALE || colorType == F_BWDITHER) {
+ info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
-+ if(colorType == F_BWDITHER) {
++ if (colorType == F_BWDITHER) {
+ /* shouldn't happen */
+ if (ptype == PIC24) FatalError("PIC24 and B/W Stipple in WritePNG()");
+
+ info_ptr->bit_depth = 1;
-+ if(MONO(rmap[0], gmap[0], bmap[0]) > MONO(rmap[1], gmap[1], bmap[1])) {
++ if (MONO(r1[0], g1[0], b1[0]) > MONO(r1[1], g1[1], b1[1])) {
+ remap[0] = 1;
+ remap[1] = 0;
+ }
@@ -23538,8 +16349,8 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ }
+ linesize = w;
+ }
-+ else {
-+ if(ptype == PIC24) {
++ else /* F_GREYSCALE */ {
++ if (ptype == PIC24) {
+ linesize = 3*w;
+ if (linesize/3 < w) {
+ SetISTR(ISTR_WARNING, "%s: image dimensions too large (%dx%d)",
@@ -23549,65 +16360,75 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ }
+ info_ptr->bit_depth = 8;
+ }
-+ else {
++ else /* ptype == PIC8 */ {
+ int low_precision;
+
+ linesize = w;
+
-+ for(i = 0; i < numcols; i++)
-+ remap[i] = MONO(rmap[i], gmap[i], bmap[i]);
-+
-+ for(; i < 256; i++)
-+ remap[i]=0;
++ /* NOTE: currently remap[] is the _secondary_ remapping of "palette"
++ * colors; its values are the final color/grayscale values, and,
++ * like r1/g1/b1[], it is _indexed_ by pc2nc[] (which is why its
++ * values come from r1/g1/b1[] and not from rmap/gmap/bmap[]).
++ *
++ * FIXME (probably): MONO() will create new duplicates; ideally should
++ * do extra round of dup-detection (and preferably collapse all
++ * remapping levels into single LUT). This stuff is a tad confusing.
++ */
++ for (i = 0; i < numuniqcols; i++)
++ remap[i] = MONO(r1[i], g1[i], b1[i]);
++
++ for (; i < 256; i++)
++ remap[i]=0; /* shouldn't be necessary, but... */
+
+ info_ptr->bit_depth = 8;
+
+ /* Note that this fails most of the time because of gamma */
++ /* (and that would be a bug: GRR FIXME) */
+ /* try to adjust to 4-bit precision grayscale */
+
+ low_precision=1;
+
-+ for(i = 0; i < numcols; i++) {
-+ if((remap[i] & 0x0f) * 0x11 != remap[i]) {
++ for (i = 0; i < numuniqcols; i++) {
++ if ((remap[i] & 0x0f) * 0x11 != remap[i]) {
+ low_precision = 0;
+ break;
+ }
+ }
+
-+ if(low_precision) {
-+ for(i = 0; i < numcols; i++) {
++ if (low_precision) {
++ for (i = 0; i < numuniqcols; i++) {
+ remap[i] &= 0xf;
+ }
+ info_ptr->bit_depth = 4;
+
+ /* try to adjust to 2-bit precision grayscale */
+
-+ for(i = 0; i < numcols; i++) {
-+ if((remap[i] & 0x03) * 0x05 != remap[i]) {
++ for (i = 0; i < numuniqcols; i++) {
++ if ((remap[i] & 0x03) * 0x05 != remap[i]) {
+ low_precision = 0;
+ break;
+ }
+ }
+ }
+
-+ if(low_precision) {
-+ for(i = 0; i < numcols; i++) {
++ if (low_precision) {
++ for (i = 0; i < numuniqcols; i++) {
+ remap[i] &= 3;
+ }
+ info_ptr->bit_depth = 2;
+
+ /* try to adjust to 1-bit precision grayscale */
+
-+ for(i = 0; i < numcols; i++) {
-+ if((remap[i] & 0x01) * 0x03 != remap[i]) {
++ for (i = 0; i < numuniqcols; i++) {
++ if ((remap[i] & 0x01) * 0x03 != remap[i]) {
+ low_precision = 0;
+ break;
+ }
+ }
+ }
+
-+ if(low_precision) {
-+ for(i = 0; i < numcols; i++) {
++ if (low_precision) {
++ for (i = 0; i < numuniqcols; i++) {
+ remap[i] &= 1;
+ }
+ info_ptr->bit_depth = 1;
@@ -23634,32 +16455,40 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+
+ Display_Gamma = gDial.val; /* Save the current gamma for loading */
+
++// GRR FIXME: add .Xdefaults option to omit writing gamma (size, cumulative errors when editing)--alternatively, modify save box to include "omit" checkbox
+ info_ptr->gamma = 1.0/gDial.val;
+ info_ptr->valid |= PNG_INFO_gAMA;
+
+ png_write_info(png_ptr, info_ptr);
+
-+ if(info_ptr->bit_depth < 8)
++ if (info_ptr->bit_depth < 8)
+ png_set_packing(png_ptr);
+
+ pass=png_set_interlace_handling(png_ptr);
+
-+ if((png_line = malloc(linesize)) == NULL)
++ if ((png_line = malloc(linesize)) == NULL)
+ png_error(png_ptr, "cannot allocate temp image line");
++ /* FIXME: should be FatalError() */
+
-+ for(i = 0; i < pass; i++) {
++ for (i = 0; i < pass; ++i) {
+ int j;
+ p = pic;
-+ for(j = 0; j < h; j++) {
-+ if(info_ptr->color_type == PNG_COLOR_TYPE_GRAY) {
++ for (j = 0; j < h; ++j) {
++ if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY) {
+ int k;
-+ for(k = 0; k < w; k++)
++ for (k = 0; k < w; ++k)
+ png_line[k] = ptype==PIC24 ? MONO(p[k*3], p[k*3+1], p[k*3+2]) :
-+ remap[p[k]];
++ remap[pc2nc[p[k]]];
++ png_write_row(png_ptr, png_line);
++ } else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
++ int k;
++ for (k = 0; k < w; ++k)
++ png_line[k] = pc2nc[p[k]];
+ png_write_row(png_ptr, png_line);
-+ } else /* RGB or palette */
++ } else { /* PNG_COLOR_TYPE_RGB */
+ png_write_row(png_ptr, p);
-+ if((j & 0x1f) == 0) WaitCursor();
++ }
++ if ((j & 0x1f) == 0) WaitCursor();
+ p += linesize;
+ }
+ }
@@ -23668,8 +16497,7 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+
+ savecmnt = NULL; /* quiet a compiler warning */
+
-+ if (text)
-+ {
++ if (text) {
+ if (picComments && strlen(picComments) &&
+ (savecmnt = (char *)malloc((strlen(picComments) + 1)*sizeof(char)))) {
+ png_textp tp;
@@ -23701,7 +16529,7 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+
+ /* See if it looks like a PNG keyword from LoadPNG */
+ /* GRR: should test for strictly < 80, right? (key = 1-79 chars only) */
-+ if(comment && comment[1] == ':' && comment - key <= 80) {
++ if (comment && comment[1] == ':' && comment - key <= 80) {
+ *(comment++) = '\0';
+ *(comment++) = '\0';
+
@@ -23709,7 +16537,7 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ since we have already stored one */
+ if (strcmp(key, "Software") == 0 && strncmp(comment, "XV", 2) == 0) {
+ key = strchr(comment, '\n');
-+ if(key)
++ if (key)
+ key++; /* skip \n */
+ comment = strchr(key, ':');
+ }
@@ -23726,7 +16554,7 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+
+ /* It looks like another keyword, go backward to the beginning */
+ if (key) {
-+ while(key > tp->text && *key != '\n')
++ while (key > tp->text && *key != '\n')
+ key--;
+
+ if (key > tp->text && comment - key <= 80) {
@@ -23774,8 +16602,7 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ }
+ } while (key && *key);
+ }
-+ else
-+ {
++ else {
+ info_ptr->num_text = 0;
+ }
+ }
@@ -23787,8 +16614,7 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ png_write_end(png_ptr, info_ptr);
+ fflush(fp); /* just in case we core-dump before finishing... */
+
-+ if (text)
-+ {
++ if (text) {
+ free(text);
+ /* must do this or png_destroy_write_struct() 0.97+ will free text again: */
+ info_ptr->text = (png_textp)NULL;
@@ -23845,28 +16671,28 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+
+ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
+ png_xv_error, png_xv_warning);
-+ if(!png_ptr) {
++ if (!png_ptr) {
+ fclose(fp);
+ FatalError("malloc failure in LoadPNG");
+ }
+
+ info_ptr = png_create_info_struct(png_ptr);
+
-+ if(!info_ptr) {
++ if (!info_ptr) {
+ fclose(fp);
+ png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
+ FatalError("malloc failure in LoadPNG");
+ }
+
-+ if(setjmp(png_ptr->jmpbuf)) {
++ if (setjmp(png_ptr->jmpbuf)) {
+ fclose(fp);
+ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
-+ if(!read_anything) {
-+ if(pinfo->pic) {
++ if (!read_anything) {
++ if (pinfo->pic) {
+ free(pinfo->pic);
+ pinfo->pic = NULL;
+ }
-+ if(pinfo->comment) {
++ if (pinfo->comment) {
+ free(pinfo->comment);
+ pinfo->comment = NULL;
+ }
@@ -23874,7 +16700,12 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ return read_anything;
+ }
+
++#ifdef PNG_NO_STDIO
++ png_set_read_fn(png_ptr, fp, png_default_read_data);
++ png_set_error_fn(png_ptr, NULL, png_xv_error, png_xv_warning);
++#else
+ png_init_io(png_ptr, fp);
++#endif
+ png_read_info(png_ptr, info_ptr);
+
+ pinfo->w = pinfo->normw = info_ptr->width;
@@ -23924,8 +16755,10 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+
+ if (info_ptr->valid & PNG_INFO_gAMA)
+ png_set_gamma(png_ptr, Display_Gamma, info_ptr->gamma);
-+ else
-+ png_set_gamma(png_ptr, Display_Gamma, 0.45);
++/*
++ *else
++ * png_set_gamma(png_ptr, Display_Gamma, 0.45);
++ */
+
+ gray_to_rgb = 0; /* quiet a compiler warning */
+
@@ -23934,7 +16767,7 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ my_background.red = imagebgR;
+ my_background.green = imagebgG;
+ my_background.blue = imagebgB;
-+ my_background.gray = imagebgG; /* only used if all three equal... */
++ my_background.gray = imagebgG; /* used only if all three equal... */
+ } else {
+ my_background.red = (imagebgR >> 8);
+ my_background.green = (imagebgG >> 8);
@@ -23980,7 +16813,7 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+
+ png_read_update_info(png_ptr, info_ptr);
+
-+ if(info_ptr->color_type == PNG_COLOR_TYPE_RGB ||
++ if (info_ptr->color_type == PNG_COLOR_TYPE_RGB ||
+ info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA || gray_to_rgb)
+ {
+ linesize = 3 * pinfo->w;
@@ -23995,13 +16828,13 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ } else {
+ linesize = pinfo->w;
+ pinfo->type = PIC8;
-+ if(info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
++ if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
+ info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
-+ for(i = 0; i < 256; i++)
++ for (i = 0; i < 256; i++)
+ pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i;
+ } else {
+ pinfo->colType = F_FULLCOLOR;
-+ for(i = 0; i < info_ptr->num_palette; i++) {
++ for (i = 0; i < info_ptr->num_palette; i++) {
+ pinfo->r[i] = info_ptr->palette[i].red;
+ pinfo->g[i] = info_ptr->palette[i].green;
+ pinfo->b[i] = info_ptr->palette[i].blue;
@@ -24018,37 +16851,37 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+ }
+ pinfo->pic = calloc((size_t)bufsize, (size_t)1);
+
-+ if(!pinfo->pic) {
++ if (!pinfo->pic) {
+ png_error(png_ptr, "can't allocate space for PNG image");
+ }
+
+ png_start_read_image(png_ptr);
+
-+ for(i = 0; i < pass; i++) {
++ for (i = 0; i < pass; i++) {
+ byte *p = pinfo->pic;
-+ for(j = 0; j < pinfo->h; j++) {
++ for (j = 0; j < pinfo->h; j++) {
+ png_read_row(png_ptr, p, NULL);
+ read_anything = 1;
-+ if((j & 0x1f) == 0) WaitCursor();
++ if ((j & 0x1f) == 0) WaitCursor();
+ p += linesize;
+ }
+ }
+
+ png_read_end(png_ptr, info_ptr);
+
-+ if(info_ptr->num_text > 0) {
++ if (info_ptr->num_text > 0) {
+ commentsize = 1;
+
-+ for(i = 0; i < info_ptr->num_text; i++)
++ for (i = 0; i < info_ptr->num_text; i++)
+ commentsize += strlen(info_ptr->text[i].key) + 1 +
+ info_ptr->text[i].text_length + 2;
+
-+ if((pinfo->comment = malloc(commentsize)) == NULL) {
++ if ((pinfo->comment = malloc(commentsize)) == NULL) {
+ png_warning(png_ptr,"can't allocate comment string");
+ }
+ else {
+ pinfo->comment[0] = '\0';
-+ for(i = 0; i < info_ptr->num_text; i++) {
++ for (i = 0; i < info_ptr->num_text; i++) {
+ strcat(pinfo->comment, info_ptr->text[i].key);
+ strcat(pinfo->comment, "::");
+ strcat(pinfo->comment, info_ptr->text[i].text);
@@ -24101,2240 +16934,9 @@ diff -ruN xv-3.10a-bugfixes/xvpng.c xv-3.10a-enhancements/xvpng.c
+}
+
+#endif /* HAVE_PNG */
-diff -ruN xv-3.10a-bugfixes/xvpopup.c xv-3.10a-enhancements/xvpopup.c
---- xv-3.10a-bugfixes/xvpopup.c 2004-05-16 18:04:13.000000000 -0700
-+++ xv-3.10a-enhancements/xvpopup.c 2005-04-25 08:21:34.000000000 -0700
-@@ -23,7 +23,7 @@
- #define OMIT_ICON_BITS
- #include "bits/icon" /* icon_bits[] not used, but icon_width/height are */
-
--#define PUWIDE 400
-+#define PUWIDE 480
- #define PUHIGH 170
-
- #define PAD_PUWIDE 480
-@@ -201,14 +201,14 @@
-
- if (!padHaveDooDads) {
- DCreate(&padWDial, popW, 16, puhigh-16-100-1,75,100,
-- 1, 2048, pWIDE, 10,
-+ 1.0, 2048.0, (double)pWIDE, 1.0, 10.0,
- infofg, infobg, hicol, locol, "Width", NULL);
- DCreate(&padHDial, popW, 16+1+75, puhigh-16-100-1,75,100,
-- 1, 2048, pHIGH, 10,
-+ 1.0, 2048.0, (double)pHIGH, 1.0, 10.0,
- infofg, infobg, hicol, locol, "Height", NULL);
-
- DCreate(&padODial, popW, 16+1+75+75+9, puhigh-16-100-1,75,100,
-- 0, 100, 100, 10,
-+ 0.0, 100.0, 100.0, 1.0, 10.0,
- infofg, infobg, hicol, locol, "Opaque", NULL);
-
- MBCreate(&padMthdMB, popW, 100-2+44, 10, 140, 19, NULL,
-@@ -259,9 +259,9 @@
- else if (poptyp == ISPAD) {
- BTSetActive(&bts[0], (int) strlen(gsBuf));
- i = pWIDE * 3; RANGE(i,2048,9999);
-- DSetRange(&padWDial, 1, i, padWDial.val, 10);
-+ DSetRange(&padWDial, 1.0, (double)i, padWDial.val, 1.0, 10.0);
- i = pHIGH * 3; RANGE(i,2048,9999);
-- DSetRange(&padHDial, 1, i, padHDial.val, 10);
-+ DSetRange(&padHDial, 1.0, (double)i, padHDial.val, 1.0, 10.0);
-
- DSetActive(&padWDial, (padMode!=PAD_LOAD)); /* DSetRange activates dial */
- DSetActive(&padHDial, (padMode!=PAD_LOAD));
-@@ -287,15 +287,19 @@
- /* center first button in window around mouse position, with constraint that
- window be fully on the screen */
-
-- CenterMapWindow(popW, 40 + bts[0].x, BUTTH/2 + bts[0].y, puwide, puhigh);
- popUp = poptyp;
-+ if (startGrab == 2)
-+ startGrab = 4;
-+ else {
-+ CenterMapWindow(popW, 40 + bts[0].x, BUTTH/2 + bts[0].y, puwide, puhigh);
-
-- /* MUST wait for VisibilityNotify event to come in, else we run the risk
-- of UnMapping the window *before* the Map request completed. This
-- appears to be bad, (It leaves an empty window frame up.) though it
-- generally only happens on slow servers. Better safe than screwed... */
-+ /* MUST wait for VisibilityNotify event to come in, else we run the risk
-+ of UnMapping the window *before* the Map request completed. This
-+ appears to be bad, (It leaves an empty window frame up.) though it
-+ generally only happens on slow servers. Better safe than screwed... */
-
-- XWindowEvent(theDisp, popW, VisibilityChangeMask, &event);
-+ XWindowEvent(theDisp, popW, VisibilityChangeMask, &event);
-+ }
-
- /* block until this window gets closed */
- while (popUp) {
-@@ -466,9 +470,9 @@
- changedGSBuf(); /* careful! popW doesn't exist yet! */
-
- if (padHaveDooDads) {
-- oldW = padWDial.val;
-- oldH = padHDial.val;
-- oldO = padODial.val;
-+ oldW = (int)padWDial.val;
-+ oldH = (int)padHDial.val;
-+ oldO = (int)padODial.val;
- }
- else { oldW = pWIDE; oldH = pHIGH; oldO = 100; }
-
-@@ -487,9 +491,9 @@
- }
-
- if (rv == 1) { /* cancelled: restore normal values */
-- DSetVal(&padWDial, oldW);
-- DSetVal(&padHDial, oldH);
-- DSetVal(&padODial, oldO);
-+ DSetVal(&padWDial, (double)oldW);
-+ DSetVal(&padHDial, (double)oldH);
-+ DSetVal(&padODial, (double)oldO);
- }
-
- XUnmapWindow(theDisp, padWDial.win);
-@@ -499,9 +503,9 @@
- /* load up return values */
- *pMode = padMode;
- *pStr = padBuf;
-- *pWide = padWDial.val;
-- *pHigh = padHDial.val;
-- *pOpaque = padODial.val;
-+ *pWide = (int)padWDial.val;
-+ *pHigh = (int)padHDial.val;
-+ *pOpaque = (int)padODial.val;
- *pOmode = padOMode;
-
- return rv;
-@@ -956,14 +960,14 @@
- int x,y;
- {
- int i;
-- BUTT *bp;
-+ BUTT *bp = NULL;
-
- for (i=0; i<nbts; i++) {
- bp = &bts[i];
- if (PTINRECT(x, y, bp->x, bp->y, bp->w, bp->h)) break;
- }
-
-- if (i<nbts && BTTrack(bp)) {
-+ if (i<nbts && bp && BTTrack(bp)) {
- popUp = 0; selected = i; return;
- }
-
-@@ -972,8 +976,8 @@
- else if (popUp == ISPAD) {
- if (PTINRECT(x, y, padDButt.x, padDButt.y, padDButt.w, padDButt.h)) {
- if (BTTrack(&padDButt)) {
-- DSetVal(&padWDial, pWIDE);
-- DSetVal(&padHDial, pHIGH);
-+ DSetVal(&padWDial, (double)pWIDE);
-+ DSetVal(&padHDial, (double)pHIGH);
- }
- }
-
-@@ -1105,7 +1109,7 @@
- }
-
-
-- else if (c=='\010' || c=='\177') { /* BS or DEL */
-+ else if (c=='\010') { /* BS */
- if (gsCurPos==0) return 1; /* at beginning of str */
- xvbcopy(&gsBuf[gsCurPos], &gsBuf[gsCurPos-1], (size_t) len-gsCurPos+1);
- gsCurPos--;
-@@ -1128,7 +1132,7 @@
- gsCurPos = len;
- }
-
-- else if (c=='\004') { /* ^D: delete character at gsCurPos */
-+ else if (c=='\004' || c=='\177') { /* ^D or DEL: delete character at gsCurPos */
- if (gsCurPos==len) return 1;
- xvbcopy(&gsBuf[gsCurPos+1], &gsBuf[gsCurPos], (size_t) len-gsCurPos);
- }
-diff -ruN xv-3.10a-bugfixes/xvps.c xv-3.10a-enhancements/xvps.c
---- xv-3.10a-bugfixes/xvps.c 2005-03-30 08:18:17.000000000 -0800
-+++ xv-3.10a-enhancements/xvps.c 2005-04-17 14:45:28.000000000 -0700
-@@ -142,9 +142,9 @@
- CBCreate(&encapsCB, psW, 240, 7, "preview", infofg, infobg, hicol, locol);
- CBCreate(&pscompCB, psW, 331, 7, "compress", infofg, infobg, hicol, locol);
-
-- DCreate(&xsDial, psW, 240, 30, 80, 100, 10, 800, 100, 5,
-+ DCreate(&xsDial, psW, 240, 30, 80, 100, 10.0, 800.0, 100.0, 0.5, 5.0,
- infofg, infobg, hicol, locol, "Width", "%");
-- DCreate(&ysDial, psW, 331, 30, 80, 100, 10, 800, 100, 5,
-+ DCreate(&ysDial, psW, 331, 30, 80, 100, 10.0, 800.0, 100.0, 0.5, 5.0,
- infofg, infobg, hicol, locol, "Height", "%");
- xsDial.drawobj = changedScale;
- ysDial.drawobj = changedScale;
-@@ -239,10 +239,10 @@
-
- if (rd_int("psres")) { /* xv.psres: default paper resolution */
- if (def_int >= 10 && def_int <= 720) {
-- int i = (int) ((PIX2INCH * 100) / def_int);
-+ double v = (PIX2INCH * 100) / def_int;
-
-- DSetVal(&xsDial, i);
-- DSetVal(&ysDial, i);
-+ DSetVal(&xsDial, v);
-+ DSetVal(&ysDial, v);
- }
- }
-
-@@ -839,7 +839,7 @@
- if (scx < scy) { sz_iny = h * scx; }
- else { sz_inx = w * scy; }
-
-- DSetVal(&xsDial, (int) ((100 * (sz_inx * PIX2INCH) / w) + .5));
-+ DSetVal(&xsDial, 100 * (sz_inx * PIX2INCH) / w);
- DSetVal(&ysDial, xsDial.val);
-
- sz_inx = (double) w / PIX2INCH * (xsDial.val / 100.0);
-@@ -1561,9 +1561,9 @@
- the first one is loaded (but not deleted) */
-
- #ifdef GS_PATH
-- char tmp[512], gscmd[512], cmdstr[512], tmpname[64];
-+ #define CMDSIZE 1024
-+ char tmp[512], gscmd[512], cmdstr[CMDSIZE], tmpname[64];
- int gsresult, nump, i, filetype, doalert, epsf;
-- char *rld;
- #endif
-
- pinfo->pic = (byte *) NULL;
-@@ -1596,7 +1596,7 @@
- /* build 'gscmd' string */
-
- #ifndef VMS /* VMS needs quotes around mixed case command lines */
-- sprintf(gscmd, "%s -sDEVICE=%s -r%d -q -dNOPAUSE -sOutputFile=%s%%d ",
-+ sprintf(gscmd, "%s -sDEVICE=%s -r%d -q -dSAFER -dNOPAUSE -sOutputFile=%s%%d ",
- GS_PATH, gsDev, gsRes, tmpname);
- #else
- sprintf(gscmd,
-@@ -1734,32 +1734,48 @@
-
- /******************************************************************/
- #ifdef GS_PATH
--void buildCmdStr(str, gscmd, fname, quick, epsf)
-- char *str, *gscmd, *fname;
-+void buildCmdStr(str, gscmd, xname, quick, epsf)
-+ char *str, *gscmd, *xname;
- int quick, epsf;
- {
- /* note 'epsf' set only on files that don't have a showpage cmd */
-+ char *x, *y, *fname;
-+
-+ x = (char *) malloc((5 * strlen(xname))+3);
-+ if (!x)
-+ FatalError("malloc failure in xvps.c buildCmdStr");
-+ fname = x;
-+ *x++ = 0x27;
-+
-+ for (y = xname; *y; ++y) {
-+ if (0x27 == *y) {
-+ strcpy(x, "'\"'\"'");
-+ x += strlen(x);
-+ } else *x++ = *y;
-+ }
-+ strcpy (x, "'");
-
- #ifndef VMS
-
-- if (epsf) sprintf(str, "echo '\n showpage ' | cat '%s' - | %s -",
-+ if (epsf) snprintf(str, CMDSIZE, "echo '\n showpage ' | cat %s - | %s -",
- fname, gscmd);
-
-- else if (quick) sprintf(str, "echo '%s' | cat - '%s' | %s -",
-+ else if (quick) snprintf(str, CMDSIZE, "echo %s | cat - %s | %s -",
- "/showpage { showpage quit } bind def",
- fname, gscmd);
-
-- else sprintf(str, "%s -- %s", gscmd, fname);
-+ else snprintf(str, CMDSIZE, "%s -- %s", gscmd, fname);
-
- #else /* VMS */
- /* VMS doesn't have pipes or an 'echo' command and GS doesn't like
-- Unix-style file names as input files in the VMS version */
-+ Unix-style filenames as input files in the VMS version */
- strcat(tmp, " -- ");
- rld = strrchr(fname, '/'); /* Pointer to last '/' */
- if (rld) rld++; /* Pointer to filename */
- else rld = fname; /* No path - use original string */
- strcat(tmp, rld);
- #endif /* VMS */
-+ free(fname);
- }
- #endif /* GS_PATH */
-
-diff -ruN xv-3.10a-bugfixes/xvrle.c xv-3.10a-enhancements/xvrle.c
---- xv-3.10a-bugfixes/xvrle.c 2005-03-29 23:29:14.000000000 -0800
-+++ xv-3.10a-enhancements/xvrle.c 2004-05-16 18:07:46.000000000 -0700
-@@ -43,7 +43,7 @@
- byte bgcol[256];
- byte maps[3][256];
- int xpos, ypos, w, h, flags, ncolors, pixelbits, ncmap, cmaplen;
-- int cmtlen, npixels, bufsize=0;
-+ int cmtlen;
- byte *img;
- long filesize;
- char *bname, *errstr;
-@@ -176,44 +176,32 @@
-
- errstr = NULL;
- if (ncolors == 0 || ncolors == 2)
-- errstr = "Unsupported number of channels in RLE file";
-+ errstr = "Unsupt. # of channels in RLE file.\n";
-
- if (pixelbits != 8)
-- errstr = "Only 8-bit pixels supported in RLE files";
-+ errstr = "Only 8-bit pixels supported in RLE files.\n";
-
- if (ncmap==0 || ncmap==1 || ncmap == 3 || ncmap == ncolors) { /* ok */ }
-- else errstr = "Invalid number of colormap channels in RLE file";
-+ else errstr = "Invalid # of colormap channels in RLE file.\n";
-
-- npixels = w * h;
-- if (w <= 0 || h <= 0 || npixels/w != h)
-- errstr = "RLE image dimensions out of range";
-+ if (w<1 || h<1)
-+ errstr = "Bogus size in RLE header.\n";
-
-
- if (errstr) {
- fclose(fp);
-- if (pinfo->comment)
-- free(pinfo->comment);
-- pinfo->comment = (char *) NULL;
-+ if (pinfo->comment) free(pinfo->comment); pinfo->comment = (char *) NULL;
- return rleError(bname, errstr);
- }
-
-
- /* allocate image memory */
-- if (ncolors == 1)
-- img = (byte *) calloc((size_t) npixels, (size_t) 1);
-- else {
-- bufsize = 3*npixels;
-- if (bufsize/3 != npixels)
-- return rleError(bname, "RLE image dimensions out of range");
-- img = (byte *) calloc((size_t) bufsize, (size_t) 1);
-- }
--
-+ if (ncolors == 1) img = (byte *) calloc((size_t) w * h, (size_t) 1);
-+ else img = (byte *) calloc((size_t) w * h * 3, (size_t) 1);
- if (!img) {
- fclose(fp);
-- if (pinfo->comment)
-- free(pinfo->comment);
-- pinfo->comment = (char *) NULL;
-- return rleError(bname, "Unable to allocate RLE image data");
-+ if (pinfo->comment) free(pinfo->comment); pinfo->comment = (char *) NULL;
-+ return rleError(bname, "unable to allocate image data.\n");
- }
-
-
-@@ -221,10 +209,10 @@
- if ((flags & H_CLEARFIRST) && !(flags & H_NO_BACKGROUND)) {
- byte *ip;
- if (ncolors == 1) {
-- for (i=0, ip=img; i<npixels; i++, ip++) *ip = bgcol[0];
-+ for (i=0, ip=img; i<w*h; i++, ip++) *ip = bgcol[0];
- }
- else {
-- for (i=0, ip=img; i<npixels; i++)
-+ for (i=0, ip=img; i<w*h; i++)
- for (j=0; j<3; j++, ip++) *ip = bgcol[j];
- }
- }
-@@ -242,7 +230,7 @@
- if (ncmap) {
- byte *ip;
- int imagelen, cmask;
-- imagelen = (ncolors==1) ? npixels : bufsize;
-+ imagelen = (ncolors==1) ? w*h : w*h*3;
- cmask = (cmaplen-1);
-
- if (ncmap == 1) { /* single gamma curve */
-@@ -250,7 +238,7 @@
- }
-
- else if (ncmap >= 3 && ncolors >=3) { /* one curve per band */
-- for (i=0, ip=img; i<npixels; i++) {
-+ for (i=0, ip=img; i<w*h; i++) {
- *ip = maps[0][*ip & cmask]; ip++;
- *ip = maps[1][*ip & cmask]; ip++;
- *ip = maps[2][*ip & cmask]; ip++;
-diff -ruN xv-3.10a-bugfixes/xvroot.c xv-3.10a-enhancements/xvroot.c
---- xv-3.10a-bugfixes/xvroot.c 2004-05-16 18:04:21.000000000 -0700
-+++ xv-3.10a-enhancements/xvroot.c 2004-05-16 18:07:52.000000000 -0700
-@@ -44,6 +44,7 @@
- case RM_MIRROR:
- case RM_IMIRROR: rpixw = 2*eWIDE; rpixh = 2*eHIGH; break;
- case RM_CSOLID:
-+ case RM_UPLEFT:
- case RM_CWARP:
- case RM_CBRICK: rpixw = dispWIDE; rpixh = dispHIGH; break;
-
-@@ -101,7 +102,7 @@
-
-
- else if (rmode == RM_CENTER || rmode == RM_CENTILE || rmode == RM_CSOLID ||
-- rmode == RM_CWARP || rmode == RM_CBRICK) {
-+ rmode == RM_CWARP || rmode == RM_CBRICK || rmode == RM_UPLEFT) {
- /* do some stuff to set up the border around the picture */
-
- if (rmode != RM_CENTILE) {
-@@ -138,6 +139,12 @@
-
- else if (rmode == RM_CSOLID) { }
-
-+ else if (rmode == RM_UPLEFT) {
-+
-+ XPutImage(theDisp, tmpPix, theGC, theImage, 0,0, 0,0,
-+ (u_int) eWIDE, (u_int) eHIGH);
-+ }
-+
- else if (rmode == RM_CWARP) { /* warp effect */
- XSetForeground(theDisp, theGC, rootfg);
- for (i=0; i<=dispWIDE; i+=8)
-@@ -157,7 +164,7 @@
-
-
- /* draw the image centered on top of the background */
-- if (rmode != RM_CENTILE)
-+ if ((rmode != RM_CENTILE) && (rmode != RM_UPLEFT))
- XPutImage(theDisp, tmpPix, theGC, theImage, 0,0,
- ((int) dispWIDE-eWIDE)/2, ((int) dispHIGH-eHIGH)/2,
- (u_int) eWIDE, (u_int) eHIGH);
-diff -ruN xv-3.10a-bugfixes/xvsmooth.c xv-3.10a-enhancements/xvsmooth.c
---- xv-3.10a-bugfixes/xvsmooth.c 2004-05-16 18:04:28.000000000 -0700
-+++ xv-3.10a-enhancements/xvsmooth.c 2004-05-16 18:07:59.000000000 -0700
-@@ -105,7 +105,7 @@
- /* we can save a lot of time by precomputing cxtab[] and pxtab[], both
- dwide arrays of ints that contain values for the equations:
- cx = (ex * swide) / dwide;
-- px = ((ex * swide * 100) / dwide) - (cx * 100) - 50; */
-+ px = ((ex * swide * 128) / dwide) - (cx * 128) - 64; */
-
- cxtab = (int *) malloc(dwide * sizeof(int));
- if (!cxtab) { free(pic24); return NULL; }
-@@ -115,8 +115,8 @@
-
- for (ex=0; ex<dwide; ex++) {
- cxtab[ex] = (ex * swide) / dwide;
-- pxtab[ex] = (((ex * swide)* 100) / dwide)
-- - (cxtab[ex] * 100) - 50;
-+ pxtab[ex] = (((ex * swide)* 128) / dwide)
-+ - (cxtab[ex] * 128) - 64;
- }
-
- for (ey=0; ey<dhigh; ey++) {
-@@ -125,7 +125,7 @@
- ProgressMeter(0, (dhigh)-1, ey, "Smooth");
-
- cy = (ey * shigh) / dhigh;
-- py = (((ey * shigh) * 100) / dhigh) - (cy * 100) - 50;
-+ py = (((ey * shigh) * 128) / dhigh) - (cy * 128) - 64;
- if (py<0) { y1 = cy-1; if (y1<0) y1=0; }
- else { y1 = cy+1; if (y1>shigh-1) y1=shigh-1; }
-
-@@ -172,30 +172,30 @@
- else {
- /* compute weighting factors */
- apx = abs(px); apy = abs(py);
-- pA = (apx * apy) / 100;
-- pB = (apy * (100 - apx)) / 100;
-- pC = (apx * (100 - apy)) / 100;
-- pD = 100 - (pA + pB + pC);
-+ pA = (apx * apy) >> 7; /* div 128 */
-+ pB = (apy * (128 - apx)) >> 7; /* div 128 */
-+ pC = (apx * (128 - apy)) >> 7; /* div 128 */
-+ pD = 128 - (pA + pB + pC);
-
- if (is24) {
-- *pp++ = ((int) (pA * rA))/100 + ((int) (pB * rB))/100 +
-- ((int) (pC * rC))/100 + ((int) (pD * rD))/100;
-+ *pp++ = (((int) (pA * rA))>>7) + (((int) (pB * rB))>>7) +
-+ (((int) (pC * rC))>>7) + (((int) (pD * rD))>>7);
-
-- *pp++ = ((int) (pA * gA))/100 + ((int) (pB * gB))/100 +
-- ((int) (pC * gC))/100 + ((int) (pD * gD))/100;
-+ *pp++ = (((int) (pA * gA))>>7) + (((int) (pB * gB))>>7) +
-+ (((int) (pC * gC))>>7) + (((int) (pD * gD))>>7);
-
-- *pp++ = ((int) (pA * bA))/100 + ((int) (pB * bB))/100 +
-- ((int) (pC * bC))/100 + ((int) (pD * bD))/100;
-+ *pp++ = (((int) (pA * bA))>>7) + (((int) (pB * bB))>>7) +
-+ (((int) (pC * bC))>>7) + (((int) (pD * bD))>>7);
- }
- else { /* 8-bit pic */
-- *pp++ = ((int) (pA * rmap[cA]))/100 + ((int)(pB * rmap[cB]))/100 +
-- ((int) (pC * rmap[cC]))/100 + ((int)(pD * rmap[cD]))/100;
-+ *pp++ = (((int)(pA * rmap[cA]))>>7) + (((int)(pB * rmap[cB]))>>7) +
-+ (((int)(pC * rmap[cC]))>>7) + (((int)(pD * rmap[cD]))>>7);
-
-- *pp++ = ((int) (pA * gmap[cA]))/100 + ((int)(pB * gmap[cB]))/100 +
-- ((int) (pC * gmap[cC]))/100 + ((int)(pD * gmap[cD]))/100;
-+ *pp++ = (((int)(pA * gmap[cA]))>>7) + (((int)(pB * gmap[cB]))>>7) +
-+ (((int)(pC * gmap[cC]))>>7) + (((int)(pD * gmap[cD]))>>7);
-
-- *pp++ = ((int)(pA * bmap[cA]))/100 + ((int)(pB * bmap[cB]))/100 +
-- ((int)(pC * bmap[cC]))/100 + ((int)(pD * bmap[cD]))/100;
-+ *pp++ = (((int)(pA * bmap[cA]))>>7) + (((int)(pB * bmap[cB]))>>7) +
-+ (((int)(pC * bmap[cC]))>>7) + (((int)(pD * bmap[cD]))>>7);
- }
- }
- }
-diff -ruN xv-3.10a-bugfixes/xvtext.c xv-3.10a-enhancements/xvtext.c
---- xv-3.10a-bugfixes/xvtext.c 2004-05-16 18:04:38.000000000 -0700
-+++ xv-3.10a-enhancements/xvtext.c 2005-05-01 13:04:23.000000000 -0700
-@@ -19,9 +19,13 @@
- #include "copyright.h"
-
- #include "xv.h"
-+#ifdef TV_MULTILINGUAL
-+#include "xvml.h"
-+#endif
-
--
--#define BUTTW 80
-+#define BUTTW1 80
-+#define BUTTW2 60
-+#define BUTTW3 110
- #define BUTTH 24
-
- #define TOPMARGIN 30 /* from top of window to top of text window */
-@@ -36,11 +40,28 @@
- #define TV_ASCII 0
- #define TV_HEX 1
- #define TV_CLOSE 2
--#define TV_NBUTTS 3
-
-+#define TV_E_NBUTTS 3
-+
-+#ifdef TV_L10N
-+# define TV_RESCAN 3
-+# define TV_USASCII 4
-+# define TV_JIS 5
-+# define TV_EUCJ 6
-+# define TV_MSCODE 7
-+
-+# define TV_J_NBUTTS 8
-+#endif
-
- #define TITLELEN 128
-
-+#ifdef TV_MULTILINGUAL
-+struct coding_spec {
-+ struct coding_system coding_system;
-+ char *(*converter)PARM((char *, int, int *));
-+};
-+#endif
-+
- /* data needed per text window */
- typedef struct { Window win, textW;
- int vis, wasvis;
-@@ -57,16 +78,89 @@
- int chwide, chhigh; /* size of textW, in chars */
- int hexmode; /* true if disp Hex, else Ascii */
- SCRL vscrl, hscrl;
-- BUTT but[TV_NBUTTS], nopBut;
-+#ifdef TV_L10N
-+ int code; /* current character code */
-+ BUTT but[TV_J_NBUTTS], nopBut;
-+#else
-+ BUTT but[TV_E_NBUTTS], nopBut;
-+#endif
-+#ifdef TV_MULTILINGUAL
-+/* int codeset; */
-+ struct coding_spec ccs; /* current coding_spec */
-+ BUTT csbut;
-+ char *cv_text;
-+ int cv_len;
-+ struct context *ctx;
-+ struct ml_text *txt;
-+ struct csinfo_t *cs;
-+#endif
- } TVINFO;
-
-
- static TVINFO tinfo[MAXTVWIN];
- static int hasBeenSized = 0;
- static int haveWindows = 0;
-+static int nbutts; /* # of buttons */
- static int mfwide, mfhigh, mfascent; /* size of chars in mono font */
- static int *event_retP, *event_doneP; /* used in tvChkEvent() */
--
-+#ifdef TV_MULTILINGUAL
-+# define TV_PLAIN 0
-+# define TV_ISO_8859_1 1
-+# define TV_ISO_2022_JP 2
-+# define TV_EUC_JAPAN 3
-+# define TV_ISO_2022_INT_1 4
-+# define TV_ISO_2022_KR 5
-+# define TV_EUC_KOREA 6
-+# define TV_ISO_2022_SS2_8 7
-+# define TV_ISO_2022_SS2_7 8
-+# define TV_SHIFT_JIS 9
-+# define TV_NCSS 10
-+static char *codeSetNames[TV_NCSS] = {
-+ "plain",
-+ "iso-8859-1",
-+ "iso-2022-jp",
-+ "euc-japan",
-+ "iso-2022-int-1",
-+ "iso-2022-kr",
-+ "euc-korea",
-+ "iso-2022-ss2-8",
-+ "iso-2022-ss2-7",
-+ "Shift JIS",
-+};
-+static struct coding_spec coding_spec[TV_NCSS] = {
-+ /* --- G0 --- --- G1 --- --- G2 --- --- G3 --- GL GR EOL SF LS */
-+ /* plain */
-+ {{{{ 1,94,'B'}, { 1,94,'B'}, { 1,94,'B'}, { 1,94,'B'}}, 0, 0, 0, 1, 1},
-+ NULL},
-+ /* iso-8859-1 */
-+ {{{{ 1,94,'B'}, { 1,96,'A'}, {-1,94,'B'}, {-1,94,'B'}}, 0, 1, 0, 0, 0},
-+ NULL},
-+ /* iso-2022-jp */
-+ {{{{ 1,94,'B'}, {-1,94,'B'}, {-1,94,'B'}, {-1,94,'B'}}, 0, 0, 0, 1, 0},
-+ NULL},
-+ /* euc-japan */
-+ {{{{ 1,94,'B'}, { 2,94,'B'}, { 1,94,'J'}, { 2,94,'D'}}, 0, 1, 0, 1, 0},
-+ NULL},
-+ /* iso-2022-int-1 */
-+ {{{{ 1,94,'B'}, { 2,94,'C'}, {-1,94,'B'}, {-1,94,'B'}}, 0, 1, 0, 1, 1},
-+ NULL},
-+ /* iso-2022-kr */
-+ {{{{ 1,94,'B'}, { 2,94,'C'}, {-1,94,'B'}, {-1,94,'B'}}, 0, 1, 0, 0, 1},
-+ NULL},
-+ /* euc-korea */
-+ {{{{ 1,94,'B'}, { 2,94,'C'}, {-1,94,'B'}, {-1,94,'B'}}, 0, 1, 0, 0, 0},
-+ NULL},
-+ /* iso-2022-ss2-8 */
-+ {{{{ 1,94,'B'}, {-1,94,'C'}, { 0,94,'B'}, {-1,94,'B'}}, 0, 1, 0, 0, 0},
-+ NULL},
-+ /* iso-2022-ss2-7 */
-+ {{{{ 1,94,'B'}, {-1,94,'C'}, { 0,94,'B'}, {-1,94,'B'}}, 0, 1, 0, 1, 0},
-+ NULL},
-+ /* shift jis */
-+ {{{{ 1,94,'B'}, { 2,94,'B'}, { 1,94,'J'}, { 2,94,'D'}}, 0, 1, 1, 1, 0},
-+ sjis_to_jis},
-+};
-+#endif
-
- static void closeText PARM((TVINFO *));
- static int tvChkEvent PARM((TVINFO *, XEvent *));
-@@ -82,7 +176,15 @@
- static void textKey PARM((TVINFO *, int));
- static void doHexAsciiCmd PARM((TVINFO *, int));
- static void computeText PARM((TVINFO *));
--
-+#ifdef TV_L10N
-+static int selectCodeset PARM((TVINFO *));
-+#endif
-+#ifdef TV_MULTILINGUAL
-+static void setCodingSpec PARM((TVINFO *, struct coding_spec *));
-+static void createCsWins PARM((char *));
-+static void openCsWin PARM((TVINFO *));
-+static void closeCsWin PARM((TVINFO *));
-+#endif
-
- /* HEXMODE output looks like this:
- 0x00000000: 00 11 22 33 44 55 66 77 - 88 99 aa bb cc dd ee ff 0123456789abcdef
-@@ -98,12 +200,51 @@
- XSizeHints hints;
- XSetWindowAttributes xswa;
- TVINFO *tv;
-+#ifdef TV_MULTILINGUAL
-+ int default_codeset;
-+#endif
-
-+#ifdef TV_L10N
-+ if (!xlocale) {
-+#endif
-+ mfwide = monofinfo->max_bounds.width;
-+ mfhigh = monofinfo->ascent + monofinfo->descent;
-+ mfascent = monofinfo->ascent;
-
-- mfwide = monofinfo->max_bounds.width;
-- mfhigh = monofinfo->ascent + monofinfo->descent;
-- mfascent = monofinfo->ascent;
-+ nbutts = TV_E_NBUTTS; /* # of buttons */
-+#ifdef TV_L10N
-+ }
-+ else {
-+ mfwide = monofsetinfo->max_logical_extent.width / 2; /* shit! */
-+ mfhigh = monofsetinfo->max_logical_extent.height + 1;
-+ mfascent = mfhigh;
-+
-+ nbutts = TV_J_NBUTTS; /* # of buttons */
-+ }
-+#endif
-
-+#ifdef TV_MULTILINGUAL
-+ {
-+ char *dc = XGetDefault(theDisp, "xv", "codeSet");
-+ if (dc == NULL)
-+ default_codeset = TV_DEFAULT_CODESET;
-+ else {
-+ for (i = 0; i < TV_NCSS; i++) {
-+ if (strcmp(dc, codeSetNames[i]) == 0)
-+ break;
-+ }
-+ if (i >= TV_NCSS) {
-+ if (strcmp(dc, "iso-2022") == 0)
-+ default_codeset = TV_PLAIN;
-+ else {
-+ SetISTR(ISTR_WARNING, "%s: unknown codeset.", dc);
-+ default_codeset = TV_PLAIN;
-+ }
-+ } else
-+ default_codeset = i;
-+ }
-+ }
-+#endif
- /* compute default size of textview windows. should be big enough to
- hold an 80x24 text window */
-
-@@ -118,6 +259,14 @@
- for (i=0; i<MAXTVWIN; i++) {
- tv = &tinfo[i];
-
-+#ifdef TV_MULTILINGUAL
-+ tv->ctx = ml_create_context(ScreenOfDisplay(theDisp, theScreen));
-+ tv->txt = NULL;
-+ tv->cv_text = NULL;
-+ tv->cv_len = 0;
-+ ml_set_charsets(tv->ctx, &coding_spec[TV_PLAIN].coding_system);
-+#endif
-+
- tv->win = CreateWindow((i<CMTWIN) ? "xv text viewer" : "xv image comments",
- "XVtextview",
- (i<CMTWIN) ? geom : cmtgeom,
-@@ -162,24 +311,56 @@
- XSelectInput(theDisp, tv->textW, ExposureMask | ButtonPressMask);
-
-
-- BTCreate(&(tv->but[TV_ASCII]), tv->win, 0,0,BUTTW,BUTTH,
-+ BTCreate(&(tv->but[TV_ASCII]), tv->win, 0,0,BUTTW1,BUTTH,
- "Ascii",infofg,infobg,hicol,locol);
-- BTCreate(&(tv->but[TV_HEX]), tv->win, 0,0,BUTTW,BUTTH,
-+ BTCreate(&(tv->but[TV_HEX]), tv->win, 0,0,BUTTW1,BUTTH,
- "Hex",infofg,infobg,hicol,locol);
-- BTCreate(&(tv->but[TV_CLOSE]), tv->win, 0,0,BUTTW,BUTTH,
-+ BTCreate(&(tv->but[TV_CLOSE]), tv->win, 0,0,BUTTW1,BUTTH,
- "Close",infofg,infobg,hicol,locol);
-
-+#ifdef TV_L10N
-+ if (xlocale) {
-+ BTCreate(&(tv->but[TV_RESCAN]), tv->win, 0,0,BUTTW2,BUTTH,
-+ "RESCAN",infofg,infobg,hicol,locol);
-+ BTCreate(&(tv->but[TV_USASCII]), tv->win, 0,0,BUTTW2,BUTTH,
-+ "ASCII",infofg,infobg,hicol,locol);
-+ BTCreate(&(tv->but[TV_JIS]), tv->win, 0,0,BUTTW2,BUTTH,
-+ "JIS",infofg,infobg,hicol,locol);
-+ BTCreate(&(tv->but[TV_EUCJ]), tv->win, 0,0,BUTTW2,BUTTH,
-+ "EUC-j",infofg,infobg,hicol,locol);
-+ BTCreate(&(tv->but[TV_MSCODE]), tv->win, 0,0,BUTTW2,BUTTH,
-+ "MS Kanji",infofg,infobg,hicol,locol);
-+ }
-+#endif
-+
- BTCreate(&(tv->nopBut), tv->win, 0,0, (u_int) tv->vscrl.tsize+1,
- (u_int) tv->vscrl.tsize+1, "", infofg, infobg, hicol, locol);
- tv->nopBut.active = 0;
-
- XMapSubwindows(theDisp, tv->win);
-
-+#ifdef TV_MULTILINGUAL
-+ BTCreate(&tv->csbut, tv->win, 0, 0, BUTTW1, BUTTH, "Code Sets",
-+ infofg, infobg, hicol, locol);
-+#endif
-+
- tv->text = (char *) NULL;
- tv->textlen = 0;
- tv->title[0] = '\0';
-+#ifdef TV_L10N
-+ tv->code = (xlocale ? LOCALE_DEFAULT : 0);
-+#endif
-+#ifdef TV_MULTILINGUAL
-+ tv->ccs = coding_spec[default_codeset];
-+#endif
- }
--
-+#ifdef TV_MULTILINGUAL
-+ get_monofont_size(&mfwide, &mfhigh);
-+ /* recalculate sizes. */
-+ defwide = 80 * mfwide + 2*LRMARGINS + 8 + 20; /* -ish */
-+ defhigh = 24 * mfhigh + TOPMARGIN + BOTMARGIN + 8 + 20; /* ish */
-+ cmthigh = 6 * mfhigh + TOPMARGIN + BOTMARGIN + 8 + 20; /* ish */
-+#endif
-
- for (i=0; i<MAXTVWIN; i++) {
- resizeText(&tinfo[i], defwide, (i<CMTWIN) ? defhigh : cmthigh);
-@@ -190,44 +371,54 @@
-
- hasBeenSized = 1; /* we can now start looking at textview events */
-
-+#ifdef TV_MULTILINGUAL
-+ createCsWins("+100+100");
-+#endif
- }
-
-
- /***************************************************************/
--void TextView(fname)
-+int TextView(fname)
- char *fname;
- {
- /* given a filename, attempts to read in the file and open a textview win */
-
-+ int filetype;
- long textlen;
- char *text, buf[512], title[128], rfname[MAXPATHLEN+1];
- char *basefname[128]; /* just current fname, no path */
- FILE *fp;
-+ char filename[MAXPATHLEN+1];
-+
-+ strncpy(filename, fname, sizeof(filename) - 1);
-+#ifdef AUTO_EXPAND
-+ Mkvdir(filename);
-+ Dirtovd(filename);
-+#endif
-
- basefname[0] = '\0';
-- strcpy(rfname, fname);
-+ strncpy(rfname, filename, sizeof(rfname) - 1);
-
- /* see if this file is compressed. if it is, uncompress it, and view
- the uncompressed version */
-
-- if (ReadFileType(fname) == RFT_COMPRESS) {
-+ filetype = ReadFileType(filename);
-+ if ((filetype == RFT_COMPRESS) || (filetype == RFT_BZIP2)) {
- #ifndef VMS
-- if (!UncompressFile(fname, rfname)) return; /* failed to uncompress */
-+ if (!UncompressFile(filename, rfname, filetype)) return FALSE;
- #else
- /* chop off trailing '.Z' from friendly displayed basefname, if any */
-- strcpy (basefname, fname);
-+ strncpy (basefname, filename, 128 - 1);
- *rindex (basefname, '.') = '\0';
-- if (!UncompressFile(basefname, rfname)) return;/* failed to uncompress */
-+ if (!UncompressFile(basefname, rfname, filetype)) return FALSE;
- #endif
- }
-
--
--
- fp = fopen(rfname, "r");
- if (!fp) {
- sprintf(buf,"Couldn't open '%s': %s", rfname, ERRSTR(errno));
- ErrPopUp(buf,"\nOh well");
-- return;
-+ return FALSE;
- }
-
-
-@@ -239,16 +430,16 @@
- sprintf(buf, "File '%s' contains no data. (Zero length file.)", rfname);
- ErrPopUp(buf, "\nOk");
- fclose(fp);
-- return;
-+ return FALSE;
- }
-
-- text = (char *) malloc((size_t) textlen);
-+ text = (char *) malloc((size_t) textlen + 1);
- if (!text) {
- sprintf(buf, "Couldn't malloc %ld bytes to read file '%s'",
- textlen, rfname);
- ErrPopUp(buf, "\nSo what!");
- fclose(fp);
-- return;
-+ return FALSE;
- }
-
- if (fread(text, (size_t) 1, (size_t) textlen, fp) != textlen) {
-@@ -256,6 +447,9 @@
- rfname);
- ErrPopUp(buf, "\nHmm...");
- }
-+#ifdef TV_MULTILINGUAL
-+ text[textlen] = '\0';
-+#endif
-
- fclose(fp);
-
-@@ -263,6 +457,7 @@
- OpenTextView(text, (int) textlen, title, 1);
-
- /* note: text gets freed when window gets closed */
-+ return TRUE;
- }
-
-
-@@ -504,6 +699,10 @@
- tv->text = (char *) NULL;
- tv->lines = (char **) NULL;
- tv->numlines = tv->textlen = tv->hexmode = 0;
-+
-+#ifdef TV_MULTILINGUAL
-+ closeCsWin(tv);
-+#endif
- }
-
-
-@@ -591,6 +790,40 @@
- else if (e->window == tv->textW) { }
- else rv = 0;
- }
-+ else if (e->button == Button4) { /* note min vs. max, + vs. - */
-+ /* scroll regardless of where we are in the text window */
-+ if (e->window == tv->win ||
-+ e->window == tv->vscrl.win ||
-+ e->window == tv->hscrl.win ||
-+ e->window == tv->textW)
-+ {
-+ SCRL *sp=&(tv->vscrl);
-+ int halfpage=sp->page/2;
-+
-+ if (sp->val > sp->min+halfpage)
-+ SCSetVal(sp,sp->val-halfpage);
-+ else
-+ SCSetVal(sp,sp->min);
-+ }
-+ else rv = 0;
-+ }
-+ else if (e->button == Button5) { /* note max vs. min, - vs. + */
-+ /* scroll regardless of where we are in the text window */
-+ if (e->window == tv->win ||
-+ e->window == tv->vscrl.win ||
-+ e->window == tv->hscrl.win ||
-+ e->window == tv->textW)
-+ {
-+ SCRL *sp=&(tv->vscrl);
-+ int halfpage=sp->page/2;
-+
-+ if (sp->val < sp->max-halfpage)
-+ SCSetVal(sp,sp->val+halfpage);
-+ else
-+ SCSetVal(sp,sp->max);
-+ }
-+ else rv = 0;
-+ }
- else rv = 0;
- }
-
-@@ -633,7 +866,9 @@
- int i, maxw, maxh;
- XSizeHints hints;
-
-+#ifndef TV_MULTILINGUAL
- if (tv->wide == w && tv->high == h) return; /* no change in size */
-+#endif
-
- if (XGetNormalHints(theDisp, tv->win, &hints)) {
- hints.width = w;
-@@ -657,10 +892,23 @@
- XMoveResizeWindow(theDisp, tv->textW, LRMARGINS, TOPMARGIN,
- (u_int) tv->twWide, (u_int) tv->twHigh);
-
-- for (i=0; i<TV_NBUTTS; i++) {
-- tv->but[i].x = tv->wide - (TV_NBUTTS-i) * (BUTTW+5);
-+ for (i=0; i<TV_E_NBUTTS; i++) {
-+ tv->but[i].x = tv->wide - (TV_E_NBUTTS-i) * (BUTTW1+5);
- tv->but[i].y = tv->high - BUTTH - 5;
- }
-+#ifdef TV_MULTILINGUAL
-+ tv->csbut.x = 5;
-+ tv->csbut.y = tv->high - BUTTH - 5;
-+#endif
-+
-+#ifdef TV_L10N
-+ if (xlocale) {
-+ for (; i<TV_J_NBUTTS; i++) {
-+ tv->but[i].x = 5 + (i-TV_E_NBUTTS) * (BUTTW2+5);
-+ tv->but[i].y = tv->high - BUTTH - 5;
-+ }
-+ }
-+#endif
-
- computeScrlVals(tv);
-
-@@ -711,6 +959,29 @@
- case TV_CLOSE: if (tv == &tinfo[CMTWIN]) CloseCommentText();
- else closeText(tv);
- break;
-+
-+#ifdef TV_L10N
-+ case TV_RESCAN:
-+ tv->code = selectCodeset(tv);
-+ drawTextW(0, &tv->vscrl);
-+ break;
-+ case TV_USASCII:
-+ tv->code = LOCALE_USASCII;
-+ drawTextW(0, &tv->vscrl);
-+ break;
-+ case TV_JIS:
-+ tv->code = LOCALE_JIS;
-+ drawTextW(0, &tv->vscrl);
-+ break;
-+ case TV_EUCJ:
-+ tv->code = LOCALE_EUCJ;
-+ drawTextW(0, &tv->vscrl);
-+ break;
-+ case TV_MSCODE:
-+ tv->code = LOCALE_MSCODE;
-+ drawTextW(0, &tv->vscrl);
-+ break;
-+#endif /* TV_L10N */
- }
- }
-
-@@ -745,8 +1016,10 @@
- drawNumLines(tv);
-
- /* draw the buttons */
-- for (i=0; i<TV_NBUTTS; i++) BTRedraw(&(tv->but[i]));
--
-+ for (i=0; i<nbutts; i++) BTRedraw(&(tv->but[i]));
-+#ifdef TV_MULTILINGUAL
-+ BTRedraw(&tv->csbut);
-+#endif
- BTRedraw(&tv->nopBut);
- }
-
-@@ -816,7 +1089,14 @@
- int delta;
- SCRL *sptr;
- {
-- int i, j, lnum, hpos, cpos, extrach, lwide;
-+ int i, j, lnum, hpos, vpos, cpos, lwide;
-+#ifndef TV_MULTILINGUAL
-+ int extrach;
-+#endif
-+#ifdef TV_L10N
-+ int desig_stat; /* for ISO 2022-JP */
-+ /* 0: ASCII, 1: JIS X 0208, 2: GL is JIS X 0201 kana */
-+#endif
- TVINFO *tv;
- char linestr[512];
- u_char *sp, *ep, *lp;
-@@ -839,12 +1119,38 @@
- XSetFont(theDisp, theGC, monofont);
-
- hpos = tv->hscrl.val;
-+ vpos = tv->vscrl.val;
- lwide = (tv->chwide < 500) ? tv->chwide : 500;
-
- /* draw text */
- if (!tv->hexmode) { /* ASCII mode */
-+#ifdef TV_MULTILINGUAL
-+ XClearArea(theDisp, tv->textW, 0, 0,
-+ (u_int) tv->twWide, (u_int) tv->twHigh, False);
-+ if(tv->txt == NULL)
-+ return;
-+ else {
-+ int i;
-+ int y;
-+ struct ml_text *tp = tv->txt;
-+ struct ml_line *lp;
-+
-+ XSetFunction(theDisp, theGC, GXcopy);
-+ XSetClipMask(theDisp, theGC, None);
-+ y = 3;
-+ for (lp = &tp->lines[vpos], i = tp->nlines - vpos;
-+ i > 0; lp++, i--) {
-+ XDrawText16(theDisp, tv->textW, theGC,
-+ -mfwide * hpos + 3, y + lp->ascent,
-+ lp->items, lp->nitems);
-+ y += lp->ascent + lp->descent;
-+ if (y > tv->twHigh)
-+ break;
-+ }
-+ }
-+#else
- for (i=0; i<tv->chhigh; i++) { /* draw each line */
-- lnum = i + tv->vscrl.val;
-+ lnum = i + vpos;
- if (lnum < tv->numlines-1) {
-
- /* find start of displayed portion of line. This is *wildly*
-@@ -865,7 +1171,13 @@
- cpos--; sp++;
- }
- else if (*sp < 32) extrach = 1;
-+
-+#ifdef TV_L10N
-+ else if (!tv->code && *sp > 127) extrach = 3;
-+#else
- else if (*sp > 127) extrach = 3;
-+#endif
-+
- else sp++;
- }
- else {
-@@ -881,6 +1193,10 @@
-
- /* build up the linestr buffer, which is the current line, padded
- with blanks to a width of exactly tv->chwide chars */
-+#ifdef TV_L10N
-+ desig_stat = 0; /* for ISO 2022-JP */
-+ /* 0: ASCII, 1: JIS X 0208, 2: GL is JIS X 0201 kana */
-+#endif
- for (cpos=0, lp=(byte *) linestr; cpos<lwide; cpos++, lp++) {
- if (sp>=ep) *lp = ' ';
- else {
-@@ -894,13 +1210,117 @@
- cpos--; lp--; sp++;
- }
-
-+#ifdef TV_L10N
-+ else if (*sp < 32 && !(tv->code == LOCALE_JIS && *sp == 0x1b)) {
-+#else
- else if (*sp < 32) {
-+#endif
- if (!extrach) extrach = 2;
- if (extrach == 2) *lp = '^';
- else if (extrach == 1) *lp = *sp + 64;
- }
-
-+#ifdef TV_L10N
-+ /* convert to EUC-Japan */
-+ else if (tv->code == LOCALE_JIS) {
-+ if (*sp == 0x1b) { /* ESC */
-+ if (*(sp+1) == '$') {
-+ if (*(sp+2) == 'B' || *(sp+2) == 'A' || *(sp+2) == '@') {
-+ /* ESC $ B, ESC $ A, ESC $ @ */
-+ desig_stat = 1;
-+ sp += 3; cpos--; lp--;
-+ }
-+ else if (*(sp+2) == '(' && *(sp+3) == 'B') {
-+ /* ESC $ ( B */
-+ desig_stat = 1;
-+ sp += 4; cpos--; lp--;
-+ }
-+ }
-+ else if (*(sp+1) == '(') {
-+ if (*(sp+2) == 'B' || *(sp+2) == 'J' || *(sp+2) == 'H') {
-+ /* ESC ( B, ESC ( J, ESC ( H */
-+ desig_stat = 0;
-+ sp += 3; cpos--; lp--;
-+ }
-+ else if (*(sp+2) == 'I') {
-+ /* ESC ( I */
-+ desig_stat = 2;
-+ sp += 3; cpos--; lp--;
-+ }
-+ }
-+ else if (*(sp+1) == ')' && *(sp+2) == 'I') {
-+ /* ESC ) I */
-+ desig_stat = 2;
-+ sp += 3; cpos--; lp--;
-+ }
-+ else { /* error */
-+ *lp = ' '; sp++;
-+ }
-+ }
-+
-+ else {
-+ switch (desig_stat) {
-+ case 0: /* ASCII */
-+ *lp = *sp++;
-+ break;
-+ case 1: /* JIS X 0208 */
-+ *lp++ = *sp++ | 0x80;
-+ *lp = *sp++ | 0x80;
-+ cpos++;
-+ break;
-+ case 2: /* JIS X 0201 kana */
-+#if defined(__osf__) && !defined(X_LOCALE)
-+ *lp = '='; sp++;
-+#else
-+ *lp++ = 0x8e; /* ^N | 0x80 */
-+ *lp = *sp++ | 0x80;
-+#endif
-+ break;
-+ default: /* error */
-+ *lp = *sp++;
-+ break;
-+ }
-+ }
-+ }
-+
-+ else if (tv->code == LOCALE_MSCODE) {
-+ if ((*sp >= 0x81 && *sp <= 0x9f)
-+ || (*sp >= 0xe0 && *sp <= 0xef)) {
-+ static u_char c1, c2;
-+
-+/*fprintf(stderr, "(%x,%x)->", *sp, *(sp+1));*/
-+ c1 = ((*sp - ((*sp>=0xe0) ? 0xb0 : 0x70)) << 1)
-+ - ((*(sp+1)<=0x9e) ? 1 : 0);
-+ c2 = *(sp+1);
-+ if (c2 >= 0x9f) c2 -= 0x7e; /* 0x9F - 0xFC */
-+ else if (c2 >= 0x80) c2 -= 0x20; /* 0x80 - 0x9E */
-+ else c2 -= 0x1f; /* 0x40 - 0x7E */
-+
-+ *lp++ = c1 | 0x80;
-+ *lp = c2 | 0x80;
-+ sp += 2;
-+/*fprintf(stderr, "(%x %x) ", c1 | 0x80, c2 | 0x80);*/
-+ cpos++;
-+ }
-+
-+ else if (*sp >= 0xa1 && *sp <= 0xdf) { /* JIS X 0201 kana */
-+#if defined(__osf__) && !defined(X_LOCALE)
-+ *lp = '='; sp++;
-+#else
-+ *lp++ = 0x8e; /* ^N | 0x80 */
-+ *lp = *sp++;
-+#endif
-+ }
-+
-+ else *lp = *sp++;
-+ }
-+#endif /* TV_L10N */
-+
-+#ifdef TV_L10N
-+ else if (!tv->code && *sp > 127) {
-+#else
- else if (*sp > 127) {
-+#endif
- if (!extrach) extrach = 4;
- if (extrach == 4) *lp = '\\';
- else if (extrach == 3) *lp = ((u_char)(*sp & 0700) >> 6) + '0';
-@@ -916,6 +1336,9 @@
- }
- }
- }
-+#ifdef TV_L10N
-+ *lp = '\0'; /* terminate linestr */
-+#endif
- }
-
- else { /* below bottom of file. Just build a blank str */
-@@ -923,15 +1346,22 @@
- }
-
- /* draw the line */
-- XDrawImageString(theDisp, tv->textW, theGC,
-- 3, i*mfhigh + 3 + mfascent, linestr, lwide);
-+#ifdef TV_L10N
-+ if (xlocale)
-+ XmbDrawImageString(theDisp, tv->textW, monofset, theGC,
-+ 3, i*mfhigh + 1 + mfascent, linestr, strlen(linestr));
-+ else
-+#endif
-+ XDrawImageString(theDisp, tv->textW, theGC,
-+ 3, i*mfhigh + 3 + mfascent, linestr, lwide);
- } /* for i ... */
-+#endif /* TV_MULTILINGUAL */
- } /* if hexmode */
-
-
- else { /* HEX MODE */
- for (i=0; i<tv->chhigh; i++) { /* draw each line */
-- lnum = i + tv->vscrl.val;
-+ lnum = i + vpos;
- if (lnum < tv->hexlines) {
-
- char hexstr[80], tmpstr[16];
-@@ -957,7 +1387,11 @@
-
- for (j=0; j<16; j++) {
- if (sp+j < ep) {
-+#ifdef TV_L10N
-+ if (sp[j] >= 32 && (sp[j] <= 127 || tv->code)) *lp++ = sp[j];
-+#else
- if (sp[j] >= 32 && sp[j] <= 127) *lp++ = sp[j];
-+#endif
- else *lp++ = '.';
- }
- else *lp++ = ' ';
-@@ -1005,14 +1439,21 @@
- int i;
- BUTT *bp;
-
-- for (i=0, bp=tv->but; i<TV_NBUTTS; i++, bp++) {
-+ for (i=0, bp=tv->but; i<nbutts; i++, bp++) {
- if (PTINRECT(x,y,bp->x,bp->y,bp->w,bp->h)) break;
- }
-
-- if (i<TV_NBUTTS) {
-+ if (i<nbutts) {
- if (BTTrack(bp)) doCmd(tv, i);
- return;
- }
-+
-+#ifdef TV_MULTILINGUAL
-+ if (PTINRECT(x, y, tv->csbut.x, tv->csbut.y, tv->csbut.w, tv->csbut.h)) {
-+ if (BTTrack(&tv->csbut))
-+ openCsWin(tv);
-+ }
-+#endif
- }
-
-
-@@ -1042,13 +1483,38 @@
-
- /* keyboard equivalents */
- switch (buf[0]) {
-- case '\001': doCmd(tv, TV_ASCII); break; /* ^A = Ascii */
-- case '\010': doCmd(tv, TV_HEX); break; /* ^H = Hex */
--
-- case '\033': doCmd(tv, TV_CLOSE); break; /* ESC = Close window */
-+ case '\001': case 'a': case 'A':
-+ doCmd(tv, TV_ASCII); break; /* ^A = Ascii */
-+ case '\010': case 'h': case 'H':
-+ doCmd(tv, TV_HEX); break; /* ^H = Hex */
-+
-+ case '\021': case 'q': case 'Q':
-+ case '\003': case 'c': case 'C':
-+ case '\033':
-+ doCmd(tv, TV_CLOSE); break; /* ESC = Close window */
-
- default: break;
- }
-+
-+#ifdef TV_L10N
-+ if (xlocale) {
-+ switch (buf[0]) {
-+ case '\022': case 'r': case 'R':
-+ doCmd(tv, TV_RESCAN); break;
-+ case '\012': case 'j': case 'J':
-+ doCmd(tv, TV_JIS); break;
-+ case '\005': case 'e': case 'E':
-+ case '\025': case 'u': case 'U':
-+ doCmd(tv, TV_EUCJ); break;
-+ case '\015': case 'm': case 'M':
-+ case '\023': case 's': case 'S':
-+ doCmd(tv, TV_MSCODE); break;
-+
-+ default: break;
-+ }
-+ }
-+#endif /* TV_L10N */
-+
- }
-
-
-@@ -1109,7 +1575,20 @@
- if (i<tv->numlines-1) SCSetVal(&tv->vscrl, i);
- }
-
-+#ifdef TV_L10N
-+ /* redraw text */
-+ if (xlocale) {
-+ XClearArea(theDisp, tv->textW, 0, 0,
-+ (u_int) tv->twWide, (u_int) tv->twHigh, False);
-+
-+ drawTextW(0, &tv->vscrl);
-+ }
-+#endif
-+#ifdef TV_MULTILINGUAL
-+ XClearArea(theDisp, tv->textW, 0, 0,
-+ (u_int) tv->twWide, (u_int) tv->twHigh, False);
- drawTextW(0, &tv->vscrl);
-+#endif
- }
-
-
-@@ -1122,9 +1601,22 @@
- int i,j,wide,maxwide,space;
- byte *sp;
-
-+#ifdef TV_L10N
-+ /* select code-set */
-+ if (xlocale)
-+ tv->code = selectCodeset(tv);
-+#endif /* TV_L10N */
-+
- if (!tv->text) {
- tv->numlines = tv->hexlines = 0;
- tv->lines = (char **) NULL;
-+#ifdef TV_MULTILINGUAL
-+ if (tv->cv_text != NULL) {
-+ free(tv->cv_text);
-+ tv->cv_text = NULL;
-+ }
-+ tv->txt = NULL;
-+#endif
- return;
- }
-
-@@ -1172,17 +1664,129 @@
- wide += space;
- }
- else if (*sp < 32) wide += 2;
-+#ifdef TV_L10N
-+ else if (*sp > 127 && !tv->code) wide += 4;
-+#else
- else if (*sp > 127) wide += 4;
-+#endif
- else wide++;
- }
- if (wide > maxwide) maxwide = wide;
- }
- tv->maxwide = maxwide;
-
-+#ifdef TV_MULTILINGUAL
-+ ml_set_charsets(tv->ctx, &tv->ccs.coding_system);
-+ if (tv->cv_text != NULL) {
-+ free(tv->cv_text);
-+ tv->cv_text = NULL;
-+ }
-+ if (tv->ccs.converter == NULL) {
-+ tv->txt = ml_draw_text(tv->ctx, tv->text, tv->textlen);
-+ } else {
-+ tv->cv_text = (*tv->ccs.converter)(tv->text, tv->textlen, &tv->cv_len);
-+ tv->txt = ml_draw_text(tv->ctx, tv->cv_text, tv->cv_len);
-+ }
-+ tv->maxwide = tv->txt->width / mfwide;
-+ tv->numlines = tv->txt->height / mfhigh + 1;
-+#endif
-+
- tv->hexlines = (tv->textlen + 15) / 16;
- }
-
-
-+/***************************************************/
-+#ifdef TV_L10N
-+static int selectCodeset(tv)
-+ TVINFO *tv;
-+{
-+ u_char *sp;
-+ int i, len;
-+ int code = LOCALE_USASCII; /* == 0 */
-+
-+
-+ len = tv->textlen;
-+
-+ /* select code-set */
-+ if (xlocale) {
-+ sp = (u_char *) tv->text; i = 0;
-+ while (i < len - 1) {
-+ if (*sp == 0x1b &&
-+ (*(sp+1) == '$' || *(sp+1) == '(' || *(sp+1) == ')')) {
-+ code = LOCALE_JIS;
-+ break;
-+ }
-+
-+ else if (*sp >= 0xa1 && *sp <= 0xdf) {
-+ if (*(sp+1) >= 0xf0 && *(sp+1) <= 0xfe) {
-+ code = LOCALE_EUCJ;
-+ break;
-+ }
-+# if (LOCALE_DEFAULT == LOCALE_EUCJ)
-+ else {
-+ sp++; i++;
-+ }
-+# endif
-+ }
-+
-+ else if ((*sp >= 0x81 && *sp <= 0x9f) || (*sp >= 0xe0 && *sp <= 0xef)) {
-+ if ((*(sp+1) >= 0x40 && *(sp+1) <= 0x7e) || *(sp+1) == 0x80) {
-+ code = LOCALE_MSCODE;
-+ break;
-+ }
-+ else if (*(sp+1) == 0xfd || *(sp+1) == 0xfe) {
-+ code = LOCALE_EUCJ;
-+ break;
-+ }
-+ else {
-+ sp++; i++;
-+ }
-+ }
-+
-+ else if (*sp >= 0xf0 && *sp <= 0xfe) {
-+ code = LOCALE_EUCJ;
-+ break;
-+ }
-+
-+ sp++; i++;
-+ }
-+ if (!code) code = LOCALE_DEFAULT;
-+ }
-+
-+ return code;
-+}
-+#endif /* TV_L10N */
-+
-+#ifdef TV_MULTILINGUAL
-+static void setCodingSpec(tv, cs)
-+ TVINFO *tv;
-+ struct coding_spec *cs;
-+{
-+ if (xvbcmp((char *) &tv->ccs, (char *) cs, sizeof *cs) == 0)
-+ return;
-+
-+ tv->ccs = *cs;
-+#if 0
-+ ml_set_charsets(tv->ctx, &tv->ccs.coding_system);
-+ if (tv->cv_text != NULL) {
-+ free(tv->cv_text);
-+ tv->cv_text = NULL;
-+ }
-+ if (tv->ccs.converter == NULL) {
-+ tv->txt = ml_draw_text(tv->ctx, tv->text, tv->textlen);
-+ } else {
-+ tv->cv_text = (*tv->ccs.converter)(tv->text, tv->textlen, &tv->cv_len);
-+ tv->txt = ml_draw_text(tv->ctx, tv->cv_text, tv->cv_len);
-+ }
-+#else
-+ computeText(tv);
-+ computeScrlVals(tv);
-+#endif
-+ /* drawTextW(0, &tv->vscrl); */
-+}
-+#endif
-+
-+
- /**********************************************************************/
- /* BUILT-IN TEXT FILES ************************************************/
- /**********************************************************************/
-@@ -1555,8 +2159,509 @@
- OpenTextView(keyhelp, (int) strlen(keyhelp), "XV Help", 0);
- }
-
-+#ifdef TV_MULTILINGUAL
-+
-+#define TV_ML_ACCEPT TV_NCSS
-+#define TV_ML_CLOSE (TV_ML_ACCEPT + 1)
-+#define TV_ML_NBUTTS (TV_ML_CLOSE + 1)
-+
-+#define TV_ML_RETCODE 0
-+# define TV_ML_RET_LF 0
-+# define TV_ML_RET_CRLF 1
-+# define TV_ML_RET_CR 2
-+# define TV_ML_RET_ANY 3
-+#define TV_ML_GL 1
-+#define TV_ML_GR 2
-+#define TV_ML_CVTR 3
-+#define TV_ML_NRBUTTS 4
-+
-+#define TV_ML_SHORT 0
-+#define TV_ML_LOCK 1
-+#define TV_ML_NCBUTTS 2
-+
-+#define TV_ML_NLISTS 4
-+
-+#define CSWIDE (BUTTW3 * 5 + 5 * 6)
-+#define CSHIGH 450
-+
-+typedef struct csinfo_t {
-+ TVINFO *tv;
-+ RBUTT *rbt[TV_ML_NRBUTTS];
-+ CBUTT cbt[TV_ML_NCBUTTS];
-+ LIST ls[TV_ML_NLISTS];
-+ BUTT bt[TV_ML_NBUTTS];
-+ int up;
-+ Window win;
-+ struct coding_spec tcs; /* temporary coding_spec */
-+} CSINFO;
-+CSINFO csinfo[MAXTVWIN];
-+static char **regs;
-+static int nregs;
-+
-+static int csCheckEvent PARM((CSINFO *, XEvent *));
-+static void csReflect PARM((CSINFO *));
-+static void csRedraw PARM((CSINFO *));
-+static void csListRedraw PARM((LIST *));
-+static void csLsRedraw PARM((int, SCRL *));
-+static void create_registry_list PARM((void));
-+
-+static char *(*cvtrtab[])PARM((char *, int, int *)) = {
-+ NULL,
-+ sjis_to_jis,
-+};
-+
-+static void createCsWins(geom)
-+ char *geom;
-+{
-+ XSetWindowAttributes xswa;
-+ int i, j;
-+
-+ create_registry_list();
-+
-+ xswa.backing_store = WhenMapped;
-+ for (i = 0; i < MAXTVWIN; i++) {
-+ char nam[8];
-+ TVINFO *tv = &tinfo[i];
-+ CSINFO *cs = &csinfo[i];
-+ tv->cs = cs;
-+ cs->tv = tv;
-+ sprintf(nam, "XVcs%d", i);
-+ cs->win = CreateWindow("xv codeset", nam, geom,
-+ CSWIDE, CSHIGH, infofg, infobg, 0);
-+ if (!cs->win) FatalError("couldn't create 'charset' window!");
-+#ifdef BACKING_STORE
-+ XChangeWindowAttributes(theDisp, cs->win, CWBackingStore, &xswa);
-+#endif
-+ XSelectInput(theDisp, cs->win, ExposureMask | ButtonPressMask);
-+
-+ DrawString(cs->win, 5, 5 + ASCENT, "Initial States");
-+ for (i = 0; i < TV_ML_NLISTS; i++) {
-+ int x, y;
-+ char buf[80];
-+
-+ if (i / 2 == 0)
-+ x = 15;
-+ else
-+ x = 280;
-+ if (i % 2 == 0)
-+ y = 5 + LINEHIGH * 1;
-+ else
-+ y = 5 + LINEHIGH * 7 + SPACING * 3;
-+
-+ sprintf(buf, "Designation for G%d:", i + 1);
-+ DrawString(cs->win, x, y + ASCENT, buf);
-+
-+ LSCreate(&cs->ls[i], cs->win, x + 15, y + LINEHIGH,
-+ 200, LINEHIGH * 5, 5,
-+ regs, nregs + 2,
-+ infofg, infobg, hicol, locol, csLsRedraw, 0, 0);
-+ cs->ls[i].selected = 0;
-+ }
-+
-+ for (i = 0; i < 2; i++) {
-+ char *p;
-+ int n;
-+ int x, y;
-+
-+ if ((p = (char *) malloc(3 * 4)) == NULL)
-+ FatalError("out of memory in createCsWins().");
-+ strcpy(p, "G1 G2 G3 G4");
-+ p[2] = p[5] = p[8] = '\0';
-+ n = (i == 0 ? TV_ML_GL : TV_ML_GR);
-+ x = (i == 0 ? 15 : 280);
-+ y = 235;
-+ DrawString(cs->win, x, y + ASCENT, "Assignment for GL:");
-+ x += 15;
-+ y += LINEHIGH;
-+ cs->rbt[n] = RBCreate(NULL, cs->win,
-+ x, y, p, infofg, infobg, hicol, locol);
-+ for (j = 1; j < 4; j++) {
-+ p += 3;
-+ x += 50;
-+ RBCreate(cs->rbt[n], cs->win,
-+ x, y, p, infofg, infobg, hicol, locol);
-+ }
-+ }
-+
-+ DrawString(cs->win, 5, 280 + ASCENT, "Ret Code:");
-+ cs->rbt[TV_ML_RETCODE] =
-+ RBCreate(NULL, cs->win, 20, 300, "LF", infofg,infobg, hicol,locol);
-+ RBCreate(cs->rbt[TV_ML_RETCODE], cs->win, 20, 300 + 20, "CR+LF",
-+ infofg, infobg, hicol, locol);
-+ RBCreate(cs->rbt[TV_ML_RETCODE], cs->win, 90, 300, "CR",
-+ infofg, infobg, hicol, locol);
-+ RBCreate(cs->rbt[TV_ML_RETCODE], cs->win, 90, 300 + 20, "Any",
-+ infofg, infobg, hicol, locol);
-+
-+ DrawString(cs->win, 350, 280 + ASCENT, "Converter:");
-+ cs->rbt[TV_ML_CVTR] =
-+ RBCreate(NULL, cs->win, 365, 300, "Nothing",
-+ infofg, infobg, hicol, locol);
-+ RBCreate(cs->rbt[TV_ML_CVTR], cs->win, 365, 300 + 20, "Shift JIS",
-+ infofg, infobg, hicol, locol);
-+
-+ CBCreate(&cs->cbt[TV_ML_SHORT], cs->win, 200, 300, "Short Form",
-+ infofg, infobg, hicol, locol);
-+ CBCreate(&cs->cbt[TV_ML_LOCK], cs->win, 200, 320, "Locking Shift",
-+ infofg, infobg, hicol, locol);
-+
-+ for (j = 0; j < TV_NCSS; j++) {
-+ BTCreate(&cs->bt[j], cs->win,
-+ 5 + (BUTTW3 + 5) * (j % 5),
-+ 350 + 5 + (BUTTH + 5) * (j / 5),
-+ BUTTW3, BUTTH, codeSetNames[j],
-+ infofg, infobg, hicol, locol);
-+ }
-+ BTCreate(&cs->bt[TV_ML_ACCEPT], cs->win,
-+ CSWIDE - 10 - BUTTW3 * 2, CSHIGH - 5 - BUTTH, BUTTW3, BUTTH,
-+ "Accept", infofg, infobg, hicol, locol);
-+ BTCreate(&cs->bt[TV_ML_CLOSE], cs->win,
-+ CSWIDE - 5 - BUTTW3, CSHIGH - 5 - BUTTH, BUTTW3, BUTTH,
-+ "Close", infofg, infobg, hicol, locol);
-
-+ XMapSubwindows(theDisp, cs->win);
-+ cs->up = 0;
-+ }
-+}
-
-+static void openCsWin(tv)
-+ TVINFO *tv;
-+{
-+ CSINFO *cs = tv->cs;
-+ if (cs->up)
-+ return;
-
-+ XMapRaised(theDisp, cs->win);
-+ cs->up = 1;
-+ cs->tcs = cs->tv->ccs;
-+ csReflect(cs);
-+}
-
-+static void closeCsWin(tv)
-+ TVINFO *tv;
-+{
-+ CSINFO *cs = tv->cs;
-+ if (!cs->up)
-+ return;
-+ cs->up = 0;
-+ XUnmapWindow(theDisp, cs->win);
-+}
-+
-+int CharsetCheckEvent(xev)
-+ XEvent *xev;
-+{
-+ int i;
-+ CSINFO *cs;
-+
-+ for (cs = csinfo, i = 0; i < MAXTVWIN; cs++, i++) {
-+ if (!cs->up)
-+ continue;
-+ if (csCheckEvent(cs, xev))
-+ break;
-+ }
-+ if (i < MAXTVWIN)
-+ return 1;
-+ return 0;
-+}
-+
-+static int csCheckEvent(cs, xev)
-+ CSINFO *cs;
-+ XEvent *xev;
-+{
-+ RBUTT **rbp;
-+ CBUTT *cbp;
-+ LIST *ls;
-+ BUTT *bp;
-+ int i, n;
-+
-+ if (xev->type == Expose) {
-+ int x, y, w, h;
-+ XExposeEvent *e = (XExposeEvent *) xev;
-+ x = e->x; y = e->y; w = e->width; h = e->height;
-+
-+ if (cs->win == e->window){
-+ csRedraw(cs);
-+ return 1;
-+ } else {
-+ for (i = 0; i < TV_ML_NLISTS; i++) {
-+ if (cs->ls[i].win == e->window) {
-+ LSRedraw(&cs->ls[i], 0);
-+ return 1;
-+ }
-+ }
-+ for (i = 0; i < TV_ML_NLISTS; i++) {
-+ if (cs->ls[i].scrl.win == e->window) {
-+ SCRedraw(&cs->ls[i].scrl);
-+ return 1;
-+ }
-+ }
-+ }
-+ } else if (xev->type == ButtonPress) {
-+ int x, y;
-+ XButtonEvent *e = (XButtonEvent *) xev;
-+ x = e->x; y = e->y;
-+ if (cs->win == e->window) {
-+ for (bp = cs->bt, i = 0; i < TV_ML_NBUTTS; bp++, i++) {
-+ if (PTINRECT(x, y, bp->x, bp->y, bp->w, bp->h))
-+ break;
-+ }
-+ if (i < TV_ML_NBUTTS) {
-+ if (BTTrack(bp)) {
-+ if (i < TV_NCSS) {
-+ cs->tcs = coding_spec[i];
-+ csReflect(cs);
-+ } else {
-+ switch (i) {
-+ case TV_ML_ACCEPT:
-+ setCodingSpec(cs->tv, &cs->tcs);
-+ break;
-+ case TV_ML_CLOSE:
-+ closeCsWin(cs->tv);
-+ break;
-+ }
-+ }
-+ }
-+ return 1;
-+ }
-+ for (cbp = cs->cbt, i = 0; i < TV_ML_NCBUTTS; cbp++, i++) {
-+ if (CBClick(cbp, x, y) && CBTrack(cbp))
-+ break;
-+ }
-+ if (i < TV_ML_NCBUTTS) {
-+ switch (i) {
-+ case TV_ML_SHORT:
-+ cs->tcs.coding_system.short_form = cbp->val;
-+ break;
-+ case TV_ML_LOCK:
-+ cs->tcs.coding_system.lock_shift = cbp->val;
-+ break;
-+ }
-+ return 1;
-+ }
-+ for (rbp = cs->rbt, i = 0; i < TV_ML_NRBUTTS; rbp++, i++) {
-+ if ((n = RBClick(*rbp, x, y)) >= 0 && RBTrack(*rbp, n)) {
-+ break;
-+ }
-+ }
-+ if (i < TV_ML_NRBUTTS) {
-+ switch (i) {
-+ case TV_ML_RETCODE:
-+ cs->tcs.coding_system.eol = n;
-+ break;
-+ case TV_ML_GL:
-+ cs->tcs.coding_system.gl = n;
-+ break;
-+ case TV_ML_GR:
-+ cs->tcs.coding_system.gr = n;
-+ break;
-+ case TV_ML_CVTR:
-+ cs->tcs.converter = cvtrtab[n];
-+ break;
-+ }
-+ return 1;
-+ }
-+ } else {
-+ for (ls = cs->ls, i = 0; i < TV_ML_NLISTS; ls++, i++) {
-+ if (ls->win == e->window) {
-+ LSClick(ls, e);
-+ n = ls->selected;
-+ if (n < nregs) {
-+ char r[32], *p = r;
-+ int b7;
-+ strcpy(r, regs[n]);
-+ if ((p = strrchr(r, '/')) != NULL) {
-+ *p = '\0';
-+ b7 = (*(p + 1) == 'R' ? 1 : 0);
-+ } else
-+ b7 = 0; /* shouldn't occur */
-+ cs->tcs.coding_system.design[i] = lookup_design(r, b7);
-+ } else if (n == nregs) /* initially none is designed. */
-+ cs->tcs.coding_system.design[i].bpc = 0;
-+ else
-+ cs->tcs.coding_system.design[i].bpc = -1;
-+ return 1;
-+ }
-+ }
-+ for (ls = cs->ls, i = 0; i < TV_ML_NLISTS; ls++, i++) {
-+ if (ls->scrl.win == e->window) {
-+ SCTrack(&ls->scrl, x, y);
-+ return 1;
-+ }
-+ }
-+ }
-+ }
-+ return 0;
-+}
-+
-+static void csReflect(cs)
-+ CSINFO *cs;
-+{
-+ int i;
-+
-+ RBSelect(cs->rbt[TV_ML_RETCODE], cs->tcs.coding_system.eol);
-+ RBSelect(cs->rbt[TV_ML_GL], cs->tcs.coding_system.gl);
-+ RBSelect(cs->rbt[TV_ML_GR], cs->tcs.coding_system.gr);
-+ for (i = 0; i < sizeof cvtrtab / sizeof cvtrtab[0]; i++) {
-+ if (cs->tcs.converter == cvtrtab[i])
-+ break;
-+ }
-+ if (i >= sizeof cvtrtab / sizeof cvtrtab[0])
-+ FatalError("program error in csReflect().");
-+ RBSelect(cs->rbt[TV_ML_CVTR], i);
-+
-+ cs->cbt[TV_ML_SHORT].val = cs->tcs.coding_system.short_form;
-+ cs->cbt[TV_ML_LOCK].val = cs->tcs.coding_system.lock_shift;
-+ for (i = 0; i < TV_ML_NLISTS; i++) {
-+ struct design design = cs->tcs.coding_system.design[i];
-+ char *reg, r[32];
-+ int b7;
-+ int n = 0;
-+ switch (design.bpc) {
-+ case -1:
-+ n = nregs + 1;
-+ break;
-+ case 0:
-+ n = nregs;
-+ break;
-+ case 1:
-+ case 2:
-+ if ((reg = lookup_registry(design, &b7)) == NULL)
-+ FatalError("internal error in csReflect.");
-+ sprintf(r, "%s/%s", reg, b7 ? "Right" : "Left");
-+ for (n = 0; n < nregs; n++) {
-+ if (strcmp(regs[n], r) == 0)
-+ break;
-+ }
-+ }
-+ cs->ls[i].selected = n;
-+ ScrollToCurrent(&cs->ls[i]);
-+ }
-+ csRedraw(cs);
-+ for (i = 0; i < TV_ML_NLISTS; i++)
-+ csListRedraw(&cs->ls[i]);
-+}
-+
-+static void csRedraw(cs)
-+ CSINFO *cs;
-+{
-+ int i;
-+
-+ XSetForeground(theDisp, theGC, infofg);
-+ DrawString(cs->win, 5,5 + ASCENT, "Initial States");
-+ for (i = 0; i < TV_ML_NLISTS; i++) {
-+ int x, y;
-+ char buf[80];
-+
-+ if (i / 2 == 0)
-+ x = 15;
-+ else
-+ x = 280;
-+ if (i % 2 == 0)
-+ y = 5 + LINEHIGH * 1;
-+ else
-+ y = 5 + LINEHIGH * 7 + SPACING * 3;
-+
-+ sprintf(buf, "Designation for G%d:", i);
-+ DrawString(cs->win, x, y + ASCENT, buf);
-+ }
-+
-+ DrawString(cs->win, 15, 235 + ASCENT, "Invocation for GL:");
-+ DrawString(cs->win, 280, 235 + ASCENT, "Invocation for GR:");
-+ DrawString(cs->win, 5, 280 + ASCENT, "Ret Code:");
-+ DrawString(cs->win, 350, 280 + ASCENT, "Converter:");
-+
-+ for (i = 0; i < TV_ML_NBUTTS; i++)
-+ BTRedraw(&cs->bt[i]);
-+ for (i = 0; i < TV_ML_NCBUTTS; i++)
-+ CBRedraw(&cs->cbt[i]);
-+ for (i = 0; i < TV_ML_NRBUTTS; i++)
-+ RBRedraw(cs->rbt[i], -1);
-+}
-+
-+static void csListRedraw(ls)
-+ LIST *ls;
-+{
-+ int i;
-+ for (i = 0; i < TV_ML_NLISTS; i++) {
-+ LSRedraw(ls, 0);
-+ SCRedraw(&ls->scrl);
-+ }
-+}
-+
-+static void csLsRedraw(delta, sptr)
-+ int delta;
-+ SCRL *sptr;
-+{
-+ int i, j;
-+ for (i = 0; i < MAXTVWIN; i++) {
-+ for (j = 0; j < TV_ML_NLISTS; j++) {
-+ if (sptr == &csinfo[i].ls[j].scrl) {
-+ LSRedraw(&csinfo[i].ls[j], delta);
-+ return;
-+ }
-+ }
-+ }
-+}
-+
-+int CharsetDelWin(win)
-+ Window win;
-+{
-+ CSINFO *cs;
-+ int i;
-+
-+ for (cs = csinfo, i = 0; i < TV_NCSS; cs++, i++) {
-+ if (cs->win == win) {
-+ if (cs->up) {
-+ XUnmapWindow(theDisp, cs->win);
-+ cs->up = 0;
-+ }
-+ return 1;
-+ }
-+ }
-+ return 0;
-+}
-+
-+static int reg_comp PARM((const void *, const void *));
-+static void create_registry_list()
-+{
-+ struct design d;
-+ char *names, *p;
-+ int i;
-+
-+ if ((p = names = (char *) malloc(32 * 0x80 * 2 * 2)) == NULL)
-+ FatalError("out of memory in create_name_list#1.");
-+ nregs = 0;
-+ for (d.bpc = 1; d.bpc <=2; d.bpc++) {
-+ for (d.noc = 94; d.noc <= 96; d.noc += 2) {
-+ for (d.des = ' '; (unsigned char) d.des < 0x80; d.des++) {
-+ int b7;
-+ char *r;
-+ if ((r = lookup_registry(d, &b7)) != NULL) {
-+ sprintf(p, "%s/%s", r, b7 ? "Right" : "Left");
-+ p += strlen(p) + 1;
-+ nregs++;
-+ }
-+ }
-+ }
-+ }
-+ if ((names = (char *) realloc(names, (size_t) (p - names))) == NULL)
-+ FatalError("out of memory in create_name_list#2.");
-+ if ((regs = (char **) malloc(sizeof(char *) * (nregs + 3))) == NULL)
-+ FatalError("out of memory in create_name_list#3.");
-+ p = names;
-+ for (i = 0; i < nregs; i++) {
-+ regs[i] = p;
-+ p += strlen(p) + 1;
-+ }
-+ qsort(regs, (size_t) nregs, sizeof(char *), reg_comp);
-+ regs[i++] = "nothing";
-+ regs[i++] = "unused";
-+ regs[i++] = NULL;
-+}
-+static int reg_comp(dst, src)
-+ const void *dst, *src;
-+{
-+ return strcmp(*(char **) dst, *(char **) src);
-+}
-
-+#endif /* TV_MULTILINGUAL */
-diff -ruN xv-3.10a-bugfixes/xvtiff.c xv-3.10a-enhancements/xvtiff.c
---- xv-3.10a-bugfixes/xvtiff.c 2005-03-27 17:25:31.000000000 -0800
-+++ xv-3.10a-enhancements/xvtiff.c 2005-04-17 14:11:55.000000000 -0700
-@@ -512,7 +512,7 @@
- vsprintf(cp, fmt, ap);
- strcat(cp, ".");
-
-- SetISTR(ISTR_WARNING,buf);
-+ SetISTR(ISTR_WARNING, "%s", buf);
-
- error_occurred = 1;
- }
-@@ -536,7 +536,7 @@
- vsprintf(cp, fmt, ap);
- strcat(cp, ".");
-
-- SetISTR(ISTR_WARNING,buf);
-+ SetISTR(ISTR_WARNING, "%s", buf);
- }
-
-
-@@ -564,6 +564,10 @@
- static byte **BWmap;
- static byte **PALmap;
-
-+/* XXXX Work around some collisions with the new library. */
-+#define tileContigRoutine _tileContigRoutine
-+#define tileSeparateRoutine _tileSeparateRoutine
-+
- typedef void (*tileContigRoutine) PARM((byte*, u_char*, RGBvalue*,
- uint32, uint32, int, int));
-
-@@ -603,7 +607,7 @@
- uint32, uint32, int, int));
- static void put4bitbwtile PARM((byte *, u_char *, RGBvalue *,
- uint32, uint32, int, int));
--static void put16bitbwtile PARM((byte *, u_char *, RGBvalue *,
-+static void put16bitbwtile PARM((byte *, u_short *, RGBvalue *,
- uint32, uint32, int, int));
-
- static void putRGBcontig8bittile PARM((byte *, u_char *, RGBvalue *,
-@@ -653,7 +657,7 @@
-
- default:
- TIFFError(TIFFFileName(tif),
-- "Sorry, can not handle %d-bit pictures", bitspersample);
-+ "Sorry, cannot handle %d-bit pictures", bitspersample);
- return (0);
- }
-
-@@ -666,7 +670,7 @@
-
- default:
- TIFFError(TIFFFileName(tif),
-- "Sorry, can not handle %d-channel images", samplesperpixel);
-+ "Sorry, cannot handle %d-channel images", samplesperpixel);
- return (0);
- }
-
-@@ -1157,7 +1161,7 @@
- b = g + stripsize;
- put = pickTileSeparateCase(Map);
- if (put == 0) {
-- TIFFError(filename, "Can not handle format");
-+ TIFFError(filename, "Cannot handle format");
- return (0);
- }
- y = setorientation(tif, h);
-@@ -1197,7 +1201,7 @@
- /*
- * Greyscale images with less than 8 bits/sample are handled
- * with a table to avoid lots of shifts and masks. The table
-- * is setup so that put*bwtile (below) can retrieve 8/bitspersample
-+ * is set up so that put*bwtile (below) can retrieve 8/bitspersample
- * pixel values simply by indexing into the table with one
- * number.
- */
-@@ -1249,11 +1253,11 @@
-
-
- /*
-- * Palette images with <= 8 bits/sample are handled
-- * with a table to avoid lots of shifts and masks. The table
-- * is setup so that put*cmaptile (below) can retrieve 8/bitspersample
-- * pixel values simply by indexing into the table with one
-- * number.
-+ * Palette images with <= 8 bits/sample are handled with
-+ * a table to avoid lots of shifts and masks. The table
-+ * is set up so that put*cmaptile (below) can retrieve
-+ * (8/bitspersample) pixel-values simply by indexing into
-+ * the table with one number.
- */
- static int makecmap()
- {
-@@ -1305,7 +1309,7 @@
- /*
- * The following routines move decoded data returned
- * from the TIFF library into rasters filled with packed
-- * ABGR pixels (i.e. suitable for passing to lrecwrite.)
-+ * ABGR pixels (i.e., suitable for passing to lrecwrite.)
- *
- * The routines have been created according to the most
- * important cases and optimized. pickTileContigCase and
-@@ -1376,7 +1380,7 @@
- int fromskew, toskew;
- {
- while (h-- > 0) {
-- UNROLL8(w, , *cp++ = PALmap[*pp++][0])
-+ UNROLL8(w, , *cp++ = PALmap[*pp++][0]);
- cp += toskew;
- pp += fromskew;
- }
-@@ -1529,7 +1533,7 @@
- */
- static void put16bitbwtile(cp, pp, Map, w, h, fromskew, toskew)
- byte *cp;
-- u_char *pp;
-+ u_short *pp;
- RGBvalue *Map;
- uint32 w, h;
- int fromskew, toskew;
-@@ -1538,8 +1542,7 @@
-
- while (h-- > 0) {
- for (x=w; x>0; x--) {
-- *cp++ = Map[(pp[0] << 8) + pp[1]];
-- pp += 2;
-+ *cp++ = Map[*pp++];
- }
- cp += toskew;
- pp += fromskew;
-@@ -1577,7 +1580,7 @@
- *cp++ = pp[0];
- *cp++ = pp[1];
- *cp++ = pp[2];
-- pp += samplesperpixel)
-+ pp += samplesperpixel);
- cp += toskew;
- pp += fromskew;
- }
-@@ -1650,7 +1653,7 @@
- *cp++ = *r++;
- *cp++ = *g++;
- *cp++ = *b++;
-- )
-+ );
- SKEW(r, g, b, fromskew);
- cp += toskew;
- }
-@@ -1857,7 +1860,7 @@
- case PHOTOMETRIC_MINISWHITE:
- case PHOTOMETRIC_MINISBLACK:
- switch (bitspersample) {
-- case 16: put = put16bitbwtile; break;
-+ case 16: put = (tileContigRoutine) put16bitbwtile; break;
- case 8: put = putgreytile; break;
- case 4: put = put4bitbwtile; break;
- case 2: put = put2bitbwtile; break;
-@@ -1872,7 +1875,7 @@
- break;
- }
-
-- if (put==0) TIFFError(filename, "Can not handle format");
-+ if (put==0) TIFFError(filename, "Cannot handle format");
- return (put);
- }
-
-@@ -1880,8 +1883,8 @@
- /*
- * Select the appropriate conversion routine for unpacked data.
- *
-- * NB: we assume that unpacked single channel data is directed
-- * to the "packed routines.
-+ * NB: we assume that unpacked single-channel data is directed
-+ * to the "packed" routines.
- */
- static tileSeparateRoutine pickTileSeparateCase(Map)
- RGBvalue* Map;
-@@ -1897,10 +1900,32 @@
- break;
- }
-
-- if (put==0) TIFFError(filename, "Can not handle format");
-+ if (put==0) TIFFError(filename, "Cannot handle format");
- return (put);
- }
-
-
-
-+/*******************************************/
-+void
-+VersionInfoTIFF() /* GRR 19980605 */
-+{
-+ char temp[1024], *p, *q;
-+
-+ strcpy(temp, TIFFGetVersion());
-+ p = temp;
-+ while (!isdigit(*p))
-+ ++p;
-+ if ((q = strchr(p, '\n')) != NULL)
-+ *q = '\0';
-+
-+ fprintf(stderr, " Compiled with libtiff %s", p);
-+#ifdef TIFFLIB_VERSION
-+ fprintf(stderr, " of %d", TIFFLIB_VERSION); /* e.g., 19960307 */
-+#endif
-+ fprintf(stderr, ".\n");
-+}
-+
-+
-+
- #endif /* HAVE_TIFF */
-diff -ruN xv-3.10a-bugfixes/xvtiffwr.c xv-3.10a-enhancements/xvtiffwr.c
---- xv-3.10a-bugfixes/xvtiffwr.c 2005-03-28 08:39:52.000000000 -0800
-+++ xv-3.10a-enhancements/xvtiffwr.c 2005-04-17 14:45:28.000000000 -0700
-@@ -86,6 +86,9 @@
- TIFFSetField(tif, TIFFTAG_GROUP3OPTIONS,
- GROUP3OPT_2DENCODING+GROUP3OPT_FILLBITS);
-
-+ if (comp == COMPRESSION_LZW)
-+ TIFFSetField(tif, TIFFTAG_PREDICTOR, 2);
-+
- TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
- TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
- TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
-diff -ruN xv-3.10a-bugfixes/xvvd.c xv-3.10a-enhancements/xvvd.c
---- xv-3.10a-bugfixes/xvvd.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvvd.c 2005-04-17 22:56:02.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/xvvd.c xv-3.10a/xvvd.c
+--- xv-3.10a.orig/xvvd.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvvd.c 2007-04-15 23:30:19.000000000 -0500
@@ -0,0 +1,1101 @@
+
+/*
@@ -27437,10 +18039,10 @@ diff -ruN xv-3.10a-bugfixes/xvvd.c xv-3.10a-enhancements/xvvd.c
+ (void)XSetIOErrorHandler(vd_XIOhandler);
+}
+#endif /* AUTO_EXPAND */
-diff -ruN xv-3.10a-bugfixes/xvwbmp.c xv-3.10a-enhancements/xvwbmp.c
---- xv-3.10a-bugfixes/xvwbmp.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvwbmp.c 2005-04-03 14:02:18.000000000 -0700
-@@ -0,0 +1,323 @@
+diff -u -r --new-file xv-3.10a.orig/xvwbmp.c xv-3.10a/xvwbmp.c
+--- xv-3.10a.orig/xvwbmp.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvwbmp.c 2007-04-15 23:38:05.000000000 -0500
+@@ -0,0 +1,345 @@
+/*
+ * xvwbmp.c - i/o routings for WBMP files
+ * defined by OMA (http://www.openmobilealliance.com)
@@ -27470,9 +18072,8 @@ diff -ruN xv-3.10a-bugfixes/xvwbmp.c xv-3.10a-enhancements/xvwbmp.c
+#endif
+
+#define MUST(a) if (!(a)) {\
-+ return fail(st_fname, st_err);\
+ close(fd); \
-+ }
++ return fail(st_fname, st_err); }
+#define READU8(fd,u) if ((read(fd, &u, 1)<1)) {\
+ myfree(); \
+ close(fd); \
@@ -27491,26 +18092,29 @@ diff -ruN xv-3.10a-bugfixes/xvwbmp.c xv-3.10a-enhancements/xvwbmp.c
+ return 0; \
+ }
+
-+static char * err_ueof = "Unexpected EOF";
-+static char * err_unst = "Unsupported image type";
-+static char * err_extf = "Extensions are forbidden";
-+static char * err_inmb = "Invalid multibyte integer";
++static const char err_ueof[] = "Unexpected EOF";
++static const char err_unst[] = "Unsupported image type";
++static const char err_extf[] = "Extensions are forbidden";
++static const char err_inmb[] = "Invalid multibyte integer";
+
-+static char * st_fname;
-+static char * st_err;
++static const char *st_fname;
++static const char *st_err;
+
-+static int fail PARM((char *, char *));
-+static int read_mb PARM((int *, int));
-+static void write_mb PARM((uint32, FILE *));
-+static int read_ext PARM((int, uint8));
-+static void * mymalloc PARM((int));
-+static void myfree PARM((void));
-+static uint8 * render1 PARM((uint8 *, int, int));
++static int fail PARM((const char *, const char *));
++static int read_mb PARM((int *, int));
++static void write_mb PARM((uint32, FILE *));
++static int read_ext PARM((int, uint8));
++static void *mymalloc PARM((int));
++static void myfree PARM((void));
++static uint8 *render1 PARM((uint8 *, int, int));
+
-+void ** mymem = NULL;
-+int mymems = 0;
++static void **mymem = NULL;
++static int mymems = 0;
+
-+int LoadWBMP(char * fname, PICINFO * pinfo)
++
++int LoadWBMP(fname, pinfo)
++ char *fname;
++ PICINFO *pinfo;
+{
+ int fd;
+ int im_type; /* image type (only type 0 supported) */
@@ -27582,9 +18186,13 @@ diff -ruN xv-3.10a-bugfixes/xvwbmp.c xv-3.10a-enhancements/xvwbmp.c
+ return 1;
+}
+
-+int WriteWBMP(FILE * fp, byte * pic, int ptype, int w, int h,
-+ byte * rmap, byte *gmap, byte *bmap,
-+ int numcols, int colorstyle)
++
++int WriteWBMP(fp, pic, ptype, w, h, rmap, gmap, bmap, numcols, colorstyle)
++ FILE *fp;
++ byte *pic;
++ int ptype, w, h;
++ byte *rmap, *gmap, *bmap;
++ int numcols, colorstyle;
+{
+ int count = 0;
+ uint8 bit = 0;
@@ -27612,13 +18220,18 @@ diff -ruN xv-3.10a-bugfixes/xvwbmp.c xv-3.10a-enhancements/xvwbmp.c
+ return 0;
+}
+
-+int fail(char * name, char * msg)
++
++static int fail(name, msg)
++ const char *name, *msg;
+{
+ SetISTR(ISTR_WARNING, "%s : %s", name, msg);
+ return 0;
+}
+
-+void write_mb(uint32 data, FILE * f)
++
++static void write_mb(data, f)
++ uint32 data;
++ FILE *f;
+{
+ int i = 32;
+ uint32 aux = data;
@@ -27650,7 +18263,9 @@ diff -ruN xv-3.10a-bugfixes/xvwbmp.c xv-3.10a-enhancements/xvwbmp.c
+
+}
+
-+int read_mb(int * dst, int fd)
++
++static int read_mb(dst, fd)
++ int *dst, fd;
+{
+ int ac = 0;
+ int ct = 0;
@@ -27674,7 +18289,10 @@ diff -ruN xv-3.10a-bugfixes/xvwbmp.c xv-3.10a-enhancements/xvwbmp.c
+ return 1;
+}
+
-+int read_ext(int fd, uint8 fixed)
++
++static int read_ext(fd, fixed)
++ int fd;
++ uint8 fixed;
+{
+ if (!(fixed&0x7f)) { /* no extensions */
+ return 1;
@@ -27712,15 +18330,18 @@ diff -ruN xv-3.10a-bugfixes/xvwbmp.c xv-3.10a-enhancements/xvwbmp.c
+ */
+}
+
-+void * mymalloc(int l)
++
++static void *mymalloc(numbytes)
++ int numbytes;
+{
+ mymem = (void**)realloc(mymem, mymems+1);
+ if (!mymem)
+ FatalError("LoadWBMP: can't realloc buffer");
-+ return (mymem[mymems++] = malloc(l));
++ return (mymem[mymems++] = malloc(numbytes));
+}
+
-+void myfree()
++
++static void myfree()
+{
+ int i;
+
@@ -27735,7 +18356,10 @@ diff -ruN xv-3.10a-bugfixes/xvwbmp.c xv-3.10a-enhancements/xvwbmp.c
+ mymems = 0;
+}
+
-+uint8 * render1(uint8 * data, int size, int npixels)
++
++static uint8 *render1(data, size, npixels)
++ uint8 *data;
++ int size, npixels;
+{
+ byte * pic;
+ int i;
@@ -27764,57 +18388,9 @@ diff -ruN xv-3.10a-bugfixes/xvwbmp.c xv-3.10a-enhancements/xvwbmp.c
+ }
+ return pic;
+}
-diff -ruN xv-3.10a-bugfixes/xvxpm.c xv-3.10a-enhancements/xvxpm.c
---- xv-3.10a-bugfixes/xvxpm.c 2005-03-28 22:22:50.000000000 -0800
-+++ xv-3.10a-enhancements/xvxpm.c 2005-04-17 14:45:28.000000000 -0700
-@@ -175,7 +175,15 @@
-
- do {
- char key[3];
-- char color[40]; /* Need to figure a good size for this... */
-+ char color[80]; /* Need to figure a good size for this... */
-+
-+/*
-+ * Problem with spaces in color names
-+ *
-+ * X s Color Name m Other Name c Last Name
-+ *
-+ * ... this parser doesn't find `Any Name'
-+ */
-
- for (j=0; j<2 && (c != ' ') && (c != '\t') && (c != EOF); j++) {
- key[j] = c;
-@@ -187,7 +195,7 @@
- if (c == EOF) /* The failure condition of getc() */
- return (XpmLoadError(bname, "Error parsing colormap line"));
-
-- for (j=0; j<39 && (c!=' ') && (c!='\t') && (c!='"') && c!=EOF; j++) {
-+ for (j=0; j<79 && (c!=' ') && (c!='\t') && (c!='"') && c!=EOF; j++) {
- color[j] = c;
- c = XpmGetc(fp);
- }
-@@ -248,7 +256,7 @@
- else { /* 'None' or unrecognized color spec */
- int rgb;
-
-- if (strcmp(color, "None") == 0) rgb = 0xb2c0dc; /* infobg */
-+ if (strcasecmp(color, "None") == 0) rgb = 0xb2c0dc; /* infobg */
- else {
- SetISTR(ISTR_INFO, "%s: unknown color spec '%s'", bname, color);
- Timer(1000);
-@@ -321,7 +329,8 @@
- *i_sptr++ = mapentry->cv_rgb[2];
- }
- } /* for ( j < w ) */
-- (void)XpmGetc(fp); /* Throw away the close " */
-+ while (((c = XpmGetc(fp))!=EOF) && /* Throw away the close " and */
-+ (c != '"')); /* erase all remaining pixels */
-
- if (!(i%7)) WaitCursor();
- } /* for ( i < h ) */
-diff -ruN xv-3.10a-bugfixes/xvzx.c xv-3.10a-enhancements/xvzx.c
---- xv-3.10a-bugfixes/xvzx.c 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-enhancements/xvzx.c 2004-05-16 18:08:33.000000000 -0700
+diff -u -r --new-file xv-3.10a.orig/xvzx.c xv-3.10a/xvzx.c
+--- xv-3.10a.orig/xvzx.c 1969-12-31 18:00:00.000000000 -0600
++++ xv-3.10a/xvzx.c 2007-05-13 19:53:46.000000000 -0500
@@ -0,0 +1,349 @@
+/*
+ * xvzx.c - load routine for Spectrum screen$
@@ -27842,9 +18418,9 @@ diff -ruN xv-3.10a-bugfixes/xvzx.c xv-3.10a-enhancements/xvzx.c
+
+#define TRUNCSTR "File appears to be truncated."
+
-+static int zxError PARM((char *, char *));
++static int zxError PARM((const char *, const char *));
+
-+static char *bname;
++static const char *bname;
+
+/*******************************************/
+int LoadZX(fname, pinfo)
@@ -27971,7 +18547,7 @@ diff -ruN xv-3.10a-bugfixes/xvzx.c xv-3.10a-enhancements/xvzx.c
+
+/*******************************************/
+static int zxError(fname, st)
-+ char *fname, *st;
++ const char *fname, *st;
+{
+ SetISTR(ISTR_WARNING,"%s: %s", fname, st);
+ return 0;
@@ -27983,12 +18559,12 @@ diff -ruN xv-3.10a-bugfixes/xvzx.c xv-3.10a-enhancements/xvzx.c
+
+byte ZXheader[128] =
+{
-+ 'P', 'L', 'U', 'S', '3', 'D', 'O', 'S', 26, /* Spectrum +3DOS file */
-+ 1, 0, /* Header type 1.0 */
-+ 128, 27, 0, 0, /* 7040 bytes */
-+ 3, /* Binary format */
-+ 0, 27, /* 6912 data bytes */
-+ 0, 64 /* load address 0x4000 */
++ 'P', 'L', 'U', 'S', '3', 'D', 'O', 'S', 26, /* Spectrum +3DOS file */
++ 1, 0, /* Header type 1.0 */
++ 128, 27, 0, 0, /* 7040 bytes */
++ 3, /* Binary format */
++ 0, 27, /* 6912 data bytes */
++ 0, 64 /* load address 0x4000 */
+};
+
+
diff --git a/source/xap/xv/xv-3.10a-jumbo-fix-patch-20050410.txt b/source/xap/xv/xv-3.10a-jumbo-fix-enh-patch-20070520.txt
index cc4e72d39..51ff30a98 100644
--- a/source/xap/xv/xv-3.10a-jumbo-fix-patch-20050410.txt
+++ b/source/xap/xv/xv-3.10a-jumbo-fix-enh-patch-20070520.txt
@@ -1,114 +1,257 @@
-diff : xv-3.10a-jumbo-fix-patch-20050410.txt
+diff : xv-3.10a-jumbo-fix-enh-patch-20070520.txt
This is a unified diff. It should be applied (using Larry Wall's "patch"
-program) to the stock XV 3.10a sources. If desired, the jumbo-enhancements
-patch may be applied afterward.
+program) to the stock XV 3.10a sources. See the "How to build" section of
+README.jumbo, which, along with roughly 40 other new files and 3 new sub-
+directories, should have been unpacked along with this jumbo patch:
+
+ README.jumbo
+ README.pcd
+ bits/br_bzip2
+ bits/br_jp2
+ bits/br_jpc
+ bits/br_mag
+ bits/br_maki
+ bits/br_mgcsfx
+ bits/br_pcd
+ bits/br_pi
+ bits/br_pic
+ bits/br_pic2
+ bits/br_png
+ bits/br_zx
+ contrib/
+ contrib/fnkey-scripts/
+ contrib/fnkey-scripts/README
+ contrib/fnkey-scripts/jpegcrop.sh
+ contrib/fnkey-scripts/jpegeditcom.sh
+ contrib/fnkey-scripts/jpeglogrot.sh
+ contrib/fnkey-scripts/jpegrot.sh
+ contrib/fnkey-scripts/jpegundocrop.sh
+ contrib/fedora/
+ contrib/fedora/README
+ contrib/fedora/Build-FC5
+ docs/xvdocs.pdf
+ tiff/RANLIB.sh
+ xv_mgcsfx.sample
+ xvhips.c
+ xvhips.h
+ xvjp2k.c
+ xvmag.c
+ xvmaki.c
+ xvmgcsfx.c
+ xvml.c
+ xvml.h
+ xvpcd.c
+ xvpi.c
+ xvpic.c
+ xvpic2.c
+ xvpng.c
+ xvvd.c
+ xvwbmp.c
+ xvzx.c
+
diffs below:
- Makefile
- Makefile.std
- README.jumbo
- bggen.c
- bits/icon
- cleandir
- config.h
- copyright.h
- tiff/Makefile
- tiff/Makefile.std
- tiff/RANLIB.sh
- vdcomp.c
- xcmap.c
- xv.c
- xv.h
- xv24to8.c
- xvalg.c
- xvbmp.c
- xvbrowse.c
- xvbutt.c
- xvcolor.c
- xvctrl.c
- xvcut.c
- xvdflt.c
- xvdial.c
- xvdir.c
- xvevent.c
- xvfits.c
- xvgam.c
- xvgif.c
- xvgifwr.c
- xvgrab.c
- xvgraf.c
- xviff.c
- xvimage.c
- xvinfo.c
- xviris.c
- xvjpeg.c
- xvmisc.c
- xvpbm.c
- xvpcx.c
- xvpds.c
- xvpictoppm.c
- xvpm.c
- xvpopup.c
- xvps.c
- xvrle.c
- xvroot.c
- xvscrl.c
- xvsmooth.c
- xvsunras.c
- xvtarga.c
- xvtext.c
- xvtiff.c
- xvtiffwr.c
- xvxbm.c
- xvxpm.c
- xvxwd.c
+
+ Imakefile
+ Makefile
+ Makefile.std
+ bggen.c
+ bits/br_targa
+ bits/icon
+ cleandir
+ config.h
+ copyright.h
+ docs/bggen.man
+ docs/xcmap.man
+ docs/xv.man
+ docs/xvp2p.man
+ tiff/Makefile
+ tiff/Makefile.std
+ vdcomp.c
+ xcmap.c
+ xv.c
+ xv.h
+ xv24to8.c
+ xvalg.c
+ xvbmp.c
+ xvbrowse.c
+ xvbutt.c
+ xvcolor.c
+ xvctrl.c
+ xvcut.c
+ xvdflt.c
+ xvdflt.h
+ xvdial.c
+ xvdir.c
+ xvevent.c
+ xvfits.c
+ xvgam.c
+ xvgif.c
+ xvgifwr.c
+ xvgrab.c
+ xvgraf.c
+ xviff.c
+ xvimage.c
+ xvinfo.c
+ xviris.c
+ xvjpeg.c
+ xvmisc.c
+ xvpbm.c
+ xvpcx.c
+ xvpds.c
+ xvpictoppm.c
+ xvpm.c
+ xvpopup.c
+ xvps.c
+ xvrle.c
+ xvroot.c
+ xvscrl.c
+ xvsmooth.c
+ xvsunras.c
+ xvtarga.c
+ xvtext.c
+ xvtiff.c
+ xvtiffwr.c
+ xvxbm.c
+ xvxpm.c
+ xvxwd.c
-diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
+diff -ru xv-3.10a/Imakefile xv-3.10a-enhancements/Imakefile
+--- xv-3.10a/Imakefile 1995-01-13 12:24:01.000000000 -0800
++++ xv-3.10a-enhancements/Imakefile 2005-04-17 14:04:22.000000000 -0700
+@@ -104,6 +104,11 @@
+ SGI = -Dsgi
+ #endif
+
++/* install directory of xv_mgcsfx.sample. */
++MGCSFXDIR = $(LIBDIR)
++/* Directory of default configuration file. */
++MGCSFX = -DMGCSFXDIR=\"$(MGCSFXDIR)\"
++
+
+
+
+@@ -137,6 +142,8 @@
+ #if defined(SCOArchitecture)
+ SCO= -Dsco -DPOSIX -DNO_RANDOM
+ SYS_LIBRARIES= -lm -lc -lx
++#elif defined(HPArchitecture)
++SYS_LIBRARIES= -lm -lV3
+ #else
+ SYS_LIBRARIES= -lm
+ #endif
+@@ -147,7 +154,7 @@
+
+ DEFINES= $(SCO) $(UNIX) $(NODIRENT) $(VPRINTF) $(TIMERS) \
+ $(HPUX7) $(JPEG) $(TIFF) $(PDS) $(DXWM) $(RAND) \
+- $(BACKING_STORE) $(BSDTYPES) $(SGI)
++ $(BACKING_STORE) $(BSDTYPES) $(SGI) $(MGCSFX)
+
+ INCLUDES = $(JPEGINCLUDE) $(TIFFINCLUDE)
+
+@@ -157,7 +164,9 @@
+ xvdial.c xvgraf.c xvsunras.c xvjpeg.c xvps.c xvpopup.c xvdflt.c \
+ xvtiff.c xvtiffwr.c xvpds.c xvrle.c xviris.c xvgrab.c vprintf.c \
+ xvbrowse.c xvtext.c xvpcx.c xviff.c xvtarga.c xvxpm.c xvcut.c \
+- xvxwd.c xvfits.c
++ xvxwd.c xvfits.c xvpng.c xvzx.c xvwbmp.c xvpcd.c \
++ xvmag.c xvpic.c xvmaki.c xvpi.c xvpic2.c xvvd.c xvmgcsfx.c \
++ xvml.c
+
+ OBJS1 = xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
+ xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
+@@ -165,7 +174,9 @@
+ xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
+ xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
+ xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
+- xvxwd.o xvfits.o
++ xvxwd.o xvfits.o xvpng.o xvzx.o xvwbmp.o xvpcd.o \
++ xvmag.o xvpic.o xvmaki.o xvpi.o xvpic2.o xvvd.o xvmgcsfx.o \
++ xvml.o
+
+ SRCS2= bggen.c
+ OBJS2= bggen.o
+@@ -266,6 +277,8 @@
+ InstallManPageLong(docs/xvp2p,$(MANDIR),xvpictoppm)
+ InstallManPageLong(docs/vdcomp,$(MANDIR),vdcomp)
+
++InstallNonExecFile(xv_mgcsfx.sample,$(MGCSFXDIR))
++
+ tar:
+ tar cf xv.tar Makefile* Imakefile *.c *.h bits docs \
+ docs unsupt vms $(JPEGDIR) $(TIFFDIR) $(MISC)
+diff -ru xv-3.10a/Makefile xv-3.10a-enhancements/Makefile
--- xv-3.10a/Makefile 1995-01-23 12:20:54.000000000 -0800
-+++ xv-3.10a-bugfixes/Makefile 2005-04-06 08:17:13.000000000 -0700
++++ xv-3.10a-enhancements/Makefile 2007-05-20 21:17:35.000000000 -0700
@@ -2,7 +2,11 @@
# your C compiler (and options) of choice
CC = cc
-# CC = gcc -ansi
+#CC = gcc -ansi
-+# note that -ansi kills __USE_MISC (gcc 2.95.3), which (at least in Linux)
++# note that -ansi kills __USE_MISC (gcc 2.95.3), which, at least on Linux,
+# determines whether stdlib.h includes prototypes for mktemp(), random(), etc.
+# (i.e., if you use it, you will get unnecessary compiler warnings)
+#CC = gcc
# use this if you're using 'cc' on a DEC Alpha (OSF/1) or MIPS (Ultrix) system:
# CC = cc -std1 -Olimit 750
-@@ -14,8 +18,13 @@
+@@ -14,8 +18,20 @@
# -Wuninitialized -Wparentheses
-CCOPTS = -O
-
+CCOPTS = -O
++#
+# these are the usual optimization and warning options for gcc; all such
+# warnings but one (mktemp() use) have been eliminated (at least on Linux):
+#CCOPTS = -O3 -Wall
++#
++# slightly more warnings... older code often made non-const pointers to
++# static strings (nothing should blow up unless something tries to write
++# to them):
++#CCOPTS = -O3 -Wall -Wpointer-arith -Wcast-align -Wwrite-strings -Wnested-externs
++#
+# for the next step up in gcc noise, try adding -W (but note that it adds a
+# huge number of unused-parameter and signed/unsigned comparison warnings):
+#CCOPTS = -O3 -Wall -W
### NOTE: Sun running OpenWindows:
### if you're using a SUN running OPENWINDOWS, you need to add these two
-@@ -27,6 +36,10 @@
+@@ -27,50 +43,155 @@
### '-I' options on the CCOPTS line to tell the compiler where said files are.
++# older Unixen don't support the -p option, but its lack may mean installation
++# will fail (if more than one directory level is missing)
++MKDIR = mkdir -p
++
++
+# BeOS _may_ need to use a different version (below), but probably not
+CLEANDIR = cleandir
+
+
### Installation locations
- BINDIR = /usr/local/bin
- MANDIR = /usr/local/man/man1
-@@ -38,7 +51,7 @@
+-BINDIR = /usr/local/bin
+-MANDIR = /usr/local/man/man1
++### NOTE: Users of old K&R compilers (i.e., any version not supporting C89
++### string concatenation, such as "fub" "ar" => "fubar") should update
++### xvtext.c:1831 (or thereabouts) if either PREFIX or DOCDIR changes:
++PREFIX = /usr/local
++BINDIR = $(PREFIX)/bin
++MANDIR = $(PREFIX)/share/man/man1
+ MANSUF = 1
+-LIBDIR = /usr/local/lib
++DOCDIR = $(PREFIX)/share/doc/xv
++LIBDIR = $(PREFIX)/lib/xv
++SYSCONFDIR = /etc
++DESTDIR =
+
+
+ buildit: all
########################### CONFIGURATION OPTIONS ############################
@@ -117,11 +260,9 @@ diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
##############################################################################
###
-@@ -59,18 +72,25 @@
- ### if, for whatever reason, you're unable to get the TIFF library to compile
- ### on your machine, *COMMENT OUT* the following lines
- ###
--TIFF = -DDOTIFF
++### if, for whatever reason, you're unable to get the TIFF library to compile
++### on your machine, *COMMENT OUT* the following lines
++###
+### GRR 20050319: USE_TILED_TIFF_BOTLEFT_FIX enables an experimental fix for
+### tiled TIFFs with ORIENTATION_BOTLEFT. It may break other tiled TIFFs,
+### or it may be required for certain other TIFF types (e.g., strips with
@@ -130,32 +271,143 @@ diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
+###
+#TIFF = -DDOTIFF
+TIFF = -DDOTIFF -DUSE_TILED_TIFF_BOTLEFT_FIX
- TIFFDIR = tiff
- TIFFINC = -I$(TIFFDIR)
- TIFFLIB = $(TIFFDIR)/libtiff.a
- $(TIFFLIB):
++###
++#TIFFDIR = tiff
++TIFFDIR = /usr
++#TIFFDIR = /usr/local
++#TIFFDIR = ../../libtiff
++###
++TIFFINC = -I$(TIFFDIR)/include
++#TIFFINC = -I$(TIFFDIR)
++###
++### libtiff 3.5 and up may be compiled with zlib and libjpeg, but the
++### dependency is properly handled in LIBS line ~247 lines below
++###
++TIFFLIB = -L$(TIFFDIR)/lib -ltiff
++#TIFFLIB = $(TIFFDIR)/lib/libtiff.a
++#TIFFLIB = -L$(TIFFDIR) -ltiff
++#TIFFLIB = $(TIFFDIR)/libtiff.a
++###
++### this is intended to build the ancient version (3.3.016 beta) that's
++### included in the "tiff" subdir of XV, not an arbitrary copy of libtiff:
++###
++#$(TIFFLIB):
++# ( cd $(TIFFDIR) ; make CC='$(CC)' COPTS='$(CCOPTS) $(MCHN)' )
++
++
++###
+ ### if, for whatever reason, you're unable to get the JPEG library to compile
+ ### on your machine, *COMMENT OUT* the following lines
+ ###
++### NOTE: /usr/sfw can be used on Solaris with "Sun freeware" installed
++###
+ JPEG = -DDOJPEG
+-JPEGDIR = jpeg
+-JPEGINC = -I$(JPEGDIR)
+-JPEGLIB = $(JPEGDIR)/libjpeg.a
+-$(JPEGDIR)/jconfig.h:
+- cd $(JPEGDIR) ; ./configure CC='$(CC)'
+-$(JPEGLIB): $(JPEGDIR)/jconfig.h
+- cd $(JPEGDIR) ; make
++#JPEGDIR = jpeg
++JPEGDIR = /usr
++#JPEGDIR = /usr/local
++#JPEGDIR = ../../libjpeg
++#JPEGDIR = /usr/sfw
++###
++JPEGINC = -I$(JPEGDIR)/include
++#JPEGINC = -I$(JPEGDIR)
++###
++JPEGLIB = -L$(JPEGDIR)/lib -ljpeg
++#JPEGLIB = -L$(JPEGDIR) -ljpeg
++#JPEGLIB = $(JPEGDIR)/libjpeg.a
++###
++### this is intended to build the ancient version (5a) that's included in the
++### "jpeg" subdir of XV, not an arbitrary copy of libjpeg:
++###
++#$(JPEGDIR)/jconfig.h:
++# cd $(JPEGDIR) ; ./configure CC='$(CC)'
++#$(JPEGLIB): $(JPEGDIR)/jconfig.h
++# cd $(JPEGDIR) ; make
+
+
+ ###
+-### if, for whatever reason, you're unable to get the TIFF library to compile
++### if, for whatever reason, you're unable to get the PNG library to compile
+ ### on your machine, *COMMENT OUT* the following lines
+ ###
+-TIFF = -DDOTIFF
+-TIFFDIR = tiff
+-TIFFINC = -I$(TIFFDIR)
+-TIFFLIB = $(TIFFDIR)/libtiff.a
+-$(TIFFLIB):
- ( cd $(TIFFDIR) ; make CC='$(CC)' )
-+ ( cd $(TIFFDIR) ; make CC='$(CC)' COPTS='$(CCOPTS) $(MCHN)' )
++PNG = -DDOPNG
++PNGDIR = /usr
++#PNGDIR = /usr/local
++#PNGDIR = ../../libpng
++###
++PNGINC = -I$(PNGDIR)/include
++#PNGINC = -I$(PNGDIR)
++###
++PNGLIB = -L$(PNGDIR)/lib -lpng
++#PNGLIB = -L$(PNGDIR) -lpng
++#PNGLIB = $(PNGDIR)/libpng.a
++
++
++###
++### if, for whatever reason, you're unable to get both the PNG library and
++### (newer versions of) the TIFF library to compile on your machine, *COMMENT
++### OUT* the following lines
++###
++ZLIBDIR = /usr
++#ZLIBDIR = /usr/local
++#ZLIBDIR = ../../zlib
++###
++ZLIBINC = -I$(ZLIBDIR)/include
++#ZLIBINC = -I$(ZLIBDIR)
++###
++ZLIBLIB = -L$(ZLIBDIR)/lib -lz
++#ZLIBLIB = -L$(ZLIBDIR) -lz
++#ZLIBLIB = $(ZLIBDIR)/libz.a
++
++
++###
++### if, for whatever reason, you're unable to get the JasPer JPEG-2000 library
++### to compile on your machine, *COMMENT OUT* the following lines
++###
++JP2K = -DDOJP2K
++###
++#JP2KDIR = ../../jasper
++JP2KDIR = /usr/local/lib
++###
++#JP2KINC = -I$(JP2KDIR)
++JP2KINC = -I/usr/local/include
++###
++#JP2KLIB = -L$(JP2KDIR) -ljasper
++JP2KLIB = $(JP2KDIR)/libjasper.a
###
### if, for whatever reason, you're unable to get the PDS/VICAR support
### to compile (xvpds.c, and vdcomp.c), *COMMENT OUT* the following line,
-### and also remove 'vdcomp' from the 'all:' dependancy
-+### and also remove 'vdcomp' from the 'all:' dependancy
++### and also remove 'vdcomp' from the 'all:' dependency
###
PDS = -DDOPDS
-@@ -78,17 +98,25 @@
+@@ -78,46 +199,60 @@
#----------System V----------
# if you are running on a SysV-based machine, such as HP, Silicon Graphics,
-# Solaris, etc., uncomment the following line to get mostly there.
-+# Solaris, etc., uncomment the following line to get mostly there.
- #UNIX = -DSVR4
-
+-#UNIX = -DSVR4
++# Solaris, etc.; uncomment one of the following lines to get you *most* of
++# the way there. SYSV means System V R3.
++# UNIX = -DSVR4
++# UNIX = -DSYSV
++
--#----------Machine Specific Configurations----------
+#----------Machine-Specific Configurations----------
+
+### If you are using a BeOS system, uncomment the following line
@@ -164,7 +416,8 @@ diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
+### The stock version of cleandir now should work for BeOS, too, so try
+### leaving this commented out:
+#CLEANDIR = cleandir.BeOS
-+
+
+-#----------Machine Specific Configurations----------
### If you are using an SGI system, uncomment the following line
#MCHN = -Dsgi
@@ -175,12 +428,25 @@ diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
#MCHN= -Dhpux -D_HPUX_SOURCE
# To use old HP compilers (HPUX 7.0 or so), you may need
#MCHN= -Dhpux -D_HPUX_SOURCE +Ns4000
-@@ -102,22 +130,22 @@
+ #
+-# also, if you're using HP's compiler, add '-Aa' to whichever of those
++# Also, if you're using HP's compiler, add '-Aa' to whichever of those
+ # two lines you're using, to turn on ANSI C mode. Or so I'm told.
+ #
+-# note: You may need to add '-I/usr/include/X11R5' (or R6, or whatever)
++# Note: You may need to add '-I/usr/include/X11R5' (or R6, or whatever)
+ # to whichever of those lines you used, as HP tends to store their X11
+ # include files in a non-standard place...
++#
++# And you probably have to add '-lV3' to the end of the LIBS def when
++# using XV's AUTO_EXPAND option.
- ### for LINUX, uncomment the following line
+-### for LINUX, uncomment the following line
-#MCHN = -DLINUX
++### for Linux, uncomment one of the following lines:
+#MCHN = -DLINUX -L/usr/X11R6/lib
++#MCHN = -DLINUX -L/usr/X11R6/lib64
# For SCO 1.1 (UNIX 3.2v2) machines, uncomment the following:
@@ -202,7 +468,7 @@ diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
# No other switches should be necessary, or so I'm told...
#
#MCHN = -q extensions=pcc_c -D__UMAXV__ -L/usr2/usr/lib/X11 -DSVR4
-@@ -147,8 +175,8 @@
+@@ -147,8 +282,8 @@
#TIMERS = -DUSLEEP
@@ -213,7 +479,7 @@ diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
# uncomment the following line:
#TIMERS = -DNOTIMER
-@@ -160,7 +188,7 @@
+@@ -160,7 +295,7 @@
#DXWM = -DDXWM
@@ -222,17 +488,77 @@ diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
# 'u_long', 'u_short', 'u_int', etc. as being undefined, uncomment the
# following line:
#BSDTYPES = -DBSDTYPES
-@@ -188,7 +216,9 @@
- $(NODIRENT) $(VPRINTF) $(TIMERS) $(UNIX) $(BSDTYPES) $(RAND) \
- $(DXWM) $(MCHN)
+@@ -177,18 +312,38 @@
+ #VPRINTF = -DNEED_VPRINTF -DLONGINT -DNOSTDHDRS
+
+
++# if your machine puts the prototype for 'malloc()' in malloc.h rather than
++# stdlib.h, uncomment the following line:
++#
++#MALLOC = -DNEED_MALLOC_H
+
+
+-################ END OF CONFIGURATION OPTIONS #################
++# if your X Window System compiled with -DX_LOCALE,
++# uncomment the following line:
++# TVL10N = -DX_LOCALE
++
++# Install directory of xv_mgcsfx.sample.
++MGCSFXDIR = $(LIBDIR)
++# Directory of default configuration file.
++MGCSFX = -DMGCSFXDIR=\"$(MGCSFXDIR)\"
++
+
+
+
++################ END OF CONFIGURATION OPTIONS #################
++
+
+-CFLAGS = $(CCOPTS) $(JPEG) $(JPEGINC) $(TIFF) $(TIFFINC) $(PDS) \
+- $(NODIRENT) $(VPRINTF) $(TIMERS) $(UNIX) $(BSDTYPES) $(RAND) \
+- $(DXWM) $(MCHN)
+-LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) -lm
++
++CFLAGS = $(CCOPTS) $(PNG) $(PNGINC) $(ZLIBINC) $(JPEG) $(JPEGINC) \
++ $(TIFF) $(TIFFINC) $(PDS) $(JP2K) $(JP2KINC) $(TVL10N) $(MGCSFX) \
++ $(UNIX) $(BSDTYPES) $(RAND) $(MALLOC) $(DXWM) $(MCHN) $(NODIRENT) \
++ $(VPRINTF) $(TIMERS) -DDOCDIR=\"$(DOCDIR)\" \
++ -DSYSCONFDIR=\"$(SYSCONFDIR)\" -DXVEXECPATH=\"$(LIBDIR)\"
++
+### remove -lm for BeOS:
- LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) -lm
-+#LIBS = -lX11 $(JPEGLIB) $(TIFFLIB)
++LIBS = $(TIFFLIB) $(JPEGLIB) $(PNGLIB) $(ZLIBLIB) $(JP2KLIB) -L/usr/X11R6/lib -lX11 -lm
++#LIBS = $(TIFFLIB) $(JPEGLIB) $(PNGLIB) $(ZLIBLIB) $(JP2KLIB) -lX11
OBJS = xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
-@@ -231,9 +261,10 @@
+@@ -196,7 +351,9 @@
+ xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
+ xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
+ xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
+- xvxwd.o xvfits.o
++ xvxwd.o xvfits.o xvpng.o xvzx.o xvwbmp.o xvpcd.o xvhips.o \
++ xvmag.o xvpic.o xvmaki.o xvpi.o xvpic2.o xvvd.o xvmgcsfx.o \
++ xvml.o xvjp2k.o
+
+ MISC = README INSTALL CHANGELOG IDEAS
+
+@@ -206,10 +363,12 @@
+
+
+
+-all: $(JPEGLIB) $(TIFFLIB) xv bggen vdcomp xcmap xvpictoppm
++#all: $(JPEGLIB) $(TIFFLIB) xv bggen vdcomp xcmap xvpictoppm
++all: xv bggen vdcomp xcmap xvpictoppm
+
+
+-xv: $(OBJS) $(JPEGLIB) $(TIFFLIB)
++#xv: $(OBJS) $(JPEGLIB) $(TIFFLIB)
++xv: $(OBJS)
+ $(CC) -o xv $(CFLAGS) $(OBJS) $(LIBS)
+
+ bggen: bggen.c
+@@ -231,23 +390,47 @@
clean: xvclean
rm -f bggen vdcomp xcmap xvpictoppm
@@ -245,9 +571,43 @@ diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
+ ./$(CLEANDIR) tiff
++# could also do some shell trickery here to attempt mkdir only if dir is
++# missing (e.g., "test -d <dir> || $(MKDIR) <dir>")
install: all
-@@ -246,8 +277,9 @@
- cp docs/xvdocs.ps* $(LIBDIR)
+- cp xv bggen vdcomp xcmap xvpictoppm $(BINDIR)
+- cp docs/xv.man $(MANDIR)/xv.$(MANSUF)
+- cp docs/bggen.man $(MANDIR)/bggen.$(MANSUF)
+- cp docs/xcmap.man $(MANDIR)/xcmap.$(MANSUF)
+- cp docs/xvp2p.man $(MANDIR)/xvpictoppm.$(MANSUF)
+- cp docs/vdcomp.man $(MANDIR)/vdcomp.$(MANSUF)
+- cp docs/xvdocs.ps* $(LIBDIR)
++ $(MKDIR) $(DESTDIR)$(BINDIR)
++ cp xv bggen vdcomp xcmap xvpictoppm $(DESTDIR)$(BINDIR)/.
++ chmod 755 $(DESTDIR)$(BINDIR)/xv $(DESTDIR)$(BINDIR)/bggen \
++ $(DESTDIR)$(BINDIR)/vdcomp $(DESTDIR)$(BINDIR)/xcmap \
++ $(DESTDIR)$(BINDIR)/xvpictoppm
++#
++ $(MKDIR) $(DESTDIR)$(MANDIR)
++ cp docs/xv.man $(DESTDIR)$(MANDIR)/xv.$(MANSUF)
++ cp docs/bggen.man $(DESTDIR)$(MANDIR)/bggen.$(MANSUF)
++ cp docs/xcmap.man $(DESTDIR)$(MANDIR)/xcmap.$(MANSUF)
++ cp docs/xvp2p.man $(DESTDIR)$(MANDIR)/xvpictoppm.$(MANSUF)
++ cp docs/vdcomp.man $(DESTDIR)$(MANDIR)/vdcomp.$(MANSUF)
++ chmod 644 $(DESTDIR)$(MANDIR)/xv.$(MANSUF) \
++ $(DESTDIR)$(MANDIR)/bggen.$(MANSUF) \
++ $(DESTDIR)$(MANDIR)/xcmap.$(MANSUF) \
++ $(DESTDIR)$(MANDIR)/xvpictoppm.$(MANSUF) \
++ $(DESTDIR)$(MANDIR)/vdcomp.$(MANSUF)
++#
++ $(MKDIR) $(DESTDIR)$(DOCDIR) # or $(DESTDIR)$(LIBDIR)
++ cp README.jumbo docs/xvdocs.pdf docs/xvdocs.ps $(DESTDIR)$(DOCDIR)/.
++ chmod 644 $(DESTDIR)$(DOCDIR)/README.jumbo \
++ $(DESTDIR)$(DOCDIR)/xvdocs.pdf $(DESTDIR)$(DOCDIR)/xvdocs.ps
++#
++ #$(MKDIR) $(DESTDIR)$(SYSCONFDIR)
++ #cp xv_mgcsfx.sample $(DESTDIR)$(SYSCONFDIR)/xv_mgcsfx
++ #chmod 644 $(DESTDIR)$(SYSCONFDIR)/xv_mgcsfx
++
tar:
+# tar only local jpeg and tiff dirs, not user's or system's copies:
@@ -257,7 +617,7 @@ diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
xvtar:
tar cvf xv.tar Makefile* Imakefile *.c *.h bits
-@@ -257,26 +289,26 @@
+@@ -257,26 +440,28 @@
################# bitmap dependencies ####################
@@ -268,15 +628,19 @@ diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
xvbrowse.o: bits/br_file bits/br_dir bits/br_exe bits/br_chr bits/br_blk
-xvbrowse.o: bits/br_sock bits/br_fifo bits/br_error bits/br_unknown
+-xvbrowse.o: bits/br_cmpres bits/br_gif bits/br_pm bits/br_pbm
+xvbrowse.o: bits/br_sock bits/br_fifo bits/br_error # bits/br_unknown
- xvbrowse.o: bits/br_cmpres bits/br_gif bits/br_pm bits/br_pbm
++xvbrowse.o: bits/br_cmpres bits/br_bzip2 bits/br_gif bits/br_pm bits/br_pbm
xvbrowse.o: bits/br_sunras bits/br_bmp bits/br_utah bits/br_iris
-xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds
-+xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds
- xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm
+-xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm
++xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds bits/br_pcd
++xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm bits/br_xwd
++xvbrowse.o: bits/br_fits bits/br_png bits/br_zx bits/br_mag bits/br_maki
++xvbrowse.o: bits/br_pic bits/br_pi bits/br_pic2 bits/br_mgcsfx
++xvbrowse.o: bits/br_jp2 bits/br_jpc
xvbrowse.o: bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm
-xvbrowse.o: bits/br_xwd
-+xvbrowse.o: bits/br_xwd
xvbutt.o: bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top
xvbutt.o: bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body
@@ -291,7 +655,7 @@ diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
xvctrl.o: bits/uicon bits/oicon1 bits/oicon2 bits/icon
xvctrl.o: bits/padimg bits/annot
-@@ -285,13 +317,13 @@
+@@ -285,13 +470,13 @@
xvdflt.o: bits/logo_top bits/logo_bot bits/logo_out bits/xv_jhb
xvdflt.o: bits/xv_cpyrt bits/xv_rev bits/xv_ver
xvdflt.o: bits/xf_left bits/xf_right bits/font5x9.h
@@ -307,50 +671,76 @@ diff -ruN xv-3.10a/Makefile xv-3.10a-bugfixes/Makefile
xvevent.o: bits/blur bits/blurm
xvgam.o: bits/h_rotl bits/h_rotr bits/h_flip bits/h_sinc bits/h_sdec
-diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
+diff -ru xv-3.10a/Makefile.std xv-3.10a-enhancements/Makefile.std
--- xv-3.10a/Makefile.std 1995-01-23 17:06:26.000000000 -0800
-+++ xv-3.10a-bugfixes/Makefile.std 2005-04-06 08:17:13.000000000 -0700
++++ xv-3.10a-enhancements/Makefile.std 2007-05-20 21:17:35.000000000 -0700
@@ -2,7 +2,11 @@
# your C compiler (and options) of choice
CC = cc
-# CC = gcc -ansi
+#CC = gcc -ansi
-+# note that -ansi kills __USE_MISC (gcc 2.95.3), which (at least in Linux)
++# note that -ansi kills __USE_MISC (gcc 2.95.3), which, at least on Linux,
+# determines whether stdlib.h includes prototypes for mktemp(), random(), etc.
+# (i.e., if you use it, you will get unnecessary compiler warnings)
+#CC = gcc
# use this if you're using 'cc' on a DEC Alpha (OSF/1) or MIPS (Ultrix) system:
# CC = cc -std1 -Olimit 750
-@@ -14,8 +18,13 @@
+@@ -14,8 +18,20 @@
# -Wuninitialized -Wparentheses
-CCOPTS = -O
-
+CCOPTS = -O
++#
+# these are the usual optimization and warning options for gcc; all such
+# warnings but one (mktemp() use) have been eliminated (at least on Linux):
+#CCOPTS = -O3 -Wall
++#
++# slightly more warnings... older code often made non-const pointers to
++# static strings (nothing should blow up unless something tries to write
++# to them):
++#CCOPTS = -O3 -Wall -Wpointer-arith -Wcast-align -Wwrite-strings -Wnested-externs
++#
+# for the next step up in gcc noise, try adding -W (but note that it adds a
+# huge number of unused-parameter and signed/unsigned comparison warnings):
+#CCOPTS = -O3 -Wall -W
### NOTE: Sun running OpenWindows:
### if you're using a SUN running OPENWINDOWS, you need to add these two
-@@ -27,6 +36,10 @@
+@@ -27,50 +43,155 @@
### '-I' options on the CCOPTS line to tell the compiler where said files are.
++# older Unixen don't support the -p option, but its lack may mean installation
++# will fail (if more than one directory level is missing)
++MKDIR = mkdir -p
++
++
+# BeOS _may_ need to use a different version (below), but probably not
+CLEANDIR = cleandir
+
+
### Installation locations
- BINDIR = /usr/local/bin
- MANDIR = /usr/local/man/man1
-@@ -38,7 +51,7 @@
+-BINDIR = /usr/local/bin
+-MANDIR = /usr/local/man/man1
++### NOTE: Users of old K&R compilers (i.e., any version not supporting C89
++### string concatenation, such as "fub" "ar" => "fubar") should update
++### xvtext.c:1831 (or thereabouts) if either PREFIX or DOCDIR changes:
++PREFIX = /usr/local
++BINDIR = $(PREFIX)/bin
++MANDIR = $(PREFIX)/share/man/man1
+ MANSUF = 1
+-LIBDIR = /usr/local/lib
++DOCDIR = $(PREFIX)/share/doc/xv
++LIBDIR = $(PREFIX)/lib/xv
++SYSCONFDIR = /etc
++DESTDIR =
+
+
+ buildit: all
########################### CONFIGURATION OPTIONS ############################
@@ -359,11 +749,9 @@ diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
##############################################################################
###
-@@ -59,18 +72,25 @@
- ### if, for whatever reason, you're unable to get the TIFF library to compile
- ### on your machine, *COMMENT OUT* the following lines
- ###
--TIFF = -DDOTIFF
++### if, for whatever reason, you're unable to get the TIFF library to compile
++### on your machine, *COMMENT OUT* the following lines
++###
+### GRR 20050319: USE_TILED_TIFF_BOTLEFT_FIX enables an experimental fix for
+### tiled TIFFs with ORIENTATION_BOTLEFT. It may break other tiled TIFFs,
+### or it may be required for certain other TIFF types (e.g., strips with
@@ -372,32 +760,143 @@ diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
+###
+#TIFF = -DDOTIFF
+TIFF = -DDOTIFF -DUSE_TILED_TIFF_BOTLEFT_FIX
- TIFFDIR = tiff
- TIFFINC = -I$(TIFFDIR)
- TIFFLIB = $(TIFFDIR)/libtiff.a
- $(TIFFLIB):
++###
++#TIFFDIR = tiff
++TIFFDIR = /usr
++#TIFFDIR = /usr/local
++#TIFFDIR = ../../libtiff
++###
++TIFFINC = -I$(TIFFDIR)/include
++#TIFFINC = -I$(TIFFDIR)
++###
++### libtiff 3.5 and up may be compiled with zlib and libjpeg, but the
++### dependency is properly handled in LIBS line ~247 lines below
++###
++TIFFLIB = -L$(TIFFDIR)/lib -ltiff
++#TIFFLIB = $(TIFFDIR)/lib/libtiff.a
++#TIFFLIB = -L$(TIFFDIR) -ltiff
++#TIFFLIB = $(TIFFDIR)/libtiff.a
++###
++### this is intended to build the ancient version (3.3.016 beta) that's
++### included in the "tiff" subdir of XV, not an arbitrary copy of libtiff:
++###
++#$(TIFFLIB):
++# ( cd $(TIFFDIR) ; make CC='$(CC)' COPTS='$(CCOPTS) $(MCHN)' )
++
++
++###
+ ### if, for whatever reason, you're unable to get the JPEG library to compile
+ ### on your machine, *COMMENT OUT* the following lines
+ ###
++### NOTE: /usr/sfw can be used on Solaris with "Sun freeware" installed
++###
+ JPEG = -DDOJPEG
+-JPEGDIR = jpeg
+-JPEGINC = -I$(JPEGDIR)
+-JPEGLIB = $(JPEGDIR)/libjpeg.a
+-$(JPEGDIR)/jconfig.h:
+- cd $(JPEGDIR) ; ./configure CC='$(CC)'
+-$(JPEGLIB): $(JPEGDIR)/jconfig.h
+- cd $(JPEGDIR) ; make
++#JPEGDIR = jpeg
++JPEGDIR = /usr
++#JPEGDIR = /usr/local
++#JPEGDIR = ../../libjpeg
++#JPEGDIR = /usr/sfw
++###
++JPEGINC = -I$(JPEGDIR)/include
++#JPEGINC = -I$(JPEGDIR)
++###
++JPEGLIB = -L$(JPEGDIR)/lib -ljpeg
++#JPEGLIB = -L$(JPEGDIR) -ljpeg
++#JPEGLIB = $(JPEGDIR)/libjpeg.a
++###
++### this is intended to build the ancient version (5a) that's included in the
++### "jpeg" subdir of XV, not an arbitrary copy of libjpeg:
++###
++#$(JPEGDIR)/jconfig.h:
++# cd $(JPEGDIR) ; ./configure CC='$(CC)'
++#$(JPEGLIB): $(JPEGDIR)/jconfig.h
++# cd $(JPEGDIR) ; make
+
+
+ ###
+-### if, for whatever reason, you're unable to get the TIFF library to compile
++### if, for whatever reason, you're unable to get the PNG library to compile
+ ### on your machine, *COMMENT OUT* the following lines
+ ###
+-TIFF = -DDOTIFF
+-TIFFDIR = tiff
+-TIFFINC = -I$(TIFFDIR)
+-TIFFLIB = $(TIFFDIR)/libtiff.a
+-$(TIFFLIB):
- ( cd $(TIFFDIR) ; make CC='$(CC)' )
-+ ( cd $(TIFFDIR) ; make CC='$(CC)' COPTS='$(CCOPTS) $(MCHN)' )
++PNG = -DDOPNG
++PNGDIR = /usr
++#PNGDIR = /usr/local
++#PNGDIR = ../../libpng
++###
++PNGINC = -I$(PNGDIR)/include
++#PNGINC = -I$(PNGDIR)
++###
++PNGLIB = -L$(PNGDIR)/lib -lpng
++#PNGLIB = -L$(PNGDIR) -lpng
++#PNGLIB = $(PNGDIR)/libpng.a
++
++
++###
++### if, for whatever reason, you're unable to get both the PNG library and
++### (newer versions of) the TIFF library to compile on your machine, *COMMENT
++### OUT* the following lines
++###
++ZLIBDIR = /usr
++#ZLIBDIR = /usr/local
++#ZLIBDIR = ../../zlib
++###
++ZLIBINC = -I$(ZLIBDIR)/include
++#ZLIBINC = -I$(ZLIBDIR)
++###
++ZLIBLIB = -L$(ZLIBDIR)/lib -lz
++#ZLIBLIB = -L$(ZLIBDIR) -lz
++#ZLIBLIB = $(ZLIBDIR)/libz.a
++
++
++###
++### if, for whatever reason, you're unable to get the JasPer JPEG-2000 library
++### to compile on your machine, *COMMENT OUT* the following lines
++###
++JP2K = -DDOJP2K
++###
++#JP2KDIR = ../../jasper
++JP2KDIR = /usr/local/lib
++###
++#JP2KINC = -I$(JP2KDIR)
++JP2KINC = -I/usr/local/include
++###
++#JP2KLIB = -L$(JP2KDIR) -ljasper
++JP2KLIB = $(JP2KDIR)/libjasper.a
###
### if, for whatever reason, you're unable to get the PDS/VICAR support
### to compile (xvpds.c, and vdcomp.c), *COMMENT OUT* the following line,
-### and also remove 'vdcomp' from the 'all:' dependancy
-+### and also remove 'vdcomp' from the 'all:' dependancy
++### and also remove 'vdcomp' from the 'all:' dependency
###
PDS = -DDOPDS
-@@ -78,17 +98,25 @@
+@@ -78,46 +199,60 @@
#----------System V----------
# if you are running on a SysV-based machine, such as HP, Silicon Graphics,
-# Solaris, etc., uncomment the following line to get mostly there.
-+# Solaris, etc., uncomment the following line to get mostly there.
- #UNIX = -DSVR4
-
+-#UNIX = -DSVR4
++# Solaris, etc.; uncomment one of the following lines to get you *most* of
++# the way there. SYSV means System V R3.
++# UNIX = -DSVR4
++# UNIX = -DSYSV
++
--#----------Machine Specific Configurations----------
+#----------Machine-Specific Configurations----------
+
+### If you are using a BeOS system, uncomment the following line
@@ -406,7 +905,8 @@ diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
+### The stock version of cleandir now should work for BeOS, too, so try
+### leaving this commented out:
+#CLEANDIR = cleandir.BeOS
-+
+
+-#----------Machine Specific Configurations----------
### If you are using an SGI system, uncomment the following line
#MCHN = -Dsgi
@@ -417,12 +917,25 @@ diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
#MCHN= -Dhpux -D_HPUX_SOURCE
# To use old HP compilers (HPUX 7.0 or so), you may need
#MCHN= -Dhpux -D_HPUX_SOURCE +Ns4000
-@@ -102,22 +130,22 @@
+ #
+-# also, if you're using HP's compiler, add '-Aa' to whichever of those
++# Also, if you're using HP's compiler, add '-Aa' to whichever of those
+ # two lines you're using, to turn on ANSI C mode. Or so I'm told.
+ #
+-# note: You may need to add '-I/usr/include/X11R5' (or R6, or whatever)
++# Note: You may need to add '-I/usr/include/X11R5' (or R6, or whatever)
+ # to whichever of those lines you used, as HP tends to store their X11
+ # include files in a non-standard place...
++#
++# And you probably have to add '-lV3' to the end of the LIBS def when
++# using XV's AUTO_EXPAND option.
- ### for LINUX, uncomment the following line
+-### for LINUX, uncomment the following line
-#MCHN = -DLINUX
++### for Linux, uncomment one of the following lines:
+#MCHN = -DLINUX -L/usr/X11R6/lib
++#MCHN = -DLINUX -L/usr/X11R6/lib64
# For SCO 1.1 (UNIX 3.2v2) machines, uncomment the following:
@@ -444,7 +957,7 @@ diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
# No other switches should be necessary, or so I'm told...
#
#MCHN = -q extensions=pcc_c -D__UMAXV__ -L/usr2/usr/lib/X11 -DSVR4
-@@ -147,8 +175,8 @@
+@@ -147,8 +282,8 @@
#TIMERS = -DUSLEEP
@@ -455,7 +968,7 @@ diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
# uncomment the following line:
#TIMERS = -DNOTIMER
-@@ -160,7 +188,7 @@
+@@ -160,7 +295,7 @@
#DXWM = -DDXWM
@@ -464,17 +977,77 @@ diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
# 'u_long', 'u_short', 'u_int', etc. as being undefined, uncomment the
# following line:
#BSDTYPES = -DBSDTYPES
-@@ -188,7 +216,9 @@
- $(NODIRENT) $(VPRINTF) $(TIMERS) $(UNIX) $(BSDTYPES) $(RAND) \
- $(DXWM) $(MCHN)
+@@ -177,18 +312,38 @@
+ #VPRINTF = -DNEED_VPRINTF -DLONGINT -DNOSTDHDRS
+
+
++# if your machine puts the prototype for 'malloc()' in malloc.h rather than
++# stdlib.h, uncomment the following line:
++#
++#MALLOC = -DNEED_MALLOC_H
+
+
+-################ END OF CONFIGURATION OPTIONS #################
++# if your X Window System compiled with -DX_LOCALE,
++# uncomment the following line:
++# TVL10N = -DX_LOCALE
++
++# Install directory of xv_mgcsfx.sample.
++MGCSFXDIR = $(LIBDIR)
++# Directory of default configuration file.
++MGCSFX = -DMGCSFXDIR=\"$(MGCSFXDIR)\"
++
+
+
+
++################ END OF CONFIGURATION OPTIONS #################
++
+
+-CFLAGS = $(CCOPTS) $(JPEG) $(JPEGINC) $(TIFF) $(TIFFINC) $(PDS) \
+- $(NODIRENT) $(VPRINTF) $(TIMERS) $(UNIX) $(BSDTYPES) $(RAND) \
+- $(DXWM) $(MCHN)
+-LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) -lm
++
++CFLAGS = $(CCOPTS) $(PNG) $(PNGINC) $(ZLIBINC) $(JPEG) $(JPEGINC) \
++ $(TIFF) $(TIFFINC) $(PDS) $(JP2K) $(JP2KINC) $(TVL10N) $(MGCSFX) \
++ $(UNIX) $(BSDTYPES) $(RAND) $(MALLOC) $(DXWM) $(MCHN) $(NODIRENT) \
++ $(VPRINTF) $(TIMERS) -DDOCDIR=\"$(DOCDIR)\" \
++ -DSYSCONFDIR=\"$(SYSCONFDIR)\" -DXVEXECPATH=\"$(LIBDIR)\"
++
+### remove -lm for BeOS:
- LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) -lm
-+#LIBS = -lX11 $(JPEGLIB) $(TIFFLIB)
++LIBS = $(TIFFLIB) $(JPEGLIB) $(PNGLIB) $(ZLIBLIB) $(JP2KLIB) -L/usr/X11R6/lib -lX11 -lm
++#LIBS = $(TIFFLIB) $(JPEGLIB) $(PNGLIB) $(ZLIBLIB) $(JP2KLIB) -lX11
OBJS = xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
-@@ -231,9 +261,10 @@
+@@ -196,7 +351,9 @@
+ xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
+ xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
+ xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
+- xvxwd.o xvfits.o
++ xvxwd.o xvfits.o xvpng.o xvzx.o xvwbmp.o xvpcd.o xvhips.o \
++ xvmag.o xvpic.o xvmaki.o xvpi.o xvpic2.o xvvd.o xvmgcsfx.o \
++ xvml.o xvjp2k.o
+
+ MISC = README INSTALL CHANGELOG IDEAS
+
+@@ -206,10 +363,12 @@
+
+
+
+-all: $(JPEGLIB) $(TIFFLIB) xv bggen vdcomp xcmap xvpictoppm
++#all: $(JPEGLIB) $(TIFFLIB) xv bggen vdcomp xcmap xvpictoppm
++all: xv bggen vdcomp xcmap xvpictoppm
+
+
+-xv: $(OBJS) $(JPEGLIB) $(TIFFLIB)
++#xv: $(OBJS) $(JPEGLIB) $(TIFFLIB)
++xv: $(OBJS)
+ $(CC) -o xv $(CFLAGS) $(OBJS) $(LIBS)
+
+ bggen: bggen.c
+@@ -231,23 +390,47 @@
clean: xvclean
rm -f bggen vdcomp xcmap xvpictoppm
@@ -487,9 +1060,43 @@ diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
+ ./$(CLEANDIR) tiff
++# could also do some shell trickery here to attempt mkdir only if dir is
++# missing (e.g., "test -d <dir> || $(MKDIR) <dir>")
install: all
-@@ -246,8 +277,9 @@
- cp docs/xvdocs.ps* $(LIBDIR)
+- cp xv bggen vdcomp xcmap xvpictoppm $(BINDIR)
+- cp docs/xv.man $(MANDIR)/xv.$(MANSUF)
+- cp docs/bggen.man $(MANDIR)/bggen.$(MANSUF)
+- cp docs/xcmap.man $(MANDIR)/xcmap.$(MANSUF)
+- cp docs/xvp2p.man $(MANDIR)/xvpictoppm.$(MANSUF)
+- cp docs/vdcomp.man $(MANDIR)/vdcomp.$(MANSUF)
+- cp docs/xvdocs.ps* $(LIBDIR)
++ $(MKDIR) $(DESTDIR)$(BINDIR)
++ cp xv bggen vdcomp xcmap xvpictoppm $(DESTDIR)$(BINDIR)/.
++ chmod 755 $(DESTDIR)$(BINDIR)/xv $(DESTDIR)$(BINDIR)/bggen \
++ $(DESTDIR)$(BINDIR)/vdcomp $(DESTDIR)$(BINDIR)/xcmap \
++ $(DESTDIR)$(BINDIR)/xvpictoppm
++#
++ $(MKDIR) $(DESTDIR)$(MANDIR)
++ cp docs/xv.man $(DESTDIR)$(MANDIR)/xv.$(MANSUF)
++ cp docs/bggen.man $(DESTDIR)$(MANDIR)/bggen.$(MANSUF)
++ cp docs/xcmap.man $(DESTDIR)$(MANDIR)/xcmap.$(MANSUF)
++ cp docs/xvp2p.man $(DESTDIR)$(MANDIR)/xvpictoppm.$(MANSUF)
++ cp docs/vdcomp.man $(DESTDIR)$(MANDIR)/vdcomp.$(MANSUF)
++ chmod 644 $(DESTDIR)$(MANDIR)/xv.$(MANSUF) \
++ $(DESTDIR)$(MANDIR)/bggen.$(MANSUF) \
++ $(DESTDIR)$(MANDIR)/xcmap.$(MANSUF) \
++ $(DESTDIR)$(MANDIR)/xvpictoppm.$(MANSUF) \
++ $(DESTDIR)$(MANDIR)/vdcomp.$(MANSUF)
++#
++ $(MKDIR) $(DESTDIR)$(DOCDIR) # or $(DESTDIR)$(LIBDIR)
++ cp README.jumbo docs/xvdocs.pdf docs/xvdocs.ps $(DESTDIR)$(DOCDIR)/.
++ chmod 644 $(DESTDIR)$(DOCDIR)/README.jumbo \
++ $(DESTDIR)$(DOCDIR)/xvdocs.pdf $(DESTDIR)$(DOCDIR)/xvdocs.ps
++#
++ #$(MKDIR) $(DESTDIR)$(SYSCONFDIR)
++ #cp xv_mgcsfx.sample $(DESTDIR)$(SYSCONFDIR)/xv_mgcsfx
++ #chmod 644 $(DESTDIR)$(SYSCONFDIR)/xv_mgcsfx
++
tar:
+# tar only local jpeg and tiff dirs, not user's or system's copies:
@@ -499,7 +1106,7 @@ diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
xvtar:
tar cvf xv.tar Makefile* Imakefile *.c *.h bits
-@@ -257,26 +289,26 @@
+@@ -257,26 +440,28 @@
################# bitmap dependencies ####################
@@ -510,15 +1117,19 @@ diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
xvbrowse.o: bits/br_file bits/br_dir bits/br_exe bits/br_chr bits/br_blk
-xvbrowse.o: bits/br_sock bits/br_fifo bits/br_error bits/br_unknown
+-xvbrowse.o: bits/br_cmpres bits/br_gif bits/br_pm bits/br_pbm
+xvbrowse.o: bits/br_sock bits/br_fifo bits/br_error # bits/br_unknown
- xvbrowse.o: bits/br_cmpres bits/br_gif bits/br_pm bits/br_pbm
++xvbrowse.o: bits/br_cmpres bits/br_bzip2 bits/br_gif bits/br_pm bits/br_pbm
xvbrowse.o: bits/br_sunras bits/br_bmp bits/br_utah bits/br_iris
-xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds
-+xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds
- xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm
+-xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm
++xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds bits/br_pcd
++xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm bits/br_xwd
++xvbrowse.o: bits/br_fits bits/br_png bits/br_zx bits/br_mag bits/br_maki
++xvbrowse.o: bits/br_pic bits/br_pi bits/br_pic2 bits/br_mgcsfx
++xvbrowse.o: bits/br_jp2 bits/br_jpc
xvbrowse.o: bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm
-xvbrowse.o: bits/br_xwd
-+xvbrowse.o: bits/br_xwd
xvbutt.o: bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top
xvbutt.o: bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body
@@ -533,7 +1144,7 @@ diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
xvctrl.o: bits/uicon bits/oicon1 bits/oicon2 bits/icon
xvctrl.o: bits/padimg bits/annot
-@@ -285,13 +317,13 @@
+@@ -285,13 +470,13 @@
xvdflt.o: bits/logo_top bits/logo_bot bits/logo_out bits/xv_jhb
xvdflt.o: bits/xv_cpyrt bits/xv_rev bits/xv_ver
xvdflt.o: bits/xf_left bits/xf_right bits/font5x9.h
@@ -549,400 +1160,9 @@ diff -ruN xv-3.10a/Makefile.std xv-3.10a-bugfixes/Makefile.std
xvevent.o: bits/blur bits/blurm
xvgam.o: bits/h_rotl bits/h_rotr bits/h_flip bits/h_sinc bits/h_sdec
-diff -ruN xv-3.10a/README.jumbo xv-3.10a-bugfixes/README.jumbo
---- xv-3.10a/README.jumbo 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-bugfixes/README.jumbo 2005-04-10 19:55:23.000000000 -0700
-@@ -0,0 +1,387 @@
-+These are the latest versions of the XV jumbo patches I originally created
-+in February 2000 (but never distributed) and eventually updated and released
-+in May 2004, prompted by a discussion on LWN (http://lwn.net/Articles/76391/).
-+Information about the patches, updates to the patches, and the patches
-+themselves can all be found here:
-+
-+ http://pobox.com/~newt/greg_xv.html
-+ http://freshmeat.net/projects/xvjumbopatches/
-+
-+(Use the "Subscribe to new releases" link on the latter page if you want to
-+be notified of new versions automatically; trivial registration required.)
-+
-+These two patches incorporate all of the fix- and enhancement-patches
-+available from John's XV site (http://www.trilon.com/xv/downloads.html
-+and ftp://ftp.trilon.com/pub/xv/patches/), plus a number of my own fixes
-+and additions, plus quite a few from other people--though not all of the
-+ones I'd intended to (sorry, SJT, AT, and JPD!) due to lack of time after
-+dealing with the latest security issue (which I discovered, sigh). They're
-+still not fully complete, and it's possible they never will be, but I do
-+plan to continue working on them whenever the mood strikes--and I may even
-+release them publicly on rare occasions. (At the current rate, it looks
-+like once a year may be the best we can hope for...we'll see.)
-+
-+Also be aware that several other people have had the same idea over the
-+years. Ones I've found, more or less by accident, include:
-+
-+ - Landon Curt "chongo" Noll (http://www.isthe.com/chongo/)
-+ http://www.isthe.com/chongo/src/xv-patch/
-+ - Mark Ashley <mark@ibiblio.org>
-+ http://www.ibiblio.org/pub/packages/solaris/sparc/html/xv.3.10a.p19.html
-+ - Peter Jordan <pete@dc.seflin.org>
-+ http://www.ibiblio.org/pub/Linux/apps/graphics/viewers/X/xv-3.10a.patch.*
-+ - Uwe F. Mayer (http://www.tux.org/~mayer/)
-+ http://www.tux.org/~mayer/linux/book/node311.html
-+ - Kurt Wall <kwall@kurtwerks.com>
-+ http://www.kurtwerks.com/software/xv.html
-+ - Chisato Yamauchi (http://phe.phyas.aichi-edu.ac.jp/~cyamauch/index_en.html)
-+ http://phe.phyas.aichi-edu.ac.jp/~cyamauch/xv.html
-+ - Daisuke Yabuki <dxy@optix.org>
-+ http://www.optix.org/~dxy/solaris/xv/
-+ - Pekoe (http://pekoe.lair.net/)
-+ http://pekoe.lair.net/diary/xv.html
-+ - FreeBSD FreshPorts
-+ http://www.freshports.org/graphics/xv/
-+ - <sudakyo@fat.coara.or.jp>
-+ http://www.coara.or.jp/~sudakyo/XV_jp.html
-+
-+I very much doubt that this is an exhaustive list. So far, most of the other
-+patch-sets appear not to be quite as extensive or as up-to-date as my own,
-+although the last three or four do include the [large] Japanese extension
-+patches that I omitted--not because they're unworthy, but simply because I
-+didn't find them until collisions between the two sets of patches had become
-+a large problem. (Maybe for the next release... I'd intended to try for
-+this release, but the security issues ended up taking almost all of my
-+available time. And, to be honest, from my perspective, inclusion of the
-+jp-extension patches is more for completeness' sake than personal interest,
-+so their priority is fairly low.)
-+
-+Below I summarize the component patches that are encompassed by my jumbo
-+bugfixes and jumbo enhancements patches. Unfortunately, some of my own
-+additions never saw the light of day as standalone patches, but considering
-+the number of overlaps (collisions) already implicit in this list, it would
-+have been difficult to accomplish even if I'd had the time. In any case,
-+they're present in these jumbo patches but not chongo's, so those who _really_
-+care can "subtract" the two sets of patches to see what I did.
-+
-+Here's a quick guide to the "third-party" credits in the lists below:
-+
-+ AAC = Andrey A. Chernov [ache]
-+ (http://cvsweb.freebsd.org/ports/graphics/xv/files/patch-ab)
-+ AD = Andreas Dilger (adilger@clusterfs.com)
-+ AL = Alexander Lehmann (lehmann@usa.net)
-+ AT = Anthony Thyssen (http://www.cit.gu.edu.au/~anthony/)
-+ DAC = David A. Clunie (http://www.dclunie.com/xv-pcd.html)
-+ EK = Egmont Koblinger (egmont@users.sourceforge.net)
-+ GRR = Greg Roelofs (http://pobox.com/~newt/)
-+ GV = Guido Vollbeding (http://sylvana.net/guido/)
-+ JCE = John C. Elliott (http://www.seasip.demon.co.uk/ZX/zxdload.html)
-+ JHB = John H. Bradley, of course (http://www.trilon.com/xv/)
-+ JPD = Jean-Pierre Demailly (http://www-fourier.ujf-grenoble.fr/~demailly/)
-+ JR = John Rochester (http://www.freebsd.org/cgi/query-pr.cgi?pr=2920)
-+ (also http://cvsweb.freebsd.org/ports/graphics/xv/files/patch-af, -ag)
-+ JZ = Joe Zbiciak (http://spatula-city.org/~im14u2c/)
-+ LCN = Landon Curt "chongo" Noll (http://www.isthe.com/chongo/)
-+ PBJ = Peter Jordan (http://www.ibiblio.org/pub/Linux/apps/graphics/viewers/X/)
-+ PSV = Pawel S. Veselov (http://manticore.2y.net/wbmp.html)
-+ SB = Sean Borman (http://www.nd.edu/~sborman/software/xvwheelmouse.html)
-+ SJT = TenThumbs (tenthumbs@cybernex.net)
-+ TA = Tim Adye (http://hepwww.rl.ac.uk/Adye/xv-psnewstyle.html)
-+
-+Other credits are as listed on the XV Downloads page or in the respective
-+patches (e.g., the jp-extension patches or within the PNG patch).
-+
-+Finally, please note that these patches have not been blessed by John Bradley
-+in any way (although I copied him on the May 2004 announcement--no response).
-+Nor have I personally tested every change and feature! (See the BIG SCARY
-+WARNING below for further caveats.) In other words, they're both completely
-+unofficial and completely unguaranteed. But they seem to work for me. (And
-+when they don't, I fix 'em. Eventually, anyway... ;-) )
-+
-+One further "final" note: this may well be the last release to include
-+separate fix- and enhancements-patches. It is too much of a timesink to
-+maintain parallel trees--not to mention parallel makefiles (generic/public
-+vs. local/personal, old vs. new libjpeg/libtiff) and xv.h (unregistered/
-+public vs. registered/personal), particularly when some fixes come about
-+while working on an enhancement. Henceforth--assuming, of course, that
-+there _is_ a "henceforth"--I expect to merge the patches into a single
-+jumbo patch. (Alternatively, I may simply freeze the current fix-patch
-+and continue to evolve only the enhancements patch; in particular, new
-+fixes would appear only in it. Either approach would be simple enough;
-+feedback as to which would be preferable is welcomed.)
-+
-+GRR 20050410
-+
-+
-+How to build
-+------------
-+
-+The following assumes you, the user, already have the libtiff,[1]
-+libjpeg,[2] libpng,[3] and zlib[4] libraries downloaded, patched (if
-+necessary), compiled, and installed, not to mention a C compiler and
-+the bzip2,[5] tar,[6] patch,[7] and make[8] utilities. You should also
-+have downloaded the original XV 3.10a source distribution from the XV
-+Downloads page[9] and be able to edit its Makefile and config.h files
-+as indicated in the INSTALL file. Finally, you should know what a
-+Unix(-style) command line is, where to find one, and how to wield it
-+with abandon (or at least with adult supervision)--and preferably not
-+as the root user until the make install step. (A filesystem is a
-+terrible thing to waste.)
-+
-+ [1] http://www.remotesensing.org/libtiff/
-+ [2] http://www.ijg.org/
-+ [3] http://www.libpng.org/pub/png/libpng.html
-+ [4] http://www.zlib.net/
-+ [5] http://sources.redhat.com/bzip2/
-+ [6] http://www.gnu.org/directory/devel/specific/tar.html
-+ [7] http://www.gnu.org/directory/devel/specific/patch.html
-+ [8] http://www.gnu.org/directory/devel/specific/make.html
-+ [9] http://www.trilon.com/xv/downloads.html#src-distrib
-+
-++-------------------------------------------------------------------------+
-+| |
-+| BIG SCARY WARNING |
-+| |
-+| These patches work for Greg (and parts of them apparently work for |
-+| various other people), and so far Greg's CPU still computes and his |
-+| hard disks haven't been wiped. But there's no guarantee that that |
-+| will be the case for you! In particular, not every incorporated patch |
-+| has been explicitly tested, nor has every possible subcase of the |
-+| explicitly tested subset. (Read that again; it's grammatical.) Nor are |
-+| these patches officially blessed by John Bradley in any way. In other |
-+| words, if you use these patches, you do so at your own risk. (Greg |
-+| doesn't believe there are any serious problems remaining, but then, |
-+| what programmer ever does? Bugs happen.) |
-+| |
-++-------------------------------------------------------------------------+
-+
-+Assuming you have the prerequisites out of the way and aren't scared
-+off by the Big Scary Warning, here's the build procedure:
-+
-+ bzip2 -dc xv-3.10a-jumbo-patches-20050410.tar.bz2 | tar xvf -
-+ (or tar xvzf xv-3.10a-jumbo-patches-20050410.tar.gz)
-+
-+ tar xvzf xv-3.10a.tar.gz
-+
-+ cd xv-3.10a
-+
-+ patch -p1 < ../xv-3.10a-jumbo-fix-patch-20050410.txt
-+
-+ [optional] patch -p1 < ../xv-3.10a-jumbo-enh-patch-20050410.txt
-+
-+ edit Makefile and config.h as directed in INSTALL file (in particular,
-+ ensure paths to external libraries and header files are correct)
-+
-+ make
-+
-+ ./xv your_favorite_image your_other_favorite_image etc.
-+
-+If everything seems to be working to your satisfaction, go ahead and install:
-+
-+ make -n install (and double-check that things will be installed
-+ where you want them to be)
-+
-+ become root if necessary (e.g., type su)
-+
-+ make install
-+
-+That wasn't so hard, was it?
-+
-+
-+Summary of incorporated and unincorporated patches
-+--------------------------------------------------
-+
-+fixes ((*) = listed on XV Downloads page, (f) = on ftp site only):
-+
-+20040516:
-+ - grabpatch (*) [obsoleted by new-xvgrab.c below]
-+ - vispatch (*)
-+ - mp-tiff-patch (*) [technically an enhancement, but JHB says...]
-+ - longname.patch (*) [*SECURITY*]
-+ - xpm.patch (*)
-+ - deepcolor.patch (*) [slightly modified for language conformance]
-+ - gifpatch (*)
-+ - exceed_grab.patch (*)
-+ - xv-redhat6-readme.txt (*) [slightly modified for portability]
-+ - beos.patch (*) [modified for portability]
-+ - croppad.patch (f)
-+ - epsfpatch (f)
-+ - tiff1200.patch (*)
-+ - gssafer.patch (*) [*SECURITY*]
-+ - new-xvgrab.c (f) [includes grabpatch but not exceed_grab.patch]
-+ - xcmap.diff (AD) [part of xv-3.10a-png-1.2d.tar.gz]
-+ - fixes for huge number gcc -Wall warnings--including two bugs (GRR)
-+ - fix for cleandir script when no makefile exists (GRR)
-+ - *SECURITY* fix for gets() in vdcomp.c (GRR, LCN vdcomp-security.patch)
-+ - *SECURITY* fix for getwd() on Linux (GRR, LCN Linux-compile.patch)
-+ - fix for "no fuss" Linux compiles (LCN Linux-compile.patch)
-+ - partial *SECURITY* fix for mktemp() in xv.c and xvdir.c (GRR)
-+ (remaining instances in xv.c (2), xvimage.c, xvfits.c, xvpds.c, xvps.c, and
-+ possibly xvtiff.c--most involve system())
-+ - freebsd-vdcomp-newline.patch (AAC)
-+ - xv-3.10a.patch.linux (PBJ) [/bin/sh versions of cleandir, RANLIB.sh only]
-+ - removed trailing white space (GRR) [purely cosmetic]
-+20050410:
-+ - fix for YCbCr oversaturated-green bug(s) in TIFF decoder (GRR)
-+ - provisional fix for contiguous tiled TIFFs with bottom-* orientation (GRR)
-+ - fixes for gcc 3.3 -Wall warnings (GRR)
-+ - fix for incorrect 16/24-bit display of xwd dumps (SJT)
-+ - *SECURITY* fix for multiple input-validation bugs (OpenBSD/SuSE, Gentoo, GRR)
-+ (this also completes the partial mktemp() security fix listed above)
-+ - fix for (probable) 24-bit endianness bug in fixpix code (GRR)
-+
-+
-+enhancements ((*) = listed on XV Downloads page, (<who>) = third-party):
-+
-+20040516:
-+ - xv-3.10a.JPEG-patch (*)
-+ (xv-3.10a.JPEG-patch.old differs only in ftp site listed in comments at top)
-+ - xv-3.10a.TIFF-patch (*)
-+ - xv-3.10a-png-1.2d.tar.gz (AL, AD) (*)
-+ (xvjpeg.diff and xvtiff.diff ignored; xcmap.diff included in fixes)
-+ - xvpng-1.2d-fix3.patch (GRR, SJT) (*)
-+ - pdf.patch (*)
-+ - windowid.patch + windowid.patch.readme (*)
-+ - bmp32.patch (*)
-+ - fixpix-20000610.tar.gz (GV)
-+ (identical to 19961127 version except for README updates and new Win32 file)
-+ [modified to be runtime-selectable via -/+fixpix option]
-+ - browse-remember.patch (JZ)
-+ - faster-smooth.patch (JZ)
-+ - PAM support (GRR)
-+ - PNG/GIF -ibg ("image background") transparency option (GRR)
-+ (does not yet support TIFF, XPM or TGA)
-+ - VersionInfo* in help screen (GRR)
-+ - minor grammar/spelling fixes (GRR)
-+ - floating-point support for -wait when USE_TICKS enabled (GRR)
-+ - wheelmouse.patch (SB)
-+ - freebsd-gravity-hints-patch (JR)
-+ - xv-zx.patch (JCE)
-+ - xv3.10a.wapbmp.patch (PSV)
-+ - xv-3.10a-pcd.patch.20010708 (DAC)
-+ - jp-ext-bzip2-1.1.patch
-+ (from ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/shige/xv/)
-+20050410:
-+ - boosted maximum number of files from 4096 to 32768 (GRR)
-+ (note that OS kernel limits may also apply; for example, in Linux see
-+ MAX_ARG_PAGES in linux-<version>/include/linux/binfmts.h)
-+ - xv-3.10a-bmp16.patch
-+ (from http://www.coara.or.jp/~sudakyo/XV_jp.html)
-+ - final-image delay (e.g., "-wait 0.2,3" : pause 3 secs on final image) (GRR)
-+ - xv-numpad.patch (EK)
-+ - xv-delete-is-not-backspace.patch (EK)
-+ - made browser window (schnauzer) and icons configurable (AT, GRR)
-+
-+
-+not (yet?) included:
-+
-+ - others from http://www.coara.or.jp/~sudakyo/XV_jp.html (some are duplicates):
-+ -rw-r--r-- 4644 Mar 11 2004 xv-3.10a-directory.patch
-+ -rw-r--r-- 462 Mar 11 2004 xv-3.10a-dirwkey.patch
-+ -rw-r--r-- 688 Mar 11 2004 xv-3.10a-docdir.patch
-+ -rw-r--r-- 11952 Mar 11 2004 xv-3.10a-download-test0.patch
-+ -rw-r--r-- 41786 Mar 11 2004 xv-3.10a-download-test1.patch
-+ -rw-r--r-- 42397 Mar 11 2004 xv-3.10a-download-test2.patch
-+ -rw-r--r-- 47679 Mar 11 2004 xv-3.10a-download-test3.patch
-+ -rw-r--r-- 52745 Mar 11 2004 xv-3.10a-download-test4.patch
-+ -rw-r--r-- 415 Mar 11 2004 xv-3.10a-formatstr.patch
-+ -rw-r--r-- 3423 Apr 24 2004 xv-3.10a-keyzoom.patch
-+ -rw-r--r-- 1461 Mar 11 2004 xv-3.10a-locale-linux.patch
-+ -rw-r--r-- 12387 Mar 15 2004 xv-3.10a-menubutton.patch
-+ -rw-r--r-- 1178 Apr 24 2004 xv-3.10a-noblink.patch
-+ -rw-r--r-- 484 Mar 11 2004 xv-3.10a-printkey.patch
-+ -rw-r--r-- 57092 Jul 9 2004 xv-3.10a-resolution.patch
-+ -rw-r--r-- 4645 Apr 24 2004 xv-3.10a-selall.patch
-+ -rw-r--r-- 360 Mar 11 2004 xv-3.10a-shortsleep.patch
-+ -rw-r--r-- 702 Apr 24 2004 xv-3.10a-showlongname.patch
-+ -rw-r--r-- 1205 Apr 24 2004 xv-3.10a-staytoppdir.patch
-+ -rw-r--r-- 1591 Mar 15 2004 xv-3.10a-sysconfdir.patch
-+ -rw-r--r-- 4228 Apr 24 2004 xv-3.10a-wheelmouse.patch
-+ -rw-r--r-- 744 Apr 24 2004 xv-3.10a-xvbutt_wait.patch
-+ -rw-r--r-- 712 Mar 11 2004 xv-3.10a-xvexecpath.patch
-+ -rw-r--r-- 3757 Jul 9 2004 xv-3.10a-xvscrl_button2.patch
-+ -rw-r--r-- 1494 Jul 9 2004 xv-3.10a-xvscrl_wait.patch
-+ -rw-r--r-- 19352 Jul 9 2004 xv-3.10a-xvzoom.patch
-+ -rw-r--r-- 1827 Apr 24 2004 xv-3.10a-zeroquit.patch
-+
-+ - xv310a-jp-extension-rev5.3.3.tar.gz [extensive]
-+ - xv-3.10a-jp-extension-5.3.3-png-1.2d.patch [PNG patch relative to jp-ext]
-+ - xv-3.10a+jp-extension-rev5.3.3+FLmask.v2.1+png+misc.patch [??]
-+
-+ - xv-grab-imake-hips.patch (JPD) [HIPS format, -startgrab option]
-+ - xv-psnewstyle.patch (TA) [coming later in 2005?]
-+ - xv-3.10a.patch.linux (PBJ) [maybe use vdcomp.c changes?]
-+ - xvxpm-anthony-thyssen.c (AT) ["slate grey" bug already gone?]
-+
-+ - stuff in xv/unsupt:
-+ -rw-r--r-- 30527 Dec 22 1994 FITS.rite
-+ -rw-r--r-- 49152 Dec 22 1994 FITS.tar
-+ -rw-r--r-- 3753 Dec 22 1994 G3.patch1
-+ -rw-r--r-- 24576 Dec 22 1994 G3.tar
-+ -rw-r--r-- 1098 Dec 22 1994 INFO.cgm
-+ -rw-r--r-- 1941 Dec 22 1994 README
-+ -rwxr-xr-x 1059 Dec 22 1994 getweather
-+ -rwxr-xr-x 2186 Dec 22 1994 getweather.ksh
-+ -rw-r--r-- 856 Dec 22 1994 twm.fix
-+ -rw-r--r-- 844 Dec 22 1994 vargs.c
-+ -rw-r--r-- 47626 Dec 22 1994 vis
-+ -rw-r--r-- 21097 Dec 22 1994 xscm
-+
-+
-+
-+not finished (and/or even started ;-) ):
-+
-+ - fix xvpng.c not to use direct struct access
-+ - fix for never-ending pile of SLOW popups when viewing TIFFs with unknown tags
-+ (or truncated/corrupted images)
-+ - fix for minor .Z inefficiency in xv.c ("FIXME")
-+ - fix for filename entry-field mouse/cursor bogosity
-+ (want at least positioning to work; preferably also select/cut/paste)
-+ - fix for spacebar-for-next-image getting stuck at first text file
-+ - fix for .ppm.gz "disk leak" [can't reproduce...already fixed?]
-+ (maybe occurs only if filesystem is already nearly full? bad .gz?)
-+
-+ - transparency support for TIFF, XPM and TGA images
-+ - support for tiled background image (with transparent foreground image)
-+ - MNG/JNG support
-+
-+
-+ChangeLog
-+---------
-+
-+ 20000220
-+ original pair of jumbo patches, comprising perhaps 16 fix-patches and a
-+ dozen enhancement-patches; never publicly released
-+
-+ 20040516
-+ first public release, incorporating 25 fix-patches and 21 enhancement-
-+ patches
-+
-+ 20040523
-+ minor fix to xvctrl.c to support registered versions (GRR warnings-patch
-+ was slightly overzealous); switched to tarball packaging
-+
-+ 20040531
-+ fixed undefined CLK_TCK with gcc -ansi (enh/USE_TICKS option); made
-+ libjpeg, libtiff, libpng and zlib sections of makefile more consistent
-+ (enh);
-+
-+ 20040606
-+ added freshmeat link, build instructions, and changelog to jumbo README
-+ (this file)
-+
-+ 20050213
-+ increased max number of files from 4096 to 32768 (enh)
-+
-+ 20050320-20050410
-+ fixed two very long-standing YCbCr bugs in TIFF decoder (fix);
-+ provisionally fixed bug in TIFF decoder for contiguous tiled TIFFs with
-+ bottom-* orientation (fix/USE_TILED_TIFF_BOTLEFT_FIX option); fixed new
-+ gcc 3.3 warnings (fix); fixed incorrect 16/24-bit display of xwd dumps
-+ (fix); fixed multiple input-validation bugs (potential heap overflows)
-+ and mktemp() dependencies (*SECURITY* fixes: CAN-2004-1725, CAN-2004-
-+ 1726, CAN-2005-0665, CERT VU#622622, and others); added support for 16-
-+ and 32-bit BMPs using bitfields "compression" (enh); fixed probable byte-
-+ sex bug in 24-bit FixPix display code (enh/USE_24BIT_ENDIAN_FIX option);
-+ fixed numerical-keypad NumLock behavior and delete-key behavior in file-
-+ load/save window (enh); made schnauzer window and icons configurable (enh)
-diff -ruN xv-3.10a/bggen.c xv-3.10a-bugfixes/bggen.c
+diff -ru xv-3.10a/bggen.c xv-3.10a-enhancements/bggen.c
--- xv-3.10a/bggen.c 1994-12-22 14:34:41.000000000 -0800
-+++ xv-3.10a-bugfixes/bggen.c 2004-05-16 17:50:52.000000000 -0700
++++ xv-3.10a-enhancements/bggen.c 2005-04-17 14:04:22.000000000 -0700
@@ -18,6 +18,11 @@
#include <stdio.h>
#include <math.h>
@@ -955,6 +1175,15 @@ diff -ruN xv-3.10a/bggen.c xv-3.10a-bugfixes/bggen.c
#ifndef M_PI
# define M_PI 3.1415926535897932385
#endif
+@@ -29,7 +34,7 @@
+ #define MAXCOLS 128
+
+ /* some VMS thing... */
+-#ifdef vax11c
++#if defined(vax11c) || (defined(__sony_news) && (defined(bsd43) || defined(__bsd43) || defined(SYSTYPE_BSD) || defined(__SYSTYPE_BSD)))
+ #include <ctype.h>
+ #endif
+
@@ -46,8 +51,8 @@
typedef unsigned char byte;
@@ -1262,9 +1491,22 @@ diff -ruN xv-3.10a/bggen.c xv-3.10a-bugfixes/bggen.c
for (y=0; y<h; y++) {
if (doascii) {
for (x=0; x<w; x++, pic+=3)
-diff -ruN xv-3.10a/bits/icon xv-3.10a-bugfixes/bits/icon
+diff -ru xv-3.10a/bits/br_targa xv-3.10a-enhancements/bits/br_targa
+--- xv-3.10a/bits/br_targa 1994-12-22 14:35:30.000000000 -0800
++++ xv-3.10a-enhancements/bits/br_targa 2007-04-15 10:40:46.000000000 -0700
+@@ -1,6 +1,6 @@
+-#define br_targa_width 48
+-#define br_targa_height 48
+-static unsigned char br_targa_bits[] = {
++#define br_tga_width 48
++#define br_tga_height 48
++static unsigned char br_tga_bits[] = {
+ 0xe0, 0xff, 0xff, 0xff, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x03, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x09, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x11, 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00,
+diff -ru xv-3.10a/bits/icon xv-3.10a-enhancements/bits/icon
--- xv-3.10a/bits/icon 1994-12-22 14:35:28.000000000 -0800
-+++ xv-3.10a-bugfixes/bits/icon 2004-04-28 00:53:10.000000000 -0700
++++ xv-3.10a-enhancements/bits/icon 2004-04-28 08:00:16.000000000 -0700
@@ -1,5 +1,6 @@
#define icon_width 40
#define icon_height 32
@@ -1277,9 +1519,9 @@ diff -ruN xv-3.10a/bits/icon xv-3.10a-bugfixes/bits/icon
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};
+#endif
-diff -ruN xv-3.10a/cleandir xv-3.10a-bugfixes/cleandir
+diff -ru xv-3.10a/cleandir xv-3.10a-enhancements/cleandir
--- xv-3.10a/cleandir 1994-12-22 14:34:50.000000000 -0800
-+++ xv-3.10a-bugfixes/cleandir 2004-05-10 23:19:16.000000000 -0700
++++ xv-3.10a-enhancements/cleandir 2004-05-10 23:19:16.000000000 -0700
@@ -1,9 +1,13 @@
-#!/bin/csh -f
+#!/bin/sh -f
@@ -1300,32 +1542,80 @@ diff -ruN xv-3.10a/cleandir xv-3.10a-bugfixes/cleandir
+# echo "no makefile found; NOT cleaning '$1' subdirectory"
+ fi
+fi
-diff -ruN xv-3.10a/config.h xv-3.10a-bugfixes/config.h
+diff -ru xv-3.10a/config.h xv-3.10a-enhancements/config.h
--- xv-3.10a/config.h 1995-01-05 10:49:21.000000000 -0800
-+++ xv-3.10a-bugfixes/config.h 2005-03-21 23:21:31.000000000 -0800
-@@ -8,9 +8,9 @@
++++ xv-3.10a-enhancements/config.h 2007-05-14 08:51:10.000000000 -0700
+@@ -6,25 +6,42 @@
+ /***************************************************************************
+ * GZIP'd file support
*
- * if you have the gnu uncompression utility 'gunzip', XV can use it to
- * automatically 'unzip' any gzip'd files. To enable this feature,
+- * if you have the gnu uncompression utility 'gunzip', XV can use it to
+- * automatically 'unzip' any gzip'd files. To enable this feature,
- * change 'undef' to 'define' in the following line. Needless to say, if
-+ * change 'undef' to 'define' in the following line. Needless to say, if
- * your gunzip is installed elsewhere on your machine, change the 'GUNZIP'
+- * your gunzip is installed elsewhere on your machine, change the 'GUNZIP'
- * definition appropriately. (use 'which gunzip' to find if you have gunzip,
-+ * definition appropriately. (use 'which gunzip' to find if you have gunzip,
- * and where it lives)
+- * and where it lives)
++ * if you have the GNU uncompression utility 'gunzip' (or 'gzip' itself,
++ * which is just a link to gunzip), XV can use it to automatically 'unzip'
++ * any gzip'd files. To enable this feature, change 'undef' to 'define' in
++ * the following line. Needless to say, if your gunzip is installed elsewhere
++ * on your machine, change the 'GUNZIP' definition appropriately. (use
++ * 'which gunzip' to find if you have gunzip, and where it lives; ditto for
++ * gzip)
*/
- #undef USE_GUNZIP
-@@ -19,7 +19,8 @@
+-#undef USE_GUNZIP
++#define USE_GUNZIP
+
+ #ifdef USE_GUNZIP
# ifdef VMS
# define GUNZIP "UNCOMPRESS"
# else
-# define GUNZIP "/usr/local/bin/gunzip -q"
-+/* define GUNZIP "/usr/local/bin/gunzip -q" */
-+# define GUNZIP "/usr/bin/gzip -dq" /* more portable */
++# define GUNZIP "gzip -dq"
# endif
#endif
-@@ -70,18 +71,18 @@
+
+ /***************************************************************************
++ * BZIP2'd file support
++ *
++ * if you have the uncompression utility 'bunzip2' (or 'bzip2' itself, which
++ * is just a link to bunzip2), XV can use it to automatically 'unzip' any
++ * bzip2'd files. To enable this feature, change 'undef' to 'define' in the
++ * following line (if not already done). Use 'which bunzip2' or 'which bzip2'
++ * to find if you have bzip2/bunzip2, and where it lives.
++ */
++#define USE_BUNZIP2
++
++#ifdef USE_BUNZIP2
++# define BUNZIP2 "bzip2 -d" /* should this include the full path? */
++#endif
++
++
++/***************************************************************************
+ * compress'd file support
+ *
+ * if you have GUNZIP defined above, just ignore this, as 'gunzip' can
+@@ -37,9 +54,16 @@
+ */
+ #define UNCOMPRESS "/usr/ucb/uncompress"
+
+-#if defined(hpux) || defined(SVR4) || defined(__386BSD__)
++#if defined(hpux) || defined(SVR4) || \
++ defined(__386BSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
++ defined(__linux__)
++ /*
++ I want to use BSD macro for checking if this OS is *BSD or not,
++ but the macro is defined in <sys/parm.h>, which I don't know all
++ machine has or not.
++ */
+ # undef UNCOMPRESS
+-# define UNCOMPRESS "/usr/bin/uncompress"
++# define UNCOMPRESS "uncompress"
+ #endif
+
+ #if defined(sgi)
+@@ -70,18 +94,18 @@
* PostScript file input support:
*
* if you have the 'ghostscript' package installed (version 2.6 or later),
@@ -1349,16 +1639,29 @@ diff -ruN xv-3.10a/config.h xv-3.10a-bugfixes/config.h
* just fix your 'gs' so it looks in the right places without being told...)
*
* GS_DEV is the file format that ghostscript will convert PS into. It
-@@ -97,7 +98,7 @@
+@@ -89,6 +113,7 @@
+ */
+
+ /* #define GS_PATH "/usr/local/bin/gs" */
++#define GS_PATH "gs"
+ /* #define GS_LIB "." */
+ /* #define GS_DEV "ppmraw" */
+
+@@ -97,10 +122,10 @@
* 'old-style' XV logo image:
*
* XV now has a nifty, new logo image. The downside is that it increases
- * the size of the 'xv' executable by 250K or so, and it's possible that
+- * your compiler may choke while compiling 'xvdflt.c'. If you're compiler
+ * the size of the 'xv' executable by 250K or so, and it's possible that
- * your compiler may choke while compiling 'xvdflt.c'. If you're compiler
++ * your compiler may choke while compiling 'xvdflt.c'. If your compiler
* can't handle it, or you're running Linux on a system with minimal memory,
- * change 'undef' to 'define' in the following line
-@@ -108,8 +109,8 @@
+- * change 'undef' to 'define' in the following line
++ * change 'undef' to 'define' in the following line:
+ */
+
+ #undef USEOLDPIC
+@@ -108,8 +133,8 @@
/***************************************************************************
* Backing Store:
@@ -1369,9 +1672,228 @@ diff -ruN xv-3.10a/config.h xv-3.10a-bugfixes/config.h
* several of its windows, which may help performance over a slow network
* connection. However, it has been known to behave strangely (or crash)
* on some X servers, so it's left here as an option. If you run into trouble
-diff -ruN xv-3.10a/copyright.h xv-3.10a-bugfixes/copyright.h
+@@ -119,3 +144,218 @@
+
+ #define BACKING_STORE
+
++
++/***************************************************************************
++ * TIFF YCbCr-to-RGB conversion:
++ *
++ * Newer versions of libtiff can be compiled with libjpeg for JPEG-in-TIFF
++ * support, and according to Scott Marovich, "the IJG JPEG Library...sometimes
++ * seems to produce slightly more accurate results" (one known example: the
++ * 'quad-jpeg.tif' test image). In addition, libtiff can be compiled with
++ * "old JPEG" support, although its configure script will not enable that by
++ * default. Change 'define' and 'undef' in the following lines as you wish,
++ * but note that defining LIBTIFF_HAS_OLDJPEG_SUPPORT when such is _not_ the
++ * case will result in crashes when encountering old-JPEG TIFFs:
++ */
++
++#define USE_LIBJPEG_FOR_TIFF_YCbCr_RGB_CONVERSION
++#undef LIBTIFF_HAS_OLDJPEG_SUPPORT
++
++
++/***************************************************************************
++ * PhotoCD/MAG/PIC/MAKI/Pi/PIC2/HIPS format Support:
++ *
++ * if, for whatever reason--say, security concerns--you don't want to
++ * include support for one or more of the PhotoCD, MAG/MAKI/Pi/PIC/PIC2
++ * (Japanese), or HIPS (astronomical) image formats, change the relevant
++ * 'define' to 'undef' in the following lines. Conversely, if you *do*
++ * want them, change 'undef' to 'define' as appropriate.
++ */
++
++#define HAVE_PCD /* believed to be reasonably safe */
++
++#undef HAVE_MAG /* probable security issues */
++#undef HAVE_MAKI /* probable security issues */
++#undef HAVE_PI /* probable security issues */
++#undef HAVE_PIC /* probable security issues */
++#undef HAVE_PIC2 /* probable security issues */
++
++#undef HAVE_HIPS /* probable security issues */
++
++
++/***************************************************************************
++ * MacBinary file support:
++ *
++ * if you want XV to be able to handle ``MacBinary'' files (which have
++ * 128 byte info file header at the head), change 'undef' to 'define'
++ * in the following line.
++ */
++
++#undef MACBINARY
++
++
++/***************************************************************************
++ * Auto Expand support:
++ *
++ * if you want to extract archived file automatically and regard it as
++ * a directory, change 'undef' to 'define' in the AUTO_EXPAND line.
++ *
++ * Virtual Thumbdir support:
++ *
++ * if you want Virtual directory based Thumbdir(It means that XV
++ * doesn't forget builded Icons still be quited even if the directory
++ * is read-only), change 'undef' to 'define' the VIRTUAL_TD line.
++ */
++
++#undef AUTO_EXPAND
++#undef VIRTUAL_TD
++
++#if defined(VIRTUAL_TD) && !defined(AUTO_EXPAND)
++# undef VIRTUAL_TD
++#endif
++
++
++/***************************************************************************
++ * Adjust the aspect ratio of Icons:
++ *
++ * if you want to adjust the aspect ratio of the icons in Visual
++ * Schnauzer, change 'undef' to 'define' in the following line.
++ */
++
++#undef VS_ADJUST
++
++
++/***************************************************************************
++ * Restore original colormap:
++ *
++ * if you want to restore original colormap when icons in Visual
++ * Shunauzer is double-clicked, change 'undef' to 'define' in the
++ * following line.
++ */
++
++#undef VS_RESCMAP
++
++
++/***************************************************************************
++ * TextViewer l10n support:
++ *
++ * if you want XV to show the text in Japanese on TextViewer, change
++ * 'undef' to 'define' in the following line.
++ */
++
++#undef TV_L10N
++
++#ifdef TV_L10N
++/*
++ * if you want to change the default code-set used in case that XV
++ * fails to select correct code-set, uncomment the '#define
++ * LOCALE_DEFAULT' line and change the 'LOCALE_DEFAULT' definition
++ * appropriately.
++ * (0:ASCII, 1:EUC-j, 2:JIS, 3:MS Kanji) */
++
++/* # define LOCALE_DEFAULT 0 */
++
++/*
++ * Uncomment and edit the following lines, if your X Window System was
++ * not compiled with -DX_LOCALE and you failed to display the Japanese
++ * text in TextViewer. You don't have to write locale name of JIS code-set
++ * and Microsoft code-set, if your system doesn't support those code-sets.
++ */
++
++/*
++# define LOCALE_NAME_EUC "ja_JP.EUC"
++# define LOCALE_NAME_JIS "ja_JP.JIS"
++# define LOCALE_NAME_MSCODE "ja_JP.SJIS"
++*/
++
++/*
++ * if your system doesn't have the Japanese fonts in the sizes,
++ * Uncomment and edit the following font size entries.
++ */
++
++/* # define TV_FONTSIZE 14,16,24 */
++
++/*
++ * If you need, uncomment and modify the following font name.
++ */
++
++/* # define TV_FONTSET "-*-fixed-medium-r-normal--%d-*" */
++#endif /* TV_L10N */
++
++
++/***************************************************************************
++ * User definable filter support:
++ *
++ * Use the filters as input and output method for load and save unsupported
++ * image format file. The filter command is recognized by definition of
++ * magic number or suffix in "~/.xv_mgcsfx" .
++ * To enable this feature, change 'undef' to 'define' in the following line.
++ */
++#undef HAVE_MGCSFX
++
++#ifdef HAVE_MGCSFX
++/*
++ * Support symbol 'auto' as <input image type> in startup file. This type
++ * cannot use pipe as input; it writes to a temporary file and recognizes
++ * the actual filetype by XV processing.
++ */
++# define HAVE_MGCSFX_AUTO
++
++/*
++ * The startup file of definition for MgcSfx. 'MGCSFX_SITE_RC' is read
++ * first and '~/MGCSFX_RC' is second. So same definitions in both files
++ * are overridden by '~/MGCSFX_RC'
++ * To define startup file, see the sample of startup file 'xv_mgcsfx.sample'.
++ */
++# define MGCSFX_SITE_RC "xv_mgcsfx"
++# define MGCSFX_RC ".xv_mgcsfx"
++
++/*
++ * If you want startup file to pass preprocessor in reading time, then
++ * change 'undef' to 'define' in the following line.
++ *
++ * WARNING : If you decide to use preprocessor, you must not write
++ * '# <comment>' style comment in startup file. Because,
++ * preprocessor can't recognize. */
++# undef USE_MGCSFX_PREPROCESSOR
++
++# ifdef USE_MGCSFX_PREPROCESSOR
++/*
++ * This is used like "system("MGCSFX_PREPROCESSOR MGCSFX_RC > tmp_name");",
++ * and read tmp_name instead of MGCSFX_RC.
++ */
++# define MGCSFX_PREPROCESSOR "/usr/lib/cpp"
++/* # define MGCSFX_PREPROCESSOR "cc -E" */
++
++# endif /* USE_MGCSFX_PREPROCESSOR */
++
++/*
++ * Default string of command. If input command is required for undefined file,
++ * dialog is popuped with 'MGCSFX_DEFAULT_INPUT_COMMAND'. And, if output
++ * command is required in save dialog of MgcSfx, dialog is popuped with
++ * 'MGCSFX_DEFAULT_OUTPUT_COMMAND'.
++ *
++ * WARNING : Now, supported only 'PNM' image format, when command input is
++ * required. You should define filter which use 'PNM' image format
++ * as input or output.
++ */
++# define MGCSFX_DEFAULT_INPUT_COMMAND "tifftopnm"
++# define MGCSFX_DEFAULT_OUTPUT_COMMAND "pnmtotiff"
++
++#endif /* HAVE_MGCSFX */
++
++
++/***************************************************************************
++ * Multi-Lingual TextViewer
++ *
++ * if you want XV to show the text in multi-lingual on TextViewer, change
++ * 'undef' to 'define' in the following line.
++ */
++
++#undef TV_MULTILINGUAL
++
++#define TV_DEFAULT_CODESET TV_EUC_JAPAN
++
++#ifdef TV_MULTILINGUAL
++# undef TV_L10N
++#endif
+diff -ru xv-3.10a/copyright.h xv-3.10a-enhancements/copyright.h
--- xv-3.10a/copyright.h 1994-12-22 14:34:56.000000000 -0800
-+++ xv-3.10a-bugfixes/copyright.h 2004-05-16 17:53:11.000000000 -0700
++++ xv-3.10a-enhancements/copyright.h 2007-05-20 21:35:34.000000000 -0700
@@ -1,11 +1,11 @@
/* Copyright Notice
* ================
@@ -1427,10 +1949,140 @@ diff -ruN xv-3.10a/copyright.h xv-3.10a-bugfixes/copyright.h
* Contact the author for more details.
*
* The author may be contacted via:
-diff -ruN xv-3.10a/tiff/Makefile xv-3.10a-bugfixes/tiff/Makefile
+@@ -56,3 +56,51 @@
+ * The author may not be contacted by (voice) phone. Please don't try.
+ *
+ */
++
++/*
++ * Portions copyright 2000-2007 by Greg Roelofs and contributors:
++ *
++ * Andrey A. Chernov [ache]
++ * (http://cvsweb.freebsd.org/ports/graphics/xv/files/patch-ab)
++ * Andreas Dilger (adilger clusterfs.com)
++ * Alexander Lehmann (lehmann usa.net)
++ * Alexey Spiridonov (http://www-math.mit.edu/~lesha/)
++ * Anthony Thyssen (http://www.cit.gu.edu.au/~anthony/)
++ * Bruno Rohee (http://bruno.rohee.com/)
++ * David A. Clunie (http://www.dclunie.com/xv-pcd.html)
++ * Erling A. Jacobsen (linuxcub email.dk)
++ * Egmont Koblinger (egmont users.sourceforge.net)
++ * Fabian Greffrath (fabian debian-unofficial.org)
++ * Greg Roelofs (http://pobox.com/~newt/greg_contact.html)
++ * Guido Vollbeding (http://sylvana.net/guido/)
++ * IKEMOTO Masahiro (ikeyan airlab.cs.ritsumei.ac.jp)
++ * John Cooper (john.cooper third-harmonic.com)
++ * John C. Elliott (http://www.seasip.demon.co.uk/ZX/zxdload.html)
++ * John D. Baker (http://mylinuxisp.com/~jdbaker/)
++ * Jörgen Grahn (jgrahn algonet.se)
++ * John H. Bradley, of course (http://www.trilon.com/xv/)
++ * Jean-Pierre Demailly (http://www-fourier.ujf-grenoble.fr/~demailly/)
++ * John Rochester (http://www.freebsd.org/cgi/query-pr.cgi?pr=2920)
++ * (also http://cvsweb.freebsd.org/ports/graphics/xv/files/patch-af, -ag)
++ * James Roberts Kirkpatrick (uwyo.edu)
++ * Joe Zbiciak (http://spatula-city.org/~im14u2c/)
++ * Kyoichiro Suda (http://www.coara.or.jp/~sudakyo/XV_jp.html)
++ * Landon Curt "chongo" Noll (http://www.isthe.com/chongo/)
++ * Larry Jones (lawrence.jones ugs.com)
++ * Peter Jordan (http://www.ibiblio.org/pub/Linux/apps/graphics/viewers/X/)
++ * Pawel S. Veselov (http://manticore.2y.net/wbmp.html)
++ * Ross Combs (rocombs cs.nmsu.edu)
++ * Robin Humble (http://www.cita.utoronto.ca/~rjh/)
++ * Sean Borman (http://www.nd.edu/~sborman/software/xvwheelmouse.html)
++ * TenThumbs (tenthumbs cybernex.net)
++ * Scott B. Marovich (formerly marovich hpl.hp.com)
++ * Tim Adye (http://hepwww.rl.ac.uk/Adye/xv-psnewstyle.html)
++ * Tim Ramsey (tar pobox.com)
++ * Tetsuya INOUE (tin329 chino.it.okayama-u.ac.jp)
++ * Tavis Ormandy (taviso gentoo.org)
++ * Werner Fink (http://www.suse.de/~werner/)
++ *
++ * Other credits are as listed on the XV Downloads page or in the respective
++ * patches (e.g., the jp-extension patches or within the PNG patch).
++ *
++ */
+diff -ru xv-3.10a/docs/bggen.man xv-3.10a-enhancements/docs/bggen.man
+--- xv-3.10a/docs/bggen.man 1994-12-22 14:35:22.000000000 -0800
++++ xv-3.10a-enhancements/docs/bggen.man 2007-04-22 17:32:11.000000000 -0700
+@@ -1,4 +1,4 @@
+-.TH bggen l
++.TH bggen 1
+ .SH NAME
+ bggen \- generates colored backgrounds on X11 displays
+ .SH SYNTAX
+diff -ru xv-3.10a/docs/xcmap.man xv-3.10a-enhancements/docs/xcmap.man
+--- xv-3.10a/docs/xcmap.man 1994-12-22 14:35:23.000000000 -0800
++++ xv-3.10a-enhancements/docs/xcmap.man 2007-04-22 17:32:31.000000000 -0700
+@@ -1,4 +1,4 @@
+-.TH xcmap 1X
++.TH xcmap 1
+ .SH NAME
+ xcmap \- displays the default colormap on X11 displays
+ .SH SYNTAX
+diff -ru xv-3.10a/docs/xv.man xv-3.10a-enhancements/docs/xv.man
+--- xv-3.10a/docs/xv.man 1994-12-22 14:35:22.000000000 -0800
++++ xv-3.10a-enhancements/docs/xv.man 2007-04-22 17:32:53.000000000 -0700
+@@ -1,4 +1,4 @@
+-.TH XV l "2 December 1994" "Rev. 3.10"
++.TH XV 1 "22 April 2007" "Rev. 3.10a-jumboFix+Enh"
+ .SH NAME
+ \fBxv\fP \- interactive image display for the X Window System
+ .SH SYNTAX
+@@ -8,14 +8,17 @@
+ .SH DESCRIPTION
+ The
+ .I xv
+-program displays images in the GIF, JPEG, TIFF,
+-PBM, PGM, PPM, X11 bitmap, Utah Raster Toolkit RLE, PDS/VICAR, Sun Rasterfile,
+-BMP, PCX, IRIS RGB, XPM, Targa, XWD, possibly PostScript, and PM formats on
+-workstations and terminals running the X Window System, Version 11.
++program displays images on workstations and terminals running the X Window
++System, Version 11. Supported image formats include
++PBM, PGM, PPM, X11 bitmap, XWD, XPM, Utah Raster Toolkit RLE, PDS/VICAR,
++FITS, Sun Rasterfile, GIF, PCX, Targa/TGA, BMP, WBMP, IRIS RGB, Spectrum
++SCREEN$, PM, and optionally PNG, JPEG, JPEG 2000, JP2, TIFF, PostScript,
++PDF, G3 fax, MAG, PIC, MAKI (640x400), PI, and PIC2.
+ .LP
+-The documentation for XV is now distributed
++Aside from the usage screen (available by typing 'xv -help' at the command
++line), documentation for XV is now distributed
+ .I only
+-as a PostScript file, as it has gotten enormous,
++as a PostScript (or PDF) file, as it has gotten enormous
+ and is no longer very well suited to the 'man' page format.
+ Print a copy of the (100-ish page) manual found in
+ .IR docs/xvdocs.ps .
+@@ -26,9 +29,14 @@
+ If you don't
+ .I have
+ the PostScript file, it is part of the standard XV distribution, the
+-latest version of which can be obtained via anonymous ftp from
++latest version of which can be obtained from
++.IR http://www.trilon.com/xv/
++or via anonymous ftp from
+ .IR ftp.cis.upenn.edu
+-in the directory pub/xv
++in the directory pub/xv .
++.PP
++This version has been patched with the XV Jumbo Patches, available from
++.IR http://pobox.com/~newt/greg_xv.html .
+ .PP
+ .SH AUTHOR
+-John Bradley
++John Bradley (and many contributors)
+diff -ru xv-3.10a/docs/xvp2p.man xv-3.10a-enhancements/docs/xvp2p.man
+--- xv-3.10a/docs/xvp2p.man 1994-12-22 14:35:25.000000000 -0800
++++ xv-3.10a-enhancements/docs/xvp2p.man 2007-04-22 17:33:23.000000000 -0700
+@@ -1,4 +1,4 @@
+-.TH xvpictoppm 1X
++.TH xvpictoppm 1
+ .SH NAME
+ xvpictoppm \- converts XV 'thumbnail' files to standard PPM format
+ .SH SYNTAX
+diff -ru xv-3.10a/tiff/Makefile xv-3.10a-enhancements/tiff/Makefile
--- xv-3.10a/tiff/Makefile 1994-12-22 14:35:12.000000000 -0800
-+++ xv-3.10a-bugfixes/tiff/Makefile 2004-05-16 18:49:11.000000000 -0700
-@@ -30,8 +30,10 @@
++++ xv-3.10a-enhancements/tiff/Makefile 2005-04-17 14:45:28.000000000 -0700
+@@ -30,13 +30,15 @@
# OF THIS SOFTWARE.
#
@@ -1443,6 +2095,12 @@ diff -ruN xv-3.10a/tiff/Makefile xv-3.10a-bugfixes/tiff/Makefile
IPATH= -I.
+ COPTS= -O
+-CFLAGS= ${COPTS} ${IPATH}
++CFLAGS= ${COPTS} ${IPATH} -D_BSD_SOURCE
+
+ INCS= tiff.h tiffio.h
+
@@ -60,6 +62,7 @@
${ALL}: ${OBJS}
@@ -1451,9 +2109,9 @@ diff -ruN xv-3.10a/tiff/Makefile xv-3.10a-bugfixes/tiff/Makefile
${RANLIB} libtiff.a
${OBJS}: tiffio.h tiff.h tiffcomp.h tiffiop.h tiffconf.h
-diff -ruN xv-3.10a/tiff/Makefile.std xv-3.10a-bugfixes/tiff/Makefile.std
+diff -ru xv-3.10a/tiff/Makefile.std xv-3.10a-enhancements/tiff/Makefile.std
--- xv-3.10a/tiff/Makefile.std 1994-12-22 14:35:16.000000000 -0800
-+++ xv-3.10a-bugfixes/tiff/Makefile.std 2004-05-16 18:50:39.000000000 -0700
++++ xv-3.10a-enhancements/tiff/Makefile.std 2004-05-16 18:50:39.000000000 -0700
@@ -30,8 +30,10 @@
# OF THIS SOFTWARE.
#
@@ -1475,35 +2133,9 @@ diff -ruN xv-3.10a/tiff/Makefile.std xv-3.10a-bugfixes/tiff/Makefile.std
${RANLIB} libtiff.a
${OBJS}: tiffio.h tiff.h tiffcomp.h tiffiop.h tiffconf.h
-diff -ruN xv-3.10a/tiff/RANLIB.sh xv-3.10a-bugfixes/tiff/RANLIB.sh
---- xv-3.10a/tiff/RANLIB.sh 1969-12-31 16:00:00.000000000 -0800
-+++ xv-3.10a-bugfixes/tiff/RANLIB.sh 2004-05-10 23:31:38.000000000 -0700
-@@ -0,0 +1,22 @@
-+#!/bin/sh -f
-+#
-+# tests to see if the program 'ranlib' exists. If it does, runs ranlib on
-+# the first argument (a library name). Otherwise, does nothing, and returns
-+#
-+# written by John Bradley for the XV 3.00 release
-+# thanks to John Hagan for shell-script hackery
-+#
-+
-+echo "executing 'ranlib $1'..."
-+
-+# Is there a ranlib? Let's try and then suffer the consequences...
-+ranlib $1 >& /dev/null
-+
-+if [ $? -ne 0 ]; then
-+ echo "There doesn't seem to be a ranlib on this system..."
-+ echo "Don't worry about it."
-+fi
-+
-+echo ""
-+echo ""
-+
-diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
+diff -ru xv-3.10a/vdcomp.c xv-3.10a-enhancements/vdcomp.c
--- xv-3.10a/vdcomp.c 1994-12-22 14:34:47.000000000 -0800
-+++ xv-3.10a-bugfixes/vdcomp.c 2005-03-20 17:48:59.000000000 -0800
++++ xv-3.10a-enhancements/vdcomp.c 2007-04-15 21:09:55.000000000 -0700
@@ -5,8 +5,8 @@
/* Decompresses images using Kris Becker's subroutine DECOMP.C */
/* which is included in this program in a shortened version. */
@@ -1515,18 +2147,64 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
/* labels, image histogram, engineering table, line header table */
/* and an image with PDS, FITS, VICAR or no labels. If used on */
/* a non-byte-swapped machine the image histogram is un-swapped. */
-@@ -108,7 +108,9 @@
- !defined(bsd43) && \
- !defined(aux) && \
- !defined(__bsdi__) && \
+@@ -96,40 +96,54 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+
+-/* include a malloc.h, of some sort... */
+-#ifndef VMS /* VMS hates multi-line '#if's */
+-# if !defined(ibm032) && \
+- !defined(__convex__) && \
+- !(defined(vax) && !defined(ultrix)) && \
+- !defined(mips) && \
+- !defined(apollo) && \
+- !defined(pyr) && \
+- !defined(__UMAXV__) && \
+- !defined(bsd43) && \
+- !defined(aux) && \
+- !defined(__bsdi__) && \
- !defined(sequent)
-+ !defined(sequent) && \
-+ !defined(__FreeBSD__) && \
-+ !defined(__OpenBSD__)
+-
+-# if defined(hp300) || defined(hp800) || defined(NeXT)
+-# include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */
+-# else
+-# include <malloc.h>
+-# endif
+-# endif
++/* include a malloc.h of some sort (if needed...most systems use stdlib.h) */
++#ifndef VMS /* VMS hates multi-line "#if"s */
++ /*
++ * I want to use BSD macro for checking if this OS is *BSD or not,
++ * but the macro is defined in <sys/parm.h>, which I don't know all
++ * machine has or not.
++ */
++# if !defined(ibm032) && \
++ !defined(__convex__) && \
++ !(defined(vax) && !defined(ultrix)) && \
++ !defined(mips) && \
++ !defined(apollo) && \
++ !defined(pyr) && \
++ !defined(sequent) && \
++ !defined(__UMAXV__) && \
++ !defined(aux) && \
++ !defined(bsd43) && \
++ !defined(__bsd43) && \
++ !defined(__bsdi__) && \
++ !defined(__386BSD__) && \
++ !defined(__FreeBSD__) && \
++ !defined(__OpenBSD__) && \
++ !defined(__NetBSD__) && \
++ !defined(__DARWIN__)
++
++# if defined(hp300) || defined(hp800) || defined(NeXT)
++# include <sys/malloc.h> /* it's in "sys" on HPs and NeXT */
++# else
++# include <malloc.h> /* FIXME: should explicitly list systems that NEED this, not everyone that doesn't */
++# endif
++
++# endif /* !most modern systems */
+ #endif /* !VMS */
- # if defined(hp300) || defined(hp800) || defined(NeXT)
- # include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */
-@@ -121,15 +123,17 @@
#include <X11/Xos.h>
@@ -1534,24 +2212,41 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
-#define FALSE 0
+#define TRUE 1
+#define FALSE 0
++
++#define NAMELEN 1024 /* inname and outname sizes */
- /* pc i/o defines */
-#define O_BINARY 0x8000 /* file mode is binary */
-+#define NAMELEN 1024 /* inname and outname sizes */
++ /* PC I/O defines */
++#define O_BINARY 0x8000 /* file mode is binary */
- /* vax i/o defines */
-#define RECORD_TYPE "rfm=fix" /* VAX fixed length output */
-#define CTX "ctx=bin" /* no translation of \n */
-+ /* PC I/O defines */
-+#define O_BINARY 0x8000 /* file mode is binary */
-+
+ /* VAX/VMS I/O defines */
+#define RECORD_TYPE "rfm=fix" /* VAX/VMS fixed-length output */
+#define CTX "ctx=bin" /* no translation of \n */
#define FOP "fop=cif,sup" /* file processing ops */
typedef struct leaf { struct leaf *right;
-@@ -176,7 +180,7 @@
+@@ -142,9 +156,9 @@
+ once the tree is created by the accompanying routine huff_tree.
+ **************************************************************************/
+
+- NODE *tree;
++static NODE *tree;
+
+-/* subroutine definitions */
++/* subroutine definitions */
+
+ #undef PARM
+ #ifdef __STDC__
+@@ -172,11 +186,11 @@
+ void free_tree PARM((int *));
+ int free_node PARM((NODE *, int));
+
+-/* global variables */
++/* global variables */
int infile;
FILE *outfile;
@@ -1560,7 +2255,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
int output_format;
int record_bytes, max_lines;
int line_samples, fits_pad;
-@@ -185,8 +189,8 @@
+@@ -185,8 +199,8 @@
/*************************************************/
int main(argc,argv)
@@ -1571,7 +2266,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
{
unsigned char ibuf[2048],obuf[2048];
unsigned char blank=32;
-@@ -200,12 +204,12 @@
+@@ -200,12 +214,12 @@
/* */
/*********************************************************************/
@@ -1586,7 +2281,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
strncmp(argv[1],"HELP",(size_t) 4) == 0 ||
strncmp(argv[1],"?", (size_t) 1) == 0)) {
fprintf(stderr,
-@@ -214,18 +218,22 @@
+@@ -214,18 +228,22 @@
fprintf(stderr," infile - name of compressed image file. \n");
fprintf(stderr," outfile - name of uncompressed output file.\n");
fprintf(stderr," output format - selected from the following list:\n");
@@ -1618,7 +2313,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
}
host = check_host();
-@@ -244,13 +252,13 @@
+@@ -244,13 +262,13 @@
case 4: no_labels(host); break;
}
@@ -1634,7 +2329,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
fits_pad = 1536;
line_samples = 1204;
}
-@@ -394,12 +402,12 @@
+@@ -394,12 +412,12 @@
if (record_bytes == 1204) /* do checksum for viking */
for (i=0; i<record_bytes; i++) checksum += (int)obuf[i];
@@ -1649,7 +2344,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
/* print checksum for viking */
fprintf(stderr,"\n Image label checksum = %d computed checksum = %d\n",
label_checksum,checksum);
-@@ -425,33 +433,36 @@
+@@ -425,33 +443,36 @@
/*********************************************************************/
int get_files(host)
@@ -1698,7 +2393,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
/* systems with standard comm programs (kermit, for example). */
/****************************************************************/
-@@ -459,9 +470,9 @@
+@@ -459,9 +480,9 @@
read(infile,&shortint, (size_t) 2);
if (shortint > 0 && shortint < 80) {
host = 4; /* change host to 4 */
@@ -1710,7 +2405,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
lseek(infile,(off_t) 0,0); /* reposition to beginning of file */
}
}
-@@ -474,13 +485,17 @@
+@@ -474,13 +495,17 @@
printf("\n 3. VICAR format.");
printf("\n 4. Unlabelled binary array.\n");
printf("\n Enter format number:");
@@ -1730,7 +2425,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
}
return(host);
-@@ -495,68 +510,68 @@
+@@ -495,68 +520,68 @@
/*********************************************************************/
void open_files(host)
@@ -1815,7 +2510,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
exit(1);
}
}
-@@ -572,11 +587,11 @@
+@@ -572,11 +597,11 @@
/*********************************************************************/
void pds_labels(host)
@@ -1830,7 +2525,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
total_bytes = 0;
-@@ -613,11 +628,11 @@
+@@ -613,11 +638,11 @@
(size_t) 53,(size_t) 1,outfile);
else
fwrite("CCSD3ZF0000100000001NJPL3IF0PDS200000001 = SFDU_LABEL",
@@ -1844,7 +2539,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
fprintf(outfile,"%c%c",cr,lf);
fwrite("RECORD_TYPE = FIXED_LENGTH",(size_t) 47,
(size_t) 1,outfile);
-@@ -710,7 +725,7 @@
+@@ -710,7 +735,7 @@
}
else {
strcpy(ibuf+35,"60");
@@ -1853,7 +2548,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
}
fwrite(ibuf,(size_t) length,(size_t) 1,outfile);
-@@ -730,7 +745,7 @@
+@@ -730,7 +755,7 @@
}
else if ((i = strncmp(ibuf," ENCODING",(size_t) 9)) == 0);
@@ -1862,7 +2557,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
/*****************************************************************/
/* delete the encoding type label in the image object */
/*****************************************************************/
-@@ -787,10 +802,10 @@
+@@ -787,10 +812,10 @@
/*********************************************************************/
void fits_labels(host)
@@ -1875,7 +2570,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
unsigned char cr=13,lf=10,blank=32;
do {
-@@ -799,7 +814,7 @@
+@@ -799,7 +824,7 @@
/*****************************************************************/
/* find the checksum and store in label_checksum */
/*****************************************************************/
@@ -1884,7 +2579,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
ibuf[length] = '\0';
label_checksum = atol(ibuf+35);
}
-@@ -842,7 +857,7 @@
+@@ -842,7 +867,7 @@
if (record_bytes == 836)
strcpy(outstring,"NAXIS1 = 800");
@@ -1893,7 +2588,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
strcpy(outstring,"NAXIS1 = 1204");
strcat(outstring," ");
-@@ -862,7 +877,7 @@
+@@ -862,7 +887,7 @@
strcpy(outstring,"END ");
strcat(outstring," ");
@@ -1902,7 +2597,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
fwrite(outstring,(size_t) 78,(size_t) 1,outfile);
fprintf(outfile,"%c%c",cr,lf);
total_bytes = total_bytes + 80;
-@@ -871,6 +886,7 @@
+@@ -871,6 +896,7 @@
for (i=total_bytes; i<2880; i++) fputc(blank,outfile);
}
@@ -1910,7 +2605,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
/*********************************************************************/
/* */
/* subroutine vicar_labels - write vicar labels to output file */
-@@ -878,11 +894,10 @@
+@@ -878,11 +904,10 @@
/*********************************************************************/
void vicar_labels(host)
@@ -1924,7 +2619,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
unsigned char cr=13,lf=10,blank=32;
do {
-@@ -890,7 +905,7 @@
+@@ -890,7 +915,7 @@
/*****************************************************************/
/* find the checksum and store in label_checksum */
/*****************************************************************/
@@ -1933,7 +2628,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
ibuf[length] = '\0';
label_checksum = atol(ibuf+35);
}
-@@ -950,10 +965,10 @@
+@@ -950,10 +975,10 @@
/*********************************************************************/
void no_labels(host)
@@ -1947,7 +2642,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
do {
length = read_var(ibuf,host);
-@@ -961,7 +976,7 @@
+@@ -961,7 +986,7 @@
/*****************************************************************/
/* find the checksum and store in label_checksum */
/*****************************************************************/
@@ -1956,7 +2651,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
ibuf[length] = '\0';
label_checksum = atol(ibuf+35);
}
-@@ -984,15 +999,16 @@
+@@ -984,15 +1009,16 @@
open_files(&host);
}
@@ -1976,7 +2671,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
{
int length,result,nlen;
char temp;
-@@ -1027,19 +1043,19 @@
+@@ -1027,19 +1053,19 @@
return (length);
case 3: /*******************************************************/
@@ -1999,7 +2694,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
while (nlen < length)
nlen += read(infile,ibuf+nlen,(size_t) length+(length%2)-nlen);
return (length);
-@@ -1061,6 +1077,7 @@
+@@ -1061,6 +1087,7 @@
return 0;
}
@@ -2007,7 +2702,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
/*********************************************************************/
/* */
/* subroutine check_host - find out what kind of machine we are on */
-@@ -1115,23 +1132,23 @@
+@@ -1115,23 +1142,23 @@
"Host 5 - 32 bit integers without swapping, no var len support.");
}
@@ -2037,7 +2732,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
onion.llen = inval;
temp = onion.ichar[0];
onion.ichar[0]=onion.ichar[3];
-@@ -1146,17 +1163,16 @@
+@@ -1146,17 +1173,13 @@
/****************************************************************************
*_TITLE decompress - decompresses image lines stored in compressed format *
*_ARGS TYPE NAME I/O DESCRIPTION */
@@ -2051,16 +2746,16 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
+ int *nin; /* I Number of bytes on input buffer */
+ int *nout; /* I Number of bytes in output buffer */
{
- /* The external root pointer to tree */
- extern NODE *tree;
-
+- /* The external root pointer to tree */
+- extern NODE *tree;
+-
dcmprs(ibuf,obuf,nin,nout,tree);
-
+
return;
}
-@@ -1165,8 +1181,7 @@
+@@ -1165,10 +1188,8 @@
/***************************************************************************
*_TITLE decmpinit - initializes the Huffman tree *
*_ARGS TYPE NAME I/O DESCRIPTION */
@@ -2068,9 +2763,11 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
-
+ int *hist; /* I First-difference histogram. */
{
- extern NODE *tree; /* Huffman tree root pointer */
+- extern NODE *tree; /* Huffman tree root pointer */
tree = huff_tree(hist);
-@@ -1178,8 +1193,7 @@
+ return;
+ }
+@@ -1178,8 +1199,7 @@
/****************************************************************************
*_TITLE huff_tree - constructs the Huffman tree; returns pointer to root *
*_ARGS TYPE NAME I/O DESCRIPTION */
@@ -2080,7 +2777,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
{
/* Local variables used */
int freq_list[512]; /* Histogram frequency list */
-@@ -1189,7 +1203,6 @@
+@@ -1189,7 +1209,6 @@
NODE **np; /* Node list pointer */
int num_freq; /* Number non-zero frequencies in histogram */
@@ -2088,7 +2785,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
short int num_nodes; /* Counter for DN initialization */
short int cnt; /* Miscellaneous counter */
-@@ -1228,7 +1241,7 @@
+@@ -1228,7 +1247,7 @@
j = 0;
for (i=4 ; --i >= 0 ; j = (j << 8) | *(cp+i));
@@ -2097,7 +2794,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
/* Now make the assignment */
*fp++ = j;
temp = new_node(num_nodes);
-@@ -1341,7 +1354,7 @@
+@@ -1341,7 +1360,7 @@
l--;
if ( j <= freq_list) break;
}
@@ -2106,7 +2803,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
}
return;
}
-@@ -1362,9 +1375,9 @@
+@@ -1362,9 +1381,9 @@
NODE *ptr = root; /* pointer to position in tree */
unsigned char test; /* test byte for bit set */
unsigned char idn; /* input compressed byte */
@@ -2118,7 +2815,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
char *ilim = ibuf + *nin; /* end of compressed bytes */
char *olim = obuf + *nout; /* end of output buffer */
-@@ -1406,10 +1419,9 @@
+@@ -1406,10 +1425,9 @@
/****************************************************************************
*_TITLE free_tree - free memory of all allocated nodes *
*_ARGS TYPE NAME I/O DESCRIPTION */
@@ -2131,7 +2828,7 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
*_DESCR This routine is supplied to the programmer to free up all the *
* allocated memory required to build the huffman tree. The count *
* of the nodes freed is returned in the parameter 'nfreed'. The *
-@@ -1417,11 +1429,10 @@
+@@ -1417,16 +1435,13 @@
* than one file per run, the program will not keep allocating new *
* memory without first deallocating all previous nodes associated *
* with the previous file decompression. *
@@ -2144,7 +2841,12 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
{
int total_free = 0;
-@@ -1435,36 +1446,33 @@
+- extern NODE *tree; /* Huffman tree root pointer */
+-
+ *nfreed = free_node(tree,total_free);
+
+ return;
+@@ -1435,36 +1450,33 @@
int free_node(pnode,total_free)
/***************************************************************************
@@ -2188,9 +2890,9 @@ diff -ruN xv-3.10a/vdcomp.c xv-3.10a-bugfixes/vdcomp.c
-
-
-diff -ruN xv-3.10a/xcmap.c xv-3.10a-bugfixes/xcmap.c
+diff -ru xv-3.10a/xcmap.c xv-3.10a-enhancements/xcmap.c
--- xv-3.10a/xcmap.c 1995-01-03 13:14:52.000000000 -0800
-+++ xv-3.10a-bugfixes/xcmap.c 2005-03-20 15:51:59.000000000 -0800
++++ xv-3.10a-enhancements/xcmap.c 2007-04-15 13:12:41.000000000 -0700
@@ -9,6 +9,9 @@
/* include files */
@@ -2210,6 +2912,15 @@ diff -ruN xv-3.10a/xcmap.c xv-3.10a-bugfixes/xcmap.c
#endif
typedef unsigned char byte;
+@@ -58,7 +61,7 @@
+ int main PARM((int, char **));
+ static void HandleEvent PARM((XEvent *));
+ static void Syntax PARM((void));
+-static void FatalError PARM((char *));
++static void FatalError PARM((const char *));
+ static void Quit PARM((void));
+ static void CreateMainWindow PARM((char *, char *, int, char **));
+ static void DrawWindow PARM((int,int,int,int));
@@ -75,50 +78,50 @@
int i;
char *display, *geom;
@@ -2315,9 +3026,10 @@ diff -ruN xv-3.10a/xcmap.c xv-3.10a-bugfixes/xcmap.c
-
+
CreateMainWindow(cmd,geom,argc,argv);
- Resize(WIDE,HIGH);
+- Resize(WIDE,HIGH);
-
- XSelectInput(theDisp, mainW, ExposureMask | KeyPressMask
++ Resize((int)WIDE,(int)HIGH);
+
+ XSelectInput(theDisp, mainW, ExposureMask | KeyPressMask
| StructureNotifyMask | ButtonPressMask);
@@ -2368,10 +3080,12 @@ diff -ruN xv-3.10a/xcmap.c xv-3.10a-bugfixes/xcmap.c
XConfigureEvent *conf_event = (XConfigureEvent *) event;
-
- if (conf_event->window == mainW &&
+- (conf_event->width != WIDE || conf_event->height != HIGH))
+- Resize(conf_event->width, conf_event->height);
++ int w = conf_event->width, h = conf_event->height;
+
-+ if (conf_event->window == mainW &&
- (conf_event->width != WIDE || conf_event->height != HIGH))
- Resize(conf_event->width, conf_event->height);
++ if (conf_event->window == mainW && (w != WIDE || h != HIGH))
++ Resize((int)(w ? w : WIDE), (int)(h ? h : HIGH));
}
break;
-
@@ -2390,7 +3104,21 @@ diff -ruN xv-3.10a/xcmap.c xv-3.10a-bugfixes/xcmap.c
default: /* ignore unexpected events */
break;
} /* end of switch */
-@@ -262,24 +270,31 @@
+@@ -237,10 +245,10 @@
+
+
+ /***********************************/
+-static void FatalError (identifier)
+- char *identifier;
++static void FatalError(identifier)
++ const char *identifier;
+ {
+- fprintf(stderr, "%s: %s\n",cmd, identifier);
++ fprintf(stderr, "%s: %s\n", cmd, identifier);
+ exit(-1);
+ }
+
+@@ -262,24 +270,33 @@
XSizeHints hints;
int i,x,y;
unsigned int w,h;
@@ -2400,6 +3128,8 @@ diff -ruN xv-3.10a/xcmap.c xv-3.10a-bugfixes/xcmap.c
-
+
x=y=w=h=1;
++ hints.flags = 0;
++
i=XParseGeometry(geom,&x,&y,&w,&h);
- if (i&WidthValue) WIDE = (int) w;
- if (i&HeightValue) HIGH = (int) h;
@@ -2437,7 +3167,7 @@ diff -ruN xv-3.10a/xcmap.c xv-3.10a-bugfixes/xcmap.c
hints.x=x; hints.y=y;
hints.width = WIDE; hints.height = HIGH;
hints.max_width = DisplayWidth(theDisp,theScreen);
-@@ -288,22 +303,22 @@
+@@ -288,22 +305,22 @@
hints.min_height = 16;
hints.width_inc = hints.height_inc = 16;
hints.flags |= PMaxSize | PMinSize | PResizeInc;
@@ -2466,7 +3196,7 @@ diff -ruN xv-3.10a/xcmap.c xv-3.10a-bugfixes/xcmap.c
}
-@@ -312,11 +327,11 @@
+@@ -312,11 +329,11 @@
int x,y,w,h;
{
int i,j,x1,y1,x2,y2;
@@ -2480,7 +3210,7 @@ diff -ruN xv-3.10a/xcmap.c xv-3.10a-bugfixes/xcmap.c
for (i=y1; i<y2; i++) {
for (j=x1; j<x2; j++) {
XSetForeground(theDisp,theGC,(unsigned long) (i*nycells+j) );
-@@ -343,18 +358,18 @@
+@@ -343,18 +360,18 @@
{
/* called when there's a button press in the window. draws the pixel
value, and loops until button is released */
@@ -2503,7 +3233,7 @@ diff -ruN xv-3.10a/xcmap.c xv-3.10a-bugfixes/xcmap.c
DrawPixValue(x,y);
}
}
-@@ -367,10 +382,10 @@
+@@ -367,10 +384,10 @@
{
static unsigned long pix, lastpix;
static int pvaly;
@@ -2516,7 +3246,7 @@ diff -ruN xv-3.10a/xcmap.c xv-3.10a-bugfixes/xcmap.c
if (!pvalup) { /* it's not up. make it so */
if (y >= HIGH/2) pvaly = 0; else pvaly = HIGH - 12;
pvalup = 1;
-@@ -378,30 +393,30 @@
+@@ -378,30 +395,30 @@
XClearArea(theDisp,mainW,0,pvaly,
(unsigned int) WIDE, (unsigned int) 13,True);
}
@@ -2555,9 +3285,9 @@ diff -ruN xv-3.10a/xcmap.c xv-3.10a-bugfixes/xcmap.c
XDrawImageString(theDisp,mainW,theGC,5,pvaly+10,tmpstr,
(int) strlen(tmpstr));
}
-diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
+diff -ru xv-3.10a/xv.c xv-3.10a-enhancements/xv.c
--- xv-3.10a/xv.c 1995-01-19 10:08:43.000000000 -0800
-+++ xv-3.10a-bugfixes/xv.c 2005-03-20 22:25:22.000000000 -0800
++++ xv-3.10a-enhancements/xv.c 2007-05-13 18:44:55.000000000 -0700
@@ -33,9 +33,9 @@
/* a mono-spaced font needed for the 'pixel value tracking' feature */
@@ -2570,23 +3300,160 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
/* default positions for various windows */
-@@ -116,13 +116,13 @@
+@@ -54,14 +54,35 @@
+ static int randomShow = 0; /* do a 'random' slideshow */
+ static int startIconic = 0; /* '-iconic' option */
+ static int defaultVis = 0; /* true if using DefaultVisual */
++#ifdef HAVE_G3
++static int fax = 0; /* temporary(?) kludge */
++int highresfax = 0;
++#endif
+ static double hexpand = 1.0; /* '-expand' argument */
+ static double vexpand = 1.0; /* '-expand' argument */
+-static char *maingeom = NULL;
+-static char *icongeom = NULL;
++static const char *maingeom = NULL;
++static const char *icongeom = NULL;
+ static Atom __SWM_VROOT = None;
+
+ static char basefname[128]; /* just the current fname, no path */
+
++#ifdef TV_L10N
++# ifndef TV_FONTSET
++# define TV_FONTSET "-*-fixed-medium-r-normal--%d-*"
++# endif
++# ifndef TV_FONTSIZE
++# define TV_FONTSIZE 14,16
++# endif
++static int mfontsize[] = { TV_FONTSIZE, 0 };
++static char mfontset[256];
++#endif
++
++#ifdef HAVE_JP2K
++static byte jp2k_magic[12] =
++ { 0, 0, 0, 0x0c, 'j', 'P', ' ', ' ', 0x0d, 0x0a, 0x87, 0x0a };
++#endif
++
++
+ /* things to do upon successfully loading an image */
+ static int autoraw = 0; /* force raw if using stdcmap */
+ static int autodither = 0; /* dither */
+@@ -78,6 +99,12 @@
+
+ static int force8 = 0; /* force 8-bit mode */
+ static int force24 = 0; /* force 24-bit mode */
++#ifdef HAVE_PCD
++static int PcdSize = -1; /* force dialog to ask */
++#endif
++
++static float waitsec_nonfinal = -1; /* "normal" waitsec value */
++static float waitsec_final = -1; /* final-image waitsec value */
+
+ /* used in DeleteCmd() and Quit() */
+ static char **mainargv;
+@@ -92,7 +119,7 @@
+ static void parseResources PARM((int, char **));
+ static void parseCmdLine PARM((int, char **));
+ static void verifyArgs PARM((void));
+-static void printoption PARM((char *));
++static void printoption PARM((const char *));
+ static void cmdSyntax PARM((void));
+ static void rmodeSyntax PARM((void));
+ static int openPic PARM((int));
+@@ -103,32 +130,34 @@
+ static void openNextLoop PARM((void));
+ static void openPrevPic PARM((void));
+ static void openNamedPic PARM((void));
+-static int findRandomPic PARM((void));
+ static void mainLoop PARM((void));
+-static void createMainWindow PARM((char *, char *));
+-static void setWinIconNames PARM((char *));
++static void createMainWindow PARM((const char *, const char *));
++static void setWinIconNames PARM((const char *));
+ static void makeDispNames PARM((void));
+ static void fixDispNames PARM((void));
+ static void deleteFromList PARM((int));
+-static int argcmp PARM((char *, char *, int, int, int *));
++static int argcmp PARM((const char *, const char *,
++ int, int, int *));
+ static void add_filelist_to_namelist PARM((char *, char **, int *, int));
+
/* formerly local vars in main, made local to this module when
parseResources() and parseCmdLine() were split out of main() */
-
-+
- int imap, ctrlmap, gmap, browmap, cmtmap, clrroot, nopos, limit2x;
- char *display, *whitestr, *blackstr, *histr, *lostr,
- *infogeom, *fgstr, *bgstr, *ctrlgeom, *gamgeom, *browgeom, *tmpstr;
- char *rootfgstr, *rootbgstr, *visualstr, *textgeom, *cmtgeom;
- char *monofontname, *flistName;
+-int imap, ctrlmap, gmap, browmap, cmtmap, clrroot, nopos, limit2x;
+-char *display, *whitestr, *blackstr, *histr, *lostr,
+- *infogeom, *fgstr, *bgstr, *ctrlgeom, *gamgeom, *browgeom, *tmpstr;
+-char *rootfgstr, *rootbgstr, *visualstr, *textgeom, *cmtgeom;
+-char *monofontname, *flistName;
-int curstype, stdinflag, browseMode, savenorm, preview, pscomp, preset,
-+int curstype, stdinflag, browseMode, savenorm, preview, pscomp, preset,
- rmodeset, gamset, cgamset, perfect, owncmap, rwcolor, stdcmap;
- int nodecor;
- double gamval, rgamval, ggamval, bgamval;
-@@ -177,16 +177,16 @@
+- rmodeset, gamset, cgamset, perfect, owncmap, rwcolor, stdcmap;
+-int nodecor;
+-double gamval, rgamval, ggamval, bgamval;
+-
+-
+
++static int imap, ctrlmap, gmap, browmap, cmtmap, clrroot, nopos, limit2x;
++static const char *histr, *lostr, *fgstr, *bgstr, *tmpstr;
++static const char *infogeom, *ctrlgeom, *gamgeom, *browgeom, *textgeom, *cmtgeom;
++static char *display, *whitestr, *blackstr;
++static char *rootfgstr, *rootbgstr, *imagebgstr, *visualstr;
++static char *monofontname, *flistName;
++#ifdef TV_L10N
++static char **misscharset, *defstr;
++static int nmisscharset;
++#endif
++static int curstype, stdinflag, browseMode, savenorm, preview, pscomp, preset,
++ rmodeset, gamset, cgamset, perfect, owncmap, rwcolor, stdcmap;
++static int nodecor;
++static double gamval, rgamval, ggamval, bgamval;
+
+ /*******************************************/
+ int main(argc, argv)
+@@ -137,6 +166,9 @@
+ /*******************************************/
+ {
+ int i;
++#ifdef TV_L10N
++ int j;
++#endif
+ XColor ecdef;
+ Window rootReturn, parentReturn, *children;
+ unsigned int numChildren, rootDEEP;
+@@ -153,6 +185,13 @@
+ /*** variable Initialization ***/
+ /*****************************************************/
+
++#ifdef TV_L10N
++ /* setlocale(LC_ALL, localeList[LOCALE_EUCJ]); */
++ setlocale(LC_ALL, "");
++ xlocale = (int)XSupportsLocale(); /* assume that (Bool) is (int) */
++ /* if X doesn't support ja_JP.ujis text viewer l10n doesn't work. */
++#endif
++
+ xv_getwd(initdir, sizeof(initdir));
+ searchdir[0] = '\0';
+ fullfname[0] = '\0';
+@@ -162,7 +201,7 @@
+
+ /* init internal variables */
+ display = NULL;
+- fgstr = bgstr = rootfgstr = rootbgstr = NULL;
++ fgstr = bgstr = rootfgstr = rootbgstr = imagebgstr = NULL;
+ histr = lostr = whitestr = blackstr = NULL;
+ visualstr = monofontname = flistName = NULL;
+ winTitle = NULL;
+@@ -172,21 +211,26 @@
+
+ picComments = (char *) NULL;
+
++ if (picExifInfo) free(picExifInfo);
++ picExifInfo = (byte *) NULL;
++ picExifInfoSize = 0;
++
+ numPages = 1; curPage = 0;
+ pageBaseName[0] = '\0';
LocalCmap = browCmap = 0;
stdinflag = 0;
@@ -2594,6 +3461,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
+ autoclose = autoDelete = 0;
cmapInGam = 0;
grabDelay = 0;
++ startGrab = 0;
showzoomcursor = 0;
perfect = owncmap = stdcmap = rwcolor = 0;
@@ -2606,8 +3474,27 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
picType = -1; /* gets set once file is loaded */
colorMapMode = CM_NORMAL;
haveStdCmap = STD_NONE;
-@@ -230,11 +230,11 @@
- }
+@@ -221,24 +265,27 @@
+ cmd = (char *) rindex(argv[0],'/');
+ if (!cmd) cmd = argv[0]; else cmd++;
+
+- tmpstr = (char *) getenv("TMPDIR");
+- if (!tmpstr) tmpdir = "/tmp";
+- else {
+- tmpdir = (char *) malloc(strlen(tmpstr) + 1);
+- if (!tmpdir) FatalError("can't malloc 'tmpdir'\n");
+- strcpy(tmpdir, tmpstr);
+- }
++ tmpstr = (const char *) getenv("TMPDIR");
++ if (!tmpstr) tmpstr = "/tmp";
++ tmpdir = (char *) malloc(strlen(tmpstr) + 1);
++ if (!tmpdir) FatalError("can't malloc 'tmpdir'\n");
++ strcpy(tmpdir, tmpstr);
++
++#ifdef AUTO_EXPAND
++ Vdinit();
++ vd_handler_setup();
++#endif
/* init command-line options flags */
- infogeom = DEFINFOGEOM; ctrlgeom = DEFCTRLGEOM;
@@ -2620,7 +3507,83 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
ninstall = 0; fixedaspect = 0; noFreeCols = nodecor = 0;
DEBUG = 0; bwidth = 2;
nolimits = useroot = clrroot = noqcheck = 0;
-@@ -306,7 +306,7 @@
+- waitsec = -1; waitloop = 0; automax = 0;
++ waitsec = waitsec_final = -1.0; waitloop = 0; automax = 0;
+ rootMode = 0; hsvmode = 0;
+ rmodeset = gamset = cgamset = 0;
+ nopos = limit2x = 0;
+@@ -251,6 +298,10 @@
+ preset = 0;
+ viewonly = 0;
+
++#ifdef ENABLE_FIXPIX_SMOOTH
++ do_fixpix_smooth = 0;
++#endif
++
+ /* init 'xormasks' array */
+ xorMasks[0] = 0x01010101;
+ xorMasks[1] = 0x02020203;
+@@ -268,15 +319,38 @@
+ defaspect = normaspect = 1.0;
+ mainW = dirW = infoW = ctrlW = gamW = psW = (Window) NULL;
+ anyBrowUp = 0;
++ incrementalSearchTimeout = 30;
+
+ #ifdef HAVE_JPEG
+ jpegW = (Window) NULL; jpegUp = 0;
+ #endif
+
++#ifdef HAVE_JP2K
++ jp2kW = (Window) NULL; jp2kUp = 0;
++#endif
++
+ #ifdef HAVE_TIFF
+ tiffW = (Window) NULL; tiffUp = 0;
+ #endif
+
++#ifdef HAVE_PNG
++ pngW = (Window) NULL; pngUp = 0;
++#endif
++
++ pcdW = (Window) NULL; pcdUp = 0;
++
++#ifdef HAVE_PIC2
++ pic2W = (Window) NULL; pic2Up = 0;
++#endif
++
++#ifdef HAVE_PCD
++ pcdW = (Window) NULL; pcdUp = 0;
++#endif
++
++#ifdef HAVE_MGCSFX
++ mgcsfxW = (Window) NULL; mgcsfxUp = 0;
++#endif
++
+ imap = ctrlmap = gmap = browmap = cmtmap = 0;
+
+ ch_offx = ch_offy = p_offx = p_offy = 0;
+@@ -303,13 +377,35 @@
+ verifyArgs();
+
+
++#if 0
++#ifdef XVEXECPATH
++ /* set up path to search for external executables */
++ {
++ char *systempath = getenv("PATH");
++ char *xvexecpath = getenv("XVPATH");
++ if (xvexecpath == NULL) xvexecpath = XVEXECPATH;
++ /* FIXME: can systempath == NULL? */
++ strcat(systempath, ":"); /* FIXME: writing to mem we don't own */
++ strcat(systempath, xvexecpath); /* FIXME: writing to mem we don't own */
++ /* FIXME: was there supposed to be a setenv() call in here? */
++ if (DEBUG)
++ fprintf(stderr, "DEBUG: executable search path: %s\n", systempath);
++ }
++#endif
++#endif
++
++
/*****************************************************/
/*** X Setup ***/
/*****************************************************/
@@ -2628,12 +3591,22 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
+
theScreen = DefaultScreen(theDisp);
theCmap = DefaultColormap(theDisp, theScreen);
- rootW = RootWindow(theDisp,theScreen);
-@@ -321,52 +321,66 @@
+- rootW = RootWindow(theDisp,theScreen);
++ if (spec_window) {
++ rootW = spec_window;
++ } else {
++ rootW = RootWindow(theDisp,theScreen);
++ }
+ theGC = DefaultGC(theDisp,theScreen);
+ theVisual = DefaultVisual(theDisp,theScreen);
+ ncells = DisplayCells(theDisp, theScreen);
+@@ -320,53 +416,67 @@
+
rootDEEP = dispDEEP;
- /* things dependant on theVisual:
+- /* things dependant on theVisual:
- * dispDEEP, theScreen, rootW, ncells, theCmap, theGC,
++ /* things dependent on theVisual:
+ * dispDEEP, theScreen, rootW, ncells, theCmap, theGC,
* vrWIDE, dispWIDE, vrHIGH, dispHIGH, maxWIDE, maxHIGH
*/
@@ -2709,7 +3682,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (visualstr && useroot) {
fprintf(stderr, "%s: %sUsing default visual.\n",
cmd, "Warning: Can't use specified visual on root. ");
-@@ -401,11 +415,11 @@
+@@ -401,11 +511,11 @@
long vinfomask;
int numvis, best;
@@ -2723,7 +3696,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
rvinfo.screen = theScreen;
vinfomask |= VisualScreenMask;
-@@ -429,9 +443,9 @@
+@@ -429,9 +539,9 @@
/* make linear colormap for DirectColor visual */
if (theVisual->class == DirectColor) makeDirectCmap();
@@ -2735,7 +3708,17 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
/* turn GraphicsExposures OFF in the default GC */
{
-@@ -456,12 +470,12 @@
+@@ -441,9 +551,6 @@
+ }
+
+
+- if (!useroot && limit2x) { maxWIDE *= 2; maxHIGH *= 2; }
+- if (nolimits) { maxWIDE = 65000; maxHIGH = 65000; }
+-
+ XSetErrorHandler(xvErrorHandler);
+
+ /* always search for virtual root window */
+@@ -456,14 +563,14 @@
Atom actual_type;
int actual_format;
unsigned long nitems, bytesafter;
@@ -2748,9 +3731,29 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
- vrootW = *newRoot;
+ vrootW = *(Window *)newRoot;
XGetWindowAttributes(theDisp, vrootW, &xwa);
- vrWIDE = xwa.width; vrHIGH = xwa.height;
+- vrWIDE = xwa.width; vrHIGH = xwa.height;
++ maxWIDE = vrWIDE = xwa.width; maxHIGH = vrHIGH = xwa.height;
dispDEEP = xwa.depth;
-@@ -492,7 +506,7 @@
+ break;
+ }
+@@ -472,7 +579,8 @@
+ vrootW = pseudo_root(theDisp, theScreen);
+ #endif
+
+-
++ if (!useroot && limit2x) { maxWIDE *= 2; maxHIGH *= 2; }
++ if (nolimits) { maxWIDE = 65000; maxHIGH = 65000; }
+
+
+ if (clrroot || useroot) {
+@@ -486,13 +594,14 @@
+ arrow = XCreateFontCursor(theDisp,(u_int) curstype);
+ cross = XCreateFontCursor(theDisp,XC_crosshair);
+ tcross = XCreateFontCursor(theDisp,XC_tcross);
++ tlcorner = XCreateFontCursor(theDisp,XC_top_left_corner);
+ zoom = XCreateFontCursor(theDisp,XC_sizing);
+
+ {
XColor fc, bc;
fc.red = fc.green = fc.blue = 0xffff;
bc.red = bc.green = bc.blue = 0x0000;
@@ -2759,7 +3762,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
XRecolorCursor(theDisp, zoom, &fc, &bc);
}
-@@ -541,7 +555,7 @@
+@@ -541,7 +650,7 @@
/* set up fg,bg colors */
@@ -2768,7 +3771,26 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (fgstr && XParseColor(theDisp, theCmap, fgstr, &ecdef) &&
xvAllocColor(theDisp, theCmap, &ecdef)) {
fg = ecdef.pixel;
-@@ -590,7 +604,7 @@
+@@ -561,6 +670,18 @@
+ xvAllocColor(theDisp, theCmap, &ecdef)) rootbg = ecdef.pixel;
+
+
++ /* GRR 19980308: set up image bg color (for transparent images) */
++ have_imagebg = 0;
++ if (imagebgstr && XParseColor(theDisp, theCmap, imagebgstr, &ecdef) &&
++ xvAllocColor(theDisp, theCmap, &ecdef)) {
++ /* imagebg = ecdef.pixel; */
++ have_imagebg = 1;
++ imagebgR = ecdef.red;
++ imagebgG = ecdef.green;
++ imagebgB = ecdef.blue;
++ }
++
++
+ /* set up hi/lo colors */
+ i=0;
+ if (dispDEEP > 1) { /* only if we're on a reasonable display */
+@@ -590,7 +711,7 @@
if (theVisual->class == StaticGray || theVisual->class == GrayScale)
mono = 1;
}
@@ -2777,7 +3799,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
iconPix = MakePix1(rootW, icon_bits, icon_width, icon_height);
-@@ -598,27 +612,27 @@
+@@ -598,32 +719,32 @@
riconPix = MakePix1(rootW, runicon_bits, runicon_width, runicon_height);
riconmask= MakePix1(rootW, runiconm_bits, runiconm_width,runiconm_height);
@@ -2812,9 +3834,16 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
+ (mfinfo = XLoadQueryFont(theDisp,FONT3))==NULL &&
+ (mfinfo = XLoadQueryFont(theDisp,FONT4))==NULL &&
(mfinfo = XLoadQueryFont(theDisp,FONT5))==NULL) {
- sprintf(str,
+- sprintf(str,
++ sprintf(dummystr,
"couldn't open the following fonts:\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s",
-@@ -632,14 +646,14 @@
+ FONT1, FONT2, FONT3, FONT4, FONT5);
+- FatalError(str);
++ FatalError(dummystr);
+ }
+ mfont=mfinfo->fid;
+ XSetFont(theDisp,theGC,mfont);
+@@ -632,45 +753,100 @@
if (monofontname) {
monofinfo = XLoadQueryFont(theDisp, monofontname);
@@ -2832,9 +3861,13 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
+ (monofinfo = XLoadQueryFont(theDisp,MFONT2))==NULL &&
+ (monofinfo = XLoadQueryFont(theDisp,MFONT3))==NULL &&
(monofinfo = XLoadQueryFont(theDisp,MFONT4))==NULL) {
- sprintf(str,"couldn't open %s fonts:\n\t%s\n\t%s\n\t%s\n\t%s",
+- sprintf(str,"couldn't open %s fonts:\n\t%s\n\t%s\n\t%s\n\t%s",
++ sprintf(dummystr,"couldn't open %s fonts:\n\t%s\n\t%s\n\t%s\n\t%s",
"any of the following",
-@@ -649,28 +663,28 @@
+ MFONT1, MFONT2, MFONT3, MFONT4);
+- FatalError(str);
++ FatalError(dummystr);
+ }
}
monofont=monofinfo->fid;
@@ -2842,6 +3875,61 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
-
-
++#ifdef TV_L10N
++ if (xlocale) {
++ i = 0;
++ while (mfontsize[i]) {
++ xlocale = 1; /* True */
++
++ sprintf(mfontset, TV_FONTSET, mfontsize[i]);
++/*fprintf(stderr, "FontSet: %s\n", mfontset);*/
++
++ monofset = XCreateFontSet(theDisp, mfontset,
++ &misscharset, &nmisscharset, &defstr);
++# if 0 /* not useful */
++ if (!monofset) {
++ /* the current locale is not supported */
++/*fprintf(stderr, "Current locale `%s' is not supported.\n", localeList[i]);*/
++ xlocale = 0;
++ break;
++ }
++# endif
++/*fprintf(stderr, "# of misscharset in mfontsize[%d]: %d\n", i,nmisscharset);*/
++
++ for (j = 0; j < nmisscharset; j++) {
++ if (!strncmp(misscharset[j], "jisx0208", 8)) {
++ /* font for JIS X 0208 is not found */
++ xlocale = 0;
++ break;
++ }
++ }
++
++ if (xlocale) {
++ monofsetinfo = XExtentsOfFontSet(monofset);
++ monofsetinfo->max_logical_extent.width = mfontsize[i];
++ /* correct size of TextViewer
++ in case that JIS X 0208 is not found */
++ break;
++ }
++
++ i++;
++ } /* while (mfontsize[i]) */
++
++# if 0
++ if (nmisscharset > 0) {
++ sprintf(dummystr,"missing %d charset:\n", nmisscharset);
++ for (i = 0; i < nmisscharset; i++) {
++ sprintf(dummystr, "%s\t%s\n", dummystr, misscharset[i]);
++ }
++# if 0
++ FatalError(dummystr);
++# else
++ fprintf(stderr, "%s", dummystr);
++# endif
++ }
++# endif
++ }
++#endif /* TV_L10N */
+
+
+
@@ -2873,11 +3961,23 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
/* have to malloc namelist[0] so we can free it in deleteFromList() */
namelist[0] = (char *) malloc(strlen(STDINSTR) + 1);
if (!namelist[0]) FatalError("unable to to build namelist[0]");
-@@ -679,16 +693,16 @@
+@@ -679,16 +855,28 @@
}
else namelist[0] = NULL;
}
-
++ else if (randomShow) {
++ int i, j;
++ char *tmp;
++
++ srandom((int)time((time_t *)0));
++ for (i = numnames; i > 1; i--) {
++ j = random() % i;
++ tmp = namelist[i-1];
++ namelist[i-1] = namelist[j];
++ namelist[j] = tmp;
++ }
++ }
+
if (numnames) makeDispNames();
-
@@ -2897,7 +3997,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
/* create the info box window */
CreateInfo(infogeom);
XSelectInput(theDisp, infoW, ExposureMask | ButtonPressMask | KeyPressMask
-@@ -698,12 +712,12 @@
+@@ -698,12 +886,12 @@
RedrawInfo(0,0,1000,1000); /* explicit draw if mapped */
XFlush(theDisp);
}
@@ -2913,7 +4013,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
XSelectInput(theDisp, ctrlW, ExposureMask | ButtonPressMask | KeyPressMask
| StructureNotifyMask);
if (ctrlmap < 0) { /* map iconified */
-@@ -719,22 +733,22 @@
+@@ -719,22 +907,22 @@
RedrawCtrl(0,0,1000,1000); /* explicit draw if mapped */
XFlush(theDisp);
}
@@ -2941,7 +4041,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
/* create the gamma window */
CreateGam(gamgeom, (gamset) ? gamval : -1.0,
(cgamset) ? rgamval : -1.0,
-@@ -744,60 +758,60 @@
+@@ -744,60 +932,84 @@
XSelectInput(theDisp, gamW, ExposureMask | ButtonPressMask | KeyPressMask
| StructureNotifyMask
| (cmapInGam ? ColormapChangeMask : 0));
@@ -2991,6 +4091,11 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
#endif
-
+
++#ifdef HAVE_JP2K
++ CreateJP2KW();
++ XSetTransientForHint(theDisp, jp2kW, dirW);
++#endif
++
#ifdef HAVE_TIFF
CreateTIFFW();
XSetTransientForHint(theDisp, tiffW, dirW);
@@ -2998,6 +4103,25 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
-
-
+
++#ifdef HAVE_PNG
++ CreatePNGW();
++ XSetTransientForHint(theDisp, pngW, dirW);
++#endif
++
++#ifdef HAVE_PCD
++ CreatePCDW();
++ XSetTransientForHint(theDisp, pcdW, dirW);
++#endif
++
++#ifdef HAVE_PIC2
++ CreatePIC2W();
++ XSetTransientForHint(theDisp, pic2W, dirW);
++#endif
++
++#ifdef HAVE_MGCSFX
++ CreateMGCSFXW();
++ XSetTransientForHint(theDisp, mgcsfxW, dirW);
++#endif
+
LoadFishCursors();
SetCursors(-1);
@@ -3022,7 +4146,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (force24) {
Set824Menus(PIC24);
conv24MB.flags[CONV24_LOCK] = 1;
-@@ -812,15 +826,15 @@
+@@ -812,15 +1024,15 @@
Set824Menus(PIC8); /* default mode */
picType = PIC8;
}
@@ -3043,7 +4167,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
/* Do The Thing... */
mainLoop();
Quit(0);
-@@ -832,12 +846,12 @@
+@@ -832,12 +1044,12 @@
/*****************************************************/
static void makeDirectCmap()
{
@@ -3058,7 +4182,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
rmask = theVisual->red_mask;
gmask = theVisual->green_mask;
-@@ -849,22 +863,22 @@
+@@ -849,22 +1061,22 @@
if (rshift<0) rmask = rmask << (-rshift);
else rmask = rmask >> rshift;
@@ -3085,7 +4209,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
for (i=0; i<256; i++) { origgot[i] = 0; directConv[i] = 0; }
for (i=numgot=0; i<cmaplen; i++) {
-@@ -882,9 +896,9 @@
+@@ -882,9 +1094,9 @@
}
}
@@ -3097,7 +4221,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
/* directConv may or may not have holes in it. */
for (i=0; i<cmaplen; i++) {
if (!origgot[i]) {
-@@ -892,10 +906,10 @@
+@@ -892,10 +1104,10 @@
numbak = numfwd = 0;
while ((i - numbak) >= 0 && !origgot[i-numbak]) numbak++;
while ((i + numfwd) < cmaplen && !origgot[i+numfwd]) numfwd++;
@@ -3110,7 +4234,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (numbak<numfwd) directConv[i] = directConv[i-numbak];
else if (numfwd<999) directConv[i] = directConv[i+numfwd];
else FatalError("DirectColor cmap: can't happen!");
-@@ -926,14 +940,14 @@
+@@ -926,14 +1138,14 @@
{
if (!vinfo || best<0) return;
@@ -3127,7 +4251,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
(vinfo[best].class==StaticGray) ? "StaticGray" :
(vinfo[best].class==StaticColor) ? "StaticColor" :
(vinfo[best].class==TrueColor) ? "TrueColor" :
-@@ -947,41 +961,41 @@
+@@ -947,41 +1159,45 @@
(int) vinfo[best].red_mask, (int) vinfo[best].green_mask,
(int) vinfo[best].blue_mask, vinfo[best].bits_per_rgb);
}
@@ -3135,7 +4259,12 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
+
dispDEEP = vinfo[best].depth;
theScreen = vinfo[best].screen;
- rootW = RootWindow(theDisp, theScreen);
+- rootW = RootWindow(theDisp, theScreen);
++ if (spec_window) {
++ rootW = spec_window;
++ } else {
++ rootW = RootWindow(theDisp,theScreen);
++ }
ncells = vinfo[best].colormap_size;
theCmap = XCreateColormap(theDisp, rootW, theVisual, AllocNone);
-
@@ -3180,7 +4309,38 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
vrWIDE = dispWIDE = DisplayWidth(theDisp,theScreen);
vrHIGH = dispHIGH = DisplayHeight(theDisp,theScreen);
maxWIDE = dispWIDE; maxHIGH = dispHIGH;
-@@ -1037,8 +1051,8 @@
+@@ -1000,25 +1216,25 @@
+ /* once through the argument list to find the display name
+ and DEBUG level, if any */
+
+- for (i=1; i<argc; i++) {
++ for (i=1; i<argc; ++i) {
+ if (!strncmp(argv[i],"-help", (size_t) 5)) { /* help */
+ cmdSyntax();
+ exit(0);
+ }
+
+ else if (!argcmp(argv[i],"-display",4,0,&pm)) {
+- i++;
++ ++i;
+ if (i<argc) display = argv[i];
+ break;
+ }
+
+-#ifdef VMS /* in VMS, cmd-line-opts are in lower case */
++#ifdef VMS /* in VMS, cmd-line opts are in lower case */
+ else if (!argcmp(argv[i],"-debug",3,0,&pm)) {
+- { if (++i<argc) DEBUG = atoi(argv[i]); }
++ if (++i<argc) DEBUG = atoi(argv[i]);
+ }
+ #else
+ else if (!argcmp(argv[i],"-DEBUG",2,0,&pm)) {
+- { if (++i<argc) DEBUG = atoi(argv[i]); }
++ if (++i<argc) DEBUG = atoi(argv[i]);
+ }
+ #endif
+ }
+@@ -1037,8 +1253,8 @@
fprintf(stderr,"%s: unable to parse 'aspect' resource\n",cmd);
else defaspect = (float) n / (float) d;
}
@@ -3191,7 +4351,15 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (rd_flag("auto4x3")) auto4x3 = def_int;
if (rd_flag("autoClose")) autoclose = def_int;
if (rd_flag("autoCrop")) autocrop = def_int;
-@@ -1073,7 +1087,7 @@
+@@ -1064,6 +1280,7 @@
+ if (rd_flag("ctrlMap")) ctrlmap = def_int;
+ if (rd_int ("cursor")) curstype = def_int;
+ if (rd_int ("defaultPreset")) preset = def_int;
++ if (rd_int ("incrementalSearchTimeout")) incrementalSearchTimeout = def_int;
+
+ if (rd_str ("driftKludge")) {
+ if (sscanf(def_str,"%d %d", &kludge_offx, &kludge_offy) != 2) {
+@@ -1073,7 +1290,7 @@
if (rd_str ("expand")) {
if (index(def_str, ':')) {
@@ -3200,16 +4368,94 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
{ hexpand = vexpand = 1.0; }
}
else hexpand = vexpand = atof(def_str);
-@@ -1108,7 +1122,7 @@
+@@ -1081,6 +1298,9 @@
+
+ if (rd_str ("fileList")) flistName = def_str;
+ if (rd_flag("fixed")) fixedaspect = def_int;
++#ifdef ENABLE_FIXPIX_SMOOTH
++ if (rd_flag("fixpix")) do_fixpix_smooth = def_int;
++#endif
+ if (rd_flag("force8")) force8 = def_int;
+ if (rd_flag("force24")) force24 = def_int;
+ if (rd_str ("foreground")) fgstr = def_str;
+@@ -1092,23 +1312,39 @@
+ if (rd_str ("highlight")) histr = def_str;
+ if (rd_str ("iconGeometry")) icongeom = def_str;
+ if (rd_flag("iconic")) startIconic = def_int;
++ if (rd_str ("imageBackground")) imagebgstr = def_str;
+ if (rd_str ("infoGeometry")) infogeom = def_str;
+ if (rd_flag("infoMap")) imap = def_int;
+ if (rd_flag("loadBrowse")) browseMode = def_int;
+ if (rd_str ("lowlight")) lostr = def_str;
++#ifdef MACBINARY
++ if (rd_flag("macbinary")) handlemacb = def_int;
++#endif
++#ifdef HAVE_MGCSFX
++ if (rd_flag("mgcsfx")) mgcsfx = def_int;
++#endif
+ if (rd_flag("mono")) mono = def_int;
+ if (rd_str ("monofont")) monofontname = def_str;
+ if (rd_int ("ncols")) ncols = def_int;
+ if (rd_flag("ninstall")) ninstall = def_int;
+ if (rd_flag("nodecor")) nodecor = def_int;
+ if (rd_flag("nolimits")) nolimits = def_int;
++#ifdef HAVE_MGCSFX
++ if (rd_flag("nomgcsfx")) nomgcsfx = def_int;
++#endif
++#if defined(HAVE_PIC) || defined(HAVE_PIC2)
++ if (rd_flag("nopicadjust")) nopicadjust = def_int;
++#endif
+ if (rd_flag("nopos")) nopos = def_int;
+ if (rd_flag("noqcheck")) noqcheck = def_int;
+ if (rd_flag("nostat")) nostat = def_int;
if (rd_flag("ownCmap")) owncmap = def_int;
if (rd_flag("perfect")) perfect = def_int;
++#ifdef HAVE_PIC2
++ if (rd_flag("pic2split")) pic2split = def_int;
++#endif
if (rd_flag("popupKludge")) winCtrPosKludge = def_int;
- if (rd_str ("print")) strncpy(printCmd, def_str,
+ if (rd_str ("print")) strncpy(printCmd, def_str,
(size_t) PRINTCMDLEN);
if (rd_flag("pscompress")) pscomp = def_int;
if (rd_flag("pspreview")) preview = def_int;
-@@ -1146,7 +1160,7 @@
+@@ -1117,18 +1353,34 @@
+ if (rd_flag("reverse")) revvideo = def_int;
+ if (rd_str ("rootBackground")) rootbgstr = def_str;
+ if (rd_str ("rootForeground")) rootfgstr = def_str;
+- if (rd_int ("rootMode")) { rootMode = def_int; rmodeset++; }
++ if (rd_int ("rootMode")) { rootMode = def_int; ++rmodeset; }
+ if (rd_flag("rwColor")) rwcolor = def_int;
+ if (rd_flag("saveNormal")) savenorm = def_int;
+ if (rd_str ("searchDirectory")) strcpy(searchdir, def_str);
+ if (rd_str ("textviewGeometry")) textgeom = def_str;
+ if (rd_flag("useStdCmap")) stdcmap = def_int;
+ if (rd_str ("visual")) visualstr = def_str;
++#ifdef VS_ADJUST
++ if (rd_flag("vsadjust")) vsadjust = def_int;
++#endif
+ if (rd_flag("vsDisable")) novbrowse = def_int;
+ if (rd_str ("vsGeometry")) browgeom = def_str;
+ if (rd_flag("vsMap")) browmap = def_int;
+ if (rd_flag("vsPerfect")) browPerfect = def_int;
+ if (rd_str ("white")) whitestr = def_str;
++
++ /* Check for any command-bindings to the supported function keys */
++#define TMPLEN 80
++ for (i=0; i<FSTRMAX; ++i) {
++ char tmp[TMPLEN];
++
++ snprintf(tmp, TMPLEN, "F%dcommand", i+1);
++ if (rd_str(tmp))
++ fkeycmds[i] = def_str;
++ else
++ fkeycmds[i] = NULL;
++ }
++#undef TMPLEN
+ }
+
+
+@@ -1146,7 +1398,7 @@
not_in_first_half = 0;
@@ -3218,35 +4464,93 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
/* a file name. put it in list */
if (!nostat) {
-@@ -1186,54 +1200,54 @@
+@@ -1158,24 +1410,30 @@
+ }
+
+ if (numnames<MAXNAMES) {
++#ifdef AUTO_EXPAND
++ if(Isarchive(argv[i]) == 0){ /* Not archive file */
++ namelist[numnames++] = argv[i];
++ }
++#else
+ namelist[numnames++] = argv[i];
++#endif
+ if (numnames==MAXNAMES) {
+- fprintf(stderr,"%s: too many filenames. Only using first %d.\n",
++ fprintf(stderr,"%s: too many filenames. Using only first %d.\n",
+ cmd, MAXNAMES);
+ }
+ }
+ }
+
+- else if (!strcmp(argv[i], "-")) /* stdin flag */
++ else if (!strcmp(argv[i], "-")) /* stdin flag */
+ stdinflag++;
- else if (!argcmp(argv[i],"-best24",3,0,&pm)) /* -best */
+- else if (!argcmp(argv[i],"-24", 3,1,&force24 )); /* force24 */
+- else if (!argcmp(argv[i],"-2xlimit",3,1,&limit2x )); /* 2xlimit */
+- else if (!argcmp(argv[i],"-4x3", 2,1,&auto4x3 )); /* 4x3 */
+- else if (!argcmp(argv[i],"-8", 2,1,&force8 )); /* force8 */
+- else if (!argcmp(argv[i],"-acrop", 3,1,&autocrop)); /* autocrop */
+-
+- else if (!argcmp(argv[i],"-aspect",3,0,&pm)) { /* def. aspect */
++ else if (!argcmp(argv[i],"-24", 3,1,&force24 )); /* force24 */
++ else if (!argcmp(argv[i],"-2xlimit",3,1,&limit2x )); /* 2xlimit */
++ else if (!argcmp(argv[i],"-4x3", 2,1,&auto4x3 )); /* 4x3 */
++ else if (!argcmp(argv[i],"-8", 2,1,&force8 )); /* force8 */
++ else if (!argcmp(argv[i],"-acrop", 3,1,&autocrop)); /* autocrop */
++
++ else if (!argcmp(argv[i],"-aspect",3,0,&pm)) { /* def. aspect */
+ int n,d;
+ if (++i<argc) {
+ if (sscanf(argv[i],"%d:%d",&n,&d)!=2 || n<1 || d<1)
+@@ -1184,57 +1442,65 @@
+ }
+ }
+
+- else if (!argcmp(argv[i],"-best24",3,0,&pm)) /* -best */
++ else if (!argcmp(argv[i],"-windowid",3,0,&pm)) {
++ if (++i<argc) {
++ if (sscanf(argv[i], "%ld", &spec_window) != 1) {
++ fprintf(stderr,"%s: bad argument to -windowid '%s'\n",cmd,argv[i]);
++ }
++ }
++ }
++
++ else if (!argcmp(argv[i],"-best24",3,0,&pm)) /* -best */
conv24 = CONV24_BEST;
-
+- else if (!argcmp(argv[i],"-bg",3,0,&pm)) /* bg color */
+
- else if (!argcmp(argv[i],"-bg",3,0,&pm)) /* bg color */
++ else if (!argcmp(argv[i],"-bg",3,0,&pm)) /* bg color */
{ if (++i<argc) bgstr = argv[i]; }
-
+- else if (!argcmp(argv[i],"-black",3,0,&pm)) /* black color */
+
- else if (!argcmp(argv[i],"-black",3,0,&pm)) /* black color */
++ else if (!argcmp(argv[i],"-black",3,0,&pm)) /* black color */
{ if (++i<argc) blackstr = argv[i]; }
-
+- else if (!argcmp(argv[i],"-bw",3,0,&pm)) /* border width */
+
- else if (!argcmp(argv[i],"-bw",3,0,&pm)) /* border width */
++ else if (!argcmp(argv[i],"-bw",3,0,&pm)) /* border width */
{ if (++i<argc) bwidth=atoi(argv[i]); }
-
-+
- else if (!argcmp(argv[i],"-cecmap",4,1,&cmapInGam)); /* cmapInGam */
+- else if (!argcmp(argv[i],"-cecmap",4,1,&cmapInGam)); /* cmapInGam */
-
+- else if (!argcmp(argv[i],"-cegeometry",4,0,&pm)) /* gammageom */
+
- else if (!argcmp(argv[i],"-cegeometry",4,0,&pm)) /* gammageom */
++ else if (!argcmp(argv[i],"-cecmap",4,1,&cmapInGam)); /* cmapInGam */
++
++ else if (!argcmp(argv[i],"-cegeometry",4,0,&pm)) /* gammageom */
{ if (++i<argc) gamgeom = argv[i]; }
-
-+
- else if (!argcmp(argv[i],"-cemap",4,1,&gmap)); /* gmap */
+- else if (!argcmp(argv[i],"-cemap",4,1,&gmap)); /* gmap */
-
+- else if (!argcmp(argv[i],"-cgamma",4,0,&pm)) { /* color gamma */
+
- else if (!argcmp(argv[i],"-cgamma",4,0,&pm)) { /* color gamma */
++ else if (!argcmp(argv[i],"-cemap",4,1,&gmap)); /* gmap */
++
++ else if (!argcmp(argv[i],"-cgamma",4,0,&pm)) { /* color gamma */
if (i+3<argc) {
- rgamval = atof(argv[++i]);
- ggamval = atof(argv[++i]);
@@ -3258,23 +4562,30 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
cgamset++;
}
-
+- else if (!argcmp(argv[i],"-cgeometry",4,0,&pm)) /* ctrlgeom */
+
- else if (!argcmp(argv[i],"-cgeometry",4,0,&pm)) /* ctrlgeom */
++ else if (!argcmp(argv[i],"-cgeometry",4,0,&pm)) /* ctrlgeom */
{ if (++i<argc) ctrlgeom = argv[i]; }
-
-+
- else if (!argcmp(argv[i],"-clear",4,1,&clrroot)); /* clear */
- else if (!argcmp(argv[i],"-close",4,1,&autoclose)); /* close */
- else if (!argcmp(argv[i],"-cmap", 3,1,&ctrlmap)); /* ctrlmap */
+- else if (!argcmp(argv[i],"-clear",4,1,&clrroot)); /* clear */
+- else if (!argcmp(argv[i],"-close",4,1,&autoclose)); /* close */
+- else if (!argcmp(argv[i],"-cmap", 3,1,&ctrlmap)); /* ctrlmap */
- else if (!argcmp(argv[i],"-cmtgeometry",5,0,&pm)) /* comment geom */
+- else if (!argcmp(argv[i],"-cmtgeometry",5,0,&pm)) /* comment geom */
++ else if (!argcmp(argv[i],"-clear",4,1,&clrroot)); /* clear */
++ else if (!argcmp(argv[i],"-close",4,1,&autoclose)); /* close */
++ else if (!argcmp(argv[i],"-cmap", 3,1,&ctrlmap)); /* ctrlmap */
++
++ else if (!argcmp(argv[i],"-cmtgeometry",5,0,&pm)) /* comment geom */
{ if (++i<argc) cmtgeom = argv[i]; }
-
-+
- else if (!argcmp(argv[i],"-cmtmap",5,1,&cmtmap)); /* map cmt window */
+- else if (!argcmp(argv[i],"-cmtmap",5,1,&cmtmap)); /* map cmt window */
-
+- else if (!argcmp(argv[i],"-crop",3,0,&pm)) { /* crop */
+
- else if (!argcmp(argv[i],"-crop",3,0,&pm)) { /* crop */
++ else if (!argcmp(argv[i],"-cmtmap",5,1,&cmtmap)); /* map cmt window */
++
++ else if (!argcmp(argv[i],"-crop",3,0,&pm)) { /* crop */
if (i+4<argc) {
- acropX = atoi(argv[++i]);
- acropY = atoi(argv[++i]);
@@ -3288,12 +4599,37 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
acrop++;
}
-
+- else if (!argcmp(argv[i],"-cursor",3,0,&pm)) /* cursor */
+
- else if (!argcmp(argv[i],"-cursor",3,0,&pm)) /* cursor */
++ else if (!argcmp(argv[i],"-cursor",3,0,&pm)) /* cursor */
{ if (++i<argc) curstype = atoi(argv[i]); }
-@@ -1265,7 +1279,7 @@
- else if (!argcmp(argv[i],"-expand",2,0,&pm)) { /* expand factor */
+ #ifdef VMS /* in VMS, cmd-line-opts are in lower case */
+@@ -1247,84 +1513,100 @@
+ }
+ #endif
+
+- else if (!argcmp(argv[i],"-dir",4,0,&pm)) /* search dir */
++ else if (!argcmp(argv[i],"-dir",4,0,&pm)) /* search dir */
+ { if (++i<argc) strcpy(searchdir, argv[i]); }
+
+- else if (!argcmp(argv[i],"-display",4,0,&pm)) /* display */
++ else if (!argcmp(argv[i],"-display",4,0,&pm)) /* display */
+ { if (++i<argc) display = argv[i]; }
+
+- else if (!argcmp(argv[i],"-dither",4,1,&autodither)); /* autodither */
++ else if (!argcmp(argv[i],"-dither",4,1,&autodither)); /* autodither */
+
+- else if (!argcmp(argv[i],"-drift",3,0,&pm)) { /* drift kludge */
++ else if (!argcmp(argv[i],"-drift",3,0,&pm)) { /* drift kludge */
+ if (i<argc-2) {
+ kludge_offx = atoi(argv[++i]);
+ kludge_offy = atoi(argv[++i]);
+ }
+ }
+
+- else if (!argcmp(argv[i],"-expand",2,0,&pm)) { /* expand factor */
++ else if (!argcmp(argv[i],"-expand",2,0,&pm)) { /* expand factor */
if (++i<argc) {
if (index(argv[i], ':')) {
- if (sscanf(argv[i], "%lf:%lf", &hexpand, &vexpand)!=2)
@@ -3301,49 +4637,74 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
{ hexpand = vexpand = 1.0; }
}
else hexpand = vexpand = atof(argv[i]);
-@@ -1274,47 +1288,47 @@
+ }
+ }
- else if (!argcmp(argv[i],"-fg",3,0,&pm)) /* fg color */
+- else if (!argcmp(argv[i],"-fg",3,0,&pm)) /* fg color */
++#ifdef HAVE_G3
++ else if (!argcmp(argv[i],"-fax",3,0,&highresfax)); /* fax */
++#endif
++
++ else if (!argcmp(argv[i],"-fg",3,0,&pm)) /* fg color */
{ if (++i<argc) fgstr = argv[i]; }
-
-+
- else if (!argcmp(argv[i],"-fixed",3,1,&fixedaspect)); /* fix asp. ratio */
+- else if (!argcmp(argv[i],"-fixed",3,1,&fixedaspect)); /* fix asp. ratio */
-
+- else if (!argcmp(argv[i],"-flist",3,0,&pm)) /* file list */
++
++ else if (!argcmp(argv[i],"-fixed",5,1,&fixedaspect)); /* fix asp. ratio */
++
++#ifdef ENABLE_FIXPIX_SMOOTH
++ else if (!argcmp(argv[i],"-fixpix",5,1,&do_fixpix_smooth)); /* dithering */
++#endif
+
- else if (!argcmp(argv[i],"-flist",3,0,&pm)) /* file list */
++ else if (!argcmp(argv[i],"-flist",3,0,&pm)) /* file list */
{ if (++i<argc) flistName = argv[i]; }
- else if (!argcmp(argv[i],"-gamma",3,0,&pm)) /* gamma */
+- else if (!argcmp(argv[i],"-gamma",3,0,&pm)) /* gamma */
++ else if (!argcmp(argv[i],"-gamma",3,0,&pm)) /* gamma */
{ if (++i<argc) gamval = atof(argv[i]); gamset++; }
-
+- else if (!argcmp(argv[i],"-geometry",3,0,&pm)) /* geometry */
+
- else if (!argcmp(argv[i],"-geometry",3,0,&pm)) /* geometry */
++ else if (!argcmp(argv[i],"-geometry",3,0,&pm)) /* geometry */
{ if (++i<argc) maingeom = argv[i]; }
-
+- else if (!argcmp(argv[i],"-grabdelay",3,0,&pm)) /* grabDelay */
+
- else if (!argcmp(argv[i],"-grabdelay",3,0,&pm)) /* grabDelay */
++ else if (!argcmp(argv[i],"-grabdelay",3,0,&pm)) /* grabDelay */
{ if (++i<argc) grabDelay = atoi(argv[i]); }
-
+- else if (!argcmp(argv[i],"-gsdev",4,0,&pm)) /* gsDevice */
+
- else if (!argcmp(argv[i],"-gsdev",4,0,&pm)) /* gsDevice */
++ else if (!argcmp(argv[i],"-gsdev",4,0,&pm)) /* gsDevice */
{ if (++i<argc) gsDev = argv[i]; }
-
+- else if (!argcmp(argv[i],"-gsgeom",4,0,&pm)) /* gsGeometry */
+
- else if (!argcmp(argv[i],"-gsgeom",4,0,&pm)) /* gsGeometry */
++ else if (!argcmp(argv[i],"-gsgeom",4,0,&pm)) /* gsGeometry */
{ if (++i<argc) gsGeomStr = argv[i]; }
-
+- else if (!argcmp(argv[i],"-gsres",4,0,&pm)) /* gsResolution */
+
- else if (!argcmp(argv[i],"-gsres",4,0,&pm)) /* gsResolution */
++ else if (!argcmp(argv[i],"-gsres",4,0,&pm)) /* gsResolution */
{ if (++i<argc) gsRes=abs(atoi(argv[i])); }
-
-+
- else if (!argcmp(argv[i],"-hflip",3,1,&autohflip)); /* hflip */
+- else if (!argcmp(argv[i],"-hflip",3,1,&autohflip)); /* hflip */
- else if (!argcmp(argv[i],"-hi",3,0,&pm)) /* highlight */
+- else if (!argcmp(argv[i],"-hi",3,0,&pm)) /* highlight */
++ else if (!argcmp(argv[i],"-hflip",3,1,&autohflip)); /* hflip */
++
++ else if (!argcmp(argv[i],"-hi",3,0,&pm)) /* highlight */
{ if (++i<argc) histr = argv[i]; }
-
+- else if (!argcmp(argv[i],"-hist", 4,1,&autohisteq)); /* hist eq */
+
- else if (!argcmp(argv[i],"-hist", 4,1,&autohisteq)); /* hist eq */
++#ifdef HAVE_G3
++ else if (!argcmp(argv[i],"-highresfax",4,0,&highresfax));/* high res. fax */
++#endif
++
++ else if (!argcmp(argv[i],"-hist", 4,1,&autohisteq)); /* hist eq */
else if (!argcmp(argv[i],"-hsv", 3,1,&hsvmode)); /* hsvmode */
@@ -3357,11 +4718,19 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
else if (!argcmp(argv[i],"-igeometry",3,0,&pm)) /* infogeom */
{ if (++i<argc) infogeom = argv[i]; }
-
-+
- else if (!argcmp(argv[i],"-imap", 3,1,&imap)); /* imap */
- else if (!argcmp(argv[i],"-lbrowse", 3,1,&browseMode)); /* browse mode */
+- else if (!argcmp(argv[i],"-imap", 3,1,&imap)); /* imap */
+- else if (!argcmp(argv[i],"-lbrowse", 3,1,&browseMode)); /* browse mode */
-@@ -1323,8 +1337,8 @@
+- else if (!argcmp(argv[i],"-lo",3,0,&pm)) /* lowlight */
++ else if (!argcmp(argv[i],"-imap",3,1,&imap)); /* imap */
++
++ else if (!argcmp(argv[i],"-ibg",3,0,&pm)) /* image bkgd color */
++ { if (++i<argc) imagebgstr = argv[i]; }
++
++ else if (!argcmp(argv[i],"-lbrowse",3,1,&browseMode)); /* browse mode */
++
++ else if (!argcmp(argv[i],"-lo",3,0,&pm)) /* lowlight */
+ { if (++i<argc) lostr = argv[i]; }
else if (!argcmp(argv[i],"-loadclear",4,1,&clearonload)); /* clearonload */
@@ -3372,15 +4741,23 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
-@@ -1339,18 +1353,18 @@
+@@ -1339,103 +1621,130 @@
if (!argcmp(argv[i],"-max",4,1,&automax)); /* auto maximize */
else if (!argcmp(argv[i],"-maxpect",5,1,&pm)) /* auto maximize */
{ automax=pm; fixedaspect=pm; }
-
+
++#ifdef MACBINARY
++ else if (!argcmp(argv[i],"-macbinary",3,1,&handlemacb)); /* macbinary */
++#endif
++
else if (!argcmp(argv[i],"-mfn",3,0,&pm)) /* mono font name */
{ if (++i<argc) monofontname = argv[i]; }
++#ifdef HAVE_MGCSFX
++ else if (!argcmp(argv[i],"-mgcsfx", 4,1,&mgcsfx)); /* mgcsfx */
++#endif
++
else if (!argcmp(argv[i],"-mono",3,1,&mono)); /* mono */
-
+
@@ -3391,11 +4768,35 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
else if (!argcmp(argv[i],"-ncols",3,0,&pm)) /* ncols */
{ if (++i<argc) ncols=abs(atoi(argv[i])); }
-
+- else if (!argcmp(argv[i],"-ninstall", 3,1,&ninstall)); /* inst cmaps?*/
+
- else if (!argcmp(argv[i],"-ninstall", 3,1,&ninstall)); /* inst cmaps?*/
++ else if (!argcmp(argv[i],"-ninstall", 3,1,&ninstall)); /* inst cmaps? */
else if (!argcmp(argv[i],"-nodecor", 4,1,&nodecor));
else if (!argcmp(argv[i],"-nofreecols",4,1,&noFreeCols));
-@@ -1367,61 +1381,61 @@
+ else if (!argcmp(argv[i],"-nolimits", 4,1,&nolimits)); /* nolimits */
++#ifdef HAVE_MGCSFX
++ else if (!argcmp(argv[i],"-nomgcsfx", 4,1,&nomgcsfx)); /* nomgcsfx */
++#endif
++#if defined(HAVE_PIC) || defined(HAVE_PIC2)
++ else if (!argcmp(argv[i],"-nopicadjust", 4,1,&nopicadjust));/*nopicadjust*/
++#endif
+ else if (!argcmp(argv[i],"-nopos", 4,1,&nopos)); /* nopos */
+ else if (!argcmp(argv[i],"-noqcheck", 4,1,&noqcheck)); /* noqcheck */
+- else if (!argcmp(argv[i],"-noresetroot",5,1,&resetroot)); /* reset root*/
++ else if (!argcmp(argv[i],"-noresetroot",5,1,&resetroot)); /* reset root */
+ else if (!argcmp(argv[i],"-norm", 5,1,&autonorm)); /* norm */
+ else if (!argcmp(argv[i],"-nostat", 4,1,&nostat)); /* nostat */
+ else if (!argcmp(argv[i],"-owncmap", 2,1,&owncmap)); /* own cmap */
++#ifdef HAVE_PCD
++ else if (!argcmp(argv[i],"-pcd", 4,0,&pm)) /* pcd with size */
++ { if (i+1<argc) PcdSize = atoi(argv[++i]); }
++#endif
+ else if (!argcmp(argv[i],"-perfect", 3,1,&perfect)); /* -perfect */
++#ifdef HAVE_PIC2
++ else if (!argcmp(argv[i],"-pic2split", 3,1,&pic2split)); /* pic2split */
++#endif
+ else if (!argcmp(argv[i],"-pkludge", 3,1,&winCtrPosKludge));
+ else if (!argcmp(argv[i],"-poll", 3,1,&polling)); /* chk mod? */
else if (!argcmp(argv[i],"-preset",3,0,&pm)) /* preset */
{ if (++i<argc) preset=abs(atoi(argv[i])); }
@@ -3447,6 +4848,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
-
+
else if (!argcmp(argv[i],"-smooth",3,1,&autosmooth)); /* autosmooth */
++ else if (!argcmp(argv[i],"-startgrab",3,1,&startGrab)); /* startGrab */
else if (!argcmp(argv[i],"-stdcmap",3,1,&stdcmap)); /* use stdcmap */
else if (!argcmp(argv[i],"-tgeometry",2,0,&pm)) /* textview geom */
@@ -3460,6 +4862,10 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
{ if (++i<argc) visualstr = argv[i]; }
-
+
++#ifdef VS_ADJUST
++ else if (!argcmp(argv[i],"-vsadjust", 3,1,&vsadjust)); /* vsadjust */
++#endif
++
else if (!argcmp(argv[i],"-vsdisable",4,1,&novbrowse)); /* disable sch? */
-
+
@@ -3473,8 +4879,12 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
else if (!argcmp(argv[i],"-vsperfect",3,1,&browPerfect)); /* vs perf. */
else if (!argcmp(argv[i],"-wait",3,0,&pm)) { /* secs betwn pics */
-@@ -1430,12 +1444,12 @@
- if (waitsec<0) waitsec = 0;
+ if (++i<argc) {
+- waitsec = abs(atoi(argv[i]));
+- if (waitsec<0) waitsec = 0;
++ char *comma = strchr(argv[i], ',');
++ waitsec_nonfinal = fabs(atof(argv[i]));
++ waitsec_final = comma? fabs(atof(comma+1)) : waitsec_nonfinal;
}
}
-
@@ -3489,7 +4899,19 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
else if (not_in_first_half) cmdSyntax();
}
-@@ -1462,7 +1476,7 @@
+@@ -1453,7 +1762,11 @@
+ /* check options for validity */
+
+ if (strlen(searchdir)) { /* got a search directory */
++#ifdef AUTO_EXPAND
++ if (Chvdir(searchdir)) {
++#else
+ if (chdir(searchdir)) {
++#endif
+ fprintf(stderr,"xv: unable to cd to directory '%s'.\n",searchdir);
+ fprintf(stderr,
+ " Ignoring '-dir' option and/or 'xv.searchDirectory' resource\n");
+@@ -1462,7 +1775,7 @@
}
@@ -3498,7 +4920,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
add_filelist_to_namelist(flistName, namelist, &numnames, MAXNAMES);
RANGE(curstype,0,254);
-@@ -1475,16 +1489,16 @@
+@@ -1475,16 +1788,16 @@
/* if using root, generally gotta map ctrl window, 'cause there won't be
any way to ask for it. (no kbd or mouse events from rootW) */
@@ -3518,23 +4940,28 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (grabDelay < 0 || grabDelay > 15) {
-@@ -1498,7 +1512,7 @@
+@@ -1498,9 +1811,9 @@
fprintf(stderr," (Valid values: 1, 2, 3, 4)\n");
preset = 0;
- }
+ }
- if (waitsec < 0) noFreeCols = 0; /* disallow nfc if not doing slideshow */
+- if (waitsec < 0) noFreeCols = 0; /* disallow nfc if not doing slideshow */
++ if (waitsec < 0.0) noFreeCols = 0; /* disallow nfc if not doing slideshow */
if (noFreeCols && perfect) { perfect = 0; owncmap = 1; }
-@@ -1512,13 +1526,13 @@
+
+ /* decide what default color allocation stuff we've settled on */
+@@ -1512,24 +1825,24 @@
defaultCmapMode = colorMapMode; /* default mode for 8-bit images */
- if (nopos) {
+- maingeom = infogeom = ctrlgeom = gamgeom = browgeom = textgeom = NULL;
+- cmtgeom = NULL;
+ if (nopos) {
- maingeom = infogeom = ctrlgeom = gamgeom = browgeom = textgeom = NULL;
- cmtgeom = NULL;
++ maingeom = infogeom = ctrlgeom = gamgeom = browgeom = textgeom = cmtgeom =
++ (const char *) NULL;
}
/* if -root and -maxp, disallow 'integer' tiling modes */
@@ -3543,7 +4970,141 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
(rootMode == RM_TILE || rootMode == RM_IMIRROR))
rootMode = RM_CSOLID;
}
-@@ -1656,7 +1670,7 @@
+
+
+
++static int cpos = 0;
+
+ /***********************************/
+-static int cpos = 0;
+ static void printoption(st)
+- char *st;
++ const char *st;
+ {
+ if (strlen(st) + cpos > 78) {
+ fprintf(stderr,"\n ");
+@@ -1540,8 +1853,26 @@
+ cpos = cpos + strlen(st) + 1;
+ }
+
++
+ static void cmdSyntax()
+ {
++ /* GRR 19980605: added version info for most common libraries */
++ fprintf(stderr, "XV - %s.\n", REVDATE);
++#ifdef HAVE_JPEG
++ VersionInfoJPEG();
++#endif
++#ifdef HAVE_JP2K
++ VersionInfoJP2K();
++#endif
++#ifdef HAVE_TIFF
++ VersionInfoTIFF();
++#endif
++#ifdef HAVE_PNG
++ VersionInfoPNG();
++#endif
++ /* pbm/pgm/ppm support is native, not via pbmplus/netpbm libraries */
++ fprintf(stderr, "\n");
++
+ fprintf(stderr, "Usage:\n");
+ printoption(cmd);
+ printoption("[-]");
+@@ -1579,8 +1910,14 @@
+ printoption("[-/+dither]");
+ printoption("[-drift dx dy]");
+ printoption("[-expand exp | hexp:vexp]");
++#ifdef HAVE_G3
++ printoption("[-fax]");
++#endif
+ printoption("[-fg color]");
+ printoption("[-/+fixed]");
++#ifdef ENABLE_FIXPIX_SMOOTH
++ printoption("[-/+fixpix]");
++#endif
+ printoption("[-flist fname]");
+ printoption("[-gamma val]");
+ printoption("[-geometry geom]");
+@@ -1591,8 +1928,12 @@
+ printoption("[-help]");
+ printoption("[-/+hflip]");
+ printoption("[-hi color]");
++#ifdef HAVE_G3
++ printoption("[-highresfax]");
++#endif
+ printoption("[-/+hist]");
+ printoption("[-/+hsv]");
++ printoption("[-ibg color]"); /* GRR 19980314 */
+ printoption("[-icgeometry geom]");
+ printoption("[-/+iconic]");
+ printoption("[-igeometry geom]");
+@@ -1600,9 +1941,15 @@
+ printoption("[-/+lbrowse]");
+ printoption("[-lo color]");
+ printoption("[-/+loadclear]");
++#ifdef MACBINARY
++ printoption("[-/+macbinary]");
++#endif
+ printoption("[-/+max]");
+ printoption("[-/+maxpect]");
+ printoption("[-mfn font]");
++#ifdef HAVE_MGCSFX
++ printoption("[-/+mgcsfx]");
++#endif
+ printoption("[-/+mono]");
+ printoption("[-name str]");
+ printoption("[-ncols #]");
+@@ -1610,13 +1957,25 @@
+ printoption("[-/+nodecor]");
+ printoption("[-/+nofreecols]");
+ printoption("[-/+nolimits]");
++#ifdef HAVE_MGCSFX
++ printoption("[-/+nomgcsfx]");
++#endif
++#if defined(HAVE_PIC) || defined(HAVE_PIC2)
++ printoption("[-/+nopicadjust]");
++#endif
+ printoption("[-/+nopos]");
+ printoption("[-/+noqcheck]");
+ printoption("[-/+noresetroot]");
+ printoption("[-/+norm]");
+ printoption("[-/+nostat]");
+ printoption("[-/+owncmap]");
++#ifdef HAVE_PCD
++ printoption("[-pcd size(0=192*128,1,2,3,4=3072*2048)]");
++#endif
+ printoption("[-/+perfect]");
++#ifdef HAVE_PIC2
++ printoption("[-/+pic2split]");
++#endif
+ printoption("[-/+pkludge]");
+ printoption("[-/+poll]");
+ printoption("[-preset #]");
+@@ -1635,17 +1994,22 @@
+ printoption("[-/+rw]");
+ printoption("[-slow24]");
+ printoption("[-/+smooth]");
++ printoption("[-/+startgrab]");
+ printoption("[-/+stdcmap]");
+ printoption("[-tgeometry geom]");
+ printoption("[-/+vflip]");
+ printoption("[-/+viewonly]");
+ printoption("[-visual type]");
++#ifdef VS_ADJUST
++ printoption("[-/+vsadjust]");
++#endif
+ printoption("[-/+vsdisable]");
+ printoption("[-vsgeometry geom]");
+ printoption("[-/+vsmap]");
+ printoption("[-/+vsperfect]");
+- printoption("[-wait seconds]");
++ printoption("[-wait secs[,final_secs]]");
+ printoption("[-white color]");
++ printoption("[-windowid windowid]");
+ printoption("[-/+wloop]");
+ printoption("[filename ...]");
+ fprintf(stderr,"\n\n");
+@@ -1656,7 +2020,7 @@
/***********************************/
static void rmodeSyntax()
{
@@ -3552,13 +5113,27 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
cmd, rootMode);
fprintf(stderr,"\t0: tiling\n");
fprintf(stderr,"\t1: integer tiling\n");
-@@ -1679,13 +1693,11 @@
+@@ -1668,6 +2032,7 @@
+ fprintf(stderr,"\t7: centered on a 'brick' background\n");
+ fprintf(stderr,"\t8: symmetrical tiling\n");
+ fprintf(stderr,"\t9: symmetrical mirrored tiling\n");
++ fprintf(stderr,"\t10: upper left corner\n");
+ fprintf(stderr,"\n");
+ Quit(1);
+ }
+@@ -1675,17 +2040,15 @@
+
+ /***********************************/
+ static int argcmp(a1, a2, minlen, plusallowed, plusminus)
+- char *a1, *a2;
++ const char *a1, *a2;
int minlen, plusallowed;
int *plusminus;
{
- /* does a string compare between a1 and a2. To return '0', a1 and a2
+- must match to the length of a2, and that length has to
+ /* does a string compare between a1 and a2. To return '0', a1 and a2
- must match to the length of a2, and that length has to
++ must match to the length of a1, and that length has to
be at least 'minlen'. Otherwise, return non-zero. plusminus set to '1'
if '-option', '0' if '+option' */
@@ -3567,7 +5142,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if ((strlen(a1) < (size_t) minlen) || (strlen(a2) < (size_t) minlen))
return 1;
if (strlen(a1) > strlen(a2)) return 1;
-@@ -1694,7 +1706,7 @@
+@@ -1694,7 +2057,7 @@
if (a1[0]=='-' || (plusallowed && a1[0]=='+')) {
/* only set if we match */
@@ -3576,17 +5151,21 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
return 0;
}
-@@ -1721,8 +1733,7 @@
+@@ -1721,8 +2084,11 @@
int oldCXOFF, oldCYOFF, oldCWIDE, oldCHIGH, wascropped;
char *tmp;
char *fullname, /* full name of the original file */
- filename[512], /* full name of file to load (could be /tmp/xxx)*/
- globnm[512]; /* globbed version of fullname of orig file */
+ filename[512]; /* full name of file to load (could be /tmp/xxx)*/
++#ifdef MACBINARY
++ char origname[512]; /* file name of original file (NO processing) */
++ origname[0] = '\0';
++#endif
xvbzero((char *) &pinfo, sizeof(PICINFO));
-@@ -1748,7 +1759,7 @@
+@@ -1748,7 +2114,7 @@
/* if we're not loading next or prev page in a multi-page doc, kill off
page files */
@@ -3595,7 +5174,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
killpage = 1;
-@@ -1799,7 +1810,7 @@
+@@ -1799,14 +2165,13 @@
}
else if (filenum == PADDED) {
@@ -3604,25 +5183,66 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
basefname(compute from fullfname) */
i = LoadPad(&pinfo, fullfname);
-@@ -1864,7 +1875,7 @@
+ fullname = fullfname;
+ strcpy(filename, fullfname);
+- tmp = BaseName(fullfname);
+- strcpy(basefname, tmp);
++ strcpy(basefname, BaseName(fullfname));
+
+ if (!i) goto FAILED; /* shouldn't happen */
+
+@@ -1855,33 +2220,48 @@
+ frompipe = 1;
+ }
+ }
++#ifdef AUTO_EXPAND
++ else {
++ fullname = (char *) malloc(MAXPATHLEN+2);
++ strcpy(fullname, namelist[filenum]); // 1 of 2 places fullname != const
++ freename = 1;
++ }
++ tmp = (char *) rindex(fullname, '/');
++ if (tmp) {
++ *tmp = '\0'; // 2 of 2 places fullname != const
++ Mkvdir(fullname);
++ *tmp = '/';
++ }
++ Dirtovd(fullname);
++#else
+ else fullname = namelist[filenum];
+-
++#endif
+
+ strcpy(fullfname, fullname);
+- tmp = BaseName(fullname);
+- strcpy(basefname, tmp);
++ strcpy(basefname, BaseName(fullname));
/* chop off trailing ".Z", ".z", or ".gz" from displayed basefname, if any */
- if (strlen(basefname) > (size_t) 2 &&
-+ if (strlen(basefname) > (size_t) 2 &&
- strcmp(basefname+strlen(basefname)-2,".Z")==0)
+- strcmp(basefname+strlen(basefname)-2,".Z")==0)
++ if (strlen(basefname)>2 && strcmp(basefname+strlen(basefname)-2,".Z")==0)
basefname[strlen(basefname)-2]='\0';
else {
-@@ -1872,7 +1883,7 @@
- if (strlen(basefname)>2 && strcmp(basefname+strlen(basefname)-2,".Z")==0)
+ #ifdef GUNZIP
+- if (strlen(basefname)>2 && strcmp(basefname+strlen(basefname)-2,".Z")==0)
++ if (strlen(basefname)>2 && strcmp(basefname+strlen(basefname)-2,".z")==0)
basefname[strlen(basefname)-2]='\0';
-
+-
- else if (strlen(basefname)>3 &&
-+ else if (strlen(basefname)>3 &&
- strcmp(basefname+strlen(basefname)-3,".gz")==0)
+- strcmp(basefname+strlen(basefname)-3,".gz")==0)
++ else
++ if (strlen(basefname)>3 && strcmp(basefname+strlen(basefname)-3,".gz")==0)
basefname[strlen(basefname)-3]='\0';
- #endif /* GUNZIP */
-@@ -1881,7 +1892,7 @@
+-#endif /* GUNZIP */
++#endif
++#ifdef BUNZIP2
++ if (strlen(basefname)>4 && strcmp(basefname+strlen(basefname)-4,".bz2")==0)
++ basefname[strlen(basefname)-4]='\0';
++#endif
+ }
+
if (filenum == LOADPIC && ISPIPE(fullname[0])) {
/* if we're reading from a pipe, 'filename' will have the /tmp/xvXXXXXX
@@ -3631,7 +5251,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
'initdir' to relative paths, dealing with reading from stdin, etc. */
/* at this point, fullname = "! do some commands",
-@@ -1891,11 +1902,11 @@
+@@ -1891,11 +2271,11 @@
else { /* NOT reading from a PIPE */
@@ -3647,7 +5267,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if we have a searchdir (ie, we have multiple places to look),
see if such a file exists (via fopen()),
if it does, we're done.
-@@ -1904,7 +1915,7 @@
+@@ -1904,7 +2284,7 @@
if it does, we're done.
if it doesn't, remove all prepended directories, and fall through
to error code below. */
@@ -3656,7 +5276,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (filenum!=LOADPIC && fullname[0]!='/' && strcmp(fullname,STDINSTR)!=0) {
char *tmp1;
-@@ -1954,26 +1965,30 @@
+@@ -1954,28 +2334,40 @@
}
}
}
@@ -3672,6 +5292,9 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (strcmp(filename,STDINSTR)==0) {
- FILE *fp;
+ FILE *fp = NULL;
++#ifndef USE_MKSTEMP
++ int tmpfd;
++#endif
-#ifndef VMS
+#ifndef VMS
@@ -3684,7 +5307,9 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
+ fp = fdopen(mkstemp(filename), "w");
+#else
mktemp(filename);
-+ fp = fopen(filename, "w");
++ tmpfd = open(filename,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
++ if (tmpfd < 0) FatalError("openPic(): can't create temporary file");
++ fp = fdopen(tmpfd,"w");
+#endif
+ if (!fp) FatalError("openPic(): can't write temporary file");
@@ -3694,8 +5319,35 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
-
while ( (i=getchar()) != EOF) putc(i,fp);
fclose(fp);
++#ifndef USE_MKSTEMP
++ close(tmpfd);
++#endif
+
+ /* and remove it from list, since we can never reload from stdin */
+ if (strcmp(namelist[0], STDINSTR)==0) deleteFromList(0);
+@@ -1990,20 +2382,26 @@
+ (no pipes or stdin, though it could be compressed) to be loaded */
+ filetype = ReadFileType(filename);
-@@ -2003,7 +2018,7 @@
++#ifdef HAVE_MGCSFX
++ if (mgcsfx && filetype == RFT_UNKNOWN){ /* force use MgcSfx */
++ if(getInputCom() != 0) filetype = RFT_MGCSFX;
++ }
++#endif
+
+- if (filetype == RFT_COMPRESS) { /* a compressed file. uncompress it */
++ /* if it's a compressed file, uncompress it: */
++ if ((filetype == RFT_COMPRESS) || (filetype == RFT_BZIP2)) {
+ char tmpname[128];
+
+ if (
+ #ifndef VMS
+- UncompressFile(filename, tmpname)
++ UncompressFile(filename, tmpname, filetype)
+ #else
+- UncompressFile(basefname, tmpname)
++ UncompressFile(basefname, tmpname, filetype)
+ #endif
) {
filetype = ReadFileType(tmpname); /* and try again */
@@ -3704,7 +5356,98 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
/* if we made a /tmp file (from stdin, etc.) won't need it any more */
if (strcmp(fullname,filename)!=0) unlink(filename);
-@@ -2084,7 +2099,7 @@
+@@ -2013,7 +2411,58 @@
+
+ WaitCursor();
+ }
+-
++
++#ifdef MACBINARY
++ if (handlemacb && macb_file == True) {
++ char tmpname[128];
++
++ if (RemoveMacbinary(filename, tmpname)) {
++ if (strcmp(fullname,filename)!=0) unlink(filename);
++ strcpy(origname, filename);
++ strcpy(filename, tmpname);
++ }
++ else filetype = RFT_ERROR;
++
++ WaitCursor();
++ }
++#endif
++
++#ifdef HAVE_MGCSFX_AUTO
++ if (filetype == RFT_MGCSFX) {
++ char tmpname[128], tmp[256];
++ char *icom;
++
++ if ((icom = mgcsfx_auto_input_com(filename)) != NULL) {
++ sprintf(tmpname, "%s/xvmsautoXXXXXX", tmpdir);
++#ifdef USE_MKSTEMP
++ close(mkstemp(tmpname));
++#else
++ mktemp(tmpname);
++#endif
++ SetISTR(ISTR_INFO, "Converting to known format by MgcSfx auto...");
++ sprintf(tmp,"%s >%s", icom, tmpname);
++ }
++ else goto ms_auto_no;
++
++#ifndef VMS
++ if (system(tmp))
++#else
++ if (!system(tmp))
++#endif
++ {
++ SetISTR(ISTR_INFO, "Unable to convert '%s' by MgcSfx auto.",
++ BaseName(filename));
++ Warning();
++ filetype = RFT_ERROR;
++ goto ms_auto_no;
++ }
++
++ filetype = ReadFileType(tmpname);
++ if (strcmp(fullname,filename)!=0) unlink(filename);
++ strcpy(filename, tmpname);
++ }
++ms_auto_no:
++#endif /* HAVE_MGCSFX_AUTO */
+
+ if (filetype == RFT_ERROR) {
+ char foostr[512];
+@@ -2027,10 +2476,16 @@
+
+ if (filetype == RFT_UNKNOWN) {
+ /* view as a text/hex file */
+- TextView(filename);
++#ifdef MACBINARY
++ if (origname[0])
++ i = TextView(origname);
++ else
++#endif
++ i = TextView(filename);
+ SetISTR(ISTR_INFO,"'%s' not in a recognized format.", basefname);
+ /* Warning(); */
+- goto SHOWN_AS_TEXT;
++ if (i) goto SHOWN_AS_TEXT;
++ else goto FAILED;
+ }
+
+ if (filetype < RFT_ERROR) {
+@@ -2058,8 +2513,9 @@
+ if (filetype == RFT_XBM && (!i || pinfo.w==0 || pinfo.h==0)) {
+ /* probably just a '.h' file or something... */
+ SetISTR(ISTR_INFO," ");
+- TextView(filename);
+- goto SHOWN_AS_TEXT;
++ i = TextView(filename);
++ if (i) goto SHOWN_AS_TEXT;
++ else goto FAILED;
+ }
+
+ if (!i) {
+@@ -2084,7 +2540,7 @@
/**************/
/* SUCCESS!!! */
/**************/
@@ -3713,7 +5456,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
GOTIMAGE:
/* successfully read this picture. No failures from here on out
-@@ -2097,7 +2112,7 @@
+@@ -2097,7 +2553,7 @@
if (conv24MB.flags[CONV24_LOCK]) { /* locked */
if (pinfo.type==PIC24 && picType==PIC8) { /* 24 -> 8 bit */
byte *pic8;
@@ -3722,7 +5465,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
pinfo.r, pinfo.g, pinfo.b);
free(pinfo.pic);
pinfo.pic = pic8;
-@@ -2108,7 +2123,7 @@
+@@ -2108,7 +2564,7 @@
else if (pinfo.type!=PIC24 && picType==PIC24) { /* 8 -> 24 bit */
byte *pic24;
@@ -3731,7 +5474,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
pinfo.r, pinfo.g, pinfo.b);
free(pinfo.pic);
pinfo.pic = pic24;
-@@ -2144,7 +2159,7 @@
+@@ -2144,7 +2600,7 @@
if (mainW && !useroot) {
/* avoid generating excess configure events while we resize the window */
@@ -3740,7 +5483,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
| StructureNotifyMask
| ButtonPressMask | KeyReleaseMask
| EnterWindowMask | LeaveWindowMask);
-@@ -2162,7 +2177,7 @@
+@@ -2162,11 +2618,13 @@
pHIGH = pinfo.h;
if (pinfo.frmType >=0) SetDirSaveMode(F_FORMAT, pinfo.frmType);
if (pinfo.colType >=0) SetDirSaveMode(F_COLORS, pinfo.colType);
@@ -3749,23 +5492,34 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
SetISTR(ISTR_FORMAT, pinfo.fullInfo);
strcpy(formatStr, pinfo.shrtInfo);
picComments = pinfo.comment;
-@@ -2195,11 +2210,11 @@
+ ChangeCommentText();
++ picExifInfo = pinfo.exifInfo;
++ picExifInfoSize = pinfo.exifInfoSize;
+ for (i=0; i<256; i++) {
+ rMap[i] = pinfo.r[i];
+@@ -2194,12 +2652,15 @@
+ if (fullname && strcmp(fullname,filename)!=0) unlink(filename);
- SetISTR(ISTR_INFO,formatStr);
+
+- SetISTR(ISTR_INFO,formatStr);
-
++ SetISTR(ISTR_INFO, "%s", formatStr);
+
SetInfoMode(INF_PART);
- SetISTR(ISTR_FILENAME,
- (filenum==DFLTPIC || filenum==GRABBED || frompipe)
- ? "<none>" : basefname);
-+ SetISTR(ISTR_FILENAME, "%s",
-+ (filenum==DFLTPIC || filenum==GRABBED || frompipe) ?
-+ "<none>" : basefname);
++ if (filenum==DFLTPIC || filenum==GRABBED || frompipe)
++ SetISTR(ISTR_FILENAME, "<none>");
++ else if (numPages > 1)
++ SetISTR(ISTR_FILENAME, "%s Page %d of %d", basefname, curPage+1, numPages);
++ else
++ SetISTR(ISTR_FILENAME, "%s", basefname);
SetISTR(ISTR_RES,"%d x %d",pWIDE,pHIGH);
SetISTR(ISTR_COLOR, "");
-@@ -2219,7 +2234,7 @@
+@@ -2219,7 +2680,7 @@
/* handle various 'auto-whatever' command line options
@@ -3774,7 +5528,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
setting the expansion factor are skipped, as we'll want it to
display in the (already-existing) window at the same size */
-@@ -2254,7 +2269,7 @@
+@@ -2254,7 +2715,7 @@
w = eWIDE; h = (w*3) / 4;
eWIDE = w; eHIGH = h;
}
@@ -3783,7 +5537,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (eWIDE != cWIDE || eHIGH != cHIGH) epic = (byte *) NULL;
-@@ -2306,14 +2321,14 @@
+@@ -2306,14 +2767,14 @@
aspWIDE = eWIDE; aspHIGH = eHIGH; /* aspect-corrected eWIDE,eHIGH */
if (hexpand < 0.0) eWIDE=(int)(aspWIDE / -hexpand); /* neg: reciprocal */
@@ -3801,7 +5555,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
int i,x,y,gewide,gehigh; u_int w,h;
gewide = eWIDE; gehigh = eHIGH;
-@@ -2321,11 +2336,11 @@
+@@ -2321,11 +2782,11 @@
if (i&WidthValue) gewide = (int) w;
if (i&HeightValue) gehigh = (int) h;
@@ -3815,7 +5569,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (i&WidthValue) { gehigh = (aspHIGH * gewide) / pWIDE; }
else { gewide = (aspWIDE * gehigh) / pHIGH; }
}
-@@ -2391,7 +2406,7 @@
+@@ -2391,7 +2852,7 @@
/* if we're using an integer tiled root mode, truncate eWIDE/eHIGH to
be an integer divisor of the display size */
@@ -3824,7 +5578,16 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (useroot && (rootMode == RM_TILE || rootMode == RM_IMIRROR)) {
/* make picture size a divisor of the rootW size. round down */
i = (dispWIDE + eWIDE-1) / eWIDE; eWIDE = (dispWIDE + i-1) / i;
-@@ -2419,7 +2434,7 @@
+@@ -2409,7 +2870,7 @@
+ if (autodither && ncols>0) epicMode = EM_DITH;
+
+ /* if in CM_STDCMAP mode, and *not* in '-wait 0', then autodither */
+- if (colorMapMode == CM_STDCMAP && waitsec != 0) epicMode = EM_DITH;
++ if (colorMapMode == CM_STDCMAP && waitsec != 0.0) epicMode = EM_DITH;
+
+ /* if -smooth or image has been shrunk to fit screen */
+ if (autosmooth || (pWIDE >maxWIDE || pHIGH>maxHIGH)
+@@ -2419,7 +2880,7 @@
/* 'dithering' makes no sense in 24-bit mode */
if (picType == PIC24 && epicMode == EM_DITH) epicMode = EM_RAW;
@@ -3833,7 +5596,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
SetEpicMode();
} /* end of !frompoll */
-@@ -2450,7 +2465,7 @@
+@@ -2450,7 +2911,7 @@
if (useroot) mainW = vrootW;
if (eWIDE != cWIDE || eHIGH != cHIGH) epic = (byte *) NULL;
@@ -3842,7 +5605,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
GenerateEpic(eWIDE, eHIGH); /* want to dither *after* color allocs */
CreateXImage();
-@@ -2474,7 +2489,7 @@
+@@ -2474,7 +2935,7 @@
SetISTR(ISTR_INFO,"%s %s %s", formatStr,
(picType==PIC8) ? "8-bit mode." : "24-bit mode.",
tmp);
@@ -3851,7 +5614,16 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
SetInfoMode(INF_FULL);
if (freename) free(fullname);
-@@ -2499,16 +2514,16 @@
+@@ -2495,20 +2956,24 @@
+ to generate the correct exposes (particularly with 'BitGravity' turned
+ on */
+
+- if (mainW && !useroot) GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
++ /*Brian T. Schellenberger: fix for X 4.2 refresh problem*/
++ if (mainW && !useroot) {
++ XSync(theDisp, False);
++ GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
++ }
return 1;
@@ -3871,59 +5643,352 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
deleteFromList(filenum);
if (polling) sleep(1);
-@@ -2546,7 +2561,7 @@
+@@ -2527,6 +2992,9 @@
+ }
+
+
++extern byte ZXheader[128]; /* [JCE] Spectrum screen magic number is
++ defined in xvzx.c */
++
+
+ /********************************/
+ int ReadFileType(fname)
+@@ -2539,76 +3007,118 @@
+
+ FILE *fp;
+ byte magicno[30]; /* first 30 bytes of file */
+- int rv, n;
++ int rv=RFT_UNKNOWN, n;
++#ifdef MACBINARY
++ int macbin_alrchk = False;
++#endif
+
+ if (!fname) return RFT_ERROR; /* shouldn't happen */
+
fp = xv_fopen(fname, "r");
if (!fp) return RFT_ERROR;
- n = fread(magicno, (size_t) 1, (size_t) 30, fp);
-+ n = fread(magicno, (size_t) 1, (size_t) 30, fp);
++ if (strlen(fname) > 4 &&
++ strcasecmp(fname+strlen(fname)-5, ".wbmp")==0) rv = RFT_WBMP;
++
++ n = fread(magicno, (size_t) 1, sizeof(magicno), fp);
fclose(fp);
- if (n<30) return RFT_UNKNOWN; /* files less than 30 bytes long... */
-@@ -2559,7 +2574,7 @@
+- if (n<30) return RFT_UNKNOWN; /* files less than 30 bytes long... */
++ if (n<=0) return RFT_UNKNOWN;
++
++ /* it is just barely possible that a few files could legitimately be as small
++ as 30 bytes (e.g., binary P{B,G,P}M format), so zero out rest of "magic
++ number" buffer and don't quit immediately if we read something small but
++ not empty */
++ if (n<30) memset(magicno+n, 0, sizeof(magicno)-n);
+
+- rv = RFT_UNKNOWN;
++#ifdef MACBINARY
++ macb_file = False;
++ while (1) {
++#endif
+
+- if (strncmp((char *) magicno,"GIF87a", (size_t) 6)==0 ||
+- strncmp((char *) magicno,"GIF89a", (size_t) 6)==0) rv = RFT_GIF;
++#ifdef HAVE_MGCSFX
++ if (is_mgcsfx(fname, magicno, 30) != 0) rv = RFT_MGCSFX;
++ else
++#endif
++ if (strncmp((char *) magicno,"GIF87a", (size_t) 6)==0 ||
++ strncmp((char *) magicno,"GIF89a", (size_t) 6)==0) rv = RFT_GIF;
+
else if (strncmp((char *) magicno,"VIEW", (size_t) 4)==0 ||
- strncmp((char *) magicno,"WEIV", (size_t) 4)==0) rv = RFT_PM;
+- strncmp((char *) magicno,"WEIV", (size_t) 4)==0) rv = RFT_PM;
++ strncmp((char *) magicno,"WEIV", (size_t) 4)==0) rv = RFT_PM;
++
++#ifdef HAVE_PIC2
++ else if (magicno[0]=='P' && magicno[1]=='2' &&
++ magicno[2]=='D' && magicno[3]=='T') rv = RFT_PIC2;
++#endif
- else if (magicno[0] == 'P' && magicno[1]>='1' &&
+- magicno[1]<='6') rv = RFT_PBM;
+ else if (magicno[0] == 'P' && magicno[1]>='1' &&
- magicno[1]<='6') rv = RFT_PBM;
++ (magicno[1]<='6' || magicno[1]=='8')) rv = RFT_PBM;
/* note: have to check XPM before XBM, as first 2 chars are the same */
-@@ -2586,7 +2601,7 @@
+ else if (strncmp((char *) magicno, "/* XPM */", (size_t) 9)==0) rv = RFT_XPM;
+
+ else if (strncmp((char *) magicno,"#define", (size_t) 7)==0 ||
+- (magicno[0] == '/' && magicno[1] == '*')) rv = RFT_XBM;
++ (magicno[0] == '/' && magicno[1] == '*')) rv = RFT_XBM;
+
+ else if (magicno[0]==0x59 && (magicno[1]&0x7f)==0x26 &&
+- magicno[2]==0x6a && (magicno[3]&0x7f)==0x15) rv = RFT_SUNRAS;
++ magicno[2]==0x6a && (magicno[3]&0x7f)==0x15) rv = RFT_SUNRAS;
+
+- else if (magicno[0] == 'B' && magicno[1] == 'M') rv = RFT_BMP;
++ else if (magicno[0] == 'B' && magicno[1] == 'M') rv = RFT_BMP;
- else if (magicno[0]==0x0a && magicno[1] <= 5) rv = RFT_PCX;
+- else if (magicno[0]==0x52 && magicno[1]==0xcc) rv = RFT_UTAHRLE;
++ else if (magicno[0]==0x52 && magicno[1]==0xcc) rv = RFT_UTAHRLE;
+
+ else if ((magicno[0]==0x01 && magicno[1]==0xda) ||
+- (magicno[0]==0xda && magicno[1]==0x01)) rv = RFT_IRIS;
++ (magicno[0]==0xda && magicno[1]==0x01)) rv = RFT_IRIS;
+
+- else if (magicno[0]==0x1f && magicno[1]==0x9d) rv = RFT_COMPRESS;
++ else if (magicno[0]==0x1f && magicno[1]==0x9d) rv = RFT_COMPRESS;
+
+ #ifdef GUNZIP
+- else if (magicno[0]==0x1f && magicno[1]==0x8b) rv = RFT_COMPRESS;
++ else if (magicno[0]==0x1f && magicno[1]==0x8b) rv = RFT_COMPRESS;
++#endif
++
++#ifdef BUNZIP2
++ else if (magicno[0]==0x42 && magicno[1]==0x5a) rv = RFT_BZIP2;
+ #endif
+
+- else if (magicno[0]==0x0a && magicno[1] <= 5) rv = RFT_PCX;
++ else if (magicno[0]==0x0a && magicno[1] <= 5) rv = RFT_PCX;
- else if (strncmp((char *) magicno, "FORM", (size_t) 4)==0 &&
+- strncmp((char *) magicno+8, "ILBM", (size_t) 4)==0) rv = RFT_IFF;
+ else if (strncmp((char *) magicno, "FORM", (size_t) 4)==0 &&
- strncmp((char *) magicno+8, "ILBM", (size_t) 4)==0) rv = RFT_IFF;
++ strncmp((char *) magicno+8, "ILBM", (size_t) 4)==0) rv = RFT_IFF;
else if (magicno[0]==0 && magicno[1]==0 &&
-@@ -2597,12 +2612,12 @@
+ magicno[2]==2 && magicno[3]==0 &&
+ magicno[4]==0 && magicno[5]==0 &&
+- magicno[6]==0 && magicno[7]==0) rv = RFT_TARGA;
++ magicno[6]==0 && magicno[7]==0) rv = RFT_TARGA;
+
else if (magicno[4]==0x00 && magicno[5]==0x00 &&
- magicno[6]==0x00 && magicno[7]==0x07) rv = RFT_XWD;
+- magicno[6]==0x00 && magicno[7]==0x07) rv = RFT_XWD;
++ magicno[6]==0x00 && magicno[7]==0x07) rv = RFT_XWD;
- else if (strncmp((char *) magicno,"SIMPLE ", (size_t) 8)==0 &&
-+ else if (strncmp((char *) magicno,"SIMPLE ", (size_t) 8)==0 &&
- magicno[29] == 'T') rv = RFT_FITS;
+- magicno[29] == 'T') rv = RFT_FITS;
-
++ else if (strncmp((char *) magicno,"SIMPLE ", (size_t) 8)==0 &&
++ magicno[29] == 'T') rv = RFT_FITS;
+
++ /* [JCE] Spectrum screen */
++ else if (memcmp(magicno, ZXheader, (size_t) 18)==0) rv = RFT_ZX;
#ifdef HAVE_JPEG
- else if (magicno[0]==0xff && magicno[1]==0xd8 &&
+- magicno[2]==0xff) rv = RFT_JFIF;
+ else if (magicno[0]==0xff && magicno[1]==0xd8 &&
- magicno[2]==0xff) rv = RFT_JFIF;
++ magicno[2]==0xff) rv = RFT_JFIF;
++#endif
++
++#ifdef HAVE_JP2K
++ else if (magicno[0]==0xff && magicno[1]==0x4f &&
++ magicno[2]==0xff && magicno[3]==0x51) rv = RFT_JPC;
++
++ else if (memcmp(magicno, jp2k_magic, sizeof(jp2k_magic))==0) rv = RFT_JP2;
+ #endif
+
+ #ifdef HAVE_TIFF
+ else if ((magicno[0]=='M' && magicno[1]=='M') ||
+- (magicno[0]=='I' && magicno[1]=='I')) rv = RFT_TIFF;
++ (magicno[0]=='I' && magicno[1]=='I')) rv = RFT_TIFF;
++#endif
++
++#ifdef HAVE_PNG
++ else if (magicno[0]==0x89 && magicno[1]=='P' &&
++ magicno[2]=='N' && magicno[3]=='G') rv = RFT_PNG;
+ #endif
+
+ #ifdef HAVE_PDS
+@@ -2620,11 +3130,67 @@
+ rv = RFT_PDSVICAR;
+ #endif
+
+-#ifdef GS_PATH
++#ifdef GS_PATH /* Ghostscript handles both PostScript and PDF */
+ else if (strncmp((char *) magicno, "%!", (size_t) 2)==0 ||
+- strncmp((char *) magicno, "\004%!", (size_t) 3)==0) rv = RFT_PS;
++ strncmp((char *) magicno, "\004%!", (size_t) 3)==0 ||
++ strncmp((char *) magicno, "%PDF", (size_t) 4)==0) rv = RFT_PS;
++#endif
++
++#ifdef HAVE_G3
++ else if ((magicno[0]== 1 && magicno[1]== 1 &&
++ magicno[2]== 77 && magicno[3]==154 &&
++ magicno[4]==128 && magicno[5]== 0 &&
++ magicno[6]== 1 && magicno[7]== 77)
++ || highresfax || fax) /* kludge! */ rv = RFT_G3;
++#endif
++
++#ifdef HAVE_MAG
++ else if (strncmp((char *) magicno,"MAKI02 ", (size_t) 8)==0) rv = RFT_MAG;
++#endif
++
++#ifdef HAVE_MAKI
++ else if (strncmp((char *) magicno,"MAKI01A ", (size_t) 8)==0 ||
++ strncmp((char *) magicno,"MAKI01B ", (size_t) 8)==0) rv = RFT_MAKI;
++#endif
++
++#ifdef HAVE_PIC
++ else if (magicno[0]=='P' && magicno[1]=='I'&&magicno[2]=='C') rv = RFT_PIC;
++#endif
++
++#ifdef HAVE_PI
++ else if (magicno[0]=='P' && magicno[1]=='i') rv = RFT_PI;
++#endif
++
++#ifdef HAVE_HIPS
++ else if (strstr((char *) magicno, "./digest")) rv = RFT_HIPS;
++#endif
++
++#ifdef HAVE_PCD
++ else if (magicno[0]==0xff && magicno[1]==0xff &&
++ magicno[2]==0xff && magicno[3]==0xff) rv = RFT_PCD;
#endif
-@@ -2668,7 +2683,7 @@
++#ifdef MACBINARY
++ /* Now we try to handle MacBinary files, but the method is VERY dirty... */
++ if (macbin_alrchk == True) {
++ macb_file = True;
++ break;
++ }
++
++ if (rv != RFT_UNKNOWN)
++ break;
++
++ /* Skip MACBSIZE and recheck */
++ macbin_alrchk = True;
++ fp = xv_fopen(fname, "r");
++ if (!fp) return RFT_ERROR;
++ fseek(fp, MACBSIZE, SEEK_SET);
++ n = fread(magicno, (size_t) 1, (size_t) 30, fp);
++ fclose(fp);
++
++ if (n<30) return RFT_UNKNOWN; /* files less than 30 bytes long... */
++ }
++#endif
+ return rv;
+ }
+
+@@ -2637,9 +3203,10 @@
+ PICINFO *pinfo;
+ {
+ /* if quick is set, we're being called to generate icons, or something
+- like that. We should load the image as quickly as possible. Currently,
+- this only affects the LoadPS routine, which, if quick is set, only
+- generates the page file for the first page of the document */
++ like that. We should load the image as quickly as possible. Previously,
++ this affected only the LoadPS routine, which, if quick is set, only
++ generates the page file for the first page of the document. Now it
++ also affects PCD, which loads only a thumbnail. */
+
+ int rv = 0;
+
+@@ -2650,7 +3217,11 @@
+ switch (ftype) {
+ case RFT_GIF: rv = LoadGIF (fname, pinfo); break;
+ case RFT_PM: rv = LoadPM (fname, pinfo); break;
++#ifdef HAVE_MGCSFX
++ case RFT_PBM: rv = LoadPBM (fname, pinfo, -1); break;
++#else
+ case RFT_PBM: rv = LoadPBM (fname, pinfo); break;
++#endif
+ case RFT_XBM: rv = LoadXBM (fname, pinfo); break;
+ case RFT_SUNRAS: rv = LoadSunRas(fname, pinfo); break;
+ case RFT_BMP: rv = LoadBMP (fname, pinfo); break;
+@@ -2662,21 +3233,69 @@
+ case RFT_XPM: rv = LoadXPM (fname, pinfo); break;
+ case RFT_XWD: rv = LoadXWD (fname, pinfo); break;
+ case RFT_FITS: rv = LoadFITS (fname, pinfo, quick); break;
++ case RFT_ZX: rv = LoadZX (fname, pinfo); break; /* [JCE] */
++ case RFT_WBMP: rv = LoadWBMP (fname, pinfo); break;
++
++#ifdef HAVE_PCD
++ /* if quick is switched on, use the smallest image size; don't ask the user */
++ case RFT_PCD: rv = LoadPCD (fname, pinfo, quick ? 0 : PcdSize); break;
++#endif
+
+ #ifdef HAVE_JPEG
+- case RFT_JFIF: rv = LoadJFIF (fname, pinfo, quick); break;
++ case RFT_JFIF: rv = LoadJFIF (fname, pinfo, quick); break;
++#endif
++
++#ifdef HAVE_JP2K
++ case RFT_JPC: rv = LoadJPC (fname, pinfo, quick); break;
++ case RFT_JP2: rv = LoadJP2 (fname, pinfo, quick); break;
#endif
#ifdef HAVE_TIFF
- case RFT_TIFF: rv = LoadTIFF (fname, pinfo); break;
-+ case RFT_TIFF: rv = LoadTIFF (fname, pinfo, quick); break;
++ case RFT_TIFF: rv = LoadTIFF (fname, pinfo, quick); break;
++#endif
++
++#ifdef HAVE_PNG
++ case RFT_PNG: rv = LoadPNG (fname, pinfo); break;
#endif
#ifdef HAVE_PDS
-@@ -2703,7 +2718,7 @@
+- case RFT_PDSVICAR: rv = LoadPDS (fname, pinfo); break;
++ case RFT_PDSVICAR: rv = LoadPDS (fname, pinfo); break;
++#endif
++
++#ifdef HAVE_G3
++ case RFT_G3: rv = LoadG3 (fname, pinfo); break;
+ #endif
+
+ #ifdef GS_PATH
+- case RFT_PS: rv = LoadPS (fname, pinfo, quick); break;
++ case RFT_PS: rv = LoadPS (fname, pinfo, quick); break;
++#endif
++
++#ifdef HAVE_MAG
++ case RFT_MAG: rv = LoadMAG (fname, pinfo); break;
++#endif
++
++#ifdef HAVE_MAKI
++ case RFT_MAKI: rv = LoadMAKI (fname, pinfo); break;
++#endif
++
++#ifdef HAVE_PIC
++ case RFT_PIC: rv = LoadPIC (fname, pinfo); break;
++#endif
++
++#ifdef HAVE_PI
++ case RFT_PI: rv = LoadPi (fname, pinfo); break;
++#endif
++
++#ifdef HAVE_PIC2
++ case RFT_PIC2: rv = LoadPIC2 (fname, pinfo, quick); break;
++#endif
++
++#ifdef HAVE_HIPS
++ case RFT_HIPS: rv = LoadHIPS (fname, pinfo); break;
++#endif
++
++#ifdef HAVE_MGCSFX
++ case RFT_MGCSFX: rv = LoadMGCSFX (fname, pinfo); break;
+ #endif
+
+ }
+@@ -2685,13 +3304,17 @@
+
+
+ /********************************/
+-int UncompressFile(name, uncompname)
++int UncompressFile(name, uncompname, filetype)
+ char *name, *uncompname;
++ int filetype;
+ {
+ /* returns '1' on success, with name of uncompressed file in uncompname
+ returns '0' on failure */
+
+ char namez[128], *fname, buf[512];
++#ifndef USE_MKSTEMP
++ int tmpfd;
++#endif
+
+ fname = name;
+ namez[0] = '\0';
+@@ -2703,7 +3326,7 @@
to what it was. necessary because uncompress doesn't handle files
that don't end with '.Z' */
@@ -3932,35 +5997,46 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
strcmp(name + strlen(name)-2,".Z")!=0 &&
strcmp(name + strlen(name)-2,".z")!=0) {
strcpy(namez, name);
-@@ -2721,34 +2736,42 @@
+@@ -2721,34 +3344,50 @@
#endif /* not VMS and not GUNZIP */
-
#ifndef VMS
sprintf(uncompname, "%s/xvuXXXXXX", tmpdir);
+- mktemp(uncompname);
+- sprintf(buf,"%s -c %s >%s", UNCOMPRESS, fname, uncompname);
+-#else /* it IS VMS */
+#else
-+ strcpy(uncompname, "[]xvuXXXXXX");
+ strcpy(uncompname, "[]xvuXXXXXX");
+#endif
+
+#ifdef USE_MKSTEMP
+ close(mkstemp(uncompname));
+#else
mktemp(uncompname);
+-# ifdef GUNZIP
+- sprintf(buf,"%s %s %s", UNCOMPRESS, fname, uncompname);
+-# else
+- sprintf(buf,"%s %s", UNCOMPRESS, fname);
+-# endif
++ tmpfd = open(uncompname,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
++ if (tmpfd < 0) FatalError("UncompressFile(): can't create temporary file");
++ close(tmpfd);
+#endif
+
+#ifndef VMS
- sprintf(buf,"%s -c %s >%s", UNCOMPRESS, fname, uncompname);
- #else /* it IS VMS */
-- strcpy(uncompname, "[]xvuXXXXXX");
-- mktemp(uncompname);
--# ifdef GUNZIP
++ if (filetype == RFT_COMPRESS)
++ sprintf(buf,"%s -c '%s' > '%s'", UNCOMPRESS, fname, uncompname);
++# ifdef BUNZIP2
++ else if (filetype == RFT_BZIP2)
++ sprintf(buf,"%s -c '%s' > '%s'", BUNZIP2, fname, uncompname);
++# endif
++#else /* it IS VMS */
+# ifdef GUNZIP
- sprintf(buf,"%s %s %s", UNCOMPRESS, fname, uncompname);
--# else
++ sprintf(buf,"%s '%s' '%s'", UNCOMPRESS, fname, uncompname);
+# else
- sprintf(buf,"%s %s", UNCOMPRESS, fname);
--# endif
++ sprintf(buf,"%s '%s'", UNCOMPRESS, fname);
+# endif
#endif
@@ -3985,16 +6061,85 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
rename it back to what it once was... */
if (strlen(namez)) {
-@@ -2769,7 +2792,7 @@
+@@ -2769,9 +3408,65 @@
}
*/
#endif /* not VMS */
-
+
++ return 1;
++}
++
++
++#ifdef MACBINARY
++/********************************/
++int RemoveMacbinary(src, dst)
++ char *src, *dst;
++{
++ char buffer[8192]; /* XXX */
++ int n, eof;
++#ifndef USE_MKSTEMP
++ int tmpfd;
++#endif
++ FILE *sfp, *dfp;
++
++ sprintf(dst, "%s/xvmXXXXXX", tmpdir);
++#ifdef USE_MKSTEMP
++ close(mkstemp(dst));
++#else
++ mktemp(dst);
++ tmpfd = open(dst,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
++ if (tmpfd < 0) FatalError("RemoveMacbinary(): can't create temporary file");
++#endif
++
++ SetISTR(ISTR_INFO, "Removing MacBinary...");
++
++ sfp = xv_fopen(src, "r");
++#ifdef USE_MKSTEMP
++ dfp = xv_fopen(dst, "w");
++#else
++ dfp = fdopen(tmpfd, "w");
++#endif
++ if (!sfp || !dfp) {
++ SetISTR(ISTR_INFO, "Unable to remove a InfoFile header form '%s'.", src);
++ Warning();
++ return 0;
++ }
++ fseek(sfp, MACBSIZE, SEEK_SET);
++ while ((n = fread(buffer, 1, sizeof(buffer), sfp)) == 8192) /* XXX */
++ fwrite(buffer, 1, n, dfp);
++ if ((eof = feof(sfp)))
++ fwrite(buffer, 1, n, dfp);
++ fclose(sfp);
++ fflush(dfp);
++ fclose(dfp);
++#ifndef USE_MKSTEMP
++ close(tmpfd);
++#endif
++ if (!eof) {
++ SetISTR(ISTR_INFO, "Unable to remove a InfoFile header form '%s'.", src);
++ Warning();
++ return 0;
++ }
++
return 1;
}
++#endif
-@@ -2798,11 +2821,11 @@
+
+ /********************************/
+@@ -2789,6 +3484,10 @@
+ sprintf(tmp, "%s%d", bname, i);
+ unlink(tmp);
+ }
++
++ /* GRR 20070506: basename file doesn't go away, at least on Linux and for
++ * GIF and TIFF images, so explicitly unlink() it, too */
++ unlink(bname);
+ }
+
+
+@@ -2798,11 +3497,11 @@
{
int i;
@@ -4008,7 +6153,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (picType == PIC8) {
byte trans[256];
-@@ -2811,18 +2834,18 @@
+@@ -2811,18 +3510,18 @@
}
if (picType == PIC8) {
@@ -4031,7 +6176,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
bMap[1] = blkRGB&0xff;
}
-@@ -2852,10 +2875,10 @@
+@@ -2852,10 +3551,10 @@
}
/* save the desired RGB colormap (before dicking with it) */
@@ -4046,7 +6191,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
}
}
-@@ -2888,7 +2911,7 @@
+@@ -2888,19 +3587,29 @@
{
/* cmd is something like: "! bggen 100 0 0"
*
@@ -4055,7 +6200,13 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
* returns "/tmp/xv******" in fname
* returns '0' if everything's cool, '1' on error
*/
-@@ -2899,8 +2922,12 @@
+
+ char fullcmd[512], tmpname[64], str[512];
+ int i;
++#ifndef USE_MKSTEMP
++ int tmpfd;
++#endif
+
if (!cmd || (strlen(cmd) < (size_t) 2)) return 1;
sprintf(tmpname,"%s/xvXXXXXX", tmpdir);
@@ -4064,21 +6215,51 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
+#else
mktemp(tmpname);
- if (tmpname[0] == '\0') { /* mktemp() blew up */
++ tmpfd = open(tmpname,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
++ if (tmpfd < 0) FatalError("openPic(): can't create temporary file");
++ close(tmpfd);
+#endif
+ if (tmpname[0] == '\0') { /* mktemp() or mkstemp() blew up */
sprintf(str,"Unable to create temporary filename.");
ErrPopUp(str, "\nHow unlikely!");
return 1;
-@@ -2946,7 +2973,7 @@
- while (numnames>0) {
- if (openPic(0)) return; /* success */
- else {
+@@ -2939,26 +3648,21 @@
+ {
+ int i;
+
++ waitsec = (numnames <= 1)? waitsec_final : waitsec_nonfinal;
++
+ if (!numnames) { openPic(DFLTPIC); return; }
+
+ i = 0;
+- if (!randomShow) {
+- while (numnames>0) {
+- if (openPic(0)) return; /* success */
+- else {
- if (polling && !i)
-+ if (polling && !i)
- fprintf(stderr,"%s: POLLING: Waiting for file '%s' \n\tto %s\n",
- cmd, namelist[0], "be created, or whatever...");
- i = 1;
-@@ -2970,11 +2997,11 @@
+- fprintf(stderr,"%s: POLLING: Waiting for file '%s' \n\tto %s\n",
+- cmd, namelist[0], "be created, or whatever...");
+- i = 1;
+- }
++ while (numnames>0) {
++ if (openPic(0)) return; /* success */
++ else {
++ if (polling && !i)
++ fprintf(stderr,"%s: POLLING: Waiting for file '%s' \n\tto %s\n",
++ cmd, namelist[0], "be created, or whatever...");
++ i = 1;
+ }
+ }
+
+- else { /* pick random first picture */
+- for (i=findRandomPic(); i>=0; i=findRandomPic())
+- if (openPic(i)) return; /* success */
+- }
+-
+ if (numnames>1) FatalError("couldn't open any pictures");
+ else Quit(-1);
+ }
+@@ -2970,11 +3674,11 @@
int i;
if (curname>=0) i = curname+1;
@@ -4092,25 +6273,71 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
while (i<numnames && !openPic(i));
if (i<numnames) return; /* success */
-@@ -2989,7 +3016,7 @@
+@@ -2987,19 +3691,15 @@
+ {
+ int i;
- if (!randomShow) {
- if (curname>=0) i = curname+1;
+- if (!randomShow) {
+- if (curname>=0) i = curname+1;
- else if (nList.selected >= 0 && nList.selected < numnames)
-+ else if (nList.selected >= 0 && nList.selected < numnames)
- i = nList.selected;
- else i = 0;
+- i = nList.selected;
+- else i = 0;
++ if (curname>=0) i = curname+1;
++ else if (nList.selected >= 0 && nList.selected < numnames)
++ i = nList.selected;
++ else i = 0;
+
+- while (i<numnames && !openPic(i));
+- if (i<numnames) return; /* success */
+- }
+- else {
+- for (i=findRandomPic(); i>=0; i=findRandomPic())
+- if (openPic(i)) return;
+- }
++ waitsec = (i == numnames-1)? waitsec_final : waitsec_nonfinal;
++
++ while (i<numnames && !openPic(i));
++ if (i<numnames) return; /* success */
+
+ Quit(0);
+ }
+@@ -3012,25 +3712,21 @@
-@@ -3015,7 +3042,7 @@
- if (!randomShow) {
+ j = loop = 0;
+ while (1) {
+- if (!randomShow) {
- if (curname>=0) i = curname+1;
+- if (curname>=0) i = curname+1;
- else if (nList.selected >= 0 && nList.selected < numnames)
-+ else if (nList.selected >= 0 && nList.selected < numnames)
- i = nList.selected;
- else i = 0;
+- i = nList.selected;
+- else i = 0;
++ if (curname>=0) i = curname+1;
++ else if (nList.selected >= 0 && nList.selected < numnames)
++ i = nList.selected;
++ else i = 0;
++
++ if (loop) { i = 0; loop = 0; }
-@@ -3044,7 +3071,7 @@
+- if (loop) { i = 0; loop = 0; }
++ waitsec = (i == numnames-1)? waitsec_final : waitsec_nonfinal;
+
+- while (i<numnames && !openPic(i));
+- if (i<numnames) return;
+- }
+- else {
+- for (i=findRandomPic(); i>=0; i=findRandomPic())
+- if (openPic(i)) return;
+- }
++ while (i<numnames && !openPic(i));
++ if (i<numnames) return;
+
+ loop = 1; /* back to top of list */
+- if (j) break; /* we're in a 'failure loop' */
++ if (j) break; /* we're in a 'failure loop' */
+ j++;
+ }
+
+@@ -3044,7 +3740,7 @@
int i;
if (curname>0) i = curname-1;
@@ -4119,25 +6346,51 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
i = nList.selected - 1;
else i = numnames-1;
-@@ -3089,7 +3116,7 @@
- loadList = (byte *) malloc((size_t) listLen);
- for (k=0; k<listLen; k++) loadList[k] = 0;
- }
--
-+
- if (left_to_load <= 0) { /* we've loaded all the pics */
- for (k=0; k<listLen; k++) loadList[k] = 0; /* clear flags */
- left_to_load = listLen;
-@@ -3097,7 +3124,7 @@
- }
+@@ -3063,64 +3759,24 @@
+ openPic(LOADPIC);
+ }
- for (k=abs(random()) % listLen; loadList[k]; k = (k+1) % listLen);
+-
+-
+-
+-/****************/
+-static int findRandomPic()
+-/****************/
+-{
+- static byte *loadList;
+- static int left_to_load, listLen = -1;
+- int k;
+- time_t t;
+-
+- /* picks a random name out of the list, and returns it's index. If there
+- are no more names to pick, it returns '-1' and resets itself */
+-
+- if (!loadList || numnames!=listLen) {
+- if (loadList) free(loadList);
+- else {
+- time(&t);
+- srandom((unsigned int) t); /* seed the random */
+- }
+-
+- left_to_load = listLen = numnames;
+- loadList = (byte *) malloc((size_t) listLen);
+- for (k=0; k<listLen; k++) loadList[k] = 0;
+- }
-
-+
- left_to_load--;
- loadList[k] = TRUE;
-
-@@ -3107,13 +3134,13 @@
+- if (left_to_load <= 0) { /* we've loaded all the pics */
+- for (k=0; k<listLen; k++) loadList[k] = 0; /* clear flags */
+- left_to_load = listLen;
+- return -1; /* 'done' return */
+- }
+-
+- for (k=abs(random()) % listLen; loadList[k]; k = (k+1) % listLen);
+-
+- left_to_load--;
+- loadList[k] = TRUE;
+-
+- return k;
+-}
+-
/****************/
static void mainLoop()
{
@@ -4154,7 +6407,17 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
selected file (or the 0th file, if no selection either), and 'Prev' means
view the one right before the selected file */
-@@ -3133,7 +3160,7 @@
+- openFirstPic(); /* find first displayable picture, exit if none */
++ /* find first displayable picture, exit if none */
++ if (!startGrab) openFirstPic();
+
+ if (!pic) { /* must've opened a text file... display dflt pic */
+- openPic(DFLTPIC);
++ if (!startGrab) openPic(DFLTPIC);
+ if (mainW && !useroot) RaiseTextWindows();
+ }
+
+@@ -3133,7 +3789,7 @@
}
else if (i==PREVPIC) {
@@ -4163,7 +6426,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
openPrevPic();
}
-@@ -3151,7 +3178,7 @@
+@@ -3151,7 +3807,7 @@
else if (i==THISNEXT) { /* open current sel, 'next' until success */
int j;
@@ -4172,13 +6435,68 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (j<0) j = 0;
while (j<numnames && !openPic(j));
if (!pic) openPic(DFLTPIC);
-@@ -3219,12 +3246,12 @@
+@@ -3169,7 +3825,7 @@
+
+ /***********************************/
+ static void createMainWindow(geom, name)
+- char *geom, *name;
++ const char *geom, *name;
+ {
+ XSetWindowAttributes xswa;
+ unsigned long xswamask;
+@@ -3195,22 +3851,35 @@
+ i = XParseGeometry(geom,&x,&y,&w,&h);
+
+ hints.flags = 0;
+- if ((i&XValue || i&YValue)) hints.flags = USPosition;
++ if (i&XValue || i&YValue)
++ hints.flags |= USPosition;
+
+- if (i&XValue && i&XNegative) x = vrWIDE - eWIDE - abs(x);
+- if (i&YValue && i&YNegative) y = vrHIGH - eHIGH - abs(y);
++ hints.win_gravity = NorthWestGravity;
++ if (i&XValue && i&XNegative) {
++ hints.win_gravity = NorthEastGravity;
++ x = vrWIDE - (eWIDE + 2 * bwidth) - x;
++ }
++ if (i&YValue && i&YNegative) {
++ hints.win_gravity = (hints.win_gravity == NorthWestGravity) ?
++ SouthWestGravity : SouthEastGravity;
++ y = vrHIGH - (eHIGH + 2 * bwidth) - y;
++ }
++ hints.flags |= PWinGravity;
+
+- if (x+eWIDE > vrWIDE) x = vrWIDE - eWIDE; /* keep on screen */
++ /* keep on screen */
++ if (x+eWIDE > vrWIDE) x = vrWIDE - eWIDE;
+ if (y+eHIGH > vrHIGH) y = vrHIGH - eHIGH;
+-
++ if (x < 0) x = 0;
++ if (y < 0) y = 0;
+
+ #define VROOT_TRANS
+ #ifdef VROOT_TRANS
+- if (vrootW != rootW) { /* virtual window manager running */
++ if (vrootW != rootW && !(hints.flags & USPosition)) { /* virtual window manager running */
+ int x1,y1;
+ Window child;
++
+ XTranslateCoordinates(theDisp, rootW, vrootW, x, y, &x1, &y1, &child);
+- if (DEBUG) fprintf(stderr,"translate: %d,%d -> %d,%d\n",x,y,x1,y1);
++ if (DEBUG) fprintf(stderr,"translate: %d,%d -> %d,%d\n", x, y, x1, y1);
+ x = x1; y = y1;
+ }
+ #endif
+@@ -3218,13 +3887,13 @@
+ hints.x = x; hints.y = y;
hints.width = eWIDE; hints.height = eHIGH;
hints.max_width = maxWIDE; hints.max_height = maxHIGH;
- hints.flags |= USSize | PMaxSize;
+- hints.flags |= USSize | PMaxSize;
-
+- xswa.bit_gravity = StaticGravity;
++ hints.flags |= PSize | PMaxSize;
+
- xswa.bit_gravity = StaticGravity;
++ xswa.bit_gravity = StaticGravity;
xswa.background_pixel = bg;
xswa.border_pixel = fg;
xswa.colormap = theCmap;
@@ -4187,7 +6505,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
xswa.backing_store = WhenMapped;
/* NOTE: I've turned 'backing-store' off on the image window, as some
-@@ -3233,9 +3260,9 @@
+@@ -3233,9 +3902,9 @@
improvement anyway (for the image window), unless you're on a slow
network. In any event, I'm not *turning off* backing store, I'm
just not explicitly turning it *on*. If your X server is set up
@@ -4199,7 +6517,16 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
xswamask = CWBackPixel | CWBorderPixel | CWColormap /* | CWBackingStore */;
if (!clearonload) xswamask |= CWBitGravity;
-@@ -3251,11 +3278,11 @@
+@@ -3244,18 +3913,18 @@
+ xwa.width = eWIDE; xwa.height = eHIGH;
+
+ /* try to keep the damned thing on-screen, if possible */
+- if (xwa.x + xwa.width > dispWIDE) xwa.x = dispWIDE - xwa.width;
+- if (xwa.y + xwa.height > dispHIGH) xwa.y = dispHIGH - xwa.height;
++ if (xwa.x + xwa.width > vrWIDE) xwa.x = vrWIDE - xwa.width;
++ if (xwa.y + xwa.height > vrHIGH) xwa.y = vrHIGH - xwa.height;
+ if (xwa.x < 0) xwa.x = 0;
+ if (xwa.y < 0) xwa.y = 0;
SetWindowPos(&xwa);
hints.flags = PSize | PMaxSize;
@@ -4213,7 +6540,14 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
theVisual, xswamask, &xswa);
if (!mainW) FatalError("can't create window!");
-@@ -3274,8 +3301,8 @@
+@@ -3267,15 +3936,11 @@
+ }
+ }
+
+-
+- XSetStandardProperties(theDisp,mainW,"","",None,NULL,0,&hints);
+- setWinIconNames(name);
+-
xwmh.input = True;
xwmh.flags = InputHint;
@@ -4224,16 +6558,26 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
xwmh.flags |= (IconPixmapHint | IconMaskHint);
-@@ -3302,7 +3329,7 @@
- XSetClassHint(theDisp, mainW, &classh);
+@@ -3295,14 +3960,15 @@
+ }
+ }
+ }
+- XSetWMHints(theDisp, mainW, &xwmh);
+
+ classh.res_name = "xv";
+ classh.res_class = "XVroot";
+- XSetClassHint(theDisp, mainW, &classh);
++ XmbSetWMProperties(theDisp, mainW, NULL, NULL, NULL, 0, &hints, &xwmh,
++ &classh);
++ setWinIconNames(name);
- if (nodecor) { /* turn of image window decorations (in MWM) */
+ if (nodecor) { /* turn of image window decorations (in MWM) */
Atom mwm_wm_hints;
struct s_mwmhints {
long flags;
-@@ -3311,7 +3338,7 @@
+@@ -3311,7 +3977,7 @@
u_long input_mode;
long status;
} mwmhints;
@@ -4242,7 +6586,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
mwm_wm_hints = XInternAtom(theDisp, "_MOTIF_WM_HINTS", False);
if (mwm_wm_hints != None) {
xvbzero((char *) &mwmhints, sizeof(mwmhints));
-@@ -3319,13 +3346,13 @@
+@@ -3319,20 +3985,20 @@
mwmhints.decorations = 4;
XChangeProperty(theDisp, mainW, mwm_wm_hints, mwm_wm_hints, 32,
@@ -4259,8 +6603,22 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
firstTime = 0;
}
-@@ -3366,8 +3393,8 @@
- int *w, *h;
+
+ /***********************************/
+ static void setWinIconNames(name)
+- char *name;
++ const char *name;
+ {
+ char winname[256], iconname[256];
+
+@@ -3362,12 +4028,12 @@
+
+ /***********************************/
+ void FixAspect(grow,w,h)
+-int grow;
+-int *w, *h;
++ int grow;
++ int *w, *h;
{
/* computes new values of eWIDE and eHIGH which will have aspect ratio
- 'normaspect'. If 'grow' it will preserve aspect by enlarging,
@@ -4270,7 +6628,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
Returns these values in 'w' and 'h' */
float xr,yr,curaspect,a,exp;
-@@ -3380,14 +3407,14 @@
+@@ -3380,14 +4046,14 @@
curaspect = xr / yr;
/* if too narrow & shrink, shrink height. too wide and grow, grow height */
@@ -4287,7 +6645,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
(curaspect > normaspect && !grow)) { /* modify width */
exp = normaspect / curaspect;
*w = (int) (eWIDE * exp + .5);
-@@ -3423,22 +3450,22 @@
+@@ -3423,22 +4089,22 @@
suffix = namelist[0];
prelen = 0; /* length of prefix to be removed */
n = i = 0; /* shut up pesky compiler warnings */
@@ -4315,7 +6673,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
dispnames[i] = namelist[i] + prelen;
}
-@@ -3447,20 +3474,20 @@
+@@ -3447,20 +4113,20 @@
static void fixDispNames()
{
/* fix dispnames array so that names don't go off right edge */
@@ -4340,7 +6698,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
tmp++; /* move to char following the '/' */
if (StringWidth(tmp) <= (nList.w-10-16)) { /* is cool now */
j++; break;
-@@ -3484,9 +3511,9 @@
+@@ -3484,9 +4150,9 @@
name = GetDirFName();
GetDirPath(cwd);
@@ -4352,8 +6710,12 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (select) {
nList.selected = numnames-1;
curname = numnames - 1;
-@@ -3501,32 +3528,32 @@
- char *fpath, *fname;
+@@ -3498,35 +4164,35 @@
+
+ /***********************************/
+ void AddFNameToCtrlList(fpath,fname)
+- char *fpath, *fname;
++ const char *fpath, *fname;
{
/* stick given path/name into 'namelist'. Doesn't redraw list */
-
@@ -4395,7 +6757,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
sprintf(fullname, "%s%s", cwd, fname);
}
else { /* copy name to fullname */
-@@ -3534,15 +3561,15 @@
+@@ -3534,15 +4200,15 @@
if (!fullname) FatalError("couldn't alloc name in AddFNameToCtrlList()\n");
strcpy(fullname, fname);
}
@@ -4414,7 +6776,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
namelist[numnames] = fullname;
numnames++;
makeDispNames();
-@@ -3578,7 +3605,7 @@
+@@ -3578,7 +4244,7 @@
/* called to enable/disable the Prev/Next buttons whenever curname and/or
numnames and/or nList.selected change */
@@ -4423,7 +6785,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
selected file (or the 0th file, if no selection either), and 'Prev' means
view the one right before the selected file */
-@@ -3591,15 +3618,15 @@
+@@ -3591,18 +4257,19 @@
BTSetActive(&but[BPREV], (curname>0));
}
}
@@ -4441,8 +6803,20 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
+ in which case the 'selected' filename on the ctrl list is now
different, and should be auto-loaded, or something */
- static char *bnames[] = { "\004Disk File", "\nList Entry", "\033Cancel" };
-@@ -3616,9 +3643,9 @@
+- static char *bnames[] = { "\004Disk File", "\nList Entry", "\033Cancel" };
++ static const char *bnames[] =
++ { "\004Disk File", "\nList Entry", "\033Cancel" };
+ char str[512];
+ int del, i, delnum, rv;
+
+@@ -3610,15 +4277,14 @@
+ delnum = nList.selected;
+ if (delnum < 0 || delnum >= numnames) return 0;
+
+- sprintf(str,"Delete '%s'?\n\n%s%s",
+- namelist[delnum],
++ sprintf(str, "Delete '%s'?\n\n%s%s", namelist[delnum],
+ "'List Entry' deletes selection from list.\n",
"'Disk File' deletes file associated with selection.");
del = PopUp(str, bnames, 3);
@@ -4454,7 +6828,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (del == 0) { /* 'Disk File' */
char *name;
if (namelist[delnum][0] != '/') { /* prepend 'initdir' */
-@@ -3669,13 +3696,13 @@
+@@ -3669,13 +4335,13 @@
if (delnum != numnames-1) {
/* snip out of namelist and dispnames lists */
@@ -4471,7 +6845,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
numnames--;
if (numnames==0) BTSetActive(&but[BDELETE],0);
windowMB.dim[WMB_TEXTVIEW] = (numnames==0);
-@@ -3686,7 +3713,7 @@
+@@ -3686,7 +4352,7 @@
if (nList.selected >= numnames) nList.selected = numnames-1;
if (nList.selected < 0) nList.selected = 0;
@@ -4480,7 +6854,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
nList.scrl.val, nList.nlines-1);
ScrollToCurrent(&nList);
DrawCtrlNumFiles();
-@@ -3753,7 +3780,7 @@
+@@ -3753,7 +4419,7 @@
if (useroot && resetroot) ClearRoot();
if (mainW == (Window) NULL || useroot) { /* window not visible */
@@ -4489,7 +6863,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (haveoldinfo) { /* just remap mainW and resize it */
XWMHints xwmh;
-@@ -3771,8 +3798,8 @@
+@@ -3771,8 +4437,8 @@
xwmh.input = True;
xwmh.flags = InputHint;
@@ -4500,7 +6874,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
xwmh.flags |= ( IconPixmapHint | IconMaskHint) ;
xwmh.flags |= StateHint;
-@@ -3787,7 +3814,7 @@
+@@ -3787,7 +4453,7 @@
else { /* first time. need to create mainW */
mainW = (Window) NULL;
createMainWindow(maingeom, fnam);
@@ -4509,7 +6883,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
| StructureNotifyMask | ButtonPressMask
| KeyReleaseMask | ColormapChangeMask
| EnterWindowMask | LeaveWindowMask );
-@@ -3802,7 +3829,7 @@
+@@ -3802,7 +4468,7 @@
else { /* mainW already visible */
createMainWindow(maingeom, fnam);
@@ -4518,7 +6892,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
| StructureNotifyMask | ButtonPressMask
| KeyReleaseMask | ColormapChangeMask
| EnterWindowMask | LeaveWindowMask );
-@@ -3845,13 +3872,13 @@
+@@ -3845,13 +4511,13 @@
if (LocalCmap) regen=1;
/* this reallocs the colors */
@@ -4536,7 +6910,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (!ctrlUp) { /* make sure ctrl is up when going to 'root' mode */
XWMHints xwmh;
xwmh.input = True;
-@@ -3861,7 +3888,7 @@
+@@ -3861,7 +4527,7 @@
CtrlBox(1);
}
}
@@ -4545,7 +6919,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
useroot = 1;
rootMode = dispMode - RMB_ROOT;
ew = eWIDE; eh = eHIGH;
-@@ -3877,7 +3904,7 @@
+@@ -3877,7 +4543,7 @@
GenerateEpic(ew, eh);
CreateXImage();
}
@@ -4554,7 +6928,24 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
KillOldRootInfo();
MakeRootPic();
-@@ -3954,7 +3981,7 @@
+@@ -3923,7 +4589,7 @@
+
+
+ if (*numn == maxn) {
+- fprintf(stderr, "%s: too many filenames. Only using first %d.\n",
++ fprintf(stderr, "%s: too many filenames. Using only first %d.\n",
+ flist, maxn);
+ }
+
+@@ -3947,14 +4613,14 @@
+
+ /***********************************/
+ int rd_int(name)
+- char *name;
++ const char *name;
+ {
+ /* returns '1' if successful. result in def_int */
+
if (rd_str_cl(name, "", 0)) { /* sets def_str */
if (sscanf(def_str, "%d", &def_int) == 1) return 1;
else {
@@ -4563,8 +6954,21 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
cmd, name);
return 0;
}
-@@ -3976,14 +4003,14 @@
- char *name;
+@@ -3965,7 +4631,7 @@
+
+ /***********************************/
+ int rd_str(name)
+- char *name;
++ const char *name;
+ {
+ return rd_str_cl(name, "", 0);
+ }
+@@ -3973,17 +4639,17 @@
+
+ /***********************************/
+ int rd_flag(name)
+-char *name;
++ const char *name;
{
/* returns '1' if successful. result in def_int */
-
@@ -4580,7 +6984,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
(strcmp(buf, "1")==0) ||
(strcmp(buf, "true")==0) ||
(strcmp(buf, "yes")==0);
-@@ -3992,12 +4019,12 @@
+@@ -3992,16 +4658,16 @@
else return 0;
}
@@ -4594,27 +6998,53 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
+
/***********************************/
int rd_str_cl (name_str, class_str, reinit)
- char *name_str;
-@@ -4044,14 +4071,14 @@
+- char *name_str;
+- char *class_str;
++ const char *name_str;
++ const char *class_str;
+ int reinit;
+ {
+ /* note: *all* X resource reading goes through this routine... */
+@@ -4043,16 +4709,30 @@
+ unsigned long nitems, nleft;
byte *data;
- i = XGetWindowProperty(theDisp, RootWindow(theDisp, 0),
+- i = XGetWindowProperty(theDisp, RootWindow(theDisp, 0),
- resAtom, 0L, 1L, False,
- XA_STRING, &actType, &actFormat, &nitems, &nleft,
-+ resAtom, 0L, 1L, False,
-+ XA_STRING, &actType, &actFormat, &nitems, &nleft,
- (unsigned char **) &data);
+- (unsigned char **) &data);
++ if (spec_window) {
++ i = XGetWindowProperty(theDisp, spec_window,
++ resAtom, 0L, 1L, False,
++ XA_STRING, &actType, &actFormat, &nitems, &nleft,
++ (unsigned char **) &data);
++ } else {
++ i = XGetWindowProperty(theDisp, RootWindow(theDisp, 0),
++ resAtom, 0L, 1L, False,
++ XA_STRING, &actType, &actFormat, &nitems, &nleft,
++ (unsigned char **) &data);
++ }
if (i==Success && actType==XA_STRING && actFormat==8) {
if (nitems>0 && data) XFree(data);
- i = XGetWindowProperty(theDisp, RootWindow(theDisp, 0), resAtom, 0L,
-+ i = XGetWindowProperty(theDisp, RootWindow(theDisp, 0), resAtom, 0L,
- (long) ((nleft+4+3)/4),
+- (long) ((nleft+4+3)/4),
- False, XA_STRING, &actType, &actFormat,
-+ False, XA_STRING, &actType, &actFormat,
- &nitems, &nleft, (unsigned char **) &data);
+- &nitems, &nleft, (unsigned char **) &data);
++ if (spec_window) {
++ i = XGetWindowProperty(theDisp, spec_window, resAtom, 0L,
++ (long) ((nleft+4+3)/4),
++ False, XA_STRING, &actType, &actFormat,
++ &nitems, &nleft, (unsigned char **) &data);
++ } else {
++ i = XGetWindowProperty(theDisp, RootWindow(theDisp, 0), resAtom, 0L,
++ (long) ((nleft+4+3)/4),
++ False, XA_STRING, &actType, &actFormat,
++ &nitems, &nleft, (unsigned char **) &data);
++ }
if (i==Success && actType==XA_STRING && actFormat==8 && data) {
def_resource = XrmGetStringDatabase((char *) data);
-@@ -4064,8 +4091,8 @@
+ XFree(data);
+@@ -4064,50 +4744,51 @@
if (!gotit) {
@@ -4625,16 +7055,19 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (xrm_str) {
def_resource = XrmGetStringDatabase(xrm_str);
if (DEBUG) fprintf(stderr,"rd_str_cl: Using RESOURCE_MANAGER prop.\n");
-@@ -4073,7 +4100,7 @@
+ }
else { /* no RESOURCE_MANAGER prop. read from 'likely' file */
- char foo[256], *homedir, *xenviron;
+- char foo[256], *homedir, *xenviron;
++ char foo[256], *xenviron;
++ const char *homedir;
XrmDatabase res1;
-
+
#ifdef VMS
strcpy(foo, "SYS$LOGIN:DECW$XDEFAULTS.DAT");
#else
-@@ -4081,33 +4108,33 @@
+- homedir = (char *) getenv("HOME");
++ homedir = (const char *) getenv("HOME");
if (!homedir) homedir = ".";
sprintf(foo,"%s/.Xdefaults", homedir);
#endif
@@ -4676,7 +7109,7 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
if (DEBUG) fprintf(stderr,"\n\n");
}
}
-@@ -4120,13 +4147,13 @@
+@@ -4120,16 +4801,15 @@
strcpy (q_name, PROGNAME);
strcat (q_name, ".");
strcat (q_name, name_str);
@@ -4690,11 +7123,16 @@ diff -ruN xv-3.10a/xv.c xv-3.10a-bugfixes/xv.c
-
+
def_str = result.addr;
- if (def_str) return (1);
- else return (0);
-diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
+- if (def_str) return (1);
+- else return (0);
++ if (def_str) return 1;
++ else return 0;
+ }
+
+-
+diff -ru xv-3.10a/xv.h xv-3.10a-enhancements/xv.h
--- xv-3.10a/xv.h 1995-01-23 12:22:23.000000000 -0800
-+++ xv-3.10a-bugfixes/xv.h 2005-04-10 09:37:18.000000000 -0700
++++ xv-3.10a-enhancements/xv.h 2007-05-20 21:26:40.000000000 -0700
@@ -1,6 +1,6 @@
/*
* xv.h - header file for xv, but you probably guessed as much
@@ -4703,7 +7141,7 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
* Author: John Bradley (bradley@cis.upenn.edu)
*/
-@@ -8,8 +8,14 @@
+@@ -8,8 +8,16 @@
#include "config.h"
@@ -4715,27 +7153,51 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
+/* GRR orig jumbo enhancements patch: 20000220 */
+/* GRR 1st public jumbo F+E patches: 20040531 */
+/* GRR 2nd public jumbo F+E patches: 20050410 */
-+#define REVDATE "version 3.10a-jumboFix of 20050410"
-+#define VERSTR "3.10a-20050410"
++/* GRR 3rd public jumbo F+E patches: 20050501 */
++/* GRR 4th public jumbo F+E patch: 20070520 */
++#define REVDATE "version 3.10a-jumboFix+Enh of 20070520"
++#define VERSTR "3.10a-20070520"
/*
* uncomment the following, and modify for your site, but only if you've
-@@ -62,15 +68,27 @@
- #endif
+@@ -43,6 +51,10 @@
+ /* START OF MACHINE-DEPENDENT CONFIGURATION INFO */
+ /*************************************************/
++
++#define ENABLE_FIXPIX_SMOOTH /* GRR 19980607 */
++
++
+ /* Things to make xv more likely to just build, without the user tweaking
+ the makefile */
--#ifdef LINUX
+@@ -61,16 +73,38 @@
+ # define SVR4
+ #endif
+
++#if defined(__sony_news) && defined(bsd43) && !defined(__bsd43)
++# define __bsd43
++#elif defined(__sony_news) && (defined(SYSTYPE_BSD) || defined(__SYSTYPE_BSD)) && !defined(bsd43) && !defined(__bsd43)
++# define bsd43
++# define __bsd43
++#endif
++
++#include <signal.h> /* for interrupt handling */
++
+/* at least on Linux, the following file (1) includes sys/types.h and
+ * (2) defines __USE_BSD (which was not defined before here), so __linux__
+ * block is now moved after this #include */
+#include <X11/Xos.h> /* need type declarations immediately */
+
-+
+
+-#ifdef LINUX
+#ifdef __linux__
# ifndef _LINUX_LIMITS_H
# include <linux/limits.h>
# endif
-+# define USLEEP
++# ifndef USLEEP
++# define USLEEP
++# endif
+ /* want only one or the other defined, not both: */
+# if !defined(BSDTYPES) && !defined(__USE_BSD)
+# define BSDTYPES
@@ -4751,13 +7213,34 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
/*********************************************************/
-@@ -115,17 +133,21 @@
+@@ -99,6 +133,16 @@
+ #endif
+
+
++#if defined(__sony_news) && defined(__bsd43)
++# include <unistd.h>
++#endif
++
++
++#if defined(__FreeBSD__)
++# include <sys/param.h>
++#endif
++
++
+ /* include files */
+ #include <stdio.h>
+ #include <math.h>
+@@ -114,18 +158,24 @@
+
#ifndef VMS
# include <errno.h>
- extern int errno; /* SHOULD be in errno.h, but often isn't */
--# ifndef __NetBSD__
-+# if !defined(__NetBSD__) && !(defined(__linux__) && defined(__USE_BSD))
- extern char *sys_errlist[]; /* this too... */
+- extern int errno; /* SHOULD be in errno.h, but often isn't */
+ # ifndef __NetBSD__
+- extern char *sys_errlist[]; /* this too... */
++# if !(defined __GLIBC__ && __GLIBC__ >= 2)
++ extern int errno; /* SHOULD be in errno.h, but often isn't */
++ extern char *sys_errlist[]; /* this too... */
++# endif
# endif
#endif
@@ -4777,18 +7260,60 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
#endif
-@@ -159,7 +181,9 @@
- !defined(bsd43) && \
- !defined(aux) && \
- !defined(__bsdi__) && \
-- !defined(sequent)
-+ !defined(sequent) && \
-+ !defined(__FreeBSD__) && \
-+ !defined(__OpenBSD__)
+@@ -146,28 +196,20 @@
+ #endif
+
+-/* lots of things don't have <malloc.h> */
+-/* A/UX systems include it from stdlib, from Xos.h */
+-#ifndef VMS /* VMS hates multi-line '#if's */
+-# if !defined(ibm032) && \
+- !defined(__convex__) && \
+- !(defined(vax) && !defined(ultrix)) && \
+- !defined(mips) && \
+- !defined(apollo) && \
+- !defined(pyr) && \
+- !defined(__UMAXV__) && \
+- !defined(bsd43) && \
+- !defined(aux) && \
+- !defined(__bsdi__) && \
+- !defined(sequent)
+-
++/* GRR 20070512: Very few modern systems even have a malloc.h anymore;
++ * stdlib.h is, well, the standard. (Former explicitly listed
++ * "don't include" systems: ibm032, __convex__, non-ultrix vax,
++ * mips, apollo, pyr, sequent, __UMAXV__, aux, bsd43, __bsd43,
++ * __bsdi__, __386BSD__, __FreeBSD__, __OpenBSD__, __NetBSD__,
++ * __DARWIN__, VMS.) Anyone who _does_ need it can explicitly
++ * define NEED_MALLOC_H in the makefile. */
++#ifdef NEED_MALLOC_H
# if defined(hp300) || defined(hp800) || defined(NeXT)
- # include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */
-@@ -205,6 +229,10 @@
+-# include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */
++# include <sys/malloc.h> /* it's in "sys" on HPs and NeXT */
+ # else
+-# include <malloc.h>
++# include <malloc.h>
+ # endif
+-# endif
+-#endif /* !VMS */
++#endif
+
+
+
+@@ -179,9 +221,10 @@
+ #include <X11/Xatom.h>
+ #include <X11/Xmd.h>
+
++#ifdef TV_L10N
++# include <X11/Xlocale.h>
++#endif
+
+-#undef SIGCHLD /* defined in both Xos.h and signal.h */
+-#include <signal.h> /* for interrupt handling */
+
+ #include <sys/types.h>
+
+@@ -205,6 +248,10 @@
# include <limits.h>
# endif
@@ -4799,7 +7324,7 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
/*** for select() call ***/
# ifdef __hpux
# define XV_FDTYPE (int *)
-@@ -259,7 +287,7 @@
+@@ -259,7 +306,7 @@
* make them if missing, along with a few fictitious ones
* Cameron Simpson (cameron@cse.unsw.edu.au)
*/
@@ -4808,7 +7333,18 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
#ifndef S_ISDIR /* missing POSIX-type macros */
# define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
# define S_ISBLK(mode) (((mode)&S_IFMT) == S_IFBLK)
-@@ -308,10 +336,18 @@
+@@ -288,7 +335,9 @@
+ # endif
+ #endif
+
+-
++#ifndef S_IRWUSR
++# define S_IRWUSR (S_IRUSR|S_IWUSR) /* or (S_IREAD|S_IWRITE) */
++#endif
+
+ #ifndef MAXPATHLEN
+ # define MAXPATHLEN 256
+@@ -308,36 +357,90 @@
#ifndef VMS /* VMS hates multi-line definitions */
# if defined(SVR4) || defined(SYSV) || defined(sco) || \
@@ -4816,30 +7352,73 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
+ defined(XENIX) || defined(__osf__) || defined(__linux__)
# undef USE_GETCWD
# define USE_GETCWD /* use 'getcwd()' instead of 'getwd()' */
--# endif
+# endif /* >> SECURITY ISSUE << */
+#endif
+
+
-+/* GRR 20040430: This is new and still only partially implemented. No doubt
-+ * there are many other systems that have mkstemp() (SUSv3),
-+ * but let's start small... */
-+#if defined(__linux__) || defined(__OpenBSD__)
-+# define USE_MKSTEMP /* use 'mkstemp()' instead of 'mktemp()' */
++/* GRR 20040430: This is new and still not fully deployed. No doubt there
++ * are other systems that have mkstemp() (SUSv3); we can add
++ * them later. */
++#ifndef VMS /* VMS hates multi-line definitions */
++# if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
++ defined(__bsdi__)
++# ifndef USE_MKSTEMP
++# define USE_MKSTEMP /* use 'mkstemp()' instead of 'mktemp()' */
++# endif /* >> SECURITY ISSUE << */
+ # endif
#endif
-@@ -320,15 +356,15 @@
++/* GRR 20040503: This is new and so far tested only under Linux. But it
++ * allows -wait to work with subsecond values as long as
++ * times() exists and clock_t is a long int (latter matters
++ * only if/when clocks wrap, which for Linux is multiples of
++ * 497.11 days since the last reboot). */
++#if defined(__linux__)
++# define USE_TICKS /* use times()/Timer(), not time()/sleep() */
++# include <limits.h> /* LONG_MAX (really want CLOCK_T_MAX) */
++# include <sys/times.h> /* times() */
++# ifndef CLK_TCK /* can be undefined in strict-ANSI mode */
++# define CLK_TCK CLOCKS_PER_SEC /* claimed to be same thing in time.h */
++# endif
++#endif
++
++#if (defined(SYSV) || defined(SVR4) || defined(linux)) && !defined(USE_GETCWD)
++# define USE_GETCWD
++#endif
++
++#ifndef SEEK_SET
++# define SEEK_SET 0
++# define SEEK_CUR 1
++# define SEEK_END 2
++#endif
++
++#if defined(__mips) && defined(__SYSTYPE_BSD43)
++# define strstr(A,B) pds_strstr((A),(B))
++# undef S_IFIFO
++#endif /* !mips_bsd */
++
+ /*****************************/
+ /* END OF CONFIGURATION INFO */
/*****************************/
++
#ifdef DOJPEG
-#define HAVE_JPEG
+# define HAVE_JPEG
++#endif
++
++#ifdef DOJP2K
++# define HAVE_JP2K
#endif
#ifdef DOTIFF
-#define HAVE_TIFF
+# define HAVE_TIFF
++#endif
++
++#ifdef DOPNG
++# define HAVE_PNG
#endif
#ifdef DOPDS
@@ -4847,17 +7426,166 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
+# define HAVE_PDS
#endif
++#ifdef DOG3
++# define HAVE_G3
++#endif
+
+
+-#define PROGNAME "xv" /* used in resource database */
++#define PROGNAME "xv" /* used in resource database */
+
+-#define MAXNAMES 4096 /* max # of files in ctrlW list */
++#define MAXNAMES 65536 /* max # of files in ctrlW list */
-@@ -442,7 +478,7 @@
+-#define MAXBRWIN 4 /* max # of vis browser windows */
++#define MAXBRWIN 16 /* max # of vis browser windows */
- /* following list gives indicies into 'saveFormats[]' array in xvdir.c
- note that JPEG and TIFF entries may or may not exist, and following
+ /* strings in the INFOBOX (used in SetISTR and GetISTR) */
+ #define NISTR 10 /* number of ISTRs */
+@@ -432,7 +535,7 @@
+ #define F_COLORS 0
+ #define F_FORMAT 1
+
+-/* the following list give indicies into saveColors[] array in xvdir.c */
++/* the following list give indices into saveColors[] array in xvdir.c */
+ #define F_FULLCOLOR 0
+ #define F_GREYSCALE 1
+ #define F_BWDITHER 2
+@@ -440,49 +543,115 @@
+ #define F_MAXCOLORS 4 /* length of saveColors[] array */
+
+
+-/* following list gives indicies into 'saveFormats[]' array in xvdir.c
+- note that JPEG and TIFF entries may or may not exist, and following
- constants have to be adjusted accordingly. Also, don't worry about
-+ constants have to be adjusted accordingly. Also, don't worry about
- duplicate cases if JPGINC or TIFINC = 0. All code that references
- F_JPEG or F_TIFF is #ifdef'd, so it won't be a problem */
+- duplicate cases if JPGINC or TIFINC = 0. All code that references
+- F_JPEG or F_TIFF is #ifdef'd, so it won't be a problem */
++/* The following list gives indices into 'saveFormats[]' array in xvdir.c.
++ Note that JPEG, TIFF, and other entries may or may not exist, so the
++ following constants have to be adjusted accordingly. Also, don't worry
++ about duplicate cases if, e.g., JPGINC or TIFINC = 0. All code that
++ references F_JPEG, F_TIFF, etc., is #ifdef'd, so it won't be a problem. */
+
+ #ifdef HAVE_JPEG
+-#define F_JPGINC 1
++# define F_JPGINC 1
+ #else
+-#define F_JPGINC 0
++# define F_JPGINC 0
++#endif
++
++#ifdef HAVE_JP2K
++# define F_JP2INC 1 /* provides both JPC and JP2 */
++#else
++# define F_JP2INC 0
+ #endif
+
+ #ifdef HAVE_TIFF
+-#define F_TIFINC 1
++# define F_TIFINC 1
++#else
++# define F_TIFINC 0
++#endif
++
++#ifdef HAVE_PNG
++# define F_PNGINC 1
++#else
++# define F_PNGINC 0
++#endif
++
++#ifdef HAVE_MAG
++# define F_MAGINC 1
++#else
++# define F_MAGINC 0
++#endif
++
++#ifdef HAVE_PIC
++# define F_PICINC 1
++#else
++# define F_PICINC 0
++#endif
++
++#ifdef HAVE_MAKI
++# define F_MAKINC 1
++#else
++# define F_MAKINC 0
++#endif
++
++#ifdef HAVE_PI
++# define F_PAIINC 1
++#else
++# define F_PAIINC 0
++#endif
++
++#ifdef HAVE_PIC2
++# define F_PC2INC 1
+ #else
+-#define F_TIFINC 0
++# define F_PC2INC 0
+ #endif
+
++#ifdef HAVE_MGCSFX
++# define F_MGCSFXINC 1
++#else
++# define F_MGCSFXINC 0
++#endif
+
+-#define F_GIF 0
+-#define F_JPEG ( 0 + F_JPGINC)
+-#define F_TIFF ( 0 + F_JPGINC + F_TIFINC)
+-#define F_PS ( 1 + F_JPGINC + F_TIFINC)
+-#define F_PBMRAW ( 2 + F_JPGINC + F_TIFINC)
+-#define F_PBMASCII ( 3 + F_JPGINC + F_TIFINC)
+-#define F_XBM ( 4 + F_JPGINC + F_TIFINC)
+-#define F_XPM ( 5 + F_JPGINC + F_TIFINC)
+-#define F_BMP ( 6 + F_JPGINC + F_TIFINC)
+-#define F_SUNRAS ( 7 + F_JPGINC + F_TIFINC)
+-#define F_IRIS ( 8 + F_JPGINC + F_TIFINC)
+-#define F_TARGA ( 9 + F_JPGINC + F_TIFINC)
+-#define F_FITS (10 + F_JPGINC + F_TIFINC)
+-#define F_PM (11 + F_JPGINC + F_TIFINC)
+-#define F_DELIM1 (12 + F_JPGINC + F_TIFINC) /* ----- */
+-#define F_FILELIST (13 + F_JPGINC + F_TIFINC)
+-#define F_MAXFMTS (14 + F_JPGINC + F_TIFINC) /* 15, normally */
++#ifdef MACBINARY
++# define MACBSIZE 128
++#endif
++
++/* NOTE: order must match saveFormats[] in xvdir.c */
++/* [this works best when first one is always present, but...we like PNG :-) ] */
++#define F_PNG 0
++#define F_JPEG ( 0 + F_PNGINC)
++#define F_JPC ( 0 + F_PNGINC + F_JPGINC)
++#define F_JP2 ( 0 + F_PNGINC + F_JPGINC + F_JP2INC)
++#define F_GIF ( 0 + F_PNGINC + F_JPGINC + F_JP2INC + F_JP2INC) /* always avail; index varies */
++#define F_TIFF ( 0 + F_PNGINC + F_JPGINC + F_JP2INC + F_JP2INC + F_TIFINC)
++#define F_PS ( 1 + F_TIFF)
++#define F_PBMRAW ( 2 + F_TIFF)
++#define F_PBMASCII ( 3 + F_TIFF)
++#define F_XBM ( 4 + F_TIFF)
++#define F_XPM ( 5 + F_TIFF)
++#define F_BMP ( 6 + F_TIFF)
++#define F_SUNRAS ( 7 + F_TIFF)
++#define F_IRIS ( 8 + F_TIFF)
++#define F_TARGA ( 9 + F_TIFF)
++#define F_FITS (10 + F_TIFF)
++#define F_PM (11 + F_TIFF)
++#define F_ZX (12 + F_TIFF) /* [JCE] */
++#define F_WBMP (13 + F_TIFF)
++#define JP_EXT_F (F_WBMP)
++#define F_MAG (JP_EXT_F + F_MAGINC)
++#define F_PIC (JP_EXT_F + F_MAGINC + F_PICINC)
++#define F_MAKI (JP_EXT_F + F_MAGINC + F_PICINC + F_MAKINC)
++#define F_PI (JP_EXT_F + F_MAGINC + F_PICINC + F_MAKINC + F_PAIINC)
++#define F_PIC2 (JP_EXT_F + F_MAGINC + F_PICINC + F_MAKINC + F_PAIINC + F_PC2INC)
++#define F_MGCSFX (JP_EXT_F + F_MAGINC + F_PICINC + F_MAKINC + F_PAIINC + F_PC2INC + F_MGCSFXINC)
++#define JP_EXT_F_END (F_MGCSFX)
++#define F_DELIM1 (JP_EXT_F_END + 1) /* ----- */
++#define F_FILELIST (JP_EXT_F_END + 2)
++#define F_MAXFMTS (JP_EXT_F_END + 3) /* 27, normally (with all formats) */
+
+
-@@ -482,7 +518,7 @@
/* return values from ReadFileType()
* positive values are *definitely* readable formats (HAVE_*** is defined)
* negative values are random files that XV can't read, but display as
@@ -4866,7 +7594,81 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
*/
#define RFT_ERROR -1 /* couldn't open file, or whatever... */
#define RFT_UNKNOWN 0
-@@ -742,7 +778,7 @@
+@@ -505,6 +674,22 @@
+ #define RFT_XPM 17
+ #define RFT_XWD 18
+ #define RFT_FITS 19
++#define RFT_PNG 20
++#define RFT_ZX 21 /* [JCE] */
++#define RFT_WBMP 22
++#define RFT_PCD 23
++#define RFT_HIPS 24
++#define RFT_BZIP2 25
++#define RFT_JPC 26
++#define RFT_JP2 27
++#define RFT_G3 28
++#define JP_EXT_RFT (RFT_G3)
++#define RFT_MAG (JP_EXT_RFT + 1)
++#define RFT_MAKI (JP_EXT_RFT + 2)
++#define RFT_PIC (JP_EXT_RFT + 3)
++#define RFT_PI (JP_EXT_RFT + 4)
++#define RFT_PIC2 (JP_EXT_RFT + 5)
++#define RFT_MGCSFX (JP_EXT_RFT + 6)
+
+ /* definitions for page up/down, arrow up/down list control */
+ #define LS_PAGEUP 0
+@@ -563,7 +748,8 @@
+ #define RM_CBRICK 7 /* centered on a 'brick' bg */
+ #define RM_ECENTER 8 /* symmetrical tiled */
+ #define RM_ECMIRR 9 /* symmetrical mirror tiled */
+-#define RM_MAX RM_ECMIRR
++#define RM_UPLEFT 10 /* just in upper left corner */
++#define RM_MAX RM_UPLEFT
+
+
+ /* values of colorMapMode */
+@@ -613,10 +799,11 @@
+ #define RMB_CBRICK 8
+ #define RMB_ECENTER 9
+ #define RMB_ECMIRR 10
+-#define RMB_MAX 11
++#define RMB_UPLEFT 11
++#define RMB_MAX 12
+
+
+-/* indicies into conv24MB */
++/* indices into conv24MB */
+ #define CONV24_8BIT 0
+ #define CONV24_24BIT 1
+ #define CONV24_SEP1 2
+@@ -631,7 +818,7 @@
+ #define PIC8 CONV24_8BIT
+ #define PIC24 CONV24_24BIT
+
+-/* indicies into algMB */
++/* indices into algMB */
+ #define ALG_NONE 0
+ #define ALG_SEP1 1 /* separator */
+ #define ALG_BLUR 2
+@@ -648,7 +835,7 @@
+ #define ALG_MAX 13
+
+
+-/* indicies into sizeMB */
++/* indices into sizeMB */
+ #define SZMB_NORM 0
+ #define SZMB_MAXPIC 1
+ #define SZMB_MAXPECT 2
+@@ -663,7 +850,7 @@
+ #define SZMB_INTEXP 11
+ #define SZMB_MAX 12
+
+-/* indicies into windowMB */
++/* indices into windowMB */
+ #define WMB_BROWSE 0
+ #define WMB_COLEDIT 1
+ #define WMB_INFO 2
+@@ -742,15 +929,15 @@
typedef unsigned char byte;
@@ -4875,7 +7677,199 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
Window win; /* window ID */
int x,y,w,h; /* window coords in parent */
int len; /* length of major axis */
-@@ -972,12 +1008,12 @@
+ int vert; /* true if vertical, else horizontal */
+ int active; /* true if scroll bar can do anything*/
+- int min,max; /* min/max values 'pos' can take */
+- int val; /* 'value' of scrollbar */
+- int page; /* amt val change on pageup/pagedown */
++ double min,max; /* min/max values 'pos' can take */
++ double val; /* 'value' of scrollbar */
++ double page; /* amt val change on pageup/pagedown */
+ int tpos; /* thumb pos. (pixels from tmin) */
+ int tmin,tmax; /* min/max thumb offsets (from 0,0) */
+ int tsize; /* size of thumb (in pixels) */
+@@ -765,11 +952,12 @@
+ typedef struct { Window win; /* window ID */
+ int x,y,w,h; /* window coords in parent */
+ int active; /* true if can do anything*/
+- int min,max; /* min/max values 'pos' can take */
+- int val; /* 'value' of dial */
+- int page; /* amt val change on pageup/pagedown */
+- char *title; /* title for this guage */
+- char *units; /* string appended to value */
++ double min,max; /* min/max values 'pos' can take */
++ double val; /* 'value' of dial */
++ double inc; /* amt val change on up/down */
++ double page; /* amt val change on pageup/pagedown */
++ const char *title; /* title for this gauge */
++ const char *units; /* string appended to value */
+ u_long fg,bg,hi,lo; /* colors */
+ int rad, cx, cy; /* internals */
+ int bx[4], by[4]; /* more internals */
+@@ -785,7 +973,7 @@
+ int active; /* if false, stipple gray */
+ int toggle; /* if true, clicking toggles state */
+ u_long fg,bg,hi,lo; /* colors */
+- char *str; /* string in button */
++ const char *str; /* string in button */
+ Pixmap pix; /* use pixmap instead of string */
+ u_int pw,ph; /* size of pixmap */
+ int colorpix; /* multi-color pixmap */
+@@ -797,21 +985,23 @@
+ typedef struct rbutt {
+ Window win; /* parent window */
+ int x,y; /* position in parent */
+- char *str; /* the message string */
++ const char *str; /* the message string */
+ int selected; /* selected or not */
+ int active; /* selectable? */
+ struct rbutt *next; /* pointer to next in group */
+- u_long fg,bg,hi,lo; /* colors */
++ u_long fg,bg; /* colors */
++ u_long hi,lo; /* colors */
+ } RBUTT;
+
+
+
+ typedef struct { Window win; /* parent window */
+ int x,y; /* position in parent */
+- char *str; /* the message string */
++ const char *str; /* the message string */
+ int val; /* 1=selected, 0=not */
+ int active; /* selectable? */
+- u_long fg,bg,hi,lo; /* colors */
++ u_long fg,bg; /* colors */
++ u_long hi,lo; /* colors */
+ } CBUTT;
+
+
+@@ -819,11 +1009,11 @@
+ typedef struct { Window win; /* parent window */
+ int x,y; /* position in parent */
+ unsigned int w,h;
+- char *title; /* title string in norm state */
++ const char *title; /* title string in norm state */
+ int active; /* selectable? */
+- char **list; /* list of strings in menu */
++ const char **list; /* list of strings in menu */
+ int nlist; /* # of strings in menu */
+- byte flags[MAXMBLEN]; /* checkmarks on items */
++ byte flags[MAXMBLEN]; /* checkmarks on items */
+ int hascheck; /* leave room for checkmark? */
+ byte dim[MAXMBLEN]; /* dim individual choices */
+ Pixmap pix; /* use pixmap instd of string */
+@@ -833,17 +1023,18 @@
+ } MBUTT;
+
+
+-typedef struct { Window win; /* window */
+- int x,y; /* size of window */
++typedef struct { Window win; /* window */
++ int x,y; /* size of window */
+ unsigned int w,h;
+- u_long fg,bg,hi,lo; /* colors */
+- char **str; /* ptr to list of strings */
+- int nstr; /* number of strings */
+- int selected; /* number of 'selected' string */
+- int nlines; /* number of lines shown at once */
+- SCRL scrl; /* scrollbar that controls list */
+- int filetypes; /* true if filetype icons to be drawn*/
+- int dirsonly; /* if true, only dirs selectable */
++ u_long fg,bg; /* colors */
++ u_long hi,lo; /* colors */
++ /* const? */ char **str; /* ptr to list of strings */
++ int nstr; /* number of strings */
++ int selected; /* number of 'selected' string */
++ int nlines; /* number of lines shown at once */
++ SCRL scrl; /* scrollbar that controls list */
++ int filetypes; /* true if filetype icons to be drawn*/
++ int dirsonly; /* if true, only dirs selectable */
+ } LIST;
+
+
+@@ -865,6 +1056,9 @@
+ char shrtInfo[128]; /* short format info */
+ char *comment; /* comment text */
+
++ byte *exifInfo; /* image info from digicam */
++ int exifInfoSize; /* size of image info */
++
+ int numpages; /* # of page files, if >1 */
+ char pagebname[64]; /* basename of page files */
+ } PICINFO;
+@@ -881,18 +1075,18 @@
+
+ #define GVMAX 8
+
+-typedef struct { Window win; /* window ID */
+- Window gwin; /* graph subwindow */
+- int spline; /* spline curve or lines? */
+- int entergamma; /* currently entering gamma value */
+- int gammamode; /* currently using gamma function */
+- double gamma; /* gamma value (if gammamode) */
+- int nhands; /* current # of handles */
+- XPoint hands[MAX_GHANDS]; /* positions of handles */
+- byte func[256]; /* output function of GRAF */
+- BUTT butts[N_GFB]; /* control buttons */
+- u_long fg,bg; /* colors */
+- char *str; /* title string */
++typedef struct { Window win; /* window ID */
++ Window gwin; /* graph subwindow */
++ int spline; /* spline curve or lines? */
++ int entergamma; /* currently entering gamma value */
++ int gammamode; /* currently using gamma function */
++ double gamma; /* gamma value (if gammamode) */
++ int nhands; /* current # of handles */
++ XPoint hands[MAX_GHANDS]; /* positions of handles */
++ byte func[256]; /* output function of GRAF */
++ BUTT butts[N_GFB]; /* control buttons */
++ u_long fg,bg; /* colors */
++ const char *str; /* title string */
+ char gvstr[GVMAX+1]; /* gamma value input string */
+ void (*drawobj)PARM((void));
+ } GRAF;
+@@ -932,18 +1126,23 @@
+ /* X stuff */
+ WHERE Display *theDisp;
+ WHERE int theScreen;
+-WHERE unsigned int ncells, dispWIDE, dispHIGH, dispDEEP;
+-WHERE unsigned int vrWIDE, vrHIGH, maxWIDE, maxHIGH;
++WHERE unsigned int ncells, dispDEEP; /* root color sizes */
++WHERE unsigned int dispWIDE, dispHIGH; /* screen sizes */
++WHERE unsigned int vrWIDE, vrHIGH, maxWIDE, maxHIGH; /* virtual root and max image sizes */
+ WHERE Colormap theCmap, LocalCmap;
+-WHERE Window rootW, mainW, vrootW;
++WHERE Window spec_window, rootW, mainW, vrootW;
+ WHERE GC theGC;
+ WHERE u_long black, white, fg, bg, infofg, infobg;
+ WHERE u_long hicol, locol;
+ WHERE u_long blkRGB, whtRGB;
+ WHERE Font mfont, monofont;
+ WHERE XFontStruct *mfinfo, *monofinfo;
++#ifdef TV_L10N
++WHERE XFontSet monofset;
++WHERE XFontSetExtents *monofsetinfo;
++#endif
+ WHERE Visual *theVisual;
+-WHERE Cursor arrow, cross, tcross, zoom, inviso;
++WHERE Cursor arrow, cross, tcross, zoom, inviso, tlcorner;
+ WHERE Pixmap iconPix, iconmask;
+ WHERE Pixmap riconPix, riconmask;
+ WHERE int showzoomcursor;
+@@ -959,6 +1158,12 @@
+ WHERE char formatStr[80]; /* short-form 'file format' */
+ WHERE int picType; /* CONV24_8BIT,CONV24_24BIT,etc.*/
+ WHERE char *picComments; /* text comments on current pic */
++WHERE byte *picExifInfo; /* image info from digicam */
++WHERE int picExifInfoSize; /* size of image info */
++
++#ifdef TV_L10N
++WHERE int xlocale; /* true if Xlib supports locale */
++#endif
+
+ WHERE int numPages, curPage; /* for multi-page files */
+ WHERE char pageBaseName[64]; /* basename for multi-page files */
+@@ -972,12 +1177,12 @@
/* this is converted to 'theImage' */
WHERE int eWIDE, eHIGH; /* size of epic */
@@ -4890,8 +7884,86 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
kludge_offy;
WHERE int winCtrPosKludge; /* kludge for popup positioning... */
-@@ -1072,7 +1108,7 @@
- WHERE int autoDelete; /* delete cmd-line files on exit? */
+@@ -993,6 +1198,26 @@
+ WHERE unsigned long cols[256]; /* maps pic pixel values to X pixel vals */
+ WHERE int fc2pcol[256]; /* maps freecols into pic pixel values */
+ WHERE int numcols; /* # of desired colors in picture */
++#ifdef MACBINARY
++WHERE char macb_file; /* True if this file type is MacBinary */
++WHERE int handlemacb; /* True if we want to handle MacBinary */
++#endif
++#if defined(HAVE_PIC) || defined(HAVE_PIC2)
++WHERE int nopicadjust; /* True if we don't want to adjust aspect */
++#endif
++#ifdef HAVE_PIC2
++WHERE int pic2split; /* True if we want to split multiblocks */
++#endif
++#ifdef VS_ADJUST
++WHERE int vsadjust; /* True if we want to adjust aspect of icons */
++#endif
++#ifdef HAVE_MGCSFX
++WHERE int mgcsfx; /* True if we want to force use MgcSfx */
++WHERE int nomgcsfx; /* True if we don't want to use MgcSfx */
++#endif
++
++#define FSTRMAX 12 /* Number of function keys to support. */
++WHERE char *fkeycmds[FSTRMAX]; /* command to run when F# is pressed */
+
+ /* Std Cmap stuff */
+ WHERE byte stdr[256], stdg[256], stdb[256]; /* std 3/3/2 cmap */
+@@ -1025,7 +1250,7 @@
+
+ WHERE int ncols; /* max # of (different) colors to alloc */
+
+-WHERE char str[128]; /* dummy string used for error messages */
++WHERE char dummystr[128]; /* dummy string used for error messages */
+ WHERE char initdir[MAXPATHLEN]; /* cwd when xv was started */
+ WHERE char searchdir[MAXPATHLEN]; /* '-dir' option */
+ WHERE char fullfname[MAXPATHLEN]; /* full name of current file */
+@@ -1047,42 +1272,47 @@
+ noFreeCols, /* don't free colors when loading new pic */
+ autoquit, /* quit in '-root' or when click on win */
+ xerrcode, /* errorcode of last X error */
+- grabDelay; /* # of seconds to sleep at start of Grab */
++ grabDelay, /* # of seconds to sleep at start of Grab */
++ startGrab; /* start immediate grab ? */
+
+ WHERE int state824; /* displays warning when going 8->24 */
+
+ WHERE float defaspect, /* default aspect ratio to use */
+ normaspect; /* normal aspect ratio of this picture */
+
+-WHERE unsigned long rootbg, rootfg; /* fg/bg for root border */
+-WHERE int waitsec; /* secs btwn pics. -1=wait for event */
+-WHERE int waitloop; /* loop at end of slide show? */
+-WHERE int automax; /* maximize pic on open */
+-WHERE int rootMode; /* mode used for -root images */
++WHERE u_long rootbg, rootfg; /* fg/bg for root border */
++WHERE u_short imagebgR;
++WHERE u_short imagebgG; /* GRR 19980308: bg for transpar. images */
++WHERE u_short imagebgB;
++WHERE int have_imagebg;
++WHERE double waitsec; /* secs btwn pics. -1.0=wait for event */
++WHERE int waitloop; /* loop at end of slide show? */
++WHERE int automax; /* maximize pic on open */
++WHERE int rootMode; /* mode used for -root images */
+
+-WHERE int nostat; /* if true, don't stat() in LdCurDir */
++WHERE int nostat; /* if true, don't stat() in LdCurDir */
+
+-WHERE int ctrlColor; /* whether or not to use colored butts */
++WHERE int ctrlColor; /* whether or not to use colored butts */
+
+-WHERE char *def_str; /* used by rd_*() routines */
++WHERE char *def_str; /* used by rd_*() routines */
+ WHERE int def_int;
+-WHERE char *tmpdir; /* equal to "/tmp" or $TMPDIR env var */
+-WHERE Pixmap gray25Tile, /* used for 3d effect on 1-bit disp's */
++WHERE char *tmpdir; /* equal to "/tmp" or $TMPDIR env var */
++WHERE Pixmap gray25Tile, /* used for 3d effect on 1-bit disp's */
+ gray50Tile;
+-WHERE int autoDelete; /* delete cmd-line files on exit? */
++WHERE int autoDelete; /* delete cmd-line files on exit? */
#define PRINTCMDLEN 256
-WHERE char printCmd[PRINTCMDLEN];
@@ -4899,92 +7971,431 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
/* stuff used for 'info' box */
WHERE Window infoW;
-@@ -1135,7 +1171,7 @@
+-WHERE int infoUp; /* boolean: whether infobox is visible */
++WHERE int infoUp; /* boolean: whether infobox is visible */
+ WHERE int infoMode;
+
+
+ /* stuff used for 'ctrl' box */
+ WHERE Window ctrlW;
+-WHERE int ctrlUp; /* boolean: whether ctrlbox is visible */
++WHERE int ctrlUp; /* boolean: whether ctrlbox is visible */
+ WHERE char *namelist[MAXNAMES]; /* list of file names from argv */
+ WHERE char *origlist[MAXNAMES]; /* only names from argv (autoDelete)*/
+ WHERE int orignumnames;
+@@ -1121,25 +1351,31 @@
+
+
+ /* stuff used for 'browse' box */
+-WHERE int anyBrowUp; /* whether *any* browser visible */
++WHERE int anyBrowUp; /* whether *any* browser visible */
++WHERE int incrementalSearchTimeout;
+
+ /* stuff used for textview windows */
+-WHERE int anyTextUp; /* are any text windows visible? */
+-WHERE int commentUp; /* comment window up? */
++WHERE int anyTextUp; /* are any text windows visible? */
++WHERE int commentUp; /* comment window up? */
+
+ /* stuff used for xvcut.c */
+-WHERE int forceClipFile; /* don't use property clipboard */
+-WHERE int clearR, clearG, clearB; /* clear color in 24-bit mode */
++WHERE int forceClipFile; /* don't use property clipboard */
++WHERE int clearR, clearG, clearB; /* clear color in 24-bit mode */
+
+
/* stuff used for 'ps' box */
WHERE Window psW;
- WHERE int psUp; /* is psW mapped, or what? */
+-WHERE int psUp; /* is psW mapped, or what? */
-WHERE CBUTT encapsCB, pscompCB;
+-WHERE char *gsDev, *gsGeomStr;
++WHERE int psUp; /* is psW mapped, or what? */
+WHERE CBUTT encapsCB, pscompCB;
- WHERE char *gsDev, *gsGeomStr;
++WHERE const char *gsDev, *gsGeomStr;
WHERE int gsRes;
-@@ -1210,7 +1246,7 @@
- /*************************** XVMISC.C ***************************/
- void StoreDeleteWindowProp PARM((Window));
--Window CreateWindow PARM((char *, char *, char *, int, int,
-+Window CreateWindow PARM((char *, char *, char *, int, int,
- u_long, u_long, int));
- void DrawString PARM((Window, int, int, char *));
- void CenterString PARM((Window, int, int, char *));
-@@ -1222,7 +1258,7 @@
- void GenExpose PARM((Window, int, int, u_int, u_int));
- void DimRect PARM((Window, int, int, u_int, u_int, u_long));
++/* stuff used for 'pcd' box */
++WHERE Window pcdW;
++WHERE int pcdUp; /* is pcdW mapped, or what? */
++
++
+ #ifdef HAVE_JPEG
+ /* stuff used for 'jpeg' box */
+ WHERE Window jpegW;
+@@ -1147,6 +1383,13 @@
+ #endif
--void Draw3dRect PARM((Window, int, int, u_int, u_int, int, int,
-+void Draw3dRect PARM((Window, int, int, u_int, u_int, int, int,
- u_long, u_long, u_long));
- void RemapKeyCheck PARM((KeySym, char *, int *));
-@@ -1237,7 +1273,7 @@
- void SetCursors PARM((int));
- char *BaseName PARM((char *));
++#ifdef HAVE_JP2K
++/* stuff used for 'jp2k' box */
++WHERE Window jp2kW;
++WHERE int jp2kUp; /* is jp2kW mapped, or what? */
++#endif
++
++
+ #ifdef HAVE_TIFF
+ /* stuff used for 'tiff' box */
+ WHERE Window tiffW;
+@@ -1154,6 +1397,91 @@
+ #endif
--void DrawTempGauge PARM((Window, int, int, int, int, double,
-+void DrawTempGauge PARM((Window, int, int, int, int, double,
- u_long, u_long, u_long, u_long, char *));
- void ProgressMeter PARM((int, int, int, char *));
- void XVDeletedFile PARM((char *));
-@@ -1248,6 +1284,7 @@
- void xv_getwd PARM((char *, size_t));
- char *xv_strstr PARM((char *, char *));
- FILE *xv_fopen PARM((char *, char *));
-+void xv_mktemp PARM((char *, char *));
- void Timer PARM((int));
-
- /*************************** XVCOLOR.C ***************************/
-@@ -1282,11 +1319,11 @@
- void DrawEpic PARM((void));
- void KillOldPics PARM((void));
--byte *FSDither PARM((byte *, int, int, int,
-+byte *FSDither PARM((byte *, int, int, int,
- byte *, byte *, byte *, int, int));
++#ifdef HAVE_PNG
++/* stuff used for 'png' box */
++WHERE Window pngW;
++WHERE int pngUp; /* is pngW mapped, or what? */
++#endif
++
++
++#ifdef ENABLE_FIXPIX_SMOOTH
++WHERE int do_fixpix_smooth; /* GRR 19980607: runtime FS dithering */
++#endif
++
++#ifdef HAVE_PIC2
++/* stuff used for 'pic2' box */
++WHERE Window pic2W;
++WHERE int pic2Up; /* is pic2W mapped, or what? */
++#endif /* HAVE_PIC2 */
++
++#ifdef HAVE_PCD
++/* stuff used for 'pcd' box */
++WHERE Window pcdW;
++WHERE int pcdUp; /* is pcdW mapped, or what? */
++#endif /* HAVE_PCD */
++
++#ifdef HAVE_MGCSFX
++/* stuff used for 'mgcsfx' box */
++WHERE Window mgcsfxW;
++WHERE Window mgcsfxNameW;
++WHERE int mgcsfxUp; /* is mgcsfxW mapped, or what? */
++#endif /* HAVE_MGCSFX */
++
++#ifdef TV_L10N
++/* stuff used for TextViewer Japanization */
++# define LOCALE_USASCII 0
++# define LOCALE_EUCJ 1
++# define LOCALE_JIS 2
++# define LOCALE_MSCODE 3
++
++# ifndef LOCALE_DEFAULT
++# define LOCALE_DEFAULT 0
++# endif /* !LOCALE_DEFAULT */
++
++# ifndef MAIN
++ extern char *localeList[];
++# else
++# ifndef LOCALE_NAME_EUC
++# ifndef X_LOCALE
++# if defined(__FreeBSD__)
++ char *localeList[] = {"", "ja_JP.EUC", "none", "none"};
++# elif defined(__linux__)
++ char *localeList[] = {"", "ja_JP.eucJP", "none", "ja_JP.SJIS"};
++# elif defined(__sun) || defined(sun)
++ char *localeList[] = {"", "ja", "none", "none"};
++# elif defined(__sgi) /* sgi, __sgi, __sgi__ (gcc) */
++ char *localeList[] = {"", "ja_JP.EUC", "none", "none"};
++# elif defined(sony_news)
++ char *localeList[] = {"", "ja_JP.EUC", "none", "ja_JP.SJIS"};
++# elif defined(nec)
++ char *localeList[] = {"", "japan", "none", "none"};
++# elif defined(__hpux)
++ char *localeList[] = {"", "japanese.euc", "none", "japanese"};
++# elif defined(__osf__)
++ char *localeList[] = {"", "ja_JP.deckanji", "none", "ja_JP.SJIS"};
++# elif defined(_AIX)
++ char *localeList[] = {"", "ja_JP", "none", "Ja_JP" };
++# elif defined(__bsdi)
++ char *localeList[] = {"", "Japanese-EUC", "none", "none" };
++# else
++ char *localeList[] = {"", "ja_JP.EUC", "ja_JP.JIS", "ja_JP.SJIS"};
++# endif
++# else
++# if (XlibSpecificationRelease > 5)
++ char *localeList[] = {"", "ja_JP.eucJP", "ja_JP.JIS7",
++ "ja_JP.SJIS"};
++# else
++ char *localeList[] = {"", "ja_JP.ujis", "ja_JP.jis7",
++ "ja_JP.mscode"};
++# endif
++# endif /* X_LOCALE */
++# else
++ char *localeList[] = {"", LOCALE_NAME_EUC,
++ LOCALE_NAME_JIS, LOCALE_NAME_MSCODE};
++# endif /* LOCALE_NAME_EUC */
++# endif /* MAIN */
++#endif /* TV_L10N */
++
+ #undef WHERE
+
+
+@@ -1161,172 +1489,115 @@
+ /* function declarations for externally-callable functions */
+
+ /****************************** XV.C ****************************/
+-int ReadFileType PARM((char *));
+-int ReadPicFile PARM((char *, int, PICINFO *, int));
+-int UncompressFile PARM((char *, char *));
+-void KillPageFiles PARM((char *, int));
+-
+-void NewPicGetColors PARM((int, int));
+-void FixAspect PARM((int, int *, int *));
+-void ActivePrevNext PARM((void));
+-int DeleteCmd PARM((void));
+-void StickInCtrlList PARM((int));
+-void AddFNameToCtrlList PARM((char *, char *));
+-void ChangedCtrlList PARM((void));
+-void HandleDispMode PARM((void));
+-char *lower_str PARM((char *));
+-int rd_int PARM((char *));
+-int rd_str PARM((char *));
+-int rd_flag PARM((char *));
+-int rd_str_cl PARM((char *, char *, int));
++int ReadFileType PARM((char *));
++int ReadPicFile PARM((char *, int, PICINFO *, int));
++int UncompressFile PARM((char *, char *, int));
++void KillPageFiles PARM((char *, int));
++#ifdef MACBINARY
++int RemoveMacbinary PARM((char *, char *));
++#endif
++
++void NewPicGetColors PARM((int, int));
++void FixAspect PARM((int, int *, int *));
++void ActivePrevNext PARM((void));
++int DeleteCmd PARM((void));
++void StickInCtrlList PARM((int));
++void AddFNameToCtrlList PARM((const char *, const char *));
++void ChangedCtrlList PARM((void));
++void HandleDispMode PARM((void));
++char *lower_str PARM((char *));
++int rd_int PARM((const char *));
++int rd_str PARM((const char *));
++int rd_flag PARM((const char *));
+
+-/****************************** XVEVENT.C ****************************/
+-int EventLoop PARM((void));
+-int HandleEvent PARM((XEvent *, int *));
+
+-void SelectDispMB PARM((int));
+-void Select24to8MB PARM((int));
+-void SelectRootMB PARM((int));
+-void SelectWindowMB PARM((int));
+-void SelectSizeMB PARM((int));
+-
+-void DoPrint PARM((void));
+-void NewCutBuffer PARM((char *));
+-void DrawWindow PARM((int,int,int,int));
+-void WResize PARM((int, int));
+-void WRotate PARM((void));
+-void WCrop PARM((int, int, int, int));
+-void WUnCrop PARM((void));
+-void GetWindowPos PARM((XWindowAttributes *));
+-void SetWindowPos PARM((XWindowAttributes *));
+-void SetEpicMode PARM((void));
+-int xvErrorHandler PARM((Display *, XErrorEvent *));
+-
+-/****************************** XVROOT.C ****************************/
+-void MakeRootPic PARM((void));
+-void ClearRoot PARM((void));
+-void SaveRootInfo PARM((void));
+-void KillOldRootInfo PARM((void));
++/*************************** XV24TO8.C **************************/
++void Init24to8 PARM((void));
++byte *Conv24to8 PARM((byte *, int, int, int,
++ byte *, byte *, byte *));
- void CreateXImage PARM((void));
+-/*************************** XVMISC.C ***************************/
+-void StoreDeleteWindowProp PARM((Window));
+-Window CreateWindow PARM((char *, char *, char *, int, int,
+- u_long, u_long, int));
+-void DrawString PARM((Window, int, int, char *));
+-void CenterString PARM((Window, int, int, char *));
+-void ULineString PARM((Window, int, int, char *));
+-int StringWidth PARM((char *));
+-int CursorKey PARM((KeySym, int, int));
+-void FakeButtonPress PARM((BUTT *));
+-void FakeKeyPress PARM((Window, KeySym));
+-void GenExpose PARM((Window, int, int, u_int, u_int));
+-void DimRect PARM((Window, int, int, u_int, u_int, u_long));
+-
+-void Draw3dRect PARM((Window, int, int, u_int, u_int, int, int,
+- u_long, u_long, u_long));
+-
+-void RemapKeyCheck PARM((KeySym, char *, int *));
+-void xvDestroyImage PARM((XImage *));
+-void SetCropString PARM((void));
+-void SetSelectionString PARM((void));
+-void Warning PARM((void));
+-void FatalError PARM((char *));
+-void Quit PARM((int));
+-void LoadFishCursors PARM((void));
+-void WaitCursor PARM((void));
+-void SetCursors PARM((int));
+-char *BaseName PARM((char *));
+-
+-void DrawTempGauge PARM((Window, int, int, int, int, double,
+- u_long, u_long, u_long, u_long, char *));
+-void ProgressMeter PARM((int, int, int, char *));
+-void XVDeletedFile PARM((char *));
+-void XVCreatedFile PARM((char *));
+-void xvbcopy PARM((char *, char *, size_t));
+-int xvbcmp PARM((char *, char *, size_t));
+-void xvbzero PARM((char *, size_t));
+-void xv_getwd PARM((char *, size_t));
+-char *xv_strstr PARM((char *, char *));
+-FILE *xv_fopen PARM((char *, char *));
+-void Timer PARM((int));
++byte *Conv8to24 PARM((byte *, int, int, byte *, byte *, byte *));
+
+-/*************************** XVCOLOR.C ***************************/
+-void SortColormap PARM((byte *, int, int, int *, byte*,byte*,byte*,
+- byte *, byte *));
+-void ColorCompress8 PARM((byte *));
+-void AllocColors PARM((void));
+-Status xvAllocColor PARM((Display *, Colormap, XColor *));
+-void xvFreeColors PARM((Display *, Colormap, u_long *, int, u_long));
+-void FreeColors PARM((void));
+-void ApplyEditColor PARM((int));
+-int MakeStdCmaps PARM((void));
+-void MakeBrowCmap PARM((void));
+-void ChangeCmapMode PARM((int, int, int));
+
+-/*************************** XVIMAGE.C ***************************/
+-void Resize PARM((int, int));
+-void GenerateCpic PARM((void));
+-void GenerateEpic PARM((int, int));
+-void DoZoom PARM((int, int, u_int));
+-void Crop PARM((void));
+-void UnCrop PARM((void));
+-void AutoCrop PARM((void));
+-int DoAutoCrop PARM((void));
+-void DoCrop PARM((int, int, int, int));
+-void Rotate PARM((int));
+-void DoRotate PARM((int));
+-void RotatePic PARM((byte *, int, int *, int *, int));
+-void Flip PARM((int));
+-void FlipPic PARM((byte *, int, int, int));
+-void InstallNewPic PARM((void));
+-void DrawEpic PARM((void));
+-void KillOldPics PARM((void));
+-
+-byte *FSDither PARM((byte *, int, int, int,
+- byte *, byte *, byte *, int, int));
+-
+-void CreateXImage PARM((void));
-XImage *Pic8ToXImage PARM((byte *, u_int, u_int, u_long *,
-+XImage *Pic8ToXImage PARM((byte *, u_int, u_int, u_long *,
- byte *, byte *, byte *));
-
- XImage *Pic24ToXImage PARM((byte *, u_int, u_int));
-@@ -1306,21 +1343,21 @@
- void DoAlg PARM((int));
-
- /*************************** XVSMOOTH.C ***************************/
+- byte *, byte *, byte *));
+-
+-XImage *Pic24ToXImage PARM((byte *, u_int, u_int));
+-
+-void Set824Menus PARM((int));
+-void Change824Mode PARM((int));
+-void FreeEpic PARM((void));
+-void InvertPic24 PARM((byte *, int, int));
++/*************************** XVALG.C ***************************/
++void AlgInit PARM((void));
++void DoAlg PARM((int));
+
+-byte *XVGetSubImage PARM((byte *, int, int,int, int,int,int,int));
+
+-int DoPad PARM((int, char *, int, int, int, int));
+-int LoadPad PARM((PICINFO *, char *));
++/*************************** XVBROWSE.C ************************/
++void CreateBrowse PARM((const char *, const char *, const char *,
++ const char *, const char *));
++void OpenBrowse PARM((void));
++void HideBrowseWindows PARM((void));
++void UnHideBrowseWindows PARM((void));
++void SetBrowseCursor PARM((Cursor));
++void KillBrowseWindows PARM((void));
++int BrowseCheckEvent PARM((XEvent *, int *, int *));
++int BrowseDelWin PARM((Window));
++void SetBrowStr PARM((const char *));
++void RegenBrowseIcons PARM((void));
++void BRDeletedFile PARM((char *));
++void BRCreatedFile PARM((char *));
+
+-/*************************** XVALG.C ***************************/
+-void AlgInit PARM((void));
+-void DoAlg PARM((int));
+
+-/*************************** XVSMOOTH.C ***************************/
-byte *SmoothResize PARM((byte *, int, int, int, int, byte *, byte *,
-+byte *SmoothResize PARM((byte *, int, int, int, int, byte *, byte *,
- byte *, byte *, byte *, byte *, int));
+- byte *, byte *, byte *, byte *, int));
++/**************************** XVBUTT.C ***************************/
++void BTCreate PARM((BUTT *, Window, int, int, u_int, u_int,
++ const char *, u_long, u_long, u_long, u_long));
-byte *Smooth24 PARM((byte *, int, int, int, int, int,
-+byte *Smooth24 PARM((byte *, int, int, int, int, int,
- byte *, byte *, byte *));
+- byte *, byte *, byte *));
++void BTSetActive PARM((BUTT *, int));
++void BTRedraw PARM((BUTT *));
++int BTTrack PARM((BUTT *));
-byte *DoColorDither PARM((byte *, byte *, int, int, byte *, byte *,
-+byte *DoColorDither PARM((byte *, byte *, int, int, byte *, byte *,
- byte *, byte *, byte *, byte *, int));
+- byte *, byte *, byte *, byte *, int));
-byte *Do332ColorDither PARM((byte *, byte *, int, int, byte *, byte *,
-+byte *Do332ColorDither PARM((byte *, byte *, int, int, byte *, byte *,
- byte *, byte *, byte *, byte *, int));
+- byte *, byte *, byte *, byte *, int));
++RBUTT *RBCreate PARM((RBUTT *, Window, int, int, const char *,
++ u_long, u_long, u_long, u_long));
- /*************************** XV24TO8.C **************************/
- void Init24to8 PARM((void));
+-/*************************** XV24TO8.C **************************/
+-void Init24to8 PARM((void));
-byte *Conv24to8 PARM((byte *, int, int, int,
-+byte *Conv24to8 PARM((byte *, int, int, int,
- byte *, byte *, byte *));
-
- byte *Conv8to24 PARM((byte *, int, int, byte *, byte *, byte *));
-@@ -1337,7 +1374,7 @@
+- byte *, byte *, byte *));
++void RBRedraw PARM((RBUTT *, int));
++void RBSelect PARM((RBUTT *, int));
++int RBWhich PARM((RBUTT *));
++int RBCount PARM((RBUTT *));
++void RBSetActive PARM((RBUTT *, int, int));
++int RBClick PARM((RBUTT *, int, int));
++int RBTrack PARM((RBUTT *, int));
++
++
++void CBCreate PARM((CBUTT *, Window, int, int, const char *,
++ u_long, u_long, u_long, u_long));
++
++void CBRedraw PARM((CBUTT *));
++void CBSetActive PARM((CBUTT *, int));
++int CBClick PARM((CBUTT *,int,int));
++int CBTrack PARM((CBUTT *));
++
++
++void MBCreate PARM((MBUTT *, Window, int, int, u_int, u_int,
++ const char *, const char * const *, int,
++ u_long, u_long, u_long, u_long));
++
++void MBRedraw PARM((MBUTT *));
++void MBSetActive PARM((MBUTT *, int));
++int MBWhich PARM((MBUTT *));
++void MBSelect PARM((MBUTT *, int));
++int MBClick PARM((MBUTT *, int, int));
++int MBTrack PARM((MBUTT *));
++
++
++/*************************** XVCOLOR.C ***************************/
++void SortColormap PARM((byte *, int, int, int *, byte*,byte*,byte*,
++ byte *, byte *));
++void ColorCompress8 PARM((byte *));
++void AllocColors PARM((void));
++Status xvAllocColor PARM((Display *, Colormap, XColor *));
++void xvFreeColors PARM((Display *, Colormap, u_long *, int, u_long));
++void FreeColors PARM((void));
++void ApplyEditColor PARM((int));
++int MakeStdCmaps PARM((void));
++void MakeBrowCmap PARM((void));
++void ChangeCmapMode PARM((int, int, int));
+
+-byte *Conv8to24 PARM((byte *, int, int, byte *, byte *, byte *));
+
+ /**************************** XVCTRL.C **************************/
+-void CreateCtrl PARM((char *));
++void CreateCtrl PARM((const char *));
+ void SetButtPix PARM((BUTT *, Pixmap, int, int));
+ Pixmap MakePix1 PARM((Window, byte *, int, int));
+
+@@ -1337,7 +1608,7 @@
void DrawCtrlStr PARM((void));
void ScrollToCurrent PARM((LIST *));
@@ -4993,172 +8404,716 @@ diff -ruN xv-3.10a/xv.h xv-3.10a-bugfixes/xv.h
char **, int, u_long, u_long, u_long, u_long,
void (*)(int, SCRL *), int, int));
-@@ -1384,7 +1421,7 @@
- FILE *OpenOutFile PARM((char *));
- int CloseOutFile PARM((FILE *, char *, int));
+@@ -1346,20 +1617,56 @@
+ void LSChangeData PARM((LIST *, char **, int));
+ void LSNewData PARM((LIST *, char **, int));
+ void LSKey PARM((LIST *, int));
++int rd_str_cl PARM((const char *, const char *, int));
+
+
+-/*************************** XVINFO.C ***************************/
+-void CreateInfo PARM((char *));
+-void InfoBox PARM((int));
+-void RedrawInfo PARM((int, int, int, int));
+-void SetInfoMode PARM((int));
+-char *GetISTR PARM((int));
++/**************************** XVCUT.C ***************************/
++int CutAllowed PARM((void));
++int PasteAllowed PARM((void));
++void DoImgCopy PARM((void));
++void DoImgCut PARM((void));
++void DoImgClear PARM((void));
++void DoImgPaste PARM((void));
+
+-#if defined(__STDC__) && !defined(NOSTDHDRS)
+-void SetISTR(int, ...);
+-#else
+-void SetISTR();
+-#endif
++void SaveToClip PARM((byte *));
++void InitSelection PARM((void));
++int HaveSelection PARM((void));
++int GetSelType PARM((void));
++void GetSelRCoords PARM((int *, int *, int *, int *));
++void EnableSelection PARM((int));
++void DrawSelection PARM((int));
++int DoSelection PARM((XButtonEvent *));
++void MoveGrowSelection PARM((int, int, int, int));
++void BlinkSelection PARM((int));
++void FlashSelection PARM((int));
++
++void CropRect2Rect PARM((int*,int*,int*,int*, int,int,int,int));
++void CoordE2C PARM((int, int, int *, int *));
++void CoordC2E PARM((int, int, int *, int *));
++void CoordP2C PARM((int, int, int *, int *));
++void CoordC2P PARM((int, int, int *, int *));
++void CoordP2E PARM((int, int, int *, int *));
++void CoordE2P PARM((int, int, int *, int *));
++
++
++/*************************** XVDFLT.C ***************************/
++void LoadDfltPic PARM((PICINFO *));
++void xbm2pic PARM((byte *, int, int, byte *, int, int, int, int,
++ int));
++void DrawStr2Pic PARM((char *, int, int, byte *, int, int, int));
++
++
++/*************************** XVDIAL.C ***************************/
++void DCreate PARM((DIAL *, Window, int, int, int, int,
++ double, double, double, double, double,
++ u_long, u_long, u_long, u_long,
++ const char *, const char *));
++
++void DSetRange PARM((DIAL *, double,double,double,double,double));
++void DSetVal PARM((DIAL *, double));
++void DSetActive PARM((DIAL *, int));
++void DRedraw PARM((DIAL *));
++int DTrack PARM((DIAL *, int, int));
+
+
+ /**************************** XVDIR.C ***************************/
+@@ -1376,15 +1683,15 @@
+ void TrackDDirW PARM((int,int));
+ int DirKey PARM((int));
+ int DoSave PARM((void));
+-void SetDirFName PARM((char *));
++void SetDirFName PARM((const char *));
+ char *GetDirFName PARM((void));
+ char *GetDirFullName PARM((void));
+ void SetDirSaveMode PARM((int, int));
+ int Globify PARM((char *));
+-FILE *OpenOutFile PARM((char *));
+-int CloseOutFile PARM((FILE *, char *, int));
++FILE *OpenOutFile PARM((const char *));
++int CloseOutFile PARM((FILE *, const char *, int));
-byte *GenSavePic PARM((int*, int*,int*, int*, int*,
+byte *GenSavePic PARM((int*, int*,int*, int*, int*,
byte**, byte**, byte**));
void GetSaveSize PARM((int *, int *));
-@@ -1451,11 +1488,11 @@
+@@ -1392,47 +1699,30 @@
+ int CheckPoll PARM((int));
+ void DIRDeletedFile PARM((char *));
+ void DIRCreatedFile PARM((char *));
++FILE *pic2_OpenOutFile PARM((char *, int *));
++void pic2_KillNullFile PARM((FILE *));
++int OpenOutFileDesc PARM((char *));
+
+
+-/*************************** XVBROWSE.C ************************/
+-void CreateBrowse PARM((char *, char *, char *, char *, char *));
+-void OpenBrowse PARM((void));
+-void HideBrowseWindows PARM((void));
+-void UnHideBrowseWindows PARM((void));
+-void SetBrowseCursor PARM((Cursor));
+-void KillBrowseWindows PARM((void));
+-int BrowseCheckEvent PARM((XEvent *, int *, int *));
+-int BrowseDelWin PARM((Window));
+-void SetBrowStr PARM((char *));
+-void RegenBrowseIcons PARM((void));
+-void BRDeletedFile PARM((char *));
+-void BRCreatedFile PARM((char *));
+-
+-
+-/*************************** XVTEXT.C ************************/
+-void CreateTextWins PARM((char *, char *));
+-void TextView PARM((char *));
+-void OpenTextView PARM((char *, int, char *, int));
+-
+-void OpenCommentText PARM((void));
+-void CloseCommentText PARM((void));
+-void ChangeCommentText PARM((void));
+-
+-void ShowLicense PARM((void));
+-void ShowKeyHelp PARM((void));
+-
+-void HideTextWindows PARM((void));
+-void UnHideTextWindows PARM((void));
+-void RaiseTextWindows PARM((void));
+-void SetTextCursor PARM((Cursor));
+-void KillTextWindows PARM((void));
+-int TextCheckEvent PARM((XEvent *, int *, int *));
+-int TextDelWin PARM((Window));
++/****************************** XVEVENT.C ****************************/
++int EventLoop PARM((void));
++int HandleEvent PARM((XEvent *, int *));
+
++void NewCutBuffer PARM((char *));
++void DrawWindow PARM((int,int,int,int));
++void WResize PARM((int, int));
++void WRotate PARM((void));
++void WCrop PARM((int, int, int, int));
++void WUnCrop PARM((void));
++void GetWindowPos PARM((XWindowAttributes *));
++void SetWindowPos PARM((XWindowAttributes *));
++void SetEpicMode PARM((void));
++int xvErrorHandler PARM((Display *, XErrorEvent *));
+
+
+ /**************************** XVGAM.C **************************/
+-void CreateGam PARM((char *, double, double, double, double, int));
++void CreateGam PARM((const char *, double, double, double, double,
++ int));
+ int GamCheckEvent PARM((XEvent *));
+ void GamBox PARM((int));
+ void NewCMap PARM((void));
+@@ -1450,173 +1740,344 @@
+ byte *GammifyPic24 PARM((byte *, int, int));
void GamSetAutoApply PARM((int));
- /*************************** XVSCRL.C ***************************/
+-/*************************** XVSCRL.C ***************************/
-void SCCreate PARM((SCRL *, Window, int, int, int, int,
- int, int, int, int, u_long, u_long,
-+void SCCreate PARM((SCRL *, Window, int, int, int, int,
-+ int, int, int, int, u_long, u_long,
- u_long, u_long, void (*)(int, SCRL *)));
+- u_long, u_long, void (*)(int, SCRL *)));
-void SCChange PARM((SCRL *, int, int, int, int, int,
-+void SCChange PARM((SCRL *, int, int, int, int, int,
- int, int, int));
+- int, int, int));
++/**************************** XVGRAB.C ***************************/
++int Grab PARM((void));
++int LoadGrab PARM((PICINFO *));
- void SCSetRange PARM((SCRL *, int, int, int, int));
-@@ -1465,8 +1502,8 @@
+-void SCSetRange PARM((SCRL *, int, int, int, int));
+-int SCSetVal PARM((SCRL *, int));
+-void SCRedraw PARM((SCRL *));
+-void SCTrack PARM((SCRL *, int, int));
++/**************************** XVGRAF.C ***************************/
++void CreateGraf PARM((GRAF *, Window, int, int,
++ u_long, u_long, const char *));
- /*************************** XVDIAL.C ***************************/
+-/*************************** XVDIAL.C ***************************/
-void DCreate PARM((DIAL *, Window, int, int, int, int, int,
- int, int, int, u_long, u_long, u_long,
-+void DCreate PARM((DIAL *, Window, int, int, int, int, int,
-+ int, int, int, u_long, u_long, u_long,
- u_long, char *, char *));
-
- void DSetRange PARM((DIAL *, int, int, int, int));
-@@ -1477,7 +1514,7 @@
-
-
- /**************************** XVBUTT.C ***************************/
+- u_long, char *, char *));
++void InitGraf PARM((GRAF *));
++void RedrawGraf PARM((GRAF *, int));
++int ClickGraf PARM((GRAF *, Window, int, int));
++int GrafKey PARM((GRAF *, char *));
++void GenerateGrafFunc PARM((GRAF *, int));
++void Graf2Str PARM((GRAF_STATE *, char *));
++int Str2Graf PARM((GRAF_STATE *, const char *));
++void GetGrafState PARM((GRAF *, GRAF_STATE *));
++int SetGrafState PARM((GRAF *, GRAF_STATE *));
++void InitSpline PARM((int *, int *, int, double *));
++double EvalSpline PARM((int *, int *, double *, int, double));
+
+-void DSetRange PARM((DIAL *, int, int, int, int));
+-void DSetVal PARM((DIAL *, int));
+-void DSetActive PARM((DIAL *, int));
+-void DRedraw PARM((DIAL *));
+-int DTrack PARM((DIAL *, int, int));
+
++/*************************** XVIMAGE.C ***************************/
++void Resize PARM((int, int));
++void GenerateCpic PARM((void));
++void GenerateEpic PARM((int, int));
++void DoZoom PARM((int, int, u_int));
++void Crop PARM((void));
++void UnCrop PARM((void));
++void AutoCrop PARM((void));
++int DoAutoCrop PARM((void));
++void DoCrop PARM((int, int, int, int));
++void Rotate PARM((int));
++void DoRotate PARM((int));
++void RotatePic PARM((byte *, int, int *, int *, int));
++void Flip PARM((int));
++void FlipPic PARM((byte *, int, int, int));
++void InstallNewPic PARM((void));
++void DrawEpic PARM((void));
++void KillOldPics PARM((void));
+
+-/**************************** XVBUTT.C ***************************/
-void BTCreate PARM((BUTT *, Window, int, int, u_int, u_int,
-+void BTCreate PARM((BUTT *, Window, int, int, u_int, u_int,
- char *, u_long, u_long, u_long, u_long));
+- char *, u_long, u_long, u_long, u_long));
++byte *FSDither PARM((byte *, int, int, int,
++ byte *, byte *, byte *, int, int));
- void BTSetActive PARM((BUTT *, int));
-@@ -1485,7 +1522,7 @@
- int BTTrack PARM((BUTT *));
+-void BTSetActive PARM((BUTT *, int));
+-void BTRedraw PARM((BUTT *));
+-int BTTrack PARM((BUTT *));
++void CreateXImage PARM((void));
++XImage *Pic8ToXImage PARM((byte *, u_int, u_int, u_long *,
++ byte *, byte *, byte *));
++XImage *Pic24ToXImage PARM((byte *, u_int, u_int));
-RBUTT *RBCreate PARM((RBUTT *, Window, int, int, char *,
-+RBUTT *RBCreate PARM((RBUTT *, Window, int, int, char *,
- u_long, u_long, u_long, u_long));
-
- void RBRedraw PARM((RBUTT *, int));
-@@ -1497,7 +1534,7 @@
- int RBTrack PARM((RBUTT *, int));
-
+- u_long, u_long, u_long, u_long));
++void Set824Menus PARM((int));
++void Change824Mode PARM((int));
++void FreeEpic PARM((void));
++void InvertPic24 PARM((byte *, int, int));
+
+-void RBRedraw PARM((RBUTT *, int));
+-void RBSelect PARM((RBUTT *, int));
+-int RBWhich PARM((RBUTT *));
+-int RBCount PARM((RBUTT *));
+-void RBSetActive PARM((RBUTT *, int, int));
+-int RBClick PARM((RBUTT *, int, int));
+-int RBTrack PARM((RBUTT *, int));
++byte *XVGetSubImage PARM((byte *, int, int,int, int,int,int,int));
+
++int DoPad PARM((int, char *, int, int, int, int));
++int LoadPad PARM((PICINFO *, char *));
-void CBCreate PARM((CBUTT *, Window, int, int, char *,
-+void CBCreate PARM((CBUTT *, Window, int, int, char *,
- u_long, u_long, u_long, u_long));
-
- void CBRedraw PARM((CBUTT *));
-@@ -1506,8 +1543,8 @@
- int CBTrack PARM((CBUTT *));
-
+- u_long, u_long, u_long, u_long));
+
+-void CBRedraw PARM((CBUTT *));
+-void CBSetActive PARM((CBUTT *, int));
+-int CBClick PARM((CBUTT *,int,int));
+-int CBTrack PARM((CBUTT *));
++/*************************** XVINFO.C ***************************/
++void CreateInfo PARM((const char *));
++void InfoBox PARM((int));
++void RedrawInfo PARM((int, int, int, int));
++void SetInfoMode PARM((int));
++char *GetISTR PARM((int));
+
++#if defined(__STDC__) && !defined(NOSTDHDRS)
++void SetISTR(int, ...);
++#else
++void SetISTR();
++#endif
-void MBCreate PARM((MBUTT *, Window, int, int, u_int, u_int,
- char *,
-+void MBCreate PARM((MBUTT *, Window, int, int, u_int, u_int,
-+ char *,
- char **, int,u_long,u_long, u_long, u_long));
-
- void MBRedraw PARM((MBUTT *));
-@@ -1519,7 +1556,7 @@
-
-
- /**************************** XVGRAF.C ***************************/
+- char **, int,u_long,u_long, u_long, u_long));
+
+-void MBRedraw PARM((MBUTT *));
+-void MBSetActive PARM((MBUTT *, int));
+-int MBWhich PARM((MBUTT *));
+-void MBSelect PARM((MBUTT *, int));
+-int MBClick PARM((MBUTT *, int, int));
+-int MBTrack PARM((MBUTT *));
++/*************************** XVMISC.C ***************************/
++void StoreDeleteWindowProp PARM((Window));
++Window CreateWindow PARM((const char *, const char *, const char *,
++ int, int, u_long, u_long, int));
++void DrawString PARM((Window, int, int, const char *));
++void CenterString PARM((Window, int, int, const char *));
++void ULineString PARM((Window, int, int, const char *));
++int StringWidth PARM((const char *));
++int CursorKey PARM((KeySym, int, int));
++void FakeButtonPress PARM((BUTT *));
++void FakeKeyPress PARM((Window, KeySym));
++void GenExpose PARM((Window, int, int, u_int, u_int));
++void DimRect PARM((Window, int, int, u_int, u_int, u_long));
++
++void Draw3dRect PARM((Window, int, int, u_int, u_int, int, int,
++ u_long, u_long, u_long));
++
++void RemapKeyCheck PARM((KeySym, char *, int *));
++void xvDestroyImage PARM((XImage *));
++void SetCropString PARM((void));
++void SetSelectionString PARM((void));
++void Warning PARM((void));
++void FatalError PARM((const char *));
++void Quit PARM((int));
++void LoadFishCursors PARM((void));
++void WaitCursor PARM((void));
++void SetCursors PARM((int));
++const char *BaseName PARM((const char *));
++
++void DrawTempGauge PARM((Window, int, int, int, int, double, u_long,
++ u_long, u_long, u_long, const char *));
++void ProgressMeter PARM((int, int, int, const char *));
++void XVDeletedFile PARM((char *));
++void XVCreatedFile PARM((char *));
++void xvbcopy PARM((const char *, char *, size_t));
++int xvbcmp PARM((const char *, const char *, size_t));
++void xvbzero PARM((char *, size_t));
++void xv_getwd PARM((char *, size_t));
++char *xv_strstr PARM((const char *, const char *));
++FILE *xv_fopen PARM((const char *, const char *));
++void xv_mktemp PARM((char *, const char *));
++void Timer PARM((int));
+
+
+-/**************************** XVGRAF.C ***************************/
-void CreateGraf PARM((GRAF *, Window, int, int,
-+void CreateGraf PARM((GRAF *, Window, int, int,
- u_long, u_long, char *));
-
- void InitGraf PARM((GRAF *));
-@@ -1539,32 +1576,32 @@
- int LoadGIF PARM((char *, PICINFO *));
-
- /*************************** XVGIFWR.C **************************/
+- u_long, u_long, char *));
++/*************************** XVPOPUP.C ***************************/
++void CenterMapWindow PARM((Window, int, int, int, int));
++int PopUp PARM((const char *, const char **, int));
++void ErrPopUp PARM((const char *, const char *));
++int GetStrPopUp PARM((const char *, const char **, int, char *, int,
++ const char *, int));
++int GrabPopUp PARM((int *, int *));
++int PadPopUp PARM((int *, char **, int *, int *, int *, int *));
++void ClosePopUp PARM((void));
++void OpenAlert PARM((const char *));
++void CloseAlert PARM((void));
++int PUCheckEvent PARM((XEvent *));
+
+-void InitGraf PARM((GRAF *));
+-void RedrawGraf PARM((GRAF *, int));
+-int ClickGraf PARM((GRAF *, Window, int, int));
+-int GrafKey PARM((GRAF *, char *));
+-void GenerateGrafFunc PARM((GRAF *, int));
+-void Graf2Str PARM((GRAF_STATE *, char *));
+-int Str2Graf PARM((GRAF_STATE *, char *));
+-void GetGrafState PARM((GRAF *, GRAF_STATE *));
+-int SetGrafState PARM((GRAF *, GRAF_STATE *));
+-void InitSpline PARM((int *, int *, int, double *));
+-double EvalSpline PARM((int *, int *, double *, int, double));
+
++/**************************** XVROOT.C ****************************/
++void MakeRootPic PARM((void));
++void ClearRoot PARM((void));
++void SaveRootInfo PARM((void));
++void KillOldRootInfo PARM((void));
+
+-/**************************** XVGIF.C ***************************/
+-int LoadGIF PARM((char *, PICINFO *));
+
+-/*************************** XVGIFWR.C **************************/
-int WriteGIF PARM((FILE *, byte *, int, int, int,
-+int WriteGIF PARM((FILE *, byte *, int, int, int,
- byte *, byte *, byte *, int, int, char *));
+- byte *, byte *, byte *, int, int, char *));
++/*************************** XVSCRL.C ***************************/
++void SCCreate PARM((SCRL *, Window, int, int, int, int,
++ int, int, int, int, u_long, u_long,
++ u_long, u_long, void (*)(int, SCRL *)));
- /**************************** XVPM.C ****************************/
- int LoadPM PARM((char *, PICINFO *));
+-/**************************** XVPM.C ****************************/
+-int LoadPM PARM((char *, PICINFO *));
-int WritePM PARM((FILE *, byte *, int, int, int, byte *,
-+int WritePM PARM((FILE *, byte *, int, int, int, byte *,
- byte *, byte *, int, int, char *));
+- byte *, byte *, int, int, char *));
++void SCChange PARM((SCRL *, int, int, int, int, int,
++ int, int, int));
- /**************************** XVPBM.C ***************************/
- int LoadPBM PARM((char *, PICINFO *));
+-/**************************** XVPBM.C ***************************/
+-int LoadPBM PARM((char *, PICINFO *));
-int WritePBM PARM((FILE *, byte *, int, int, int, byte *,
-+int WritePBM PARM((FILE *, byte *, int, int, int, byte *,
- byte *, byte *, int, int, int, char *));
-
- /**************************** XVXBM.C ***************************/
- int LoadXBM PARM((char *, PICINFO *));
+- byte *, byte *, int, int, int, char *));
++void SCSetRange PARM((SCRL *, int, int, int, int));
++int SCSetVal PARM((SCRL *, int));
++void SCRedraw PARM((SCRL *));
++void SCTrack PARM((SCRL *, int, int));
+
+-/**************************** XVXBM.C ***************************/
+-int LoadXBM PARM((char *, PICINFO *));
-int WriteXBM PARM((FILE *, byte *, int, int, byte *, byte *,
-+int WriteXBM PARM((FILE *, byte *, int, int, byte *, byte *,
- byte *, char *));
+- byte *, char *));
- /**************************** XVSUNRAS.C ***************************/
- int LoadSunRas PARM((char *, PICINFO *));
+-/**************************** XVSUNRAS.C ***************************/
+-int LoadSunRas PARM((char *, PICINFO *));
-int WriteSunRas PARM((FILE *, byte *, int, int, int, byte *,
-+int WriteSunRas PARM((FILE *, byte *, int, int, int, byte *,
- byte *, byte*, int, int, int));
+- byte *, byte*, int, int, int));
++/*************************** XVSMOOTH.C ***************************/
++byte *SmoothResize PARM((byte *, int, int, int, int, byte *, byte *,
++ byte *, byte *, byte *, byte *, int));
- /**************************** XVBMP.C ***************************/
- int LoadBMP PARM((char *, PICINFO *));
+-/**************************** XVBMP.C ***************************/
+-int LoadBMP PARM((char *, PICINFO *));
-int WriteBMP PARM((FILE *, byte *, int, int, int, byte *,
-+int WriteBMP PARM((FILE *, byte *, int, int, int, byte *,
- byte *, byte *, int, int));
+- byte *, byte *, int, int));
++byte *Smooth24 PARM((byte *, int, int, int, int, int,
++ byte *, byte *, byte *));
- /**************************** XVRLE.C ***************************/
-@@ -1572,7 +1609,7 @@
+-/**************************** XVRLE.C ***************************/
+-int LoadRLE PARM((char *, PICINFO *));
++byte *DoColorDither PARM((byte *, byte *, int, int, byte *, byte *,
++ byte *, byte *, byte *, byte *, int));
- /**************************** XVIRIS.C ***************************/
- int LoadIRIS PARM((char *, PICINFO *));
+-/**************************** XVIRIS.C ***************************/
+-int LoadIRIS PARM((char *, PICINFO *));
-int WriteIRIS PARM((FILE *, byte *, int, int, int, byte *,
-+int WriteIRIS PARM((FILE *, byte *, int, int, int, byte *,
- byte *, byte *, int, int));
-
- /**************************** XVPCX.C ***************************/
-@@ -1583,12 +1620,12 @@
-
- /**************************** XVTARGA.C ***************************/
- int LoadTarga PARM((char *, PICINFO *));
+- byte *, byte *, int, int));
++byte *Do332ColorDither PARM((byte *, byte *, int, int, byte *, byte *,
++ byte *, byte *, byte *, byte *, int));
+
+-/**************************** XVPCX.C ***************************/
+-int LoadPCX PARM((char *, PICINFO *));
+
+-/**************************** XVIFF.C ***************************/
+-int LoadIFF PARM((char *, PICINFO *));
++/*************************** XVTEXT.C ************************/
++void CreateTextWins PARM((const char *, const char *));
++int TextView PARM((const char *));
++void OpenTextView PARM((const char *, int, const char *, int));
+
+-/**************************** XVTARGA.C ***************************/
+-int LoadTarga PARM((char *, PICINFO *));
-int WriteTarga PARM((FILE *, byte *, int, int, int, byte *,
-+int WriteTarga PARM((FILE *, byte *, int, int, int, byte *,
- byte *, byte *, int, int));
+- byte *, byte *, int, int));
++void OpenCommentText PARM((void));
++void CloseCommentText PARM((void));
++void ChangeCommentText PARM((void));
- /**************************** XVXPM.C ***************************/
- int LoadXPM PARM((char *, PICINFO *));
+-/**************************** XVXPM.C ***************************/
+-int LoadXPM PARM((char *, PICINFO *));
-int WriteXPM PARM((FILE *, byte *, int, int, int, byte *,
-+int WriteXPM PARM((FILE *, byte *, int, int, int, byte *,
- byte *, byte *, int, int, char *, char *));
+- byte *, byte *, int, int, char *, char *));
++void ShowLicense PARM((void));
++void ShowKeyHelp PARM((void));
+
+-/**************************** XVXWD.C ***************************/
+-int LoadXWD PARM((char *, PICINFO *));
++void HideTextWindows PARM((void));
++void UnHideTextWindows PARM((void));
++void RaiseTextWindows PARM((void));
++void SetTextCursor PARM((Cursor));
++void KillTextWindows PARM((void));
++int TextCheckEvent PARM((XEvent *, int *, int *));
++int TextDelWin PARM((Window));
++
++int CharsetCheckEvent PARM((XEvent *));
++int CharsetDelWin PARM((Window));
++
++
++/**************************** XVVD.C ****************************/
++void Vdinit PARM((void));
++void Vdsettle PARM((void));
++int Chvdir PARM((char *));
++void Dirtovd PARM((char *));
++void Vdtodir PARM((char *));
++void Dirtosubst PARM((char *));
++int Mkvdir PARM((char *));
++void Mkvdir_force PARM((char *));
++int Rmvdir PARM((char *));
++int Movevdir PARM((char *, char *));
++int Isarchive PARM((char *));
++int Isvdir PARM((char *));
++void vd_HUPhandler PARM((void));
++void vd_handler PARM((int));
++int vd_Xhandler PARM((Display *, XErrorEvent *));
++int vd_XIOhandler PARM((Display *));
++void vd_handler_setup PARM((void));
++
++
++
++/*=======================================================================*/
++/* IMAGE FORMATS */
++/*=======================================================================*/
++
++/**************************** XVBMP.C ***************************/
++int LoadBMP PARM((char *, PICINFO *));
++int WriteBMP PARM((FILE *, byte *, int, int, int, byte *,
++ byte *, byte *, int, int));
- /**************************** XVXWD.C ***************************/
-@@ -1607,7 +1644,7 @@
+ /**************************** XVFITS.C ***************************/
+ int LoadFITS PARM((char *, PICINFO *, int));
+ int WriteFITS PARM((FILE *, byte *, int, int, int, byte *,
+ byte *, byte *, int, int, char *));
+
++/**************************** XVGIF.C ***************************/
++int LoadGIF PARM((char *, PICINFO *));
++
++/**************************** XVGIFWR.C **************************/
++int WriteGIF PARM((FILE *, byte *, int, int, int,
++ byte *, byte *, byte *, int, int, char *));
++
++/**************************** XVHIPS.C ***************************/
++int LoadHIPS PARM((char *, PICINFO *));
++
++/**************************** XVIFF.C ***************************/
++int LoadIFF PARM((char *, PICINFO *));
++
++/**************************** XVIRIS.C ***************************/
++int LoadIRIS PARM((char *, PICINFO *));
++int WriteIRIS PARM((FILE *, byte *, int, int, int, byte *,
++ byte *, byte *, int, int));
++
++/**************************** XVJP2K.C ***************************/
++int LoadJPC PARM((char *, register PICINFO *, int));
++int LoadJP2 PARM((char *, register PICINFO *, int));
++void CreateJP2KW PARM((void));
++void JP2KSaveParams PARM((int, char *, int));
++void JP2KDialog PARM((int vis));
++int JP2KCheckEvent PARM((register XEvent *));
++void VersionInfoJP2K PARM((void)); /* GRR 20070304 */
++
+ /**************************** XVJPEG.C ***************************/
+ int LoadJFIF PARM((char *, PICINFO *, int));
+ void CreateJPEGW PARM((void));
+ void JPEGDialog PARM((int));
+ int JPEGCheckEvent PARM((XEvent *));
void JPEGSaveParams PARM((char *, int));
++void VersionInfoJPEG PARM((void)); /* GRR 19980605 */
- /**************************** XVTIFF.C ***************************/
+-/**************************** XVTIFF.C ***************************/
-int LoadTIFF PARM((char *, PICINFO *));
-+int LoadTIFF PARM((char *, PICINFO *, int));
- void CreateTIFFW PARM((void));
- void TIFFDialog PARM((int));
- int TIFFCheckEvent PARM((XEvent *));
-@@ -1628,7 +1665,7 @@
- void CenterMapWindow PARM((Window, int, int, int, int));
- int PopUp PARM((char *, char **, int));
- void ErrPopUp PARM((char *, char *));
+-void CreateTIFFW PARM((void));
+-void TIFFDialog PARM((int));
+-int TIFFCheckEvent PARM((XEvent *));
+-void TIFFSaveParams PARM((char *, int));
++/**************************** XVMAG.C ***************************/
++int LoadMAG PARM((char *, PICINFO *));
++int WriteMAG PARM((FILE *, byte *, int, int, int,
++ byte *, byte *, byte *, int, int, char *));
++
++/**************************** XVMAKI.C ***************************/
++int LoadMAKI PARM((char *, PICINFO *));
++int WriteMAKI PARM((FILE *, byte *, int, int, int,
++ byte *, byte *, byte *, int, int));
++
++/**************************** XVMGCSFX.C ***************************/
++int is_mgcsfx PARM((char *, unsigned char *, int));
++char *mgcsfx_auto_input_com PARM((char *));
++int LoadMGCSFX PARM((char *, PICINFO *));
++void CreateMGCSFXW PARM((void));
++void MGCSFXDialog PARM((int));
++int MGCSFXCheckEvent PARM((XEvent *));
++int MGCSFXSaveParams PARM((char *, int));
++
++int getInputCom PARM((void));
++int getOutputCom PARM((void));
++
++/**************************** XVPBM.C ***************************/
++#ifdef HAVE_MGCSFX
++int LoadPBM PARM((char *, PICINFO *, int));
++#else
++int LoadPBM PARM((char *, PICINFO *));
++#endif
++int WritePBM PARM((FILE *, byte *, int, int, int, byte *,
++ byte *, byte *, int, int, int, char *));
++
++/**************************** XVPCD.C ***************************/
++int LoadPCD PARM((char *, PICINFO *, int));
++void CreatePCDW PARM((void));
++void PCDDialog PARM((int));
++int PCDCheckEvent PARM((XEvent *));
++void PCDSetParamOptions PARM((const char *));
++
++/**************************** XVPCX.C ***************************/
++int LoadPCX PARM((char *, PICINFO *));
+
+ /**************************** XVPDS.C ***************************/
+ int LoadPDS PARM((char *, PICINFO *));
+
+-/*************************** XVPS.C ***************************/
++/**************************** XVPI.C ***************************/
++int LoadPi PARM((char *, PICINFO *));
++int WritePi PARM((FILE *, byte *, int, int, int,
++ byte *, byte *, byte *, int, int, char *));
++
++/**************************** XVPIC.C ***************************/
++int LoadPIC PARM((char *, PICINFO *));
++int WritePIC PARM((FILE *, byte *, int, int, int,
++ byte *, byte *, byte *, int, int, char *));
++
++/**************************** XVPIC2.C ***************************/
++int LoadPIC2 PARM((char *, PICINFO *, int));
++void CreatePIC2W PARM((void));
++void PIC2Dialog PARM((int));
++int PIC2CheckEvent PARM((XEvent *));
++int PIC2SetParamOptions PARM((char *));
++
++/**************************** XVPM.C ****************************/
++int LoadPM PARM((char *, PICINFO *));
++int WritePM PARM((FILE *, byte *, int, int, int, byte *,
++ byte *, byte *, int, int, char *));
++
++/**************************** XVPNG.C ***************************/
++int LoadPNG PARM((char *, PICINFO *));
++void CreatePNGW PARM((void));
++void PNGDialog PARM((int));
++int PNGCheckEvent PARM((XEvent *));
++void PNGSaveParams PARM((char *, int));
++void VersionInfoPNG PARM((void)); /* GRR 19980605 */
++
++/**************************** XVPS.C ****************************/
+ void CreatePSD PARM((char *));
+ void PSDialog PARM((int));
+ int PSCheckEvent PARM((XEvent *));
+@@ -1624,56 +2085,46 @@
+ void PSResize PARM((void));
+ int LoadPS PARM((char *, PICINFO *, int));
+
+-/*************************** XVPOPUP.C ***************************/
+-void CenterMapWindow PARM((Window, int, int, int, int));
+-int PopUp PARM((char *, char **, int));
+-void ErrPopUp PARM((char *, char *));
-int GetStrPopUp PARM((char *, char **, int, char *, int,
-+int GetStrPopUp PARM((char *, char **, int, char *, int,
- char *, int));
- int GrabPopUp PARM((int *, int *));
- int PadPopUp PARM((int *, char **, int *, int *, int *, int *));
-diff -ruN xv-3.10a/xv24to8.c xv-3.10a-bugfixes/xv24to8.c
+- char *, int));
+-int GrabPopUp PARM((int *, int *));
+-int PadPopUp PARM((int *, char **, int *, int *, int *, int *));
+-void ClosePopUp PARM((void));
+-void OpenAlert PARM((char *));
+-void CloseAlert PARM((void));
+-int PUCheckEvent PARM((XEvent *));
+-void TextRect PARM((Window, char *, int, int, int, int, u_long));
++/**************************** XVRLE.C ***************************/
++int LoadRLE PARM((char *, PICINFO *));
+
+-/*************************** XVDFLT.C ***************************/
+-void LoadDfltPic PARM((PICINFO *));
+-void xbm2pic PARM((byte *, int, int, byte *, int, int, int, int,
+- int));
+-void DrawStr2Pic PARM((char *, int, int, byte *, int, int, int));
++/**************************** XVSUNRAS.C ***************************/
++int LoadSunRas PARM((char *, PICINFO *));
++int WriteSunRas PARM((FILE *, byte *, int, int, int, byte *,
++ byte *, byte*, int, int, int));
+
+-/**************************** XVGRAB.C ***************************/
+-int Grab PARM((void));
+-int LoadGrab PARM((PICINFO *));
++/**************************** XVTARGA.C ***************************/
++int LoadTarga PARM((char *, PICINFO *));
++int WriteTarga PARM((FILE *, byte *, int, int, int, byte *,
++ byte *, byte *, int, int));
+
++/**************************** XVTIFF.C ***************************/
++int LoadTIFF PARM((char *, PICINFO *, int));
++void CreateTIFFW PARM((void));
++void TIFFDialog PARM((int));
++int TIFFCheckEvent PARM((XEvent *));
++void TIFFSaveParams PARM((char *, int));
++void VersionInfoTIFF PARM((void)); /* GRR 19980605 */
+
+-/**************************** XVCUT.C ***************************/
+-int CutAllowed PARM((void));
+-int PasteAllowed PARM((void));
+-void DoImgCopy PARM((void));
+-void DoImgCut PARM((void));
+-void DoImgClear PARM((void));
+-void DoImgPaste PARM((void));
++/**************************** XVWBMP.C ***************************/
++int LoadWBMP PARM((char *, PICINFO *));
++int WriteWBMP PARM((FILE *, byte *, int, int, int, byte *,
++ byte *, byte *, int, int));
+
+-void SaveToClip PARM((byte *));
+-void InitSelection PARM((void));
+-int HaveSelection PARM((void));
+-int GetSelType PARM((void));
+-void GetSelRCoords PARM((int *, int *, int *, int *));
+-void EnableSelection PARM((int));
+-void DrawSelection PARM((int));
+-int DoSelection PARM((XButtonEvent *));
+-void MoveGrowSelection PARM((int, int, int, int));
+-void BlinkSelection PARM((int));
+-void FlashSelection PARM((int));
++/**************************** XVXBM.C ***************************/
++int LoadXBM PARM((char *, PICINFO *));
++int WriteXBM PARM((FILE *, byte *, int, int, byte *, byte *,
++ byte *, char *));
+
+-void CropRect2Rect PARM((int*,int*,int*,int*, int,int,int,int));
+-void CoordE2C PARM((int, int, int *, int *));
+-void CoordC2E PARM((int, int, int *, int *));
+-void CoordP2C PARM((int, int, int *, int *));
+-void CoordC2P PARM((int, int, int *, int *));
+-void CoordP2E PARM((int, int, int *, int *));
+-void CoordE2P PARM((int, int, int *, int *));
++/**************************** XVXPM.C ***************************/
++int LoadXPM PARM((char *, PICINFO *));
++int WriteXPM PARM((FILE *, byte *, int, int, int, byte *,
++ byte *, byte *, int, int, char *, char *));
+
++/**************************** XVXWD.C ***************************/
++int LoadXWD PARM((char *, PICINFO *));
++
++/**************************** XVZX.C [JCE] **********************/
++int LoadZX PARM((char *, PICINFO *));
++int WriteZX PARM((FILE *, byte *, int, int, int, byte *,
++ byte *, byte *, int, int, char *));
+diff -ru xv-3.10a/xv24to8.c xv-3.10a-enhancements/xv24to8.c
--- xv-3.10a/xv24to8.c 1995-01-13 11:49:21.000000000 -0800
-+++ xv-3.10a-bugfixes/xv24to8.c 2004-05-16 18:00:58.000000000 -0700
++++ xv-3.10a-enhancements/xv24to8.c 2007-05-12 13:56:44.000000000 -0700
@@ -14,15 +14,15 @@
*
* The Conv24to8 procedure will set up the following: it will allocate, make
@@ -5363,6 +9318,37 @@ diff -ruN xv-3.10a/xv24to8.c xv-3.10a-bugfixes/xv24to8.c
* #define PPM_LUMIN(p) \
* ( 0.299 * PPM_GETR(p) + 0.587 * PPM_GETG(p) + 0.114 * PPM_GETB(p) )
*/
+@@ -449,18 +449,18 @@
+ byte *pic24, *pic8, *rmap, *gmap, *bmap;
+ int cols, rows, newcolors;
+ {
+- pixel** pixels;
+- register pixel* pP;
+- int row;
+- register int col, limitcol;
+- pixval maxval, newmaxval;
+- int colors;
+- register int index;
+- chist_vec chv, colormap;
+- chash_table cht;
+- int i;
+- unsigned char *picptr;
+- static char *fn = "ppmquant()";
++ pixel** pixels;
++ register pixel* pP;
++ int row;
++ register int col, limitcol;
++ pixval maxval, newmaxval;
++ int colors;
++ register int index;
++ chist_vec chv, colormap;
++ chash_table cht;
++ int i;
++ unsigned char *picptr;
++ static const char *fn = "ppmquant()";
+
+ index = 0;
+ maxval = 255;
@@ -472,7 +472,7 @@
if (DEBUG) fprintf(stderr,"%s: remapping to ppm-style internal fmt\n", fn);
@@ -5585,9 +9571,9 @@ diff -ruN xv-3.10a/xv24to8.c xv-3.10a-bugfixes/xv24to8.c
numcolors = find_nearby_colors(minc0, minc1, minc2, colorlist);
/* Determine the actually nearest colors. */
-diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
+diff -ru xv-3.10a/xvalg.c xv-3.10a-enhancements/xvalg.c
--- xv-3.10a/xvalg.c 1994-12-22 14:34:47.000000000 -0800
-+++ xv-3.10a-bugfixes/xvalg.c 2004-05-16 18:01:13.000000000 -0700
++++ xv-3.10a-enhancements/xvalg.c 2007-05-12 16:07:37.000000000 -0700
@@ -38,7 +38,7 @@
double, int));
static void doPixel PARM((byte *,int,int,byte *, int,int,int,int,
@@ -5597,7 +9583,30 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
int, int));
static void doMedianFilter PARM((byte *,int,int,byte *, int,int,int,int, int));
-@@ -89,7 +89,7 @@
+@@ -53,7 +53,7 @@
+ static int start24bitAlg PARM((byte **, byte **));
+ static void end24bitAlg PARM((byte *, byte *));
+
+-static void printUTime PARM((char *));
++static void printUTime PARM((const char *));
+
+ static byte *origPic = (byte *) NULL;
+ static int origPicType;
+@@ -70,10 +70,11 @@
+
+ /***************************/
+ static void printUTime(str)
+- char *str;
++ const char *str;
+ {
+ #ifdef TIMING_TEST
+- int i; struct rusage ru;
++ int i;
++ struct rusage ru;
+
+ i = getrusage(RUSAGE_SELF, &ru);
+ fprintf(stderr,"%s: utime = %d.%d seconds\n",
+@@ -89,7 +90,7 @@
/************************************************************/
void AlgInit()
{
@@ -5606,7 +9615,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
if neccessary, and points it to null */
if (origPic) free(origPic);
-@@ -160,7 +160,7 @@
+@@ -160,16 +161,16 @@
{
/* runs a n*n convolution mask (all 1's) over 'pic',
producing a 24-bit version. Then calls 24to8 to generate a new 8-bit
@@ -5615,16 +9624,22 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
Note that 'n' must be odd for things to work properly */
-@@ -169,7 +169,7 @@
- static char *labels[] = { "\nOk", "\033Cancel" };
- char txt[256];
- static char buf[64] = { '3', '\0' };
+- byte *pic24, *tmpPic;
+- int i, sx,sy,sw,sh, n;
+- static char *labels[] = { "\nOk", "\033Cancel" };
+- char txt[256];
+- static char buf[64] = { '3', '\0' };
-
++ byte *pic24, *tmpPic;
++ int i, sx,sy,sw,sh, n;
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char txt[256];
++ static char buf[64] = { '3', '\0' };
+
sprintf(txt, "Blur: \n\n%s",
"Enter mask size (ex. 3, 5, 7, ...)");
-@@ -178,7 +178,7 @@
+@@ -178,7 +179,7 @@
n = atoi(buf);
if (n < 1 || (n&1)!=1) {
@@ -5633,7 +9648,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
"\nOh!");
return;
}
-@@ -194,7 +194,7 @@
+@@ -194,7 +195,7 @@
if (start24bitAlg(&pic24, &tmpPic)) return;
xvbcopy((char *) pic24, (char *) tmpPic, (size_t) (pWIDE*pHIGH*3));
@@ -5642,16 +9657,26 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
doBlurConvolv(pic24, pWIDE,pHIGH, tmpPic, sx,sy,sw,sh, n);
end24bitAlg(pic24, tmpPic);
-@@ -212,7 +212,7 @@
- static char *labels[] = { "\nOk", "\033Cancel" };
- char txt[256];
- static char buf[64] = { '7', '5', '\0' };
+@@ -207,12 +208,12 @@
+ {
+ /* runs an edge-enhancment algorithm */
+
+- byte *pic24, *tmpPic;
+- int i, sx,sy,sw,sh, n;
+- static char *labels[] = { "\nOk", "\033Cancel" };
+- char txt[256];
+- static char buf[64] = { '7', '5', '\0' };
-
++ byte *pic24, *tmpPic;
++ int i, sx,sy,sw,sh, n;
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char txt[256];
++ static char buf[64] = { '7', '5', '\0' };
+
sprintf(txt, "Sharpen: \n\n%s",
"Enter enhancement factor (0-99%)");
-@@ -236,7 +236,7 @@
+@@ -236,7 +237,7 @@
if (start24bitAlg(&pic24, &tmpPic)) return;
xvbcopy((char *) pic24, (char *) tmpPic, (size_t) (pWIDE*pHIGH*3));
@@ -5660,7 +9685,16 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
doSharpConvolv(pic24, pWIDE,pHIGH, tmpPic, sx,sy,sw,sh, n);
end24bitAlg(pic24, tmpPic);
-@@ -264,7 +264,7 @@
+@@ -248,7 +249,7 @@
+ static void EdgeDetect()
+ {
+ byte *pic24, *p24, *tmpPic, *tlp;
+- char *str;
++ const char *str;
+ int i, j, v, maxv, sx,sy,sw,sh;
+
+ WaitCursor();
+@@ -264,7 +265,7 @@
xvbcopy((char *) pic24, (char *) tmpPic, (size_t) (pWIDE*pHIGH*3));
doEdgeConvolv(pic24, pWIDE, pHIGH, tmpPic, sx,sy,sw,sh);
@@ -5669,15 +9703,16 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
SetISTR(ISTR_INFO, "%snormalizing...", str);
/* Normalize results */
-@@ -292,19 +292,19 @@
+@@ -292,19 +293,19 @@
/************************/
static void TinFoil()
{
- byte *pic24, *p24, *tmpPic, *tp, *tlp;
-+ byte *pic24, *tmpPic, *tp, *tlp;
- char *str;
+- char *str;
- int i, j, v, maxv,sx,sy,sw,sh;
-
++ byte *pic24, *tmpPic, *tp, *tlp;
++ const char *str;
+ int i, j, v, sx,sy,sw,sh;
+
WaitCursor();
@@ -5695,7 +9730,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
if (start24bitAlg(&pic24, &tmpPic)) return;
xvbcopy((char *) pic24, (char *) tmpPic, (size_t) (pWIDE*pHIGH*3));
-@@ -315,9 +315,9 @@
+@@ -315,9 +316,9 @@
*tp++ = 128; *tp++ = 128; *tp++ = 128;
}
}
@@ -5707,7 +9742,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
/* mono-ify selected area of tmpPic */
for (i=sy; i<sy+sh; i++) {
tp = tlp = tmpPic + (i*pWIDE + sx) * 3;
-@@ -327,9 +327,9 @@
+@@ -327,9 +328,9 @@
tp[0] = tp[1] = tp[2] = (byte) v;
}
}
@@ -5719,7 +9754,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
/************************/
-@@ -345,7 +345,7 @@
+@@ -345,7 +346,7 @@
if (HaveSelection()) GetSelRCoords(&sx,&sy,&sw,&sh);
else { sx = 0; sy = 0; sw = pWIDE; sh = pHIGH; }
CropRect2Rect(&sx,&sy,&sw,&sh, 0,0,pWIDE,pHIGH);
@@ -5728,7 +9763,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
if (start24bitAlg(&pic24, &tmpPic)) return;
xvbcopy((char *) pic24, (char *) tmpPic, (size_t) (pWIDE*pHIGH*3));
-@@ -365,7 +365,7 @@
+@@ -365,7 +366,7 @@
if (HaveSelection()) GetSelRCoords(&sx,&sy,&sw,&sh);
else { sx = 0; sy = 0; sw = pWIDE; sh = pHIGH; }
CropRect2Rect(&sx,&sy,&sw,&sh, 0,0,pWIDE,pHIGH);
@@ -5737,7 +9772,26 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
WaitCursor();
if (start24bitAlg(&pic24, &tmpPic)) return;
-@@ -396,12 +396,12 @@
+@@ -381,12 +382,12 @@
+ static void FineRotate(clr)
+ int clr;
+ {
+- byte *pic24, *tmpPic;
+- int i,sx,sy,sw,sh;
+- double rotval;
+- static char *labels[] = { "\nOk", "\033Cancel" };
+- char txt[256];
+- static char buf[64] = { '\0' };
++ byte *pic24, *tmpPic;
++ int i,sx,sy,sw,sh;
++ double rotval;
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char txt[256];
++ static char buf[64] = { '\0' };
+
+ sprintf(txt, "Rotate (%s):\n\nEnter rotation angle, in degrees: (>0 = CCW)",
+ (clr ? "Clear" : "Copy"));
+@@ -396,12 +397,12 @@
rotval = atof(buf);
if (rotval == 0.0) return;
@@ -5752,7 +9806,24 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
WaitCursor();
if (start24bitAlg(&pic24, &tmpPic)) return;
-@@ -443,11 +443,11 @@
+@@ -416,11 +417,11 @@
+ /************************/
+ static void Pixelize()
+ {
+- byte *pic24, *tmpPic;
+- int i,sx,sy,sw,sh, pixX,pixY,err;
+- static char *labels[] = { "\nOk", "\033Cancel" };
+- char txt[256];
+- static char buf[64] = { '4', '\0' };
++ byte *pic24, *tmpPic;
++ int i,sx,sy,sw,sh, pixX,pixY,err;
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char txt[256];
++ static char buf[64] = { '4', '\0' };
+
+ sprintf(txt, "Pixelize:\n\nEnter new pixel size, in image pixels: %s",
+ "(ex. '3', '5x8')");
+@@ -443,11 +444,11 @@
return;
}
@@ -5766,7 +9837,24 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
WaitCursor();
if (start24bitAlg(&pic24, &tmpPic)) return;
-@@ -493,11 +493,11 @@
+@@ -463,11 +464,11 @@
+ /************************/
+ static void Spread()
+ {
+- byte *pic24, *tmpPic;
+- int i,sx,sy,sw,sh, pixX,pixY,err;
+- static char *labels[] = { "\nOk", "\033Cancel" };
+- char txt[256];
+- static char buf[64] = { '5', '\0' };
++ byte *pic24, *tmpPic;
++ int i,sx,sy,sw,sh, pixX,pixY,err;
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char txt[256];
++ static char buf[64] = { '5', '\0' };
+
+ sprintf(txt, "Spread:\n\nEnter spread factor (or x,y factors): %s",
+ "(ex. '10', '1x5')");
+@@ -493,11 +494,11 @@
return;
}
@@ -5780,16 +9868,26 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
WaitCursor();
if (start24bitAlg(&pic24, &tmpPic)) return;
-@@ -521,7 +521,7 @@
- static char *labels[] = { "\nOk", "\033Cancel" };
- char txt[256];
- static char buf[64] = { '3', '\0' };
--
+@@ -516,12 +517,12 @@
+ /* runs median filter algorithm (for n*n rect centered around each pixel,
+ replace with median value */
+
+- byte *pic24, *tmpPic;
+- int i, sx,sy,sw,sh, n;
+- static char *labels[] = { "\nOk", "\033Cancel" };
+- char txt[256];
+- static char buf[64] = { '3', '\0' };
+-
++ byte *pic24, *tmpPic;
++ int i, sx,sy,sw,sh, n;
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char txt[256];
++ static char buf[64] = { '3', '\0' };
+
sprintf(txt, "DeSpeckle (median filter): \n\n%s",
"Enter mask size (ex. 3, 5, 7, ...)");
-@@ -530,7 +530,7 @@
+@@ -530,7 +531,7 @@
n = atoi(buf);
if (n < 1 || (n&1)!=1) {
@@ -5798,7 +9896,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
"\nOh!");
return;
}
-@@ -546,7 +546,7 @@
+@@ -546,7 +547,7 @@
if (start24bitAlg(&pic24, &tmpPic)) return;
xvbcopy((char *) pic24, (char *) tmpPic, (size_t) (pWIDE*pHIGH*3));
@@ -5807,7 +9905,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
doMedianFilter(pic24, pWIDE,pHIGH, tmpPic, sx,sy,sw,sh, n);
end24bitAlg(pic24, tmpPic);
-@@ -560,7 +560,7 @@
+@@ -560,7 +561,7 @@
int w,h, selx,sely,selw,selh, n;
{
@@ -5816,7 +9914,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
Operates on rectangular region 'selx,sely,selw,selh' (in pic coords)
Region is guaranteed to be completely within pic boundaries
'n' must be odd */
-@@ -568,7 +568,7 @@
+@@ -568,7 +569,7 @@
register byte *p24;
register int rsum,gsum,bsum;
byte *rp;
@@ -5825,7 +9923,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
printUTime("start of blurConvolv");
-@@ -589,7 +589,7 @@
+@@ -589,7 +590,7 @@
for (y1=y-n2; y1<=y+n2; y1++) {
if (y1>=sely && y1<sely+selh) {
@@ -5834,7 +9932,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
for (x1=x-n2; x1<=x+n2; x1++) {
if (x1>=selx && x1<selx+selw) {
-@@ -631,7 +631,7 @@
+@@ -631,7 +632,7 @@
byte *p24;
int rv, gv, bv;
byte *rp;
@@ -5843,7 +9941,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
double fact, ifact, hue,sat,val, vsum;
double *linem1, *line0, *linep1, *tmpptr;
-@@ -673,7 +673,7 @@
+@@ -673,7 +674,7 @@
for (y=sely+1; y<(sely+selh)-1; y++) {
ProgressMeter(sely+1, (sely+selh)-2, y, "Sharpen");
if ((y & 15) == 0) WaitCursor();
@@ -5852,7 +9950,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
tmpptr = linem1; linem1 = line0; line0 = linep1; linep1 = tmpptr;
/* get next line */
-@@ -691,7 +691,7 @@
+@@ -691,7 +692,7 @@
vsum = linem1[i-1] + linem1[i] + linem1[i+1] +
line0 [i-1] + line0 [i] + line0 [i+1] +
linep1[i-1] + linep1[i] + linep1[i+1];
@@ -5861,7 +9959,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
rgb2hsv((int) p24[0], (int) p24[1], (int) p24[2], &hue, &sat, &val);
val = ((val - (fact * vsum) / 9) / ifact);
-@@ -723,22 +723,22 @@
+@@ -723,22 +724,22 @@
{
/* convolves with two edge detection masks (vertical and horizontal)
@@ -5888,7 +9986,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
Also, only does pixels in which the masks fit fully onto the picture
(no pesky boundary conditionals) */
-@@ -746,7 +746,7 @@
+@@ -746,7 +747,7 @@
register byte *p24;
register int bperlin, a, b, c, d, rsum, gsum, bsum;
byte *rp;
@@ -5897,7 +9995,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
printUTime("start of edgeConvolv");
-@@ -818,13 +818,13 @@
+@@ -818,13 +819,13 @@
{
/* convolves with edge detection mask, at 45 degrees to horizontal.
@@ -5913,7 +10011,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
Also, only does pixels in which the masks fit fully onto the picture
(no pesky boundary conditionals)
-@@ -833,7 +833,7 @@
+@@ -833,7 +834,7 @@
register byte *p24;
register int bperlin,rsum,gsum,bsum;
byte *rp;
@@ -5922,7 +10020,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
printUTime("start of doAngleConvolv");
-@@ -912,14 +912,14 @@
+@@ -912,14 +913,14 @@
for each pixel in the image (assume, for a second, a grayscale image),
compute a histogram of the n*n rectangle centered on the pixel.
replace the pixel with the color that had the greatest # of hits in
@@ -5939,7 +10037,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
byte *rp, *p24, *plin;
int i,j,k,x,y,n2,col,cnt,maxcnt;
int *nnrect;
-@@ -933,7 +933,7 @@
+@@ -933,7 +934,7 @@
/* nnrect[] is an n*n array of ints, with '-1' meaning 'outside the region'
otherwise they'll have 24-bit RGB values */
@@ -5948,7 +10046,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
nnrect = (int *) malloc(n * n * sizeof(int));
if (!nnrect) FatalError("can't malloc nnrect[] in doOilPaint()\n");
-@@ -943,13 +943,13 @@
+@@ -943,13 +944,13 @@
p24 = pic24 + ((y-n2)*w + selx-n2)*3; /* pts to top-left of mask */
rp = results + (y*w + selx)*3;
@@ -5964,7 +10062,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
nnrect[k] = (((int) pp[0])<<16) | (((int) pp[1])<<8) | pp[2];
}
else nnrect[k] = -1;
-@@ -957,7 +957,7 @@
+@@ -957,7 +958,7 @@
plin += bperlin; pp = plin;
}
@@ -5973,7 +10071,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
/* find 'most popular color' in nnrect, not counting '-1' */
maxcnt = cnt = col = 0;
for (i=0; i<n*n; i++) {
-@@ -1021,7 +1021,7 @@
+@@ -1021,7 +1022,7 @@
p24 = pic24 + (y*w + selx) * 3;
rf += (double) p24[0]; gf += (double) p24[1]; bf += (double) p24[2];
i++;
@@ -5982,7 +10080,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
p24 = pic24 + (y*w + (selx+selw-1)) * 3;
rf += (double) p24[0]; gf += (double) p24[1]; bf += (double) p24[2];
i++;
-@@ -1047,7 +1047,7 @@
+@@ -1047,7 +1048,7 @@
if (dx==0 && dy==0) { ex = selx; ey = sely; } /* don't care */
else if (dx==0) { ex = cx; ey = (dy<0) ? sely : sely+selh-1; }
else if (dy==0) { ey = cy; ex = (dx<0) ? selx : selx+selw-1; }
@@ -5991,7 +10089,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
slope = ((double) dy) / dx;
if (fabs(slope) > fabs(dslope)) { /* y axis is major */
ey = (dy<0) ? sely : sely+selh-1;
-@@ -1092,7 +1092,7 @@
+@@ -1092,7 +1093,7 @@
printUTime("end of blend");
}
@@ -6000,7 +10098,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
/************************/
static void doRotate(pic24, w, h, results, selx,sely,selw,selh, rotval, clear)
-@@ -1104,7 +1104,7 @@
+@@ -1104,7 +1105,7 @@
by the amount specified in degrees (rotval), and stores the result in
'results', which is also a w*h 24-bit image. The rotated bits are
clipped to fit in 'results'. If 'clear', the (unrotated) rectangular
@@ -6009,7 +10107,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
sel[x,y,w,h] is guaranteed to be within image bounds */
byte *pp, *dp;
-@@ -1118,7 +1118,7 @@
+@@ -1118,7 +1119,7 @@
printUTime("start of rotate");
/*
@@ -6018,7 +10116,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
* rx1,ry1 - top-left of sel, rotated
* rx2,ry2 - bot-left of sel, rotated
* rx3,ry3 - top-right of sel, rotated
-@@ -1174,7 +1174,7 @@
+@@ -1174,7 +1175,7 @@
/* now, for each pixel in rb[x,y,w,h], do the inverse rotation to see if
it would be in the original unrotated selection rectangle. if it *is*,
compute and store an appropriate color, otherwise skip it */
@@ -6027,7 +10125,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
for (y=rby; y<rby+rbh; y++) {
dp = results + (y * w + rbx) * 3;
-@@ -1194,7 +1194,7 @@
+@@ -1194,7 +1195,7 @@
int p0r,p0g,p0b, p1r,p1g,p1b, p2r,p2g,p2b, p3r,p3g,p3b;
int rv,gv,bv;
double rd,gd,bd, p0wgt, p1wgt, p2wgt, p3wgt;
@@ -6036,7 +10134,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
/* compute the color, same idea as in Smooth**(). The color
will be a linear combination of the colors of the center pixel,
its left-or-right neighbor, its top-or-bottom neighbor, and
-@@ -1265,9 +1265,9 @@
+@@ -1265,9 +1266,9 @@
}
#endif /* ROTATE_FOO */
@@ -6049,7 +10147,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
}
}
}
-@@ -1311,11 +1311,11 @@
+@@ -1311,11 +1312,11 @@
#ifdef FOO
fprintf(stderr,"rotXfer: rotating (%4d,%4d) %7.2f degrees around",
x,y, rad*180.0 / M_PI);
@@ -6063,7 +10161,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
/************************/
-@@ -1323,29 +1323,29 @@
+@@ -1323,29 +1324,29 @@
byte *pic24, *results;
int w, h, selx,sely,selw,selh, pixX,pixY;
{
@@ -6101,7 +10199,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
/* COMPUTE AVERAGE COLOR FOR RECT:[x,y,pixX,pixY] */
nsum = rsum = gsum = bsum = 0;
for (y1=y; y1<y+pixY; y1++) {
-@@ -1357,17 +1357,17 @@
+@@ -1357,17 +1358,17 @@
}
}
}
@@ -6123,7 +10221,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
pp = results + (y1 * w + x) * 3;
for (x1=x; x1<x+pixX; x1++, pp+=3) {
if (PTINRECT(x1,y1, selx,sely,selw,selh)) {
-@@ -1381,7 +1381,7 @@
+@@ -1381,7 +1382,7 @@
printUTime("end of pixelize");
}
@@ -6132,7 +10230,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
/************************/
static void doSpread(pic24, w, h, results, selx,sely,selw,selh, pixX, pixY)
-@@ -1393,17 +1393,17 @@
+@@ -1393,17 +1394,17 @@
by pixX,pixY. If pixX<0, it is treated as a single 'distance' value
(after being abs()'d). */
@@ -6154,7 +10252,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
printUTime("start of spread");
for (y=sely; y<sely+selh; y++) {
-@@ -1453,7 +1453,7 @@
+@@ -1453,7 +1454,7 @@
printUTime("end of spread");
}
@@ -6163,7 +10261,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
/************************/
static void doMedianFilter(pic24, w, h, results, selx,sely,selw,selh, n)
-@@ -1468,7 +1468,7 @@
+@@ -1468,7 +1469,7 @@
register byte *p24;
register int rsum,gsum,bsum;
byte *rp;
@@ -6172,7 +10270,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
int *rtab, *gtab, *btab;
printUTime("start of doMedianFilter");
-@@ -1494,7 +1494,7 @@
+@@ -1494,7 +1495,7 @@
for (y1=y-n2; y1<=y+n2; y1++) {
if (y1>=sely && y1<sely+selh) {
@@ -6181,7 +10279,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
for (x1=x-n2; x1<=x+n2; x1++) {
if (x1>=selx && x1<selx+selw) {
-@@ -1509,12 +1509,12 @@
+@@ -1509,12 +1510,12 @@
}
@@ -6198,7 +10296,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
for (d=count/2; d>0; d=d/2) {
for (i=d; i<count; i++) {
for (j=i-d; j>=0 && rtab[j]>rtab[j+d]; j-=d) {
-@@ -1531,14 +1531,14 @@
+@@ -1531,14 +1532,14 @@
}
}
}
@@ -6215,7 +10313,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
free(rtab); free(gtab); free(btab);
printUTime("end of doMedianFilter");
}
-@@ -1549,7 +1549,7 @@
+@@ -1549,7 +1550,7 @@
static void intsort(a, n)
int *a, n;
{
@@ -6224,7 +10322,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
we'll be using, should be quicker than qsort() because of all the
function calling overhead associated with qsort(). */
-@@ -1571,7 +1571,7 @@
+@@ -1571,7 +1572,7 @@
byte **pic24, **tmpPic;
{
/* generates a 24-bit version of 'pic', if neccessary, and also mallocs
@@ -6233,7 +10331,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
*
* Returns '1' if there's some sort of screwup, '0' if cool
*/
-@@ -1588,7 +1588,7 @@
+@@ -1588,7 +1589,7 @@
*tmpPic = (byte *) calloc((size_t) (pWIDE * pHIGH * 3), (size_t) 1);
if (!(*tmpPic)) {
SetCursors(-1);
@@ -6242,7 +10340,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
"\nTough!");
if (picType == PIC8) free(*pic24);
return 1;
-@@ -1609,16 +1609,16 @@
+@@ -1609,16 +1610,16 @@
saveOrigPic(); /* also kills pic/cpic/epic/egampic/theImage, NOT pic24 */
/* copy results to pic24 */
@@ -6262,7 +10360,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
return;
}
}
-@@ -1632,7 +1632,7 @@
+@@ -1632,7 +1633,7 @@
static void saveOrigPic()
{
/* saves original picture into origPic, if it hasn't already been done.
@@ -6271,7 +10369,7 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
Also, frees all pics, (except 'pic', if we're in PIC24 mode) */
-@@ -1649,7 +1649,7 @@
+@@ -1649,7 +1650,7 @@
/* make a backup copy of 'pic' */
origPic = (byte *) malloc((size_t)(pWIDE*pHIGH*((picType==PIC8) ? 1 : 3)));
if (!origPic) FatalError("out of memory in 'saveOrigPic()'");
@@ -6280,32 +10378,105 @@ diff -ruN xv-3.10a/xvalg.c xv-3.10a-bugfixes/xvalg.c
(size_t) (pWIDE * pHIGH * ((picType==PIC8) ? 1 : 3)));
origPicType = picType;
-diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
+diff -ru xv-3.10a/xvbmp.c xv-3.10a-enhancements/xvbmp.c
--- xv-3.10a/xvbmp.c 1994-12-22 14:34:42.000000000 -0800
-+++ xv-3.10a-bugfixes/xvbmp.c 2005-03-27 18:12:17.000000000 -0800
-@@ -14,7 +14,7 @@
- rest of the pic is filled with 0's.
++++ xv-3.10a-enhancements/xvbmp.c 2007-05-13 17:46:16.000000000 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * xvbmp.c - i/o routines for .BMP files (MS Windows 3.x)
++ * xvbmp.c - I/O routines for .BMP files (MS Windows 3.x and later; OS/2)
+ *
+ * LoadBMP(fname, numcols)
+ * WriteBMP(fp, pic, ptype, w, h, r, g, b, numcols, style);
+@@ -9,30 +9,39 @@
- a file with garbage characters in it is an unloadable file. All allocated
+ #include "xv.h"
+
+-/* comments on error handling:
+- a truncated file is not considered a Major Error. The file is loaded, the
+- rest of the pic is filled with 0's.
+-
+- a file with garbage characters in it is an unloadable file. All allocated
- stuff is tossed, and LoadPBM returns non-zero
-+ stuff is tossed, and LoadBMP returns non-zero
+-
+- not being able to malloc is a Fatal Error. The program is aborted. */
+-
+-
+-#define BI_RGB 0
+-#define BI_RLE8 1
+-#define BI_RLE4 2
++/* Comments on error-handling:
++ A truncated file is not considered a Major Error. The file is loaded,
++ and the rest of the pic is filled with 0's.
++
++ A file with garbage characters in it is an unloadable file. All allocated
++ stuff is tossed, and LoadBMP returns non-zero.
++
++ Not being able to malloc is a Fatal Error. The program is aborted. */
++
++
++#define BI_RGB 0 /* a.k.a. uncompressed */
++#define BI_RLE8 1
++#define BI_RLE4 2
++#define BI_BITFIELDS 3 /* BMP version 4 */
++#define BI_JPEG 4 /* BMP version 5 (not yet supported) */
++#define BI_PNG 5 /* BMP version 5 (not yet supported) */
+
+ #define WIN_OS2_OLD 12
+ #define WIN_NEW 40
+ #define OS2_NEW 64
- not being able to malloc is a Fatal Error. The program is aborted. */
++#if (defined(UINT_MAX) && UINT_MAX != 0xffffffffU)
++# error XV's BMP code requires 32-bit unsigned integer type, but u_int isn't
++#endif
++
+ static long filesize;
-@@ -54,9 +54,9 @@
+ static int loadBMP1 PARM((FILE *, byte *, u_int, u_int));
+ static int loadBMP4 PARM((FILE *, byte *, u_int, u_int, u_int));
+ static int loadBMP8 PARM((FILE *, byte *, u_int, u_int, u_int));
+-static int loadBMP24 PARM((FILE *, byte *, u_int, u_int));
++static int loadBMP16 PARM((FILE *, byte *, u_int, u_int, u_int *));
++static int loadBMP24 PARM((FILE *, byte *, u_int, u_int, u_int));
++static int loadBMP32 PARM((FILE *, byte *, u_int, u_int, u_int *));
+ static u_int getshort PARM((FILE *));
+ static u_int getint PARM((FILE *));
+ static void putshort PARM((FILE *, int));
+@@ -41,7 +50,7 @@
+ static void writeBMP4 PARM((FILE *, byte *, int, int));
+ static void writeBMP8 PARM((FILE *, byte *, int, int));
+ static void writeBMP24 PARM((FILE *, byte *, int, int));
+-static int bmpError PARM((char *, char *));
++static int bmpError PARM((const char *, const char *));
+
+
+ #define FERROR(fp) (ferror(fp) || feof(fp))
+@@ -52,15 +61,15 @@
+ PICINFO *pinfo;
+ /*******************************************/
{
- FILE *fp;
- int i, c, c1, rv;
+- FILE *fp;
+- int i, c, c1, rv;
- unsigned int bfSize, bfOffBits, biSize, biWidth, biHeight, biPlanes;
- unsigned int biBitCount, biCompression, biSizeImage, biXPelsPerMeter;
- unsigned int biYPelsPerMeter, biClrUsed, biClrImportant;
-+ u_int bfSize, bfOffBits, biSize, biWidth, biHeight, biPlanes;
-+ u_int biBitCount, biCompression, biSizeImage, biXPelsPerMeter;
-+ u_int biYPelsPerMeter, biClrUsed, biClrImportant;
- int bPad;
- char *cmpstr;
- byte *pic24, *pic8;
-@@ -69,7 +69,7 @@
+- int bPad;
+- char *cmpstr;
+- byte *pic24, *pic8;
+- char buf[512], *bname;
++ FILE *fp;
++ int i, c, c1, rv, bPad;
++ u_int bfSize, bfOffBits, biSize, biWidth, biHeight, biPlanes;
++ u_int biBitCount, biCompression, biSizeImage, biXPelsPerMeter;
++ u_int biYPelsPerMeter, biClrUsed, biClrImportant;
++ u_int colormask[3];
++ char buf[512], rgb_bits[16];
++ const char *cmpstr, *bname;
++ byte *pic24, *pic8;
+
+ /* returns '1' on success */
+
+@@ -69,7 +78,7 @@
fp = xv_fopen(fname,"r");
if (!fp) return (bmpError(bname, "couldn't open file"));
@@ -6314,13 +10485,20 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
fseek(fp, 0L, 2); /* figure out the file size */
filesize = ftell(fp);
fseek(fp, 0L, 0);
-@@ -104,11 +104,11 @@
+@@ -98,17 +107,16 @@
+ biClrUsed = getint(fp);
+ biClrImportant = getint(fp);
+ }
+-
+ else { /* old bitmap format */
+ biWidth = getshort(fp); /* Types have changed ! */
biHeight = getshort(fp);
biPlanes = getshort(fp);
biBitCount = getshort(fp);
-
+- /* Not in old versions so have to compute them*/
+
- /* Not in old versions so have to compute them*/
++ /* not in old versions, so have to compute them */
biSizeImage = (((biPlanes * biBitCount*biWidth)+31)/32)*4*biHeight;
-
- biCompression = BI_RGB;
@@ -6329,48 +10507,80 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
biXPelsPerMeter = biYPelsPerMeter = 0;
biClrUsed = biClrImportant = 0;
}
-@@ -127,11 +127,14 @@
+@@ -126,22 +134,39 @@
+ if (FERROR(fp)) { bmpError(bname,"EOF reached in file header"); goto ERROR; }
- /* error checking */
+- /* error checking */
- if ((biBitCount!=1 && biBitCount!=4 && biBitCount!=8 && biBitCount!=24) ||
- biPlanes!=1 || biCompression>BI_RLE4) {
--
-- sprintf(buf,"Bogus BMP File! (bitCount=%d, Planes=%d, Compression=%d)",
-- biBitCount, biPlanes, biCompression);
-+ if ((biBitCount!=1 && biBitCount!=4 && biBitCount!=8 && biBitCount!=24) ||
-+ biPlanes!=1 || biCompression>BI_RLE4 ||
++ /* error-checking */
++ if ((biBitCount!=1 && biBitCount!=4 && biBitCount!=8 &&
++ biBitCount!=16 && biBitCount!=24 && biBitCount!=32) ||
++ biPlanes!=1 || biCompression>BI_PNG ||
+ biWidth<=0 || biHeight<=0 ||
+ (biClrUsed && biClrUsed > (1 << biBitCount))) {
+
+ sprintf(buf,
-+ "Bogus BMP File! (%dx%d, Bits=%d, Colors=%d, Planes=%d, Compr=%d)",
++ "Unsupported BMP type (%dx%d, Bits=%d, Colors=%d, Planes=%d, "
++ "Compr=%d)",
+ biWidth, biHeight, biBitCount, biClrUsed, biPlanes, biCompression);
+- sprintf(buf,"Bogus BMP File! (bitCount=%d, Planes=%d, Compression=%d)",
+- biBitCount, biPlanes, biCompression);
++ bmpError(bname, buf);
++ goto ERROR;
++ }
++
++ if (biCompression>BI_BITFIELDS) {
++ sprintf(buf, "Unsupported BMP compression method (%s)",
++ biCompression == BI_JPEG? "JPEG" :
++ biCompression == BI_PNG? "PNG" :
++ "unknown/newer than v5");
+
bmpError(bname, buf);
goto ERROR;
-@@ -154,7 +157,7 @@
+ }
+
+ if (((biBitCount==1 || biBitCount==24) && biCompression != BI_RGB) ||
+- (biBitCount==4 && biCompression==BI_RLE8) ||
+- (biBitCount==8 && biCompression==BI_RLE4)) {
++ (biBitCount==4 && biCompression!=BI_RGB && biCompression!=BI_RLE4) ||
++ (biBitCount==8 && biCompression!=BI_RGB && biCompression!=BI_RLE8) ||
++ ((biBitCount==16 || biBitCount==32) &&
++ biCompression!=BI_RGB && biCompression!=BI_BITFIELDS)) {
+
+- sprintf(buf,"Bogus BMP File! (bitCount=%d, Compression=%d)",
++ sprintf(buf,"Unsupported BMP type (bitCount=%d, Compression=%d)",
+ biBitCount, biCompression);
+
+ bmpError(bname, buf);
+@@ -153,13 +178,21 @@
+ if (biSize != WIN_OS2_OLD) {
/* skip ahead to colormap, using biSize */
c = biSize - 40; /* 40 bytes read from biSize to biClrImportant */
- for (i=0; i<c; i++) getc(fp);
+- for (i=0; i<c; i++) getc(fp);
-
-+
++ for (i=0; i<c; i++)
++ getc(fp);
bPad = bfOffBits - (biSize + 14);
}
-@@ -162,6 +165,11 @@
- if (biBitCount!=24) {
++ /* 16-bit or 32-bit color mask */
++ if (biCompression==BI_BITFIELDS) {
++ colormask[0] = getint(fp);
++ colormask[1] = getint(fp);
++ colormask[2] = getint(fp);
++ bPad -= 12;
++ }
++
+ /* load up colormap, if any */
+- if (biBitCount!=24) {
++ if (biBitCount == 1 || biBitCount == 4 || biBitCount == 8) {
int i, cmaplen;
-+/* this is superfluous; see identical test in "error checking" block above
-+ if (biClrUsed > (1 << biBitCount))
-+ biClrUsed = (1 << biBitCount);
-+ */
-+
cmaplen = (biClrUsed) ? biClrUsed : 1 << biBitCount;
- for (i=0; i<cmaplen; i++) {
- pinfo->b[i] = getc(fp);
-@@ -173,7 +181,7 @@
+@@ -173,7 +206,7 @@
}
}
@@ -6379,7 +10589,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
{ bmpError(bname,"EOF reached in BMP colormap"); goto ERROR; }
if (DEBUG>1) {
-@@ -188,7 +196,7 @@
+@@ -188,7 +221,7 @@
if (biSize != WIN_OS2_OLD) {
/* Waste any unused bytes between the colour map (if present)
and the start of the actual bitmap data. */
@@ -6388,11 +10598,13 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
while (bPad > 0) {
(void) getc(fp);
bPad--;
-@@ -198,11 +206,21 @@
+@@ -197,31 +230,57 @@
+
/* create pic8 or pic24 */
- if (biBitCount==24) {
+- if (biBitCount==24) {
- pic24 = (byte *) calloc((size_t) biWidth * biHeight * 3, (size_t) 1);
++ if (biBitCount==16 || biBitCount==24 || biBitCount==32) {
+ u_int npixels = biWidth * biHeight;
+ u_int count = 3 * npixels;
+
@@ -6412,16 +10624,73 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
if (!pic8) return(bmpError(bname, "couldn't malloc 'pic8'"));
}
-@@ -216,7 +234,7 @@
- biCompression);
- else rv = loadBMP24(fp,pic24,biWidth,biHeight);
+ WaitCursor();
-- if (rv) bmpError(bname, "File appears truncated. Winging it.\n");
+ /* load up the image */
+- if (biBitCount == 1) rv = loadBMP1(fp,pic8,biWidth,biHeight);
+- else if (biBitCount == 4) rv = loadBMP4(fp,pic8,biWidth,biHeight,
+- biCompression);
+- else if (biBitCount == 8) rv = loadBMP8(fp,pic8,biWidth,biHeight,
+- biCompression);
+- else rv = loadBMP24(fp,pic24,biWidth,biHeight);
++ switch (biBitCount) {
++ case 1:
++ rv = loadBMP1(fp, pic8, biWidth, biHeight);
++ break;
++ case 4:
++ rv = loadBMP4(fp, pic8, biWidth, biHeight, biCompression);
++ break;
++ case 8:
++ rv = loadBMP8(fp, pic8, biWidth, biHeight, biCompression);
++ break;
++ case 16:
++ rv = loadBMP16(fp, pic24, biWidth, biHeight, /* v-- BI_RGB */
++ biCompression == BI_BITFIELDS? colormask : NULL);
++ break;
++ default:
++ if (biBitCount == 32 && biCompression == BI_BITFIELDS)
++ rv = loadBMP32(fp, pic24, biWidth, biHeight, colormask);
++ else /* 24 or (32 and BI_RGB) */
++ rv = loadBMP24(fp, pic24, biWidth, biHeight, biBitCount);
++ break;
++ }
++
+ if (rv) bmpError(bname, "File appears truncated. Winging it.");
+- if (rv) bmpError(bname, "File appears truncated. Winging it.\n");
+
fclose(fp);
-@@ -254,7 +272,7 @@
+
+- if (biBitCount == 24) {
++ if (biBitCount > 8) {
+ pinfo->pic = pic24;
+ pinfo->type = PIC24;
+ }
+@@ -233,6 +292,22 @@
+ cmpstr = "";
+ if (biCompression == BI_RLE4) cmpstr = ", RLE4 compressed";
+ else if (biCompression == BI_RLE8) cmpstr = ", RLE8 compressed";
++ else if (biCompression == BI_BITFIELDS) {
++ int bit, c[3], i;
++ u_int mask;
++
++ for (i = 0; i < 3; ++i) {
++ mask = colormask[i];
++ c[i] = 0;
++ for (bit = 0; bit < 32; ++bit) {
++ if (mask & 1)
++ ++c[i];
++ mask >>= 1;
++ }
++ }
++ sprintf(rgb_bits, ", RGB%d%d%d", c[0], c[1], c[2]);
++ cmpstr = rgb_bits;
++ }
+
+ pinfo->w = biWidth; pinfo->h = biHeight;
+ pinfo->normw = pinfo->w; pinfo->normh = pinfo->h;
+@@ -254,7 +329,7 @@
ERROR:
fclose(fp);
return 0;
@@ -6430,7 +10699,23 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
/*******************************************/
-@@ -277,7 +295,7 @@
+@@ -264,12 +339,13 @@
+ u_int w,h;
+ {
+ int i,j,c,bitnum,padw;
+- byte *pp;
++ byte *pp = pic8 + ((h - 1) * w);
++ size_t l = w*h;
+
+ c = 0;
+ padw = ((w + 31)/32) * 32; /* 'w', padded to be a multiple of 32 */
+
+- for (i=h-1; i>=0; i--) {
++ for (i=h-1; i>=0 && (pp - pic8 <= l); i--) {
+ pp = pic8 + (i * w);
+ if ((i&0x3f)==0) WaitCursor();
+ for (j=bitnum=0; j<padw; j++,bitnum++) {
+@@ -277,7 +353,7 @@
c = getc(fp);
bitnum = 0;
}
@@ -6439,7 +10724,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
if (j<w) {
*pp++ = (c & 0x80) ? 1 : 0;
c <<= 1;
-@@ -287,7 +305,7 @@
+@@ -287,7 +363,7 @@
}
return (FERROR(fp));
@@ -6448,13 +10733,15 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
-@@ -299,24 +317,24 @@
+@@ -298,25 +374,25 @@
+ u_int w,h,comp;
{
int i,j,c,c1,x,y,nybnum,padw,rv;
- byte *pp;
+- byte *pp;
-
-
-+
++ byte *pp = pic8 + ((h - 1) * w);
++ size_t l = w*h;
+
rv = 0;
c = c1 = 0;
@@ -6463,8 +10750,9 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
if (comp == BI_RGB) { /* read uncompressed data */
padw = ((w + 7)/8) * 8; /* 'w' padded to a multiple of 8pix (32 bits) */
-
+- for (i=h-1; i>=0; i--) {
+
- for (i=h-1; i>=0; i--) {
++ for (i=h-1; i>=0 && (pp - pic8 <= l); i--) {
pp = pic8 + (i * w);
if ((i&0x3f)==0) WaitCursor();
-
@@ -6479,7 +10767,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
if (j<w) {
*pp++ = (c & 0xf0) >> 4;
c <<= 4;
-@@ -325,55 +343,55 @@
+@@ -325,55 +401,55 @@
if (FERROR(fp)) break;
}
}
@@ -6498,7 +10786,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
if (c) { /* encoded mode */
c1 = getc(fp);
- for (i=0; i<c; i++,x++,pp++)
-+ for (i=0; i<c; i++,x++,pp++)
++ for (i=0; i<c && (pp - pic8 <= l); i++,x++,pp++)
*pp = (i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f);
}
-
@@ -6524,7 +10812,8 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
-
+
else { /* absolute mode */
- for (i=0; i<c; i++, x++, pp++) {
+- for (i=0; i<c; i++, x++, pp++) {
++ for (i=0; i<c && (pp - pic8 <= l); i++, x++, pp++) {
if ((i&1) == 0) c1 = getc(fp);
*pp = (i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f);
}
@@ -6550,16 +10839,29 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
-@@ -385,7 +403,7 @@
+@@ -384,14 +460,18 @@
+ u_int w,h,comp;
{
int i,j,c,c1,padw,x,y,rv;
- byte *pp;
+- byte *pp;
-
++ byte *pp = pic8 + ((h - 1) * w);
++ size_t l = w*h;
++ byte *pend;
+
rv = 0;
++ pend = pic8 + w * h;
++
if (comp == BI_RGB) { /* read uncompressed data */
-@@ -404,7 +422,7 @@
+ padw = ((w + 3)/4) * 4; /* 'w' padded to a multiple of 4pix (32 bits) */
+
+- for (i=h-1; i>=0; i--) {
++ for (i=h-1; i>=0 && (pp - pic8 <= l); i--) {
+ pp = pic8 + (i * w);
+ if ((i&0x3f)==0) WaitCursor();
+
+@@ -404,15 +484,15 @@
}
else if (comp == BI_RLE8) { /* read RLE8 compressed data */
@@ -6567,8 +10869,18 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
+ x = y = 0;
pp = pic8 + x + (h-y-1)*w;
- while (y<h) {
-@@ -420,7 +438,7 @@
+- while (y<h) {
++ while (y<h && pp<=pend) {
+ c = getc(fp); if (c == EOF) { rv = 1; break; }
+
+ if (c) { /* encoded mode */
+ c1 = getc(fp);
+- for (i=0; i<c; i++,x++,pp++) *pp = c1;
++ for (i=0; i<c && pp<=pend; i++,x++,pp++) *pp = c1;
+ }
+
+ else { /* c==0x00 : escape codes */
+@@ -420,7 +500,7 @@
if (c == 0x00) { /* end of line */
x=0; y++; pp = pic8 + x + (h-y-1)*w;
@@ -6577,7 +10889,12 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
else if (c == 0x01) break; /* end of pic8 */
-@@ -435,21 +453,21 @@
+@@ -431,49 +511,156 @@
+ }
+
+ else { /* absolute mode */
+- for (i=0; i<c; i++, x++, pp++) {
++ for (i=0; i<c && pp<=pend; i++, x++, pp++) {
c1 = getc(fp);
*pp = c1;
}
@@ -6602,21 +10919,212 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
-@@ -469,7 +487,7 @@
+ /*******************************************/
+-static int loadBMP24(fp, pic24, w, h)
++static int loadBMP16(fp, pic24, w, h, mask)
++ FILE *fp;
++ byte *pic24;
++ u_int w, h, *mask;
++{
++ int x, y;
++ byte *pp = pic24 + ((h - 1) * w * 3);
++ size_t l = w*h*3;
++ u_int buf, colormask[6];
++ int i, bit, bitshift[6], colorbits[6], bitshift2[6];
++
++ if (mask == NULL) { /* RGB555 */
++ colormask[0] = 0x00007c00;
++ colormask[1] = 0x000003e0;
++ colormask[2] = 0x0000001f;
++ colormask[3] = 0x7c000000;
++ colormask[4] = 0x03e00000;
++ colormask[5] = 0x001f0000;
++ bitshift[0] = 7; bitshift2[0] = 0;
++ bitshift[1] = 2; bitshift2[1] = 0;
++ bitshift[2] = 0; bitshift2[2] = 3;
++ bitshift[3] = 23; bitshift2[3] = 0;
++ bitshift[4] = 18; bitshift2[4] = 0;
++ bitshift[5] = 13; bitshift2[5] = 0;
++ } else {
++ colormask[0] = mask[0];
++ colormask[1] = mask[1];
++ colormask[2] = mask[2];
++ colormask[3] = (mask[0] & 0xffff) << 16;
++ colormask[4] = (mask[1] & 0xffff) << 16;
++ colormask[5] = (mask[2] & 0xffff) << 16;
++
++ for (i = 0; i < 3; ++i) {
++ buf = colormask[i];
++
++ bitshift[i] = 0;
++ for (bit = 0; bit < 32; ++bit) {
++ if (buf & 1)
++ break;
++ else
++ ++bitshift[i];
++ buf >>= 1;
++ }
++ bitshift[i+3] = bitshift[i] + 16;
++
++ colorbits[i] = 0;
++ for (; bit < 32; ++bit) {
++ if (buf & 1)
++ ++colorbits[i];
++ else
++ break;
++ buf >>= 1;
++ }
++ if (colorbits[i] > 8) { /* over 8-bit depth */
++ bitshift[i] += (colorbits[i] - 8);
++ bitshift[i+3] = bitshift[i] + 16;
++ bitshift2[i] = bitshift2[i+3] = 0;
++ } else
++ bitshift2[i] = bitshift2[i+3] = 8 - colorbits[i];
++ }
++ }
++
++ if (DEBUG > 1)
++ fprintf(stderr, "loadBMP16: bitfields\n"
++ "\tR: bits = %2d, mask = %08x, shift >>%2d, <<%2d\n"
++ "\t (mask = %08x, shift >>%2d, <<%2d)\n"
++ "\tG: bits = %2d, mask = %08x, shift >>%2d, <<%2d\n"
++ "\t (mask = %08x, shift >>%2d, <<%2d)\n"
++ "\tB: bits = %2d, mask = %08x, shift >>%2d, <<%2d\n"
++ "\t (mask = %08x, shift >>%2d, <<%2d)\n",
++ colorbits[0], colormask[0], bitshift[0], bitshift2[0],
++ colormask[3], bitshift[3], bitshift2[3],
++ colorbits[1], colormask[1], bitshift[1], bitshift2[1],
++ colormask[4], bitshift[4], bitshift2[4],
++ colorbits[2], colormask[2], bitshift[2], bitshift2[2],
++ colormask[5], bitshift[5], bitshift2[5]);
++
++ for (y = h-1; y >= 0 && (pp - pic24 <= l); y--) {
++ pp = pic24 + (3 * w * y);
++ if ((y&0x3f)==0) WaitCursor();
++
++ for (x = w; x > 1; x -= 2) {
++ buf = getint(fp);
++ *(pp++) = (buf & colormask[0]) >> bitshift[0] << bitshift2[0];
++ *(pp++) = (buf & colormask[1]) >> bitshift[1] << bitshift2[1];
++ *(pp++) = (buf & colormask[2]) >> bitshift[2] << bitshift2[2];
++ *(pp++) = (buf & colormask[3]) >> bitshift[3] << bitshift2[3];
++ *(pp++) = (buf & colormask[4]) >> bitshift[4] << bitshift2[4];
++ *(pp++) = (buf & colormask[5]) >> bitshift[5] << bitshift2[5];
++ }
++ if (w & 1) { /* padded to 2 pix */
++ buf = getint(fp);
++ *(pp++) = (buf & colormask[0]) >> bitshift[0];
++ *(pp++) = (buf & colormask[1]) >> bitshift[1];
++ *(pp++) = (buf & colormask[2]) >> bitshift[2];
++ }
++ }
++
++ return FERROR(fp)? 1 : 0;
++}
++
++
++
++/*******************************************/
++static int loadBMP24(fp, pic24, w, h, bits) /* also handles 32-bit BI_RGB */
+ FILE *fp;
+ byte *pic24;
+- u_int w,h;
++ u_int w,h, bits;
+ {
+ int i,j,padb,rv;
+- byte *pp;
++ byte *pp = pic24 + ((h - 1) * w * 3);
++ size_t l = w*h*3;
+
+ rv = 0;
+
+ padb = (4 - ((w*3) % 4)) & 0x03; /* # of pad bytes to read at EOscanline */
++ if (bits==32) padb = 0;
+
for (i=h-1; i>=0; i--) {
pp = pic24 + (i * w * 3);
if ((i&0x3f)==0) WaitCursor();
-
+- for (j=0; j<w; j++) {
+
- for (j=0; j<w; j++) {
++ for (j=0; j<w && (pp - pic24 <= l); j++) {
pp[2] = getc(fp); /* blue */
pp[1] = getc(fp); /* green */
-@@ -484,30 +502,30 @@
+ pp[0] = getc(fp); /* red */
++ if (bits==32) getc(fp);
+ pp += 3;
+ }
+
+@@ -484,30 +671,94 @@
}
return rv;
-}
+}
++
++
++
++/*******************************************/
++static int loadBMP32(fp, pic24, w, h, colormask) /* 32-bit BI_BITFIELDS only */
++ FILE *fp;
++ byte *pic24;
++ u_int w, h, *colormask;
++{
++ int x, y;
++ byte *pp;
++ u_int buf;
++ int i, bit, bitshift[3], colorbits[3], bitshift2[3];
++
++ for (i = 0; i < 3; ++i) {
++ buf = colormask[i];
++
++ bitshift[i] = 0;
++ for (bit = 0; bit < 32; ++bit) {
++ if (buf & 1)
++ break;
++ else
++ ++bitshift[i];
++ buf >>= 1;
++ }
++
++ colorbits[i] = 0;
++ for (; bit < 32; ++bit) {
++ if (buf & 1)
++ ++colorbits[i];
++ else
++ break;
++ buf >>= 1;
++ }
++ if (colorbits[i] > 8) { /* over 8-bit depth */
++ bitshift[i] += (colorbits[i] - 8);
++ bitshift2[i] = 0;
++ } else
++ bitshift2[i] = 8 - colorbits[i];
++ }
++
++ if (DEBUG > 1)
++ fprintf(stderr, "loadBMP32: bitfields\n"
++ "\tR: bits = %2d, mask = %08x, shift >>%2d, <<%2d\n"
++ "\tG: bits = %2d, mask = %08x, shift >>%2d, <<%2d\n"
++ "\tB: bits = %2d, mask = %08x, shift >>%2d, <<%2d\n",
++ colorbits[0], colormask[0], bitshift[0], bitshift2[0],
++ colorbits[1], colormask[1], bitshift[1], bitshift2[1],
++ colorbits[2], colormask[2], bitshift[2], bitshift2[2]);
++
++ for (y = h-1; y >= 0; y--) {
++ pp = pic24 + (3 * w * y);
++ if ((y&0x3f)==0) WaitCursor();
++
++ for(x = w; x > 0; x --) {
++ buf = getint(fp);
++ *(pp++) = (buf & colormask[0]) >> bitshift[0] << bitshift2[0];
++ *(pp++) = (buf & colormask[1]) >> bitshift[1] << bitshift2[1];
++ *(pp++) = (buf & colormask[2]) >> bitshift[2] << bitshift2[2];
++ }
++ }
++
++ return FERROR(fp)? 1 : 0;
++}
@@ -6644,13 +11152,13 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
- (((unsigned int) c2) << 16) +
- (((unsigned int) c3) << 24);
+ return ((u_int) c) +
-+ (((u_int) c1) << 8) +
++ (((u_int) c1) << 8) +
+ (((u_int) c2) << 16) +
+ (((u_int) c3) << 24);
}
-@@ -518,7 +536,7 @@
+@@ -518,7 +769,7 @@
{
int c, c1;
@@ -6659,7 +11167,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
putc(c, fp); putc(c1,fp);
}
-@@ -529,10 +547,10 @@
+@@ -529,10 +780,10 @@
int i;
{
int c, c1, c2, c3;
@@ -6674,7 +11182,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
putc(c, fp); putc(c1,fp); putc(c2,fp); putc(c3,fp);
}
-@@ -562,11 +580,11 @@
+@@ -562,11 +813,11 @@
* 8-bit image
* note that PIC24 and F_BWDITHER/F_REDUCED won't happen
*
@@ -6688,7 +11196,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
byte *graypic, *sp, *dp, graymap[256];
nc = nbits = cmaplen = 0;
-@@ -576,10 +594,16 @@
+@@ -576,10 +827,16 @@
/* generate a faked 8-bit per pixel image with a grayscale cmap,
so that it can just fall through existing 8-bit code */
@@ -6707,7 +11215,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
*dp = MONO(sp[0],sp[1],sp[2]);
}
-@@ -611,7 +635,7 @@
+@@ -611,7 +868,7 @@
for (i=0; i<numcols; i++) {
/* see if color #i is a duplicate */
for (j=0; j<i; j++) {
@@ -6716,7 +11224,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
bmap[i] == bmap[j]) break;
}
-@@ -689,13 +713,13 @@
+@@ -689,13 +946,13 @@
#else
if (!FERROR(fp)) return -1;
#endif
@@ -6733,7 +11241,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
/*******************************************/
static void writeBMP1(fp, pic8, w, h)
FILE *fp;
-@@ -708,7 +732,7 @@
+@@ -708,7 +965,7 @@
padw = ((w + 31)/32) * 32; /* 'w', padded to be a multiple of 32 */
for (i=h-1; i>=0; i--) {
@@ -6742,7 +11250,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
if ((i&0x3f)==0) WaitCursor();
for (j=bitnum=c=0; j<=padw; j++,bitnum++) {
-@@ -716,7 +740,7 @@
+@@ -716,7 +973,7 @@
putc(c,fp);
bitnum = c = 0;
}
@@ -6751,7 +11259,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
c <<= 1;
if (j<w) {
-@@ -724,7 +748,7 @@
+@@ -724,7 +981,7 @@
}
}
}
@@ -6760,7 +11268,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
-@@ -758,7 +782,7 @@
+@@ -758,7 +1015,7 @@
}
}
}
@@ -6769,7 +11277,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
-@@ -768,7 +792,7 @@
+@@ -768,7 +1025,7 @@
byte *pic8;
int w,h;
{
@@ -6778,7 +11286,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
byte *pp;
padw = ((w + 3)/4) * 4; /* 'w' padded to a multiple of 4pix (32 bits) */
-@@ -780,7 +804,7 @@
+@@ -780,7 +1037,7 @@
for (j=0; j<w; j++) putc(pc2nc[*pp++], fp);
for ( ; j<padw; j++) putc(0, fp);
}
@@ -6787,7 +11295,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
/*******************************************/
-@@ -789,7 +813,7 @@
+@@ -789,7 +1046,7 @@
byte *pic24;
int w,h;
{
@@ -6796,7 +11304,7 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
byte *pp;
padb = (4 - ((w*3) % 4)) & 0x03; /* # of pad bytes to write at EOscanline */
-@@ -807,7 +831,7 @@
+@@ -807,7 +1064,7 @@
for (j=0; j<padb; j++) putc(0, fp);
}
@@ -6805,9 +11313,18 @@ diff -ruN xv-3.10a/xvbmp.c xv-3.10a-bugfixes/xvbmp.c
-diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
+@@ -816,7 +1073,7 @@
+
+ /*******************************************/
+ static int bmpError(fname, st)
+- char *fname, *st;
++ const char *fname, *st;
+ {
+ SetISTR(ISTR_WARNING,"%s: %s", fname, st);
+ return 0;
+diff -ru xv-3.10a/xvbrowse.c xv-3.10a-enhancements/xvbrowse.c
--- xv-3.10a/xvbrowse.c 1995-01-19 09:49:17.000000000 -0800
-+++ xv-3.10a-bugfixes/xvbrowse.c 2004-05-16 18:01:25.000000000 -0700
++++ xv-3.10a-enhancements/xvbrowse.c 2007-05-13 17:50:18.000000000 -0700
@@ -1,6 +1,6 @@
/*
* xvbrowse.c - visual schnauzer routines
@@ -6816,43 +11333,326 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
* includes:
* void CreateBrowse(char *, char *, char *, char *, char *);
* void OpenBrowse();
-@@ -34,7 +34,7 @@
+@@ -19,11 +19,16 @@
+
+ #define NEEDSDIR
+ #include "xv.h"
++#include <unistd.h> /* access() */
+
+ #if defined(VMS) || defined(isc)
+ typedef unsigned int mode_t; /* file mode bits */
+ #endif
+
++#ifndef MAX
++# define MAX(a,b) (((a)>(b))?(a):(b)) /* used only for wheelmouse support */
++#endif
++
+
+ /* load up built-in icons */
+ #include "bits/br_file"
+@@ -34,27 +39,40 @@
#include "bits/br_sock"
#include "bits/br_fifo"
#include "bits/br_error"
-#include "bits/br_unknown"
+/* #include "bits/br_unknown" commented out (near line 492) */
++
#include "bits/br_cmpres"
-
- #include "bits/br_gif"
-@@ -97,7 +97,7 @@
- #define BF_MAX 28 /* # of built-in icons */
++#include "bits/br_bzip2"
+
+-#include "bits/br_gif"
+-#include "bits/br_pm"
+-#include "bits/br_pbm"
+-#include "bits/br_xbm"
+-#include "bits/br_sunras"
+ #include "bits/br_bmp"
+-#include "bits/br_utah"
++#include "bits/br_fits"
++#include "bits/br_gif"
++#include "bits/br_iff"
+ #include "bits/br_iris"
+-#include "bits/br_pcx"
+ #include "bits/br_jfif"
+-#include "bits/br_tiff"
++#include "bits/br_jp2"
++#include "bits/br_jpc"
++#include "bits/br_mag"
++#include "bits/br_maki"
++#include "bits/br_mgcsfx"
++#include "bits/br_pbm"
++#include "bits/br_pcd"
++#include "bits/br_pcx"
+ #include "bits/br_pds"
++#include "bits/br_pi"
++#include "bits/br_pic"
++#include "bits/br_pic2"
++#include "bits/br_pm"
++#include "bits/br_png"
+ #include "bits/br_ps"
+-#include "bits/br_iff"
++#include "bits/br_sunras"
+ #include "bits/br_targa"
++#include "bits/br_tiff"
++#include "bits/br_utah"
++#include "bits/br_xbm"
+ #include "bits/br_xpm"
+ #include "bits/br_xwd"
+-#include "bits/br_fits"
++#include "bits/br_zx" /* [JCE] The Spectrum+3 icon */
+
+ #include "bits/br_trash"
+ #include "bits/fcurs"
+@@ -90,17 +108,28 @@
+ #define BF_COMPRESS 21
+ #define BF_PS 22
+ #define BF_IFF 23
+-#define BF_TARGA 24
++#define BF_TGA 24
+ #define BF_XPM 25
+ #define BF_XWD 26
+ #define BF_FITS 27
+-#define BF_MAX 28 /* # of built-in icons */
++#define BF_PNG 28
++#define BF_ZX 29 /* [JCE] Spectrum SCREEN$ */
++#define BF_PCD 30
++#define BF_BZIP2 31
++#define BF_JP2 32
++#define BF_JPC 33
++#define JP_EXT_BF (BF_JPC)
++#define BF_MAG (JP_EXT_BF + 1)
++#define BF_MAKI (JP_EXT_BF + 2)
++#define BF_PIC (JP_EXT_BF + 3)
++#define BF_PI (JP_EXT_BF + 4)
++#define BF_PIC2 (JP_EXT_BF + 5)
++#define BF_MGCSFX (JP_EXT_BF + 6)
++#define JP_EXT_BF_END (BF_MGCSFX)
++#define BF_MAX (JP_EXT_BF_END + 1) /* # of built-in icons */
#define ISLOADABLE(ftyp) (ftyp!=BF_DIR && ftyp!=BF_CHR && ftyp!=BF_BLK && \
- ftyp!=BF_SOCK && ftyp!=BF_FIFO)
+-
+-#define DEF_BROWWIDE 615 /* default size of window */
+-#define DEF_BROWHIGH 356
+ ftyp!=BF_SOCK && ftyp!=BF_FIFO)
- #define DEF_BROWWIDE 615 /* default size of window */
- #define DEF_BROWHIGH 356
-@@ -150,12 +150,12 @@
- static char *hideHstr = "Hide 'hidden' files";
+ #define SCROLLVERT 8 /* height of scroll region at top/bottom of iconw */
+ #define PAGEVERT 40 /* during rect drag, if further than this, page */
+@@ -113,59 +142,93 @@
+ #define BOTMARGIN 58 /* room for a row of buttons and a line of text */
+ #define LRMARGINS 5 /* left and right margins */
+
+-#define ISIZE_WIDE 80 /* maximum size of an icon */
+-#define ISIZE_HIGH 60
++/* some people like bigger icons; 4:3 aspect ratio is recommended
++ * (NOTE: standard XV binaries will not be able to read larger icons!) */
++#ifndef ISIZE_WIDE
++# define ISIZE_WIDE 80 /* maximum size of an icon */
++#endif
++#ifndef ISIZE_HIGH
++# define ISIZE_HIGH 60
++#endif
++
++#ifndef ISIZE_WPAD
++# define ISIZE_WPAD 16 /* extra horizontal padding between icons */
++#endif
++
++#ifndef INUM_WIDE
++# define INUM_WIDE 6 /* size initial window to hold this many icons */
++#endif
++#ifndef INUM_HIGH
++# define INUM_HIGH 3
++#endif
+
+-#define ISPACE_WIDE (ISIZE_WIDE+16) /* icon spacing */
++#define ISPACE_WIDE (ISIZE_WIDE+ISIZE_WPAD) /* icon spacing */
+ #define ISPACE_TOP 4 /* dist btwn top of ISPACE and ISIZE */
+ #define ISPACE_TTOP 4 /* dist btwn bot of icon and title */
+ #define ISPACE_HIGH (ISIZE_HIGH+ISPACE_TOP+ISPACE_TTOP+16+4)
+
+ #define DBLCLICKTIME 300 /* milliseconds */
+
+-/* button/menu indicies */
+-#define BR_CHDIR 0
+-#define BR_DELETE 1
+-#define BR_MKDIR 2
+-#define BR_RENAME 3
+-#define BR_RESCAN 4
+-#define BR_UPDATE 5
+-#define BR_NEWWIN 6
+-#define BR_GENICON 7
+-#define BR_SELALL 8
+-#define BR_TEXTVIEW 9
+-#define BR_RECURSUP 10
+-#define BR_QUIT 11
+-#define BR_CLOSE 12
+-#define BR_NBUTTS 13 /* # of command buttons */
+-#define BR_SEP1 13 /* separator */
+-#define BR_HIDDEN 14
+-#define BR_SELFILES 15
+-#define BR_NCMDS 16 /* # of menu commands */
++#define COUNT(x) (sizeof (x) / sizeof (x)[0])
++
++/* button/menu indices */
++#define BR_CHDIR 0
++#define BR_DELETE 1
++#define BR_MKDIR 2
++#define BR_RENAME 3
++#define BR_RESCAN 4
++#define BR_UPDATE 5
++#define BR_NEWWIN 6
++#define BR_GENICON 7
++#define BR_SELALL 8
++#define BR_TEXTVIEW 9
++#define BR_RECURSUP 10
++#define BR_QUIT 11
++#define BR_CLOSE 12
++#define BR_NBUTTS 13 /* # of command buttons */
++#define BR_SEP1 13 /* separator */
++#define BR_HIDDEN 14
++#define BR_SELFILES 15
++#define BR_CLIPBRD 16
++#ifdef AUTO_EXPAND
++# define BR_CLEARVD 17
++# define BR_NCMDS 18 /* # of menu commands */
++#else
++# define BR_NCMDS 17 /* # of menu commands */
++#endif
- static char *cmdMList[] = { "Change directory...\t^c",
+ #define BUTTW 80
+ #define BUTTH 24
+
+-static char *showHstr = "Show hidden files";
+-static char *hideHstr = "Hide 'hidden' files";
+-
+-static char *cmdMList[] = { "Change directory...\t^c",
- "Delete file(s)\t^d",
- "New directory...\t^n",
- "Rename file...\t^r",
-+ "Delete file(s)\t^d",
-+ "New directory...\t^n",
-+ "Rename file...\t^r",
- "Rescan directory\t^s",
+- "Rescan directory\t^s",
- "Update icons\t^u",
- "Open new window\t^w",
-+ "Update icons\t^u",
-+ "Open new window\t^w",
- "Generate icon(s)\t^g",
- "Select all files\t^a",
- "Text view\t^t",
-@@ -260,7 +260,7 @@
+- "Generate icon(s)\t^g",
+- "Select all files\t^a",
+- "Text view\t^t",
+- "Recursive Update\t^e",
+- "Quit xv\t^q",
+- "Close window\t^c",
+- MBSEP,
+- "Show hidden files", /* no equiv */
+- "Select files...\t^f"
+- };
++/* original size of window was 615 x 356 (for 80x60 thumbnails in 6x3 array) */
++#define DEF_BROWWIDE (ISPACE_WIDE * INUM_WIDE + LRMARGINS * 2 + 29)
++#define DEF_BROWHIGH (ISPACE_HIGH * INUM_HIGH + BUTTH * 2 + 16 + 28)
++/* last number is a fudge--e.g., extra spaces, borders, etc. -----^ */
++
++static const char *showHstr = "Show hidden files";
++static const char *hideHstr = "Hide 'hidden' files";
++
++static const char *cmdMList[] = { "Change directory...\t^c",
++ "Delete file(s)\t^d",
++ "New directory...\t^n",
++ "Rename file...\t^r",
++ "Rescan directory\t^s",
++ "Update icons\t^u",
++ "Open new window\t^w",
++ "Generate icon(s)\t^g",
++ "Select all files\t^a",
++ "Text view\t^t",
++ "Recursive Update\t^e",
++ "Quit xv\t^q",
++ "Close window\t^c",
++ MBSEP,
++ "Show hidden files", /* no equiv */
++ "Select files...\t^f",
++ "Clipboard\t^x"
++#ifdef AUTO_EXPAND
++ , "Clear virtual directory"
++#endif
++ };
+
+
+ #define MAXDEEP 30 /* maximum directory depth */
+@@ -183,32 +246,43 @@
+ } BFIL;
+
+ /* data needed per schnauzer window */
+-typedef struct { Window win, iconW;
+- int vis, wasvis;
++typedef struct { Window win, iconW;
++ int vis, wasvis;
+
+- int wide, high;
+- int iwWide, iwHigh;
+- int numWide, numHigh, visHigh;
+-
+- SCRL scrl;
+- BUTT but[BR_NBUTTS];
+- MBUTT dirMB, cmdMB;
+- char dispstr[256];
+- int numbutshown;
+- int showhidden;
+-
+- int numlit;
+- BFIL *bfList;
+- int bfLen;
+- int lastIconClicked;
++ int wide, high;
++ int iwWide, iwHigh;
++ int numWide, numHigh, visHigh;
++
++ SCRL scrl;
++ BUTT but[BR_NBUTTS];
++ MBUTT dirMB, cmdMB;
++ char dispstr[256];
++ int numbutshown;
++ int showhidden;
++
++ int numlit;
++ BFIL *bfList;
++ int bfLen;
++ int lastIconClicked;
+ unsigned long lastClickTime;
+
+- int ndirs;
+- char *mblist[MAXDEEP];
+- char path[MAXPATHLEN+2]; /* '/' terminated */
++ int ndirs;
++ const char *mblist[MAXDEEP];
++ char path[MAXPATHLEN+2]; /* '/' terminated */
++
++ char *str;
++ int siz, len;
++ time_t lst;
+ } BROWINFO;
+
+
++/* keep track of last icon visible in each path */
++typedef struct IVIS IVIS;
++ struct IVIS { IVIS *next;
++ char *name;
++ int icon;
++ };
++
+ static Cursor movecurs, copycurs, delcurs;
+ static BROWINFO binfo[MAXBRWIN];
+ static Pixmap bfIcons[BF_MAX], trashPix;
+@@ -220,7 +294,7 @@
+ static void closeBrowse PARM((BROWINFO *));
+ static int brChkEvent PARM((BROWINFO *, XEvent *));
+ static void resizeBrowse PARM((BROWINFO *, int, int));
+-static void setBrowStr PARM((BROWINFO *, char *));
++static void setBrowStr PARM((BROWINFO *, const char *));
+ static void doCmd PARM((BROWINFO *, int));
+ static void drawBrow PARM((BROWINFO *));
+ static void drawNumfiles PARM((BROWINFO *));
+@@ -255,12 +329,12 @@
+ static void rescanDir PARM((BROWINFO *));
+ static int namcmp PARM((const void *, const void *));
+ static void freeBfList PARM((BROWINFO *br));
+-static char **getDirEntries PARM((char *, int *, int));
++static char **getDirEntries PARM((const char *, int *, int));
+ static void computeScrlVals PARM((BROWINFO *, int *, int *));
static void genSelectedIcons PARM((BROWINFO *));
static void genIcon PARM((BROWINFO *, BFIL *));
static void loadThumbFile PARM((BROWINFO *, BFIL *));
@@ -6861,16 +11661,52 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
int, char *));
static void makeThumbDir PARM((BROWINFO *));
-@@ -284,7 +284,7 @@
+@@ -278,14 +352,14 @@
+ static void doSelFilesCmd PARM((BROWINFO *));
+
+ static void doRecurseCmd PARM((BROWINFO *));
+-static void recurseUpdate PARM((BROWINFO *, char *));
++static void recurseUpdate PARM((BROWINFO *, const char *));
+
+ static void rm_file PARM((BROWINFO *, char *));
static void rm_dir PARM((BROWINFO *, char *));
static void rm_dir1 PARM((BROWINFO *));
-static void dragFiles PARM((BROWINFO *, BROWINFO *, char *, char *,
+- char *, char **, int, int));
+static void dragFiles PARM((BROWINFO *, BROWINFO *, char *, char *,
- char *, char **, int, int));
++ const char *, char **, int, int));
static int moveFile PARM((char *, char *));
static int copyFile PARM((char *, char *));
-@@ -369,8 +369,8 @@
+ static void cp PARM((void));
+@@ -294,16 +368,25 @@
+ static void cp_special PARM((struct stat *, int));
+ static void cp_fifo PARM((struct stat *, int));
+
++#ifdef AUTO_EXPAND
++static int stat2bf PARM((u_int, char *));
++#else
+ static int stat2bf PARM((u_int));
++#endif
+
+ static int selmatch PARM((char *, char *));
+ static int selmatch1 PARM((char *, char *));
++static void recIconVisible PARM((char *, int));
++static void restIconVisible PARM((BROWINFO *));
++
++static void clipChanges PARM((BROWINFO *));
+
+
+
+ /***************************************************************/
+ void CreateBrowse(geom, fgstr, bgstr, histr, lostr)
+- char *geom, *fgstr, *bgstr, *histr, *lostr;
++ const char *geom;
++ const char *fgstr, *bgstr, *histr, *lostr;
+ {
+ int i;
+ XSizeHints hints;
+@@ -369,8 +452,8 @@
if (gset & YNegative) gy1 = gy - i * 20;
else gy1 = gy + i * 20;
@@ -6881,7 +11717,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(gset & XNegative) ? "-" : "+", abs(gx1),
(gset & YNegative) ? "-" : "+", abs(gy1));
else
-@@ -402,11 +402,11 @@
+@@ -402,11 +485,11 @@
/* note: everything is sized and positioned in ResizeBrowse() */
@@ -6895,7 +11731,22 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
browfg, browbg, browhi, browlo, drawIconWin);
-@@ -486,7 +486,7 @@
+@@ -448,10 +531,12 @@
+ "Text view",browfg,browbg,browhi,browlo);
+ BTCreate(&(br->but[BR_RECURSUP]), br->win, 0,0,BUTTW,BUTTH,
+ "RecursUpd",browfg,browbg,browhi,browlo);
+- BTCreate(&(br->but[BR_QUIT]), br->win, 0,0,BUTTW,BUTTH,
++ BTCreate(&(br->but[BR_QUIT]), br->win, 0,0,BUTTW,BUTTH,
+ "Quit xv",browfg,browbg,browhi,browlo);
+- BTCreate(&(br->but[BR_CLOSE]), br->win, 0,0,BUTTW,BUTTH,
++ BTCreate(&(br->but[BR_CLOSE]), br->win, 0,0,BUTTW,BUTTH,
+ "Close",browfg,browbg,browhi,browlo);
++ BTCreate(&(br->but[BR_CLIPBRD]), br->win, 0,0,BUTTW,BUTTH,
++ "Clipboard",browfg,browbg,browhi,browlo);
+
+ XMapSubwindows(theDisp, br->win);
+
+@@ -486,55 +571,62 @@
bfIcons[BF_SOCK]=MakePix1(br->win,br_sock_bits,br_sock_width,br_sock_height);
bfIcons[BF_FIFO]=MakePix1(br->win,br_fifo_bits,br_fifo_width,br_fifo_height);
@@ -6904,19 +11755,72 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
br_error_width, br_error_height);
/* bfIcons[BF_UNKNOWN] = MakePix1(br->win, br_unknown_bits,
-@@ -501,9 +501,9 @@
+ br_unknown_width, br_unknown_height); */
+-
+ bfIcons[BF_UNKNOWN] = bfIcons[BF_FILE];
- bfIcons[BF_SUNRAS] = MakePix1(br->win, br_sunras_bits,
- br_sunras_width, br_sunras_height);
+- bfIcons[BF_GIF] =MakePix1(br->win,br_gif_bits, br_gif_width, br_gif_height);
+- bfIcons[BF_PM] =MakePix1(br->win,br_pm_bits, br_pm_width, br_pm_height);
+- bfIcons[BF_PBM] =MakePix1(br->win,br_pbm_bits, br_pbm_width, br_pbm_height);
+- bfIcons[BF_XBM] =MakePix1(br->win,br_xbm_bits, br_xbm_width, br_xbm_height);
+-
+- bfIcons[BF_SUNRAS] = MakePix1(br->win, br_sunras_bits,
+- br_sunras_width, br_sunras_height);
- bfIcons[BF_BMP] = MakePix1(br->win,br_bmp_bits,
-+ bfIcons[BF_BMP] = MakePix1(br->win,br_bmp_bits,
- br_bmp_width, br_bmp_height);
+- br_bmp_width, br_bmp_height);
- bfIcons[BF_UTAHRLE] = MakePix1(br->win, br_utahrle_bits,
+- br_utahrle_width, br_utahrle_height);
++ bfIcons[BF_COMPRESS] = MakePix1(br->win, br_cmpres_bits,
++ br_cmpres_width, br_cmpres_height);
++ bfIcons[BF_BZIP2] = MakePix1(br->win, br_bzip2_bits,
++ br_bzip2_width, br_bzip2_height);
+
++ bfIcons[BF_BMP] =MakePix1(br->win,br_bmp_bits, br_bmp_width, br_bmp_height);
++ bfIcons[BF_FITS]=MakePix1(br->win,br_fits_bits,br_fits_width,br_fits_height);
++ bfIcons[BF_GIF] =MakePix1(br->win,br_gif_bits, br_gif_width, br_gif_height);
++ bfIcons[BF_IFF] =MakePix1(br->win,br_iff_bits, br_iff_width, br_iff_height);
+ bfIcons[BF_IRIS]=MakePix1(br->win,br_iris_bits,br_iris_width,br_iris_height);
+- bfIcons[BF_PCX] =MakePix1(br->win,br_pcx_bits, br_pcx_width, br_pcx_height);
+ bfIcons[BF_JFIF]=MakePix1(br->win,br_jfif_bits,br_jfif_width,br_jfif_height);
+- bfIcons[BF_TIFF]=MakePix1(br->win,br_tiff_bits,br_tiff_width,br_tiff_height);
++ bfIcons[BF_JP2] =MakePix1(br->win,br_jp2_bits, br_jp2_width, br_jp2_height);
++ bfIcons[BF_JPC] =MakePix1(br->win,br_jpc_bits, br_jpc_width, br_jpc_height);
++ bfIcons[BF_MAG] =MakePix1(br->win,br_mag_bits, br_mag_width, br_mag_height);
++ bfIcons[BF_MAKI]=MakePix1(br->win,br_maki_bits,br_maki_width,br_maki_height);
++ bfIcons[BF_PBM] =MakePix1(br->win,br_pbm_bits, br_pbm_width, br_pbm_height);
++ bfIcons[BF_PCD] =MakePix1(br->win,br_pcd_bits, br_pcd_width, br_pcd_height);
++ bfIcons[BF_PCX] =MakePix1(br->win,br_pcx_bits, br_pcx_width, br_pcx_height);
+ bfIcons[BF_PDS] =MakePix1(br->win,br_pds_bits, br_pds_width, br_pds_height);
+-
+- bfIcons[BF_COMPRESS]= MakePix1(br->win, br_cmpres_bits,
+- br_cmpres_width, br_cmpres_height);
+-
++ bfIcons[BF_PIC2]=MakePix1(br->win,br_pic2_bits,br_pic2_width,br_pic2_height);
++ bfIcons[BF_PIC] =MakePix1(br->win,br_pic_bits, br_pic_width, br_pic_height);
++ bfIcons[BF_PI] =MakePix1(br->win,br_pi_bits, br_pi_width, br_pi_height);
++ bfIcons[BF_PM] =MakePix1(br->win,br_pm_bits, br_pm_width, br_pm_height);
++ bfIcons[BF_PNG] =MakePix1(br->win,br_png_bits, br_png_width, br_png_height);
+ bfIcons[BF_PS] =MakePix1(br->win,br_ps_bits, br_ps_width, br_ps_height);
+- bfIcons[BF_IFF] =MakePix1(br->win,br_iff_bits, br_iff_width, br_iff_height);
+-
+- bfIcons[BF_TARGA] = MakePix1(br->win, br_targa_bits,
+- br_targa_width, br_targa_height);
+-
++ bfIcons[BF_TGA] =MakePix1(br->win,br_tga_bits, br_tga_width, br_tga_height);
++ bfIcons[BF_TIFF]=MakePix1(br->win,br_tiff_bits,br_tiff_width,br_tiff_height);
++ bfIcons[BF_XBM] =MakePix1(br->win,br_xbm_bits, br_xbm_width, br_xbm_height);
+ bfIcons[BF_XPM] =MakePix1(br->win,br_xpm_bits, br_xpm_width, br_xpm_height);
+ bfIcons[BF_XWD] =MakePix1(br->win,br_xwd_bits, br_xwd_width, br_xwd_height);
+- bfIcons[BF_FITS]=MakePix1(br->win,br_fits_bits,br_fits_width,br_fits_height);
++ bfIcons[BF_ZX] =MakePix1(br->win,br_zx_bits, br_zx_width, br_zx_height);
++
++ bfIcons[BF_SUNRAS] = MakePix1(br->win, br_sunras_bits,
++ br_sunras_width, br_sunras_height);
+ bfIcons[BF_UTAHRLE] = MakePix1(br->win, br_utahrle_bits,
- br_utahrle_width, br_utahrle_height);
++ br_utahrle_width, br_utahrle_height);
++ bfIcons[BF_MGCSFX] = MakePix1(br->win, br_mgcsfx_bits,
++ br_mgcsfx_width, br_mgcsfx_height);
- bfIcons[BF_IRIS]=MakePix1(br->win,br_iris_bits,br_iris_width,br_iris_height);
-@@ -528,13 +528,13 @@
/* check that they all got built */
for (i=0; i<BF_MAX && bfIcons[i]; i++);
@@ -6932,7 +11836,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
KeyPressMask | StructureNotifyMask);
}
-@@ -557,7 +557,7 @@
+@@ -557,7 +649,7 @@
movecurs = XCreatePixmapCursor(theDisp,mcpix,fcmpix,&cursfg,&cursbg,13,13);
copycurs = XCreatePixmapCursor(theDisp,ccpix,fcmpix,&cursfg,&cursbg,13,13);
delcurs = XCreatePixmapCursor(theDisp,dcpix,fcmpix,&cursbg,&cursfg,13,13);
@@ -6941,7 +11845,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
FatalError("unable to create schnauzer cursors...");
}
else FatalError("unable to create schnauzer cursors...");
-@@ -566,7 +566,7 @@
+@@ -566,7 +658,7 @@
XFreePixmap(theDisp, ccpix);
XFreePixmap(theDisp, dcpix);
XFreePixmap(theDisp, fcmpix);
@@ -6950,7 +11854,20 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
hasBeenSized = 1; /* we can now start looking at browse events */
}
-@@ -586,11 +586,11 @@
+@@ -576,9 +668,10 @@
+ void OpenBrowse()
+ {
+ /* opens up a single browser window */
+- int i;
++
++ int i;
+ BROWINFO *br;
+- char path[MAXPATHLEN+1];
++ char path[MAXPATHLEN+1];
+
+ /* find next browser to be opened */
+ for (i=0; i<MAXBRWIN; i++) {
+@@ -586,11 +679,11 @@
if (!br->vis) break;
}
if (i==MAXBRWIN) return; /* full up: shouldn't happen */
@@ -6964,7 +11881,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
freeBfList(br);
/* see if some browser is pointing to the same path as CWD. If so,
-@@ -645,7 +645,7 @@
+@@ -645,7 +738,7 @@
/* free all info for this browse window */
freeBfList(br);
sprintf(br->path, BOGUSPATH);
@@ -6973,17 +11890,68 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/* turn on 'open new window' command doodads */
windowMB.dim[WMB_BROWSE] = 0;
for (i=0; i<MAXBRWIN; i++) {
-@@ -739,8 +739,7 @@
+@@ -698,6 +791,9 @@
+ }
+ }
+
++#ifdef VS_RESCMAP
++static int _IfTempOut=0;
++#endif
+
+ /***************************************************************/
+ void KillBrowseWindows()
+@@ -730,7 +826,6 @@
+ return 0;
+ }
+
+-
+ /***************************************************************/
+ static int brChkEvent(br, xev)
+ BROWINFO *br;
+@@ -739,22 +834,36 @@
/* checks event to see if it's a browse-window related thing. If it
is, it eats the event and returns '1', otherwise '0'. */
- int i, rv;
- char buf[1024];
-+ int rv;
+-
+- rv = 1;
++ int rv = 1;
- rv = 1;
+ if (!hasBeenSized) return 0; /* ignore evrythng until we get 1st Resize */
+
++
++#ifdef VS_RESCMAP
++ /* force change color map if have LocalCmap */
++ if (browPerfect && browCmap && (_IfTempOut==2)) {
++ int i;
++ XSetWindowAttributes xswa;
++
++ xswa.colormap = LocalCmap? LocalCmap : theCmap;
++ for (i=0; i<MAXBRWIN; ++i)
++ XChangeWindowAttributes(theDisp, binfo[i].win, CWColormap, &xswa);
++ XFlush(theDisp);
++ _IfTempOut=1;
++ }
++#endif
++
+ if (xev->type == Expose) {
+ int x,y,w,h;
+ XExposeEvent *e = (XExposeEvent *) xev;
+ x = e->x; y = e->y; w = e->width; h = e->height;
-@@ -788,7 +787,7 @@
+ /* throw away excess redraws for 'dumb' windows */
+- if (e->count > 0 && (e->window == br->scrl.win)) {}
++ if (e->count > 0 && (e->window == br->scrl.win))
++ ;
+
+- else if (e->window == br->scrl.win) SCRedraw(&(br->scrl));
++ else if (e->window == br->scrl.win)
++ SCRedraw(&(br->scrl));
+
+ else if (e->window == br->win || e->window == br->iconW) { /* smart wins */
+ /* group individual expose rects into a single expose region */
+@@ -788,7 +897,7 @@
fprintf(stderr,"grouped %d expose events into %d,%d %dx%d rect\n",
count, rect.x, rect.y, rect.width, rect.height);
}
@@ -6992,16 +11960,65 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if (e->window == br->win) drawBrow(br);
else if (e->window == br->iconW)
-@@ -811,7 +810,7 @@
+@@ -807,13 +916,55 @@
+ int i,x,y;
+ x = e->x; y = e->y;
+
++#ifdef VS_RESCMAP
++ if (browCmap && browPerfect && (_IfTempOut!=0)) {
++ XSetWindowAttributes xswa;
++ _IfTempOut--;
++ xswa.colormap = browCmap;
++ for(i=0;i<MAXBRWIN;i++)
++ XChangeWindowAttributes(theDisp, binfo[i].win, CWColormap, &xswa);
++ XFlush(theDisp);
++ }
++#endif
++
+ if (e->button == Button1) {
if (e->window == br->win) clickBrow(br,x,y);
else if (e->window == br->scrl.win) SCTrack(&(br->scrl),x,y);
else if (e->window == br->iconW) {
- i = clickIconWin(br, x,y,(unsigned long) e->time,
+ i = clickIconWin(br, x,y,(unsigned long) e->time,
(e->state&ControlMask) || (e->state&ShiftMask));
-
+-
++ }
++ else rv = 0;
++ }
++ else if (e->button == Button4) { /* note min vs. max, + vs. - */
++ /* scroll regardless of where we are in the browser window */
++ if (e->window == br->win ||
++ e->window == br->scrl.win ||
++ e->window == br->iconW)
++ {
++ SCRL *sp=&(br->scrl);
++ int halfpage=MAX(1,sp->page/2); /* user resize to 1 line? */
++
++ if (sp->val > sp->min+halfpage)
++ SCSetVal(sp,sp->val-halfpage);
++ else
++ SCSetVal(sp,sp->min);
++ }
++ else rv = 0;
++ }
++ else if (e->button == Button5) { /* note max vs. min, - vs. + */
++ /* scroll regardless of where we are in the browser window */
++ if (e->window == br->win ||
++ e->window == br->scrl.win ||
++ e->window == br->iconW)
++ {
++ SCRL *sp=&(br->scrl);
++ int halfpage=MAX(1,sp->page/2); /* user resize to 1 line? */
++
++ if (sp->val < sp->max-halfpage)
++ SCSetVal(sp,sp->val+halfpage);
++ else
++ SCSetVal(sp,sp->max);
}
-@@ -837,7 +836,7 @@
+ else rv = 0;
+ }
+@@ -837,7 +988,7 @@
if (br->wide != e->width || br->high != e->height) {
if (DEBUG) fprintf(stderr,"Forcing a redraw! (from configure)\n");
@@ -7010,7 +12027,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(u_int) e->width, (u_int) e->height, True);
resizeBrowse(br, e->width, e->height);
}
-@@ -877,7 +876,7 @@
+@@ -877,7 +1028,7 @@
int w,h;
{
XSizeHints hints;
@@ -7019,7 +12036,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if (br->wide == w && br->high == h) return; /* no change in size */
-@@ -895,7 +894,7 @@
+@@ -895,7 +1046,7 @@
br->iwHigh = (maxh / ISPACE_HIGH) * ISPACE_HIGH;
if (br->iwHigh < ISPACE_HIGH) br->iwHigh = ISPACE_HIGH;
@@ -7028,7 +12045,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(u_int) br->iwWide, (u_int) br->iwHigh);
-@@ -907,11 +906,11 @@
+@@ -907,11 +1058,11 @@
for (i=0; i<BR_NBUTTS; i++) {
/* 'close' always goes on right-most edge */
@@ -7042,7 +12059,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
br->but[i].x = br->wide + 10; /* offscreen */
br->but[i].y = br->high - BUTTH - 5;
-@@ -928,11 +927,11 @@
+@@ -928,11 +1079,11 @@
br->numWide = br->iwWide / ISPACE_WIDE;
br->visHigh = br->iwHigh / ISPACE_HIGH;
@@ -7057,7 +12074,13 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
1, br->iwHigh, 0, maxv, br->scrl.val, page);
}
-@@ -945,7 +944,7 @@
+@@ -940,12 +1091,12 @@
+
+ /***************************************************************/
+ void SetBrowStr(str)
+- char *str;
++ const char *str;
+ {
/* put string in *all* browse windows */
int i;
@@ -7066,15 +12089,19 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
setBrowStr(&binfo[i], str);
}
-@@ -956,6 +955,7 @@
- char *str;
+@@ -953,9 +1104,10 @@
+ /***************************************************************/
+ static void setBrowStr(br, str)
+ BROWINFO *br;
+- char *str;
++ const char *str;
{
strncpy(br->dispstr, str, (size_t) 256);
+ br->dispstr[255] = '\0';
drawBrowStr(br);
XFlush(theDisp);
}
-@@ -992,7 +992,7 @@
+@@ -992,7 +1144,7 @@
char tmp[64];
@@ -7083,7 +12110,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
i+1, br->bfLen);
setBrowStr(br, tmp);
}
-@@ -1011,14 +1011,14 @@
+@@ -1011,14 +1163,14 @@
{
/* called when file 'name' has been deleted. If any of the browsers
were showing the directory that the file was in, does a rescan() */
@@ -7093,14 +12120,24 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
char buf[MAXPATHLEN + 2], *tmp;
strcpy(buf, name);
- tmp = BaseName(buf);
+- tmp = BaseName(buf);
++ tmp = (char *) BaseName(buf); /* intentionally losing constness */
*tmp = '\0'; /* truncate after last '/' */
-
+
for (i=0; i<MAXBRWIN; i++) {
if (strcmp(binfo[i].path, buf)==0) rescanDir(&binfo[i]);
}
-@@ -1070,9 +1070,9 @@
+@@ -1043,6 +1195,8 @@
+ BROWINFO *br;
+ int cmd;
+ {
++ br->lst = 0;
++
+ switch (cmd) {
+ case BR_CHDIR: doChdirCmd(br);
+ break;
+@@ -1070,9 +1224,9 @@
case BR_GENICON: genSelectedIcons(br); break;
case BR_SELALL: {
@@ -7112,7 +12149,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
br->bfList[i].lit = 1;
br->numlit = br->bfLen;
-@@ -1087,13 +1087,13 @@
+@@ -1087,20 +1241,25 @@
break;
case BR_TEXTVIEW: doTextCmd(br); break;
@@ -7124,11 +12161,24 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
case BR_HIDDEN: br->showhidden = !br->showhidden;
- br->cmdMB.list[cmd] = (br->showhidden)
-+ br->cmdMB.list[cmd] = (br->showhidden)
- ? hideHstr : showHstr;
+- ? hideHstr : showHstr;
++ br->cmdMB.list[cmd] = br->showhidden ? hideHstr : showHstr;
rescanDir(br);
break;
-@@ -1137,16 +1137,16 @@
+
+ case BR_SELFILES: doSelFilesCmd(br); break;
+
+ case BR_RECURSUP: doRecurseCmd(br); break;
++
++ case BR_CLIPBRD: clipChanges(br); break;
++
++#ifdef AUTO_EXPAND
++ case BR_CLEARVD: Vdsettle(); break;
++#endif
+ }
+ }
+
+@@ -1137,16 +1296,16 @@
if (br->bfLen != 1) sprintf(foo, "%d files", br->bfLen);
else strcpy(foo, "1 file");
@@ -7148,7 +12198,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(u_int) br->dirMB.h-2, R3D_IN, 2, browhi, browlo, browbg);
XSetForeground(theDisp,theGC,browfg);
-@@ -1163,7 +1163,7 @@
+@@ -1163,7 +1322,7 @@
if (nf != 1) sprintf(foo,"%d files",nf);
else strcpy(foo,"1 file");
@@ -7157,7 +12207,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
XClearArea(theDisp,br->win, 30, br->dirMB.y,
(u_int) StringWidth(foo)+8, (u_int) br->dirMB.h+1, False);
}
-@@ -1185,13 +1185,13 @@
+@@ -1185,13 +1344,13 @@
XSetForeground(theDisp,theGC,browfg);
XDrawRectangle(theDisp,br->win, theGC, x,y, (u_int) w, (u_int) h);
@@ -7174,7 +12224,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
x+(w-br_trash_width)/2, y+(h-br_trash_height)/2,
1L);
}
-@@ -1222,7 +1222,7 @@
+@@ -1222,7 +1381,7 @@
y = br->high - (BUTTH+10) - (CHIGH + 6);
XSetForeground(theDisp, theGC, browbg);
@@ -7183,7 +12233,39 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(u_int) br->wide, (u_int) CHIGH+1);
XSetForeground(theDisp, theGC, browfg);
-@@ -1277,7 +1277,7 @@
+@@ -1250,6 +1409,19 @@
+ int i, allowtext;
+
+ if (!nostr) setSelInfoStr(br, sel);
++#ifdef AUTO_EXPAND
++ if (Isvdir(br->path)) {
++ BTSetActive(&br->but[BR_DELETE], 0);
++ br->cmdMB.dim[BR_DELETE] = 1;
++
++ BTSetActive(&br->but[BR_RENAME], 0);
++ br->cmdMB.dim[BR_RENAME] = 1;
++
++ BTSetActive(&br->but[BR_MKDIR], 0);
++ br->cmdMB.dim[BR_MKDIR] = 1;
++ }
++ else {
++#endif
+ BTSetActive(&br->but[BR_DELETE], br->numlit>0);
+ br->cmdMB.dim[BR_DELETE] = !(br->numlit>0);
+
+@@ -1258,6 +1430,11 @@
+
+ BTSetActive(&br->but[BR_GENICON], br->numlit>0);
+ br->cmdMB.dim[BR_GENICON] = !(br->numlit>0);
++#ifdef AUTO_EXPAND
++ BTSetActive(&br->but[BR_MKDIR], 1);
++ br->cmdMB.dim[BR_MKDIR] = 0;
++ }
++#endif
+
+ /* turn on 'text view' cmd if exactly one non-dir is lit */
+ allowtext = 0;
+@@ -1277,7 +1454,7 @@
{
/* sets the '# files selected' string in the brow window appropriately */
@@ -7192,16 +12274,23 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
* if no files are lit, display ''
* if 1 file is lit, pretend it was selected, fall through...
* if 1 or more files are lit
-@@ -1316,7 +1316,7 @@
+@@ -1316,10 +1493,13 @@
else if (bf->ftype != BF_DIR) { /* no info. display file size */
struct stat st;
-
+
sprintf(buf, "%s%s", br->path, bf->name); /* build filename */
++#ifdef AUTO_EXPAND
++ Dirtovd(buf);
++#endif
if (stat(buf, &st) == 0) {
- sprintf(buf, "%s: %ld bytes", bf->name, st.st_size);
-@@ -1360,8 +1360,8 @@
+- sprintf(buf, "%s: %ld bytes", bf->name, st.st_size);
++ sprintf(buf, "%s: %ld bytes", bf->name, (long)st.st_size);
+ strcat(buf, buf1);
+ }
+ }
+@@ -1360,8 +1540,8 @@
if (j>=0 && j < br->bfLen) drawIcon(br,j);
}
}
@@ -7212,7 +12301,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
R3D_IN, 2, browhi, browlo, browbg);
}
-@@ -1371,10 +1371,8 @@
+@@ -1371,10 +1551,8 @@
int delta;
SCRL *sptr;
{
@@ -7224,7 +12313,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/* figure out BROWINFO pointer from SCRL pointer */
for (i=0; i<MAXBRWIN; i++) {
-@@ -1385,7 +1383,7 @@
+@@ -1385,7 +1563,7 @@
br = &binfo[i];
/* make sure we've been sized. Necessary, as creating/modifying the
@@ -7233,7 +12322,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
BrowseCheckEvent() */
if (!hasBeenSized) return;
-@@ -1413,12 +1411,12 @@
+@@ -1413,12 +1591,12 @@
if (y+h > br->iwHigh-4) h = (br->iwHigh-4)-y + 2;
}
XFillRectangle(theDisp, br->iconW, theGC, x, y, ISPACE_WIDE, (u_int) h);
@@ -7248,19 +12337,20 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
R3D_IN, 2, browhi, browlo, browbg);
}
-@@ -1431,7 +1429,10 @@
+@@ -1431,7 +1609,11 @@
{
int i,x,y,ix,iy,sw,sh,sx,sy;
BFIL *bf;
- char tmpstr[64], fixedname[64], *nstr, *str;
-+ char tmpstr[64], *nstr, *str;
++ const char *nstr, *cstr;
++ char tmpstr[64];
+#ifdef VMS
+ char fixedname[64];
+#endif
if (num<0 || num >= br->bfLen) return;
-@@ -1463,12 +1464,12 @@
+@@ -1463,49 +1645,51 @@
}
else if (bf->ftype == BF_HAVEIMG && bf->ximage) {
@@ -7275,13 +12365,33 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(u_int) bf->w, (u_int) bf->h);
}
-@@ -1488,24 +1489,25 @@
+
+- str = bf->name;
++ cstr = bf->name;
+ #ifdef VMS
+ if (bf->ftype == BF_DIR) {
++ char *vstr;
+ strcpy(fixedname, bf->name);
+- str = rindex(fixedname, '.'); /* lop off '.DIR' suffix, if any */
+- if (str) *str = '\0';
+- str = fixedname;
++ vstr = rindex(fixedname, '.'); /* lop off '.DIR' suffix, if any */
++ if (vstr) *vstr = '\0';
++ cstr = fixedname;
+ }
+ #endif /* VMS */
+
+- if (!strcmp(bf->name,"..")) str = "<parent>";
++ if (!strcmp(bf->name,"..")) cstr = "<parent>";
+
/* decide if the title is too big, and shorten if neccesary */
- if (StringWidth(str) > ISPACE_WIDE-6) {
+- if (StringWidth(str) > ISPACE_WIDE-6) {
- int dotpos;
+- strncpy(tmpstr, str, (size_t) 56);
++ if (StringWidth(cstr) > ISPACE_WIDE-6) {
+ int dotpos;
- strncpy(tmpstr, str, (size_t) 56);
++ strncpy(tmpstr, cstr, (size_t) 56);
+ tmpstr[56] = '\0'; /* MR: otherwise it dies on long file names */
dotpos = strlen(tmpstr);
strcat(tmpstr,"...");
@@ -7299,13 +12409,14 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
+
nstr = tmpstr;
}
- else nstr = str;
+- else nstr = str;
-
++ else nstr = cstr;
+
/* draw the title */
sw = StringWidth(nstr);
-@@ -1516,12 +1518,12 @@
+@@ -1516,12 +1700,12 @@
XSetForeground(theDisp, theGC,
(bf->lit && bf->lit!=ICON_ONLY) ? browfg : browbg);
@@ -7320,7 +12431,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
y + ISPACE_TOP + ISIZE_HIGH + ISPACE_TTOP + CHIGH/2, nstr);
}
-@@ -1535,7 +1537,6 @@
+@@ -1535,7 +1719,6 @@
int i,x,y,ix,iy,w,h;
BFIL *bf;
@@ -7328,7 +12439,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if (num<0 || num >= br->bfLen) return;
bf = &(br->bfList[num]);
-@@ -1579,12 +1580,12 @@
+@@ -1579,12 +1762,12 @@
y = (i / br->numWide) * ISPACE_HIGH;
XSetForeground(theDisp, theGC, browbg);
@@ -7344,16 +12455,54 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
R3D_IN, 2, browhi, browlo, browbg);
}
-@@ -1658,7 +1659,7 @@
- /* returns '-1' normally, returns an index into bfList[] if the user
- double-clicks an icon */
+@@ -1597,6 +1780,10 @@
+ {
+ int sval, first, numvis;
+
++ /* if we know what path we have, remember last visible icon for this path */
++ if (br->path)
++ recIconVisible(br->path, num);
++
+ /* if icon #i isn't visible, adjust scrollbar so it *is* */
+
+ sval = br->scrl.val;
+@@ -1648,29 +1835,14 @@
+ return;
+ }
+-
+ /***************************************************************/
+-static int clickIconWin(br, mx, my, mtime, multi)
+- BROWINFO *br;
+- int mx,my,multi;
+- unsigned long mtime;
++static int updateSel(br, sel, multi, mtime)
++ BROWINFO *br;
++ int sel, multi;
++ unsigned long mtime;
+ {
+- /* returns '-1' normally, returns an index into bfList[] if the user
+- double-clicks an icon */
+-
- int i,j, base, num, x,y,ix,iy, rv, sel, cpymode, dodel;
-+ int i,j, rv, sel, cpymode, dodel;
- BROWINFO *destBr;
- BFIL *bf;
- char buf[256], *destFolderName;
-@@ -1681,7 +1682,7 @@
+- BROWINFO *destBr;
+- BFIL *bf;
+- char buf[256], *destFolderName;
+-
+- rv = -1; /* default return value */
+- if (!br->bfList || !br->bfLen) return rv;
+-
+- destBr = br; destFolderName = ".";
+-
+- sel = mouseInWhichIcon(br, mx, my);
+-
+- dodel = 0;
++ int i;
++ BFIL *bf;
+
+ if (sel == -1) { /* clicked on nothing */
+ if (!multi) { /* deselect all */
+@@ -1681,7 +1853,7 @@
}
changedNumLit(br, sel, 0);
@@ -7362,19 +12511,65 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
}
-@@ -1725,10 +1726,9 @@
+@@ -1725,14 +1897,14 @@
changedNumLit(br, sel, 0);
-
+
/* see if we've double-clicked something */
- if (sel==br->lastIconClicked && mtime-br->lastClickTime < DBLCLICKTIME) {
+- if (sel==br->lastIconClicked && mtime-br->lastClickTime < DBLCLICKTIME) {
- int k;
++ if (mtime &&
++ sel==br->lastIconClicked && mtime-br->lastClickTime < DBLCLICKTIME) {
br->lastIconClicked = -1; /* YES */
doubleClick(br, sel);
-@@ -1759,10 +1759,10 @@
+- return rv;
++ return -1;
+ }
+
+ else {
+@@ -1741,9 +1913,37 @@
+ }
+ }
+
+-
+ changedNumLit(br, -1, 0);
++ return 0;
++}
++
++
++/***************************************************************/
++static int clickIconWin(br, mx, my, mtime, multi)
++ BROWINFO *br;
++ int mx,my,multi;
++ unsigned long mtime;
++{
++ /* returns '-1' normally, returns an index into bfList[] if the user
++ double-clicks an icon */
++
++ int i,j, sel, cpymode, dodel;
++ BROWINFO *destBr;
++ BFIL *bf;
++ char buf[256];
++ const char *destFolderName;
++
++ if (!br->bfList || !br->bfLen) return -1;
++
++ destBr = br; destFolderName = ".";
+
++ sel = mouseInWhichIcon(br, mx, my);
++ dodel = 0;
++
++ recIconVisible(br->path, sel);
++
++ if (updateSel(br, sel, multi, mtime))
++ return -1;
+
+
+ { /* track mouse until button1 is released */
+@@ -1759,10 +1959,10 @@
first = 1; hasrect = 0; cpymode = 0;
origsval = br->scrl.val;
@@ -7387,7 +12582,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
&x,&y,&mask));
if (mask & Button1Mask) { /* still held down */
-@@ -1773,7 +1773,7 @@
+@@ -1773,7 +1973,7 @@
else curs = movecurs;
/* change cursors */
@@ -7396,7 +12591,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
XDefineCursor(theDisp,binfo[i].iconW, curs);
samepos = oldx = oldy = oldbrnum = 0;
-@@ -1785,43 +1785,43 @@
+@@ -1785,43 +1985,43 @@
if (sel>=0) { /* see if changed copy/move status (and cursor) */
int cmod;
@@ -7450,7 +12645,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
&iwx,&iwy, &cW);
/* find deepest child that the mouse is in */
-@@ -1837,12 +1837,12 @@
+@@ -1837,12 +2037,12 @@
/* if it's in any icon window, and we're doing icon-dragging
OR we're doing a rectangle-drag */
@@ -7466,7 +12661,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
a rect drag */
if (sel>=0 && (oldx!=x || oldy!=y || oldbrnum!=i)) { /* moved */
-@@ -1873,7 +1873,7 @@
+@@ -1873,7 +2073,7 @@
}
}
@@ -7475,7 +12670,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/* if we clicked on an icon (originally), and therefore are
showing the 'move files' cursor, see if the cursor is within
the icon region of any folders. If so, light up *the icon
-@@ -1904,9 +1904,9 @@
+@@ -1904,9 +2104,9 @@
/* Dragging a selection rectangle. */
@@ -7487,7 +12682,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if (first) { prevx = mx; prevy = my; first=0; prevcnt = -1; }
-@@ -1922,18 +1922,18 @@
+@@ -1922,18 +2122,18 @@
rx = (mx < x) ? mx : x;
ry = (origy < y) ? origy : y;
@@ -7511,7 +12706,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
+ ISPACE_TOP + ISIZE_HIGH - bf->h;
iy = iy - br->scrl.val * ISPACE_HIGH;
-@@ -1994,7 +1994,7 @@
+@@ -1994,7 +2194,7 @@
}
/* RELEASED BUTTON: back to normal arrow cursor */
@@ -7520,7 +12715,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
XDefineCursor(theDisp, binfo[i].iconW, None);
if (sel == -1) { /* was dragging rectangle */
-@@ -2007,7 +2007,7 @@
+@@ -2007,7 +2207,7 @@
if (bf->lit == TEMP_LIT || bf->lit == TEMP_LIT1) {
bf->lit = 1; drawIcon(br, i);
}
@@ -7529,7 +12724,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if (bf->lit) br->numlit++;
}
-@@ -2020,7 +2020,6 @@
+@@ -2020,7 +2220,6 @@
/* if doing a copy or a move, do the thing to the files */
if (sel >= 0) {
@@ -7537,7 +12732,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if (DEBUG) {
fprintf(stderr,"---------------\n");
-@@ -2029,7 +2028,7 @@
+@@ -2029,7 +2228,7 @@
fprintf(stderr,"Dest Folder: '%s'\n", destFolderName);
}
@@ -7546,7 +12741,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if (!br->numlit) {
if (DEBUG) fprintf(stderr, "no selected files. Nothing to do!\n");
}
-@@ -2042,7 +2041,7 @@
+@@ -2042,7 +2241,7 @@
if (DEBUG) fprintf(stderr, "no destination. Nothing to do!\n");
}
@@ -7555,7 +12750,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
strcmp(br->path, destBr->path) == 0) {
if (DEBUG) fprintf(stderr,"source == destination. Nothing to do!\n");
}
-@@ -2067,12 +2066,12 @@
+@@ -2067,20 +2266,20 @@
}
}
if (DEBUG) fprintf(stderr,"\n\n");
@@ -7572,7 +12767,8 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
* in a copy command... :( RLD 26-FEB-1993
*/
-@@ -2080,7 +2079,7 @@
+- *rindex ( destFolderName, '.' ) = '\0';
++ *rindex ( destFolderName, '.' ) = '\0'; /* FIXME: potentially writing into static strings! */
#endif
@@ -7581,7 +12777,25 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
ncnt, cpymode);
/* free namelist */
-@@ -2155,7 +2154,7 @@
+@@ -2099,7 +2298,7 @@
+ }
+ } /* end of 'tracking' sub-function */
+
+- return rv;
++ return -1;
+ }
+
+ /*******************************************/
+@@ -2113,6 +2312,8 @@
+
+ /* called to 'open' icon #sel, which could be a file or a dir */
+
++ br->lst = 0;
++
+ /* if sel == -1, then called via RETURN key. just use first lit item
+ as thing that was double clicked on */
+
+@@ -2155,7 +2356,7 @@
}
@@ -7590,16 +12804,72 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/* double-clicked something. We should do something about it */
if (br->bfList[sel].ftype == BF_DIR) { /* try to cd */
#ifndef VMS
-@@ -2193,7 +2192,7 @@
+@@ -2165,15 +2366,36 @@
+ else sprintf(buf, "%s%s", br->path, br->bfList[sel].name);
+ #endif
+
++#ifdef AUTO_EXPAND
++ if (Chvdir(buf)) {
++#else
+ if (chdir(buf)) {
++#endif
+ char str[512];
+ sprintf(str,"Unable to cd to '%s'\n", br->bfList[sel].name);
+ setBrowStr(br, str);
+ XBell(theDisp, 50);
+ }
+ else {
++#ifdef AUTO_EXPAND
++ if (Isvdir(buf)) {
++ BTSetActive(&br->but[BR_DELETE], 0);
++ br->cmdMB.dim[BR_DELETE] = 1;
++
++ BTSetActive(&br->but[BR_RENAME], 0);
++ br->cmdMB.dim[BR_RENAME] = 1;
++
++ BTSetActive(&br->but[BR_MKDIR], 0);
++ br->cmdMB.dim[BR_MKDIR] = 1;
++ }
++ else {
++ BTSetActive(&br->but[BR_MKDIR], 1);
++ br->cmdMB.dim[BR_MKDIR] = 0;
++ }
++#endif
+ scanDir(br);
+ SCSetVal(&(br->scrl), 0); /* reset to top on a chdir */
++ restIconVisible(br);
+ }
+ }
+
+@@ -2193,7 +2415,26 @@
*event_retP = THISNEXT;
}
else { *event_retP = LOADPIC; SetDirFName(buf); }
-
+
++#ifdef VS_RESCMAP
++ /* Change Colormap for browser */
++ if (browPerfect && browCmap) {
++ int i;
++ XSetWindowAttributes xswa;
++ if(LocalCmap) {
++ xswa.colormap = LocalCmap;
++ _IfTempOut=2;
++ }
++ else {
++ xswa.colormap = theCmap;
++ _IfTempOut=2;
++ }
++ for(i=0;i<MAXBRWIN;i++)
++ XChangeWindowAttributes(theDisp, binfo[i].win, CWColormap, &xswa);
++ XFlush(theDisp);
++ }
++#endif
++
*event_doneP = 1; /* make MainLoop load image */
}
}
-@@ -2259,7 +2258,7 @@
+@@ -2259,7 +2500,7 @@
stlen = XLookupString(kevt, buf, 128, &ks, (XComposeStatus *) NULL);
shift = kevt->state & ShiftMask;
ck = CursorKey(ks, shift, 1);
@@ -7608,7 +12878,25 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
RemapKeyCheck(ks, buf, &stlen);
-@@ -2306,7 +2305,7 @@
+@@ -2289,6 +2530,7 @@
+ case '\021': doCmd(br, BR_QUIT); break; /* ^Q = Quit xv */
+
+ case '\006': doCmd(br, BR_SELFILES); break; /* ^F = Select Files */
++ case '\030': doCmd(br, BR_CLIPBRD); break; /* ^X = Copy to clipboard */
+
+
+ /* case '\003': FakeButtonPress(&but[BCMTVIEW]); break; */ /* ^C */
+@@ -2299,6 +2541,9 @@
+ case '\n': doubleClick(br, -1); break; /* RETURN = load selected */
+
+ case ' ':
++ if (br->lst && (time(NULL) <= br->lst + incrementalSearchTimeout))
++ goto do_default;
++ /* else fall through... */
+ case '\010':
+ case '\177': /* SPACE = load next, BS/DEL = load prev */
+ if (br->bfLen && br->numlit >= 1) {
+@@ -2306,7 +2551,7 @@
char fname[MAXPATHLEN];
/* if 'shift-space' find last lit icon, select the next one after it,
@@ -7617,7 +12905,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
are the only cases where br->numlit >1 allowed */
if (br->numlit>1 && buf[0] != ' ') return;
-@@ -2314,7 +2313,7 @@
+@@ -2314,7 +2559,7 @@
if (buf[0]==' ' && (br->numlit>1 || (br->numlit==1 && shift))) {
for (i=br->bfLen-1; i>=0 && !br->bfList[i].lit; i--); /* i=last lit */
if (i==br->bfLen-1) return;
@@ -7626,16 +12914,30 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
i++;
if (!shift) {
for (j=0; j<br->bfLen; j++) {
-@@ -2364,7 +2363,7 @@
+@@ -2348,6 +2593,9 @@
+
+ /* try to open this file */
+ sprintf(foo, "%s%s", br->path, br->bfList[i].name);
++#ifdef AUTO_EXPAND
++ Dirtovd(foo);
++#endif
+ for (j=0; j<numnames && strcmp(namelist[j],foo); j++);
+ if (j<numnames) {
+ curname = nList.selected = j;
+@@ -2363,8 +2611,11 @@
+ else { /* not SPACE, or SPACE and lit=1 and not shift */
for (i=0; i<br->bfLen && !br->bfList[i].lit; i++); /* find lit one */
sprintf(fname, "%s%s", br->path, br->bfList[i].name);
++#ifdef AUTO_EXPAND
++ Dirtovd(fname);
++#endif
viewsel = !(strcmp(fname, fullfname));
-
+
if (viewsel) {
if (buf[0]==' ') browKey(br, CK_RIGHT);
else browKey(br, CK_LEFT);
-@@ -2372,7 +2371,7 @@
+@@ -2372,7 +2623,7 @@
if (!br->bfList[i].lit || !viewsel) { /* changed selection */
for (i=0; i<br->bfLen && !br->bfList[i].lit; i++); /* find it */
@@ -7644,7 +12946,26 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
doubleClick(br, -1);
}
}
-@@ -2410,10 +2409,10 @@
+@@ -2381,7 +2632,8 @@
+
+
+ default: /* unknown character. Take it as an alpha accelerator */
+- if (buf[0] > 32) browAlpha(br, buf[0]);
++ do_default: /* (goto-label, not switch-label) */
++ if (buf[0] >= 32) browAlpha(br, buf[0]);
+ else XBell(theDisp, 0);
+ break;
+ }
+@@ -2401,6 +2653,8 @@
+ /* an arrow key (or something like that) was pressed in icon window.
+ change selection/scrollbar accordingly */
+
++ br->lst = 0;
++
+ /* handle easy keys */
+ if (key == CK_PAGEUP) SCSetVal(&br->scrl, br->scrl.val - br->scrl.page);
+ if (key == CK_PAGEDOWN) SCSetVal(&br->scrl, br->scrl.val + br->scrl.page);
+@@ -2410,10 +2664,10 @@
/* handle up/down/left/right keys
*
* if precisely *one* item is lit, than the up/down/left/right keys move
@@ -7657,7 +12978,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
* anything
*
* if more than one item is lit, up/down/left/right keys BEEP
-@@ -2443,8 +2442,8 @@
+@@ -2443,8 +2697,8 @@
if (key == CK_DOWN) j = i + br->numWide;
if (key == CK_LEFT) j = i - 1;
if (key == CK_RIGHT) j = i + 1;
@@ -7668,7 +12989,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
br->bfList[i].lit = 0;
br->bfList[j].lit = 1;
makeIconVisible(br,j);
-@@ -2455,7 +2454,7 @@
+@@ -2455,7 +2709,7 @@
}
}
@@ -7677,7 +12998,38 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if (br->numlit == 0) { /* no current selection */
if (key == CK_UP) SCSetVal(&br->scrl, br->scrl.val - 1);
if (key == CK_DOWN) SCSetVal(&br->scrl, br->scrl.val + 1);
-@@ -2541,13 +2540,13 @@
+@@ -2482,15 +2736,28 @@
+ /* find first 'plain' file that is lexically >= than the given ch */
+
+ int i,j;
++ time_t now = time(NULL);
+
+ if (!br->bfLen) return;
+- if (ch <= ' ' || ch > '\177') return; /* ignore 'funny' keys */
++ if (ch < ' ' || ch > '\177') return; /* ignore 'funny' keys */
+
+ for (i=0; i<br->bfLen && br->bfList[i].ftype==BF_DIR; i++);
+ if (i==br->bfLen) return; /* only directories in this dir */
+
++ if (!br->lst || (br->lst + incrementalSearchTimeout < now)) br->len = 0;
++ br->lst = now;
++
++ if (br->len + 2 > br->siz)
++ if ((br->str = (char *)realloc(br->str, (br->siz = br->len + 32))) == NULL)
++ br->siz = br->len = 0;
++
++ if (br->len + 2 <= br->siz) {
++ br->str[br->len++] = ch;
++ br->str[br->len] = '\0';
++ }
++
+ for ( ; i<br->bfLen; i++) {
+- if (br->bfList[i].name[0] >= ch) break;
++ if (strncmp(br->bfList[i].name, br->str, br->len) >= 0) break;
+ }
+
+ if (i==br->bfLen) i--;
+@@ -2541,20 +2808,24 @@
* The VMS chdir always needs 2 components (device and directory),
* so convert "/device" to "/device/000000" and convert
* "/" to "/XV_Root_Device/000000" (XV_RootDevice will need to be
@@ -7693,7 +13045,81 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
strcat ( tmppath, "/000000" ); /* add root dir for device */
else if ((br->ndirs-sel) == 1 )
strcpy ( tmppath, "/XV_Root_Device/000000" ); /* fake top level */
-@@ -2599,7 +2598,7 @@
+ }
+ #endif
+
++#ifdef AUTO_EXPAND
++ if (Chvdir(tmppath)) {
++#else
+ if (chdir(tmppath)) {
++#endif
+ char str[512];
+ sprintf(str,"Unable to cd to '%s'\n", tmppath);
+ MBRedraw(&(br->dirMB));
+@@ -2562,8 +2833,25 @@
+ XBell(theDisp, 50);
+ }
+ else {
++#ifdef AUTO_EXPAND
++ if (Isvdir(tmppath)) {
++ BTSetActive(&br->but[BR_DELETE], 0);
++ br->cmdMB.dim[BR_DELETE] = 1;
++
++ BTSetActive(&br->but[BR_RENAME], 0);
++ br->cmdMB.dim[BR_RENAME] = 1;
++
++ BTSetActive(&br->but[BR_MKDIR], 0);
++ br->cmdMB.dim[BR_MKDIR] = 1;
++ }
++ else {
++ BTSetActive(&br->but[BR_MKDIR], 1);
++ br->cmdMB.dim[BR_MKDIR] = 0;
++ }
++#endif
+ scanDir(br);
+ SCSetVal(&br->scrl, 0); /* reset to top of window on a chdir */
++ restIconVisible(br);
+ }
+ }
+ }
+@@ -2582,7 +2870,11 @@
+ if ((strlen(br->path) > (size_t) 2) && br->path[strlen(br->path)-1] == '/')
+ br->path[strlen(br->path)-1] = '\0';
+
++#ifdef AUTO_EXPAND
++ rv = Chvdir(br->path);
++#else
+ rv = chdir(br->path);
++#endif
+ if (rv) {
+ char str[512];
+ sprintf(str, "Unable to cd to '%s'\n", br->path);
+@@ -2590,6 +2882,24 @@
+ XBell(theDisp, 50);
+ }
+
++#ifdef AUTO_EXPAND
++ if (Isvdir(br->path)) {
++ BTSetActive(&br->but[BR_DELETE], 0);
++ br->cmdMB.dim[BR_DELETE] = 1;
++
++ BTSetActive(&br->but[BR_RENAME], 0);
++ br->cmdMB.dim[BR_RENAME] = 1;
++
++ BTSetActive(&br->but[BR_MKDIR], 0);
++ br->cmdMB.dim[BR_MKDIR] = 1;
++ }
++ else {
++ BTSetActive(&br->but[BR_MKDIR], 1);
++ br->cmdMB.dim[BR_MKDIR] = 0;
++ }
++#endif
++
++ restIconVisible(br);
+ strcat(br->path, "/"); /* put trailing '/' back on */
+ return rv;
+ }
+@@ -2599,7 +2909,7 @@
static void copyDirInfo(srcbr, dstbr)
BROWINFO *srcbr, *dstbr;
{
@@ -7702,16 +13128,31 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(ie, one that is already showing the same directory) */
int i, oldnum, maxv, page;
-@@ -2619,7 +2618,7 @@
- dstbr->dirMB.list = srcbr->mblist;
+@@ -2611,15 +2921,19 @@
+ /* copy mblist */
+ dstbr->ndirs = srcbr->ndirs;
+ for (i=0; i<dstbr->ndirs; i++) {
+- dstbr->mblist[i] = (char *) malloc(strlen(srcbr->mblist[i]) + 1);
++ dstbr->mblist[i] = strdup(srcbr->mblist[i]);
+ if (!dstbr->mblist[i]) FatalError("unable to malloc brMBlist[]");
+- strcpy(dstbr->mblist[i], srcbr->mblist[i]);
+ }
+
+- dstbr->dirMB.list = srcbr->mblist;
++#if 0
++ dstbr->dirMB.list = srcbr->mblist; /* original bug..? */
dstbr->dirMB.nlist = srcbr->ndirs;
++#else
++ dstbr->dirMB.list = dstbr->mblist; /* fixed by */
++ dstbr->dirMB.nlist = dstbr->ndirs; /* jp-extension. */
++#endif
- XClearArea(theDisp, dstbr->dirMB.win, dstbr->dirMB.x, dstbr->dirMB.y,
+ XClearArea(theDisp, dstbr->dirMB.win, dstbr->dirMB.x, dstbr->dirMB.y,
dstbr->dirMB.w+3, dstbr->dirMB.h+3, False);
i = StringWidth(dstbr->mblist[0]) + 10;
-@@ -2644,7 +2643,7 @@
+@@ -2644,7 +2958,7 @@
if ((i&0x03) == 0) drawTemp(dstbr, i, dstbr->bfLen);
if ((i & 0x3f) == 0) WaitCursor();
@@ -7720,7 +13161,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
sbf = &(srcbr->bfList[i]);
dbf = &(dstbr->bfList[i]);
-@@ -2670,7 +2669,7 @@
+@@ -2670,7 +2984,7 @@
if (sbf->pimage) {
dbf->pimage = (byte *) malloc((size_t) dbf->w * dbf->h);
if (!dbf->pimage) FatalError("ran out of memory for dbf->pimage");
@@ -7729,7 +13170,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(size_t) (dbf->w * dbf->h));
}
else dbf->pimage = (byte *) NULL;
-@@ -2681,10 +2680,10 @@
+@@ -2681,10 +2995,10 @@
xvbcopy((char *) sbf->ximage, (char *) dbf->ximage, sizeof(XImage));
if (sbf->ximage->data) {
@@ -7742,7 +13183,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(size_t) dbf->ximage->height * dbf->ximage->bytes_per_line);
}
}
-@@ -2701,15 +2700,15 @@
+@@ -2701,15 +3015,15 @@
computeScrlVals(dstbr, &maxv, &page);
if (dstbr->scrl.val > maxv) dstbr->scrl.val = maxv;
@@ -7761,7 +13202,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/***************************************************************/
static void scanDir(br)
-@@ -2726,7 +2725,7 @@
+@@ -2726,7 +3040,7 @@
* and it's reasonable to expect folks to want to add their own bitmaps
*/
@@ -7770,18 +13211,34 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
BFIL *bf;
DIR *dirp;
-@@ -2775,7 +2774,7 @@
+@@ -2753,7 +3067,7 @@
+ xv_getwd(path, sizeof(path));
+ if (path[strlen(path)-1] != '/') strcat(path,"/"); /* add trailing '/' */
+
+- for (i=0; i<br->ndirs; i++) free(br->mblist[i]); /* clear old dir names */
++ for (i=0; i<br->ndirs; i++) free((char *) br->mblist[i]); /* clear old dir names */
+
+ /* path will be something like: "/u3/bradley/src/weiner/whatever/" */
+
+@@ -2775,22 +3089,24 @@
/* build brMBlist */
for (i = br->ndirs-1,j=0; i>=0; i--,j++) {
- size_t stlen = (i<(br->ndirs-1)) ? dirnames[i+1] - dirnames[i]
-+ size_t stlen = (i<(br->ndirs-1)) ? dirnames[i+1] - dirnames[i]
++ size_t stlen = (i<(br->ndirs-1)) ? dirnames[i+1] - dirnames[i]
: strlen(dirnames[i]);
++ char *copy;
+
+- br->mblist[j] = (char *) malloc(stlen+1);
+- if (!br->mblist[j]) FatalError("unable to malloc brMBlist[]");
++ copy = malloc(stlen+1);
++ if (!copy) FatalError("unable to malloc brMBlist[]");
- br->mblist[j] = (char *) malloc(stlen+1);
-@@ -2784,13 +2783,13 @@
- strncpy(br->mblist[j], dirnames[i], stlen);
- br->mblist[j][stlen] = '\0';
+- strncpy(br->mblist[j], dirnames[i], stlen);
+- br->mblist[j][stlen] = '\0';
++ strncpy(copy, dirnames[i], stlen);
++ copy[stlen] = '\0';
++ br->mblist[j] = copy;
}
-
+
@@ -7795,7 +13252,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
br->dirMB.w+3, br->dirMB.h+3, False);
i = StringWidth(br->mblist[0]) + 10;
-@@ -2815,7 +2814,7 @@
+@@ -2815,7 +3131,7 @@
/* count how many files are in the list */
dirp = opendir(".");
@@ -7804,7 +13261,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
endScan(br, oldbflen);
setBrowStr(br, "Couldn't read current directory.");
SetCursors(-1);
-@@ -2827,11 +2826,11 @@
+@@ -2827,11 +3143,11 @@
#endif
while ( (dp = readdir(dirp)) != NULL) {
@@ -7819,7 +13276,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
br->bfLen++;
}
if ((br->bfLen & 0x3f) == 0) WaitCursor();
-@@ -2877,13 +2876,13 @@
+@@ -2877,13 +3193,13 @@
}
else {
do { dp = readdir(dirp); }
@@ -7836,7 +13293,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if (!dp) { br->bfLen = i; break; } /* dir got shorter... */
}
-@@ -2940,11 +2939,11 @@
+@@ -2940,11 +3256,11 @@
if (w<1) w = 1;
if (h<1) h = 1;
@@ -7850,7 +13307,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
SetCursors(-1);
}
-@@ -2972,7 +2971,7 @@
+@@ -2972,10 +3288,14 @@
bf->pimage = (byte *) NULL;
bf->ximage = (XImage *) NULL;
bf->lit = 0;
@@ -7858,8 +13315,47 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
+
if (stat(bf->name, &st)==0) {
++#ifdef AUTO_EXPAND
++ bf->ftype = stat2bf((u_int) st.st_mode , bf->name);
++#else
bf->ftype = stat2bf((u_int) st.st_mode);
-@@ -3048,11 +3047,11 @@
++#endif
+ if (bf->ftype == BF_FILE && (st.st_mode & 0111)) bf->ftype = BF_EXE;
+
+ switch (bf->ftype) {
+@@ -3007,6 +3327,7 @@
+ case RFT_XBM: bf->ftype = BF_XBM; break;
+ case RFT_SUNRAS: bf->ftype = BF_SUNRAS; break;
+ case RFT_BMP: bf->ftype = BF_BMP; break;
++ case RFT_WBMP: bf->ftype = BF_BMP; break;
+ case RFT_UTAHRLE: bf->ftype = BF_UTAHRLE; break;
+ case RFT_IRIS: bf->ftype = BF_IRIS; break;
+ case RFT_PCX: bf->ftype = BF_PCX; break;
+@@ -3014,12 +3335,22 @@
+ case RFT_TIFF: bf->ftype = BF_TIFF; break;
+ case RFT_PDSVICAR: bf->ftype = BF_PDS; break;
+ case RFT_COMPRESS: bf->ftype = BF_COMPRESS; break;
++ case RFT_BZIP2: bf->ftype = BF_BZIP2; break;
+ case RFT_PS: bf->ftype = BF_PS; break;
+ case RFT_IFF: bf->ftype = BF_IFF; break;
+- case RFT_TARGA: bf->ftype = BF_TARGA; break;
++ case RFT_TARGA: bf->ftype = BF_TGA; break;
+ case RFT_XPM: bf->ftype = BF_XPM; break;
+ case RFT_XWD: bf->ftype = BF_XWD; break;
+ case RFT_FITS: bf->ftype = BF_FITS; break;
++ case RFT_PNG: bf->ftype = BF_PNG; break;
++ case RFT_ZX: bf->ftype = BF_ZX; break; /* [JCE] */
++ case RFT_PCD: bf->ftype = BF_PCD; break;
++ case RFT_MAG: bf->ftype = BF_MAG; break;
++ case RFT_MAKI: bf->ftype = BF_MAKI; break;
++ case RFT_PIC: bf->ftype = BF_PIC; break;
++ case RFT_PI: bf->ftype = BF_PI; break;
++ case RFT_PIC2: bf->ftype = BF_PIC2; break;
++ case RFT_MGCSFX: bf->ftype = BF_MGCSFX; break;
+ }
+ }
+ }
+@@ -3048,11 +3379,11 @@
bfcompares++;
if ((bfcompares & 0x7f)==0) WaitCursor();
@@ -7874,7 +13370,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
return strcmp(b1->name, b2->name);
else if (b1->ftype == BF_DIR && b2->ftype != BF_DIR) return -1;
-@@ -3108,7 +3107,7 @@
+@@ -3108,7 +3439,7 @@
for (i=0; i<bflen; i++) {
bfnames[i] = (char *) malloc(strlen(br->bfList[i].name) + 1);
if (!bfnames[i]) FatalError("couldn't alloc bfnames in rescanDir()");
@@ -7883,7 +13379,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
strcpy(bfnames[i], br->bfList[i].name);
}
}
-@@ -3121,7 +3120,7 @@
+@@ -3121,7 +3452,7 @@
/* note, either (or both) dirnames/bfnames can be NULL, in which case
their respective 'len's will be zero */
@@ -7892,7 +13388,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/* sort the two name lists */
if (bflen) qsort((char *) bfnames, (size_t) bflen, sizeof(char *),namcmp);
if (dirlen) qsort((char *) dirnames, (size_t) dirlen,sizeof(char *),namcmp);
-@@ -3153,7 +3152,7 @@
+@@ -3153,7 +3484,7 @@
}
}
bflen = j;
@@ -7901,7 +13397,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
for (i=j=0; i<dirlen; i++) {
if (dirnames[i] && strcmp(dirnames[i],".") && strcmp(dirnames[i],"..") &&
-@@ -3162,21 +3161,21 @@
+@@ -3162,21 +3493,21 @@
}
}
dirlen = j;
@@ -7928,7 +13424,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/* create a new bfList */
newlen = br->bfLen - bflen + dirlen; /* oldlen - #del'd + #created */
if (newlen>0) {
-@@ -3241,7 +3240,7 @@
+@@ -3241,7 +3572,7 @@
if (bf->pimage) free(bf->pimage);
if (bf->ximage) xvDestroyImage(bf->ximage);
}
@@ -7937,7 +13433,12 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
free(br->bfList);
}
-@@ -3267,13 +3266,13 @@
+@@ -3263,17 +3594,17 @@
+
+ /***************************************************************/
+ static char **getDirEntries(dir, lenP, dohidden)
+- char *dir;
++ const char *dir;
int *lenP;
int dohidden;
{
@@ -7954,7 +13455,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
DIR *dirp;
char **names;
#ifdef NODIRENT
-@@ -3294,9 +3293,9 @@
+@@ -3294,9 +3625,9 @@
/* count # of entries in dir (worst case) */
for (dirlen=0; (dp = readdir(dirp)) != NULL; dirlen++);
if (!dirlen) {
@@ -7966,7 +13467,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
}
-@@ -3312,7 +3311,7 @@
+@@ -3312,7 +3643,7 @@
if (!dohidden) {
#ifndef VMS
@@ -7975,7 +13476,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
strcmp(dp->d_name,"." )!=0 &&
strcmp(dp->d_name,"..")!=0) continue;
#endif
-@@ -3324,7 +3323,7 @@
+@@ -3324,7 +3655,7 @@
strcpy(names[i], dp->d_name);
i++;
}
@@ -7984,7 +13485,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if (i<dirlen) dirlen = i; /* dir got shorter... */
closedir(dirp);
-@@ -3359,7 +3358,7 @@
+@@ -3359,7 +3690,7 @@
static void genSelectedIcons(br)
BROWINFO *br;
{
@@ -7993,7 +13494,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
setBrowStr(br, "");
-@@ -3395,7 +3394,7 @@
+@@ -3395,7 +3726,7 @@
BFIL *bf;
{
/* given a BFIL entry, load up the file.
@@ -8002,9 +13503,12 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
* generate an aspect-correct 8-bit image using brow Cmap
* otherwise
* replace this icon with the BF_UNKNOWN, or BF_ERR icons
-@@ -3408,20 +3407,20 @@
+@@ -3406,22 +3737,22 @@
+ double wexpand,hexpand;
+ int iwide, ihigh;
byte *icon24, *icon8;
- char str[256], str1[256], *readname, uncompname[128];
+- char str[256], str1[256], *readname, uncompname[128];
++ char str[256], str1[256], readname[128], uncompname[128];
char basefname[128], *uncName;
-
-
@@ -8015,8 +13519,9 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
basefname[0] = '\0';
pinfo.pic = (byte *) NULL;
pinfo.comment = (char *) NULL;
- readname = bf->name;
+- readname = bf->name;
-
++ strncpy(readname, bf->name, sizeof(readname) - 1);
+
/* free any old info in 'bf' */
if (bf->imginfo) free (bf->imginfo);
@@ -8027,7 +13532,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
bf->imginfo = (char *) NULL;
bf->pimage = (byte *) NULL;
bf->ximage = (XImage *) NULL;
-@@ -3429,9 +3428,9 @@
+@@ -3429,10 +3760,10 @@
/* skip all 'special' files */
if (!ISLOADABLE(bf->ftype)) return;
@@ -8035,25 +13540,83 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
+
filetype = ReadFileType(bf->name);
-
+- if (filetype == RFT_COMPRESS) {
+
- if (filetype == RFT_COMPRESS) {
++ if ((filetype == RFT_COMPRESS) || (filetype == RFT_BZIP2)) {
#if (defined(VMS) && !defined(GUNZIP))
/* VMS decompress doesn't like the file to have a trailing .Z in fname
-@@ -3442,7 +3441,7 @@
+ however, GUnZip is OK with it, which we are calling UnCompress */
+@@ -3442,10 +3773,10 @@
#else
uncName = bf->name;
#endif
-
+- if (UncompressFile(uncName, uncompname)) {
+
- if (UncompressFile(uncName, uncompname)) {
++ if (UncompressFile(uncName, uncompname, filetype)) {
filetype = ReadFileType(uncompname);
- readname = uncompname;
-@@ -3453,61 +3452,61 @@
+- readname = uncompname;
++ strncpy(readname, uncompname, sizeof(readname) - 1);
+ }
+ else {
+ sprintf(str, "Couldn't uncompress file '%s'", bf->name);
+@@ -3453,71 +3784,139 @@
bf->ftype = BF_ERROR;
}
}
-
+
++#ifdef MACBINARY
++ if (handlemacb && macb_file == True && bf->ftype != BF_ERROR) {
++ if (RemoveMacbinary(readname, uncompname)) {
++ if (strcmp(readname, bf->name)!=0) unlink(readname);
++ strncpy(readname, uncompname, sizeof(readname) - 1);
++ }
++ else {
++ sprintf(str, "Unable to remove a InfoFile header form '%s'.", bf->name);
++ setBrowStr(br, str);
++ bf->ftype = BF_ERROR;
++ }
++ }
++#endif
++
++#ifdef HAVE_MGCSFX_AUTO
++ if (bf->ftype != BF_ERROR) {
++ if(filetype == RFT_MGCSFX){
++ char tmpname[128];
++ char *icom;
++
++ if((icom = mgcsfx_auto_input_com(bf->name)) != NULL){
++ sprintf(tmpname, "%s/xvmsautoXXXXXX", tmpdir);
++#ifdef USE_MKSTEMP
++ close(mkstemp(tmpname));
++#else
++ mktemp(tmpname);
++#endif
++ SetISTR(ISTR_INFO, "Converting to known format by MgcSfx auto...");
++ sprintf(str,"%s >%s", icom, tmpname);
++ }else goto ms_auto_no;
++
++#ifndef VMS
++ if (system(str))
++#else
++ if (!system(str))
++#endif
++ {
++ sprintf(str, "Unable to convert '%s' by MgcSfx auto.", bf->name);
++ setBrowStr(br, str);
++ bf->ftype = BF_ERROR;
++ }
++ else {
++ filetype = ReadFileType(tmpname);
++ if (strcmp(readname, bf->name)!=0) unlink(readname);
++ strncpy(readname, tmpname, sizeof(readname) - 1);
++ }
++ }
++ }
++ms_auto_no:
++#endif /* HAVE_MGCSFX_AUTO */
++
/* get rid of comments. don't need 'em */
if (pinfo.comment) free(pinfo.comment); pinfo.comment = (char *) NULL;
-
@@ -8076,6 +13639,9 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/* otherwise it's a known filetype... do the *hard* part now... */
-
+
++#ifdef VS_ADJUST
++ normaspect = defaspect;
++#endif
i = ReadPicFile(readname, filetype, &pinfo, 1);
KillPageFiles(pinfo.pagebname, pinfo.numpages);
-
@@ -8101,9 +13667,10 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
-
+
/* if we made an uncompressed file, we can rm it now */
- if (readname != bf->name) unlink(readname);
+- if (readname != bf->name) unlink(readname);
-
-
++ if (strcmp(readname, bf->name)!=0) unlink(readname);
+
+
/* at this point either BF_ERROR, BF_UNKNOWN, BF_EXE or pic */
@@ -8127,10 +13694,34 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/* compute size of icon (iwide,ihigh) */
-
+
++#ifdef VS_ADJUST
++ if (!vsadjust) normaspect = 1;
++
++ wexpand = (double) (pinfo.w * normaspect) / (double) ISIZE_WIDE;
++#else
wexpand = (double) pinfo.w / (double) ISIZE_WIDE;
++#endif /* VS_ADJUST */
hexpand = (double) pinfo.h / (double) ISIZE_HIGH;
-@@ -3527,13 +3526,13 @@
+ if (wexpand >= 1.0 || hexpand >= 1.0) { /* don't expand small icons */
+ if (wexpand>hexpand) {
++#ifdef VS_ADJUST
++ iwide = (int) ((pinfo.w * normaspect) / wexpand + 0.5);
++#else
+ iwide = (int) (pinfo.w / wexpand + 0.5);
++#endif
+ ihigh = (int) (pinfo.h / wexpand + 0.5);
+ }
+ else {
++#ifdef VS_ADJUST
++ iwide = (int) ((pinfo.w * normaspect) / hexpand + 0.5);
++#else
+ iwide = (int) (pinfo.w / hexpand + 0.5);
++#endif
+ ihigh = (int) (pinfo.h / hexpand + 0.5);
+ }
+ }
+@@ -3527,13 +3926,13 @@
/* generate icon */
@@ -8146,7 +13737,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
strcat(str,"GIF89 file");
else
strcat(str,"GIF87 file");
-@@ -3543,12 +3542,12 @@
+@@ -3543,12 +3942,12 @@
case RFT_PBM: if (xv_strstr(pinfo.fullInfo, "raw")) strcat(str,"Raw ");
else strcat(str,"Ascii ");
@@ -8161,8 +13752,19 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
strcat(str," file");
break;
-@@ -3569,19 +3568,19 @@
+@@ -3567,21 +3966,30 @@
+ case RFT_XPM: strcat(str,"XPM file"); break;
+ case RFT_XWD: strcat(str,"XWD file"); break;
case RFT_FITS: strcat(str,"FITS file"); break;
++ case RFT_PNG: strcat(str,"PNG file"); break;
++ case RFT_ZX: strcat(str,"Spectrum SCREEN$"); break; /* [JCE] */
++ case RFT_PCD: strcat(str,"PhotoCD file"); break;
++ case RFT_MAG: strcat(str,"MAG file"); break;
++ case RFT_MAKI: strcat(str,"MAKI file"); break;
++ case RFT_PIC: strcat(str,"PIC file"); break;
++ case RFT_PI: strcat(str,"PI file"); break;
++ case RFT_PIC2: strcat(str,"PIC2 file"); break;
++ case RFT_MGCSFX: strcat(str,"Magic Suffix file"); break;
default: strcat(str,"file of unknown type"); break;
}
-
@@ -8185,7 +13787,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
sprintf(buf," (%ld bytes)", filesize);
strcat(str, buf);
}
-@@ -3609,17 +3608,17 @@
+@@ -3609,17 +4017,17 @@
bf->w = iwide;
bf->h = ihigh;
bf->ftype = BF_HAVEIMG;
@@ -8206,7 +13808,18 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/*
-@@ -3682,7 +3681,7 @@
+@@ -3670,6 +4078,10 @@
+
+ sprintf(thFname, "%s%s/%s", br->path, THUMBDIR, bf->name);
+
++#ifdef AUTO_EXPAND
++ Dirtovd(thFname);
++#endif
++
+ fp = fopen(thFname, "r");
+ if (!fp) return; /* nope, it doesn't have one */
+
+@@ -3682,7 +4094,7 @@
/* read comments until we see '#END_OF_COMMENTS', or hit EOF */
while (1) {
if (!fgets(buf, 256, fp)) goto errexit;
@@ -8215,7 +13828,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if (!strncmp(buf, "#END_OF_COMMENTS", strlen("#END_OF_COMMENTS")))
break;
-@@ -3714,7 +3713,7 @@
+@@ -3714,7 +4126,7 @@
/* read width, height, maxval */
@@ -8224,7 +13837,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
goto errexit;
-@@ -3738,14 +3737,14 @@
+@@ -3738,14 +4150,14 @@
bf->h = h;
bf->ftype = BF_HAVEIMG;
bf->imginfo = info;
@@ -8242,7 +13855,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
fclose(fp);
return;
-@@ -3757,7 +3756,7 @@
+@@ -3757,7 +4169,7 @@
}
@@ -8251,8 +13864,15 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/***************************************************************/
static void writeThumbFile(br, bf, icon8, w, h, info)
BROWINFO *br;
-@@ -3787,7 +3786,7 @@
+@@ -3785,9 +4197,14 @@
+
+ sprintf(thFname, "%s%s/%s", br->path, THUMBDIR, bf->name);
++#ifdef AUTO_EXPAND
++ Dirtovd(thFname);
++#endif
++
++ unlink(thFname); /* just in case there's already an unwritable one */
fp = fopen(thFname, "w");
if (!fp) {
- sprintf(buf, "Can't create thumbnail file '%s': %s", thFname,
@@ -8260,7 +13880,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
ERRSTR(errno));
setBrowStr(br, buf);
return; /* can't write... */
-@@ -3829,9 +3828,9 @@
+@@ -3829,9 +4246,9 @@
setBrowStr(br, buf);
return; /* can't write... */
}
@@ -8272,27 +13892,93 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
chmod(thFname, (mode_t) perm);
}
-@@ -3915,7 +3914,7 @@
+@@ -3849,15 +4266,29 @@
+
+ sprintf(thFname, "%s%s", br->path, THUMBDIRNAME);
+
++#ifdef AUTO_EXPAND
++ Dirtovd(thFname);
++#endif
++
+ i = stat(thFname, &st);
+ if (i) { /* failed, let's create it */
+ sprintf(thFname, "%s.", br->path);
++#ifdef AUTO_EXPAND
++ Dirtovd(thFname);
++#endif
+ i = stat(thFname, &st); /* get permissions of parent dir */
+ if (!i) perm = st.st_mode & 07777;
+ else perm = 0755;
+
+ sprintf(thFname, "%s%s", br->path, THUMBDIRNAME);
+- mkdir(thFname, (mode_t) perm);
++#ifdef AUTO_EXPAND
++ Dirtovd(thFname);
++#endif
++ i = mkdir(thFname, (mode_t) perm);
++#ifdef VIRTUAL_TD
++ if (i < 0)
++ Mkvdir_force(thFname);
++#endif
+ }
+ }
+
+@@ -3899,7 +4330,7 @@
+ for (i=0, bf=br->bfList; i<br->bfLen; i++, bf++) {
+ if (bf->ftype <= BF_FILE || bf->ftype >= BF_ERROR || bf->ftype==BF_EXE) {
- if (s1 || s2 || filest.st_mtime > thumbst.st_mtime ||
- filest.st_ctime > thumbst.st_ctime) {
+- /* ie, not a 'special' file */
++ /* i.e., not a 'special' file */
+
+ int s1, s2;
+ char thfname[256];
+@@ -3913,10 +4344,9 @@
+ sprintf(thfname, "%s/%s", THUMBDIR, bf->name);
+ s2 = stat(thfname, &thumbst);
+
+- if (s1 || s2 || filest.st_mtime > thumbst.st_mtime ||
+- filest.st_ctime > thumbst.st_ctime) {
- /* either stat'ing the file or the thumbfile failed, or
+- both stat's succeeded and the file has a newer mod or creation
++ if (s1 || s2 || filest.st_mtime > thumbst.st_mtime) {
+ /* either stat'ing the file or the thumbfile failed, or
- both stat's succeeded and the file has a newer mod or creation
++ both stat's succeeded and the file has a newer mod
time than the thumbnail file */
-@@ -3926,8 +3925,8 @@
+ makeIconVisible(br, i);
+@@ -3926,11 +4356,16 @@
if (bf->ftype != BF_EXE) {
iconsBuilt++;
- if (DEBUG)
- fprintf(stderr,"icon made:fname='%s' thfname='%s' %d,%d,%d,%d\n",
+- bf->name, thfname, s1,s2,filest.st_mtime,thumbst.st_mtime);
+ if (DEBUG)
+ fprintf(stderr,"icon made:fname='%s' thfname='%s' %d,%d,%ld,%ld\n",
- bf->name, thfname, s1,s2,filest.st_mtime,thumbst.st_mtime);
++ bf->name, thfname, s1, s2,
++ (long)filest.st_mtime, (long)thumbst.st_mtime);
}
}
-@@ -3974,7 +3973,7 @@
++ else if (filest.st_ctime > thumbst.st_ctime) {
++ /* update protections */
++ chmod(thfname, (mode_t) (filest.st_mode & 07777));
++ }
+ }
+ statcount++;
+
+@@ -3964,7 +4399,11 @@
+ sprintf(thfname, "%s/%s", THUMBDIR, dp->d_name);
+ if (stat(thfname, &thumbst)==0) { /* success */
+ int tmp;
++#ifdef AUTO_EXPAND
++ tmp = stat2bf((u_int) thumbst.st_mode , thfname);
++#else
+ tmp = stat2bf((u_int) thumbst.st_mode);
++#endif
+
+ if (tmp == BF_FILE) { /* a plain file */
+ /* see if this thumbfile has an associated pic file */
+@@ -3974,7 +4413,7 @@
}
}
statcount++;
@@ -8301,7 +13987,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if ((statcount % 30)==0) WaitCursor();
}
closedir(dirp);
-@@ -3998,16 +3997,16 @@
+@@ -3998,16 +4437,16 @@
{
if (maxcnt<1) return; /* none of that naughty ol' divide by zero stuff */
@@ -8321,7 +14007,30 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(u_int) br->dirMB.x-10+1, (u_int) br->dirMB.h + 1, True);
}
-@@ -4048,7 +4047,7 @@
+@@ -4038,17 +4477,26 @@
+ pops up a 'what do you want to rename it to' box, and attempts to
+ do the trick... */
+
+- int i, num;
+- char buf[128], txt[256], *origname, txt1[256];
+- static char *labels[] = { "\nOk", "\033Cancel" };
+- struct stat st;
++ int i, num;
++ char buf[128], txt[256], *origname, txt1[256];
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ struct stat st;
++
++#ifdef AUTO_EXPAND
++ if (Isvdir(br->path)) {
++ sprintf(buf,"Sorry, you can't rename file in the virtual directory, '%s'",
++ br->path);
++ ErrPopUp(buf, "\nBummer!");
++ return;
++ }
++#endif
+
+ if (cdBrow(br)) return;
+
/* find the selected file */
for (i=0; i<br->bfLen && !br->bfList[i].lit; i++);
if (i==br->bfLen) return; /* shouldn't happen */
@@ -8330,7 +14039,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
origname = br->bfList[i].name; num = i;
if (strcmp(origname, "..")==0) {
-@@ -4058,7 +4057,7 @@
+@@ -4058,7 +4506,7 @@
return;
}
@@ -8339,7 +14048,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(br->bfList[i].ftype==BF_DIR) ? "directory" : "file",
origname);
-@@ -4107,7 +4106,7 @@
+@@ -4107,7 +4555,7 @@
drawIcon(br, num);
for (i=0; i<MAXBRWIN; i++) {
@@ -8348,7 +14057,28 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
rescanDir(&binfo[i]);
}
-@@ -4133,7 +4132,7 @@
+@@ -4125,15 +4573,24 @@
+ pops up a 'what do you want to call it' box, and attempts to
+ do the trick... */
+
+- int i;
+- char buf[128], txt[256];
+- static char *labels[] = { "\nOk", "\033Cancel" };
+- struct stat st;
++ int i;
++ char buf[128], txt[256];
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ struct stat st;
++
++#ifdef AUTO_EXPAND
++ if (Isvdir(br->path)) {
++ sprintf(buf,"Sorry, you can't mkdir in the virtual directory, '%s'",
++ br->path);
++ ErrPopUp(buf, "\nBummer!");
++ return;
++ }
++#endif
+
if (cdBrow(br)) return;
buf[0] = '\0';
@@ -8357,7 +14087,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
buf, 128, "/ |\'\"<>,", 0);
if (i) return; /* cancelled */
-@@ -4161,7 +4160,7 @@
+@@ -4161,7 +4618,7 @@
/* rescan current br, and all other br's pointing to same directory */
for (i=0; i<MAXBRWIN; i++) {
@@ -8366,25 +14096,93 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
rescanDir(&binfo[i]);
}
-@@ -4179,7 +4178,7 @@
- int i;
- static char buf[MAXPATHLEN+100];
- static char *labels[] = { "\nOk", "\033Cancel" };
+@@ -4176,10 +4633,10 @@
+ static void doChdirCmd(br)
+ BROWINFO *br;
+ {
+- int i;
+- static char buf[MAXPATHLEN+100];
+- static char *labels[] = { "\nOk", "\033Cancel" };
- char str[512];
-+ char str[512];
++ int i;
++ static char buf[MAXPATHLEN+100];
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char str[512];
buf[0] = '\0';
i = GetStrPopUp("Change to directory:", labels, 2, buf, MAXPATHLEN, " ", 0);
-@@ -4226,7 +4225,7 @@
+@@ -4198,14 +4655,35 @@
+ if (cdBrow(br)) return; /* prints its own error message */
+ }
+
++#ifdef AUTO_EXPAND
++ if (Chvdir(buf)) {
++#else
+ if (chdir(buf)) {
++#endif
+ sprintf(str,"Unable to cd to '%s'\n", buf);
+ setBrowStr(br, str);
+ XBell(theDisp, 50);
+ }
+ else {
++#ifdef AUTO_EXPAND
++ if (Isvdir(buf)) {
++ BTSetActive(&br->but[BR_DELETE], 0);
++ br->cmdMB.dim[BR_DELETE] = 1;
++
++ BTSetActive(&br->but[BR_RENAME], 0);
++ br->cmdMB.dim[BR_RENAME] = 1;
++
++ BTSetActive(&br->but[BR_MKDIR], 0);
++ br->cmdMB.dim[BR_MKDIR] = 1;
++ }
++ else {
++ BTSetActive(&br->but[BR_MKDIR], 1);
++ br->cmdMB.dim[BR_MKDIR] = 0;
++ }
++#endif
+ scanDir(br);
+ SCSetVal(&(br->scrl), 0); /* reset to top on a chdir */
++ restIconVisible(br);
+ }
+ }
+
+@@ -4225,10 +4703,19 @@
+ * call 'rm_dir()' for each of the directories
*/
- BFIL *bf;
+- BFIL *bf;
- int i, j, numdirs, numfiles, slen, firstdel;
-+ int i, numdirs, numfiles, slen, firstdel;
- char buf[512];
- static char *yesno[] = { "\004Delete", "\033Cancel" };
+- char buf[512];
+- static char *yesno[] = { "\004Delete", "\033Cancel" };
++ BFIL *bf;
++ int i, numdirs, numfiles, slen, firstdel;
++ char buf[512];
++ static const char *yesno[] = { "\004Delete", "\033Cancel" };
++
++#ifdef AUTO_EXPAND
++ if (Isvdir(br->path)) {
++ sprintf(buf,"Sorry, you can't delete file at the virtual directory, '%s'",
++ br->path);
++ ErrPopUp(buf, "\nBummer!");
++ return;
++ }
++#endif
-@@ -4258,7 +4257,7 @@
+ if (!br->bfLen || !br->bfList || !br->numlit) return;
+
+@@ -4252,13 +4739,17 @@
+ for (i=0, bf=br->bfList; i<br->bfLen; i++,bf++) {
+ if (bf->lit) {
+ if (firstdel == -1) firstdel = i;
+- if (bf->ftype == BF_DIR) numdirs++;
++ if (bf->ftype == BF_DIR
++#ifdef AUTO_EXPAND
++ && (!Isarchive(bf->name))
++#endif
++ ) numdirs++;
+ else numfiles++;
+ }
}
@@ -8393,8 +14191,25 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
confirmation box */
if (numfiles) {
-@@ -4281,7 +4280,7 @@
- i = PopUp(buf, yesno, 2);
+@@ -4266,7 +4757,12 @@
+ slen = strlen(buf);
+
+ for (i=0, bf=br->bfList; i<br->bfLen; i++,bf++) {
++#ifdef AUTO_EXPAND
++ if (bf->lit && (bf->ftype != BF_DIR || Isarchive(bf->name))) {
++#else
+ if (bf->lit && bf->ftype != BF_DIR) {
++#endif
++
+ if ( (slen + strlen(bf->name) + 1) > 256) {
+ strcat(buf,"...");
+ break;
+@@ -4278,10 +4774,10 @@
+ }
+ }
+
+- i = PopUp(buf, yesno, 2);
++ i = PopUp(buf, yesno, COUNT(yesno));
if (i) return; /* cancelled */
}
-
@@ -8402,7 +14217,26 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/* if any directories are being toasted, bring up the are you REALLY sure
confirmation box */
-@@ -4309,7 +4308,7 @@
+@@ -4291,7 +4787,11 @@
+ slen = strlen(buf);
+
+ for (i=0, bf=br->bfList; i<br->bfLen; i++,bf++) {
++#ifdef AUTO_EXPAND
++ if (bf->lit && (bf->ftype == BF_DIR || !Isarchive(bf->name))) {
++#else
+ if (bf->lit && bf->ftype == BF_DIR) {
++#endif
+ if ( (slen + strlen(bf->name) + 1) > 256) {
+ strcat(buf,"...");
+ break;
+@@ -4303,16 +4803,20 @@
+ }
+ }
+
+- i = PopUp(buf, yesno, 2);
++ i = PopUp(buf, yesno, COUNT(yesno));
+ if (i) return; /* cancelled */
+ }
/* okay, at this point they've been warned. do the deletion */
@@ -8410,8 +14244,16 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
+
for (i=0, bf=br->bfList; i<br->bfLen; i++,bf++) {
if (bf->lit) {
- if (bf->ftype == BF_DIR) rm_dir (br, bf->name);
-@@ -4340,7 +4339,7 @@
+- if (bf->ftype == BF_DIR) rm_dir (br, bf->name);
++ if (bf->ftype == BF_DIR
++#ifdef AUTO_EXPAND
++ && !Isarchive(bf->name)
++#endif
++ ) rm_dir (br, bf->name);
+ else rm_file(br, bf->name);
+ }
+ }
+@@ -4340,7 +4844,7 @@
/* rescan other br's that are looking at this directory */
for (i=0; i<MAXBRWIN; i++) {
@@ -8420,34 +14262,48 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
rescanDir(&binfo[i]);
}
-@@ -4356,7 +4355,7 @@
- int i;
- static char buf[MAXPATHLEN+100];
- static char *labels[] = { "\nOk", "\033Cancel" };
+@@ -4353,10 +4857,10 @@
+ static void doSelFilesCmd(br)
+ BROWINFO *br;
+ {
+- int i;
+- static char buf[MAXPATHLEN+100];
+- static char *labels[] = { "\nOk", "\033Cancel" };
- char str[512];
-+ char str[512];
++ int i;
++ static char buf[MAXPATHLEN+100];
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char str[512];
buf[0] = '\0';
strcpy(str,"Select file name(s). Wildcard '*' is allowed. ");
-@@ -4396,7 +4395,7 @@
+@@ -4394,9 +4898,9 @@
+ static void doRecurseCmd(br)
+ BROWINFO *br;
{
- int i;
- static char *labels[] = { "\nOk", "\033Cancel" };
+- int i;
+- static char *labels[] = { "\nOk", "\033Cancel" };
- char str[512];
-+ char str[512];
++ int i;
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char str[512];
strcpy(str,"Recursive Update: This could take *quite* a while.\n");
strcat(str,"Are you sure?");
-@@ -4415,7 +4414,7 @@
+@@ -4415,9 +4919,9 @@
/*******************************************/
-static void recurseUpdate(br, subdir)
+- BROWINFO *br;
+- char *subdir;
+static void recurseUpdate(br, subdir)
- BROWINFO *br;
- char *subdir;
++ BROWINFO *br;
++ const char *subdir;
{
-@@ -4430,7 +4429,7 @@
+ /* note: 'br->path + subdir' is the full path to recurse down from */
+
+@@ -4430,7 +4934,7 @@
* and for each subdir in this dir, recurse
*
* if cur dir != orig dir, cd back to orig dir and reload 'br'
@@ -8456,7 +14312,19 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
int i;
char orgDir[MAXPATHLEN + 2];
-@@ -4449,7 +4448,7 @@
+@@ -4441,7 +4945,11 @@
+ xv_getwd(orgDir, sizeof(orgDir));
+
+ sprintf(curDir, "%s%s", br->path, subdir);
++#ifdef AUTO_EXPAND
++ if (Chvdir(curDir)) {
++#else
+ if (chdir(curDir)) {
++#endif
+ char str[512];
+ sprintf(str, "Unable to cd to '%s'\n", curDir);
+ setBrowStr(br, str);
+@@ -4449,18 +4957,28 @@
}
xv_getwd(curDir, sizeof(curDir));
@@ -8465,7 +14333,28 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/* have we looped? */
for (i=0; i<dirStackLen && strcmp(curDir, dirStack[i]); i++);
if (i<dirStackLen) { /* YES */
-@@ -4481,8 +4480,8 @@
++#ifdef AUTO_EXPAND
++ Chvdir(orgDir);
++#else
+ chdir(orgDir);
++#endif
++ restIconVisible(br);
+ return;
+ }
+
+ sp = (char *) malloc((size_t) strlen(curDir) + 1);
+ if (!sp) {
+ setBrowStr(br, "malloc() error in recurseUpdate()\n");
++#ifdef AUTO_EXPAND
++ Chvdir(orgDir);
++#else
+ chdir(orgDir);
++#endif
++ restIconVisible(br);
+ return;
+ }
+
+@@ -4481,8 +4999,8 @@
/* do subdirectories of this directory, not counting . .. and .xvpics */
for (i=0; i<br->bfLen; i++) {
bf = &(br->bfList[i]);
@@ -8476,7 +14365,32 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
strcmp(bf->name, ".") &&
strcmp(bf->name, "..") &&
strcmp(bf->name, THUMBDIRNAME) ) {
-@@ -4524,7 +4523,7 @@
+@@ -4495,7 +5013,12 @@
+
+ xv_getwd(curDir, sizeof(curDir));
+ if (strcmp(orgDir, curDir)) { /* change back to orgdir */
++#ifdef AUTO_EXPAND
++ Chvdir(orgDir);
++#else
+ chdir(orgDir);
++#endif
++ restIconVisible(br);
+ scanDir(br);
+ }
+ }
+@@ -4519,12 +5042,19 @@
+ setBrowStr(br, buf);
+ }
+
++#ifdef AUTO_EXPAND
++ if (Rmvdir(name)) {
++ sprintf(buf, "fail to remove virturl directory: %s", name);
++ setBrowStr(br, buf);
++ }
++#endif
++
+ /* try to delete a thumbnail file, as well. ignore errors */
+ strcpy(buf1, name); /* tmp1 = leading path of name */
tmp = (char *) rindex(buf1, '/');
if (!tmp) strcpy(buf1,".");
else *tmp = '\0';
@@ -8485,7 +14399,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
sprintf(buf, "%s/%s/%s", buf1, THUMBDIR, BaseName(name));
if (DEBUG) fprintf(stderr," (%s)\n", buf);
-@@ -4548,7 +4547,7 @@
+@@ -4548,7 +5078,7 @@
BROWINFO *br;
{
/* recursively delete this directory, and all things under it */
@@ -8494,7 +14408,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
int i, dirlen, longpath, oldpathlen;
char **names, *name, buf[512];
struct stat st;
-@@ -4569,7 +4568,7 @@
+@@ -4569,7 +5099,7 @@
name = names[i];
/* skip . and .. (not that we should ever see them... */
@@ -8503,16 +14417,24 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(name[1]=='.' && name[2]=='\0'))) goto done;
if (strlen(name) + oldpathlen >= (MAXPATHLEN-3)) {
-@@ -4586,7 +4585,7 @@
+@@ -4586,15 +5116,22 @@
rmdirPath[oldpathlen] = '\0';
goto done;
}
-
+- if (stat2bf((u_int) st.st_mode) == BF_DIR) { /* skip, for now */
++
++#ifdef AUTO_EXPAND
++ if ((stat2bf((u_int) st.st_mode , rmdirPath) == BF_DIR)
++ && !Isarchive(rmdirPath)) /* skip, for now */
++#else
+
- if (stat2bf((u_int) st.st_mode) == BF_DIR) { /* skip, for now */
++ if (stat2bf((u_int) st.st_mode) == BF_DIR) /* skip, for now */
++#endif
++ {
rmdirPath[oldpathlen] = '\0';
continue; /* don't remove from list */
-@@ -4594,7 +4593,7 @@
+ }
rm_file(br, rmdirPath);
rmdirPath[oldpathlen] = '\0';
@@ -8521,16 +14443,28 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
done: /* remove name from list */
free(name);
names[i] = (char *) NULL;
-@@ -4645,19 +4644,19 @@
+@@ -4640,30 +5177,35 @@
+ static int overwrite;
+ #define OWRT_ASK 0
+-#define OWRT_NOASK 1
+-#define OWRT_CANCEL 2
+-
++#define OWRT_ALWAYS 1
++#define OWRT_NEVER 2
++#define OWRT_CANCEL 3
/*******************************************/
-static void dragFiles(srcBr, dstBr, srcpath, dstpath, dstdir,
+static void dragFiles(srcBr, dstBr, srcpath, dstpath, dstdir,
names, nlen, cpymode)
- BROWINFO *srcBr, *dstBr;
- char *srcpath, *dstpath, *dstdir, **names;
- int nlen, cpymode;
+- BROWINFO *srcBr, *dstBr;
+- char *srcpath, *dstpath, *dstdir, **names;
+- int nlen, cpymode;
++ BROWINFO *srcBr, *dstBr;
++ char *srcpath, *dstpath, **names;
++ const char *dstdir;
++ int nlen, cpymode;
{
- /* move or copy file(s) and their associated thumbnail files.
+ /* move or copy file(s) and their associated thumbnail files.
@@ -8544,16 +14478,78 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
char dstp[MAXPATHLEN + 1];
char src[MAXPATHLEN+1], dst[MAXPATHLEN+1];
char buf[128];
-@@ -4750,7 +4749,7 @@
+ struct stat st;
+
+
++ /* if the source directory is read-only, don't move files; copy them */
++ if (!cpymode && (access(srcpath, W_OK) != 0))
++ cpymode = 1;
++
+ /* build real destination dir */
+ strcpy(dstp, dstpath);
+
+@@ -4677,11 +5219,26 @@
+ }
+ else if (strcmp(dstdir,".")!=0) sprintf(dstp, "%s%s/", dstpath, dstdir);
+
++#ifdef AUTO_EXPAND
++ if (Isvdir(dstp)) {
++ sprintf(buf,"Sorry, you can't %s to the virtual directory, '%s'",
++ cpymode ? "copy" : "move", dstp);
++ ErrPopUp(buf, "\nBummer!");
++ SetCursors(-1);
++ return;
++ }
++ if (Isvdir(srcpath))
++ cpymode = 1;
++#endif
++
+
+ /* if there is a thumbnail directory in 'srcpath', make one for dstpath */
+ sprintf(src,"%s%s", srcpath, THUMBDIR);
+ dothumbs = 0;
++#ifdef AUTO_EXPAND
++ Dirtovd(src);
++#endif
+ if (stat(src, &st)==0) {
+ sprintf(dst,"%s%s", dstp, THUMBDIR);
+ mkdir(dst, st.st_mode & 07777);
+@@ -4712,6 +5269,14 @@
+ if (overwrite == OWRT_CANCEL) break; /* abort move */
+ if (j==1) fail++;
+
++#ifdef AUTO_EXPAND
++ if (!cpymode && j==0)
++ if (Movevdir(src,dst)) {
++ sprintf(buf, "fail to move virturl directory: %s", names[i]);
++ setBrowStr(srcBr, buf);
++ }
++#endif
++
+ if (dothumbs && j==0) {
+ sprintf(src,"%s%s/%s", srcpath, THUMBDIR, names[i]);
+ sprintf(dst,"%s%s/%s", dstp, THUMBDIR, names[i]);
+@@ -4749,8 +5314,17 @@
+ }
+
++ if (!cpymode) {
++ /* clear all lit files in the source folder (as they've been moved)
++ note: this won't be the optimal behavior if any files failed to
++ move, but screw it, that's not going to happen too often... */
++ for (i=0; i<srcBr->bfLen; i++) srcBr->bfList[i].lit = 0;
++ srcBr->numlit = 0;
++ }
++
++
/* clear all files in the destination folder */
- for (i=0; i<dstBr->bfLen; i++) {
+ for (i=0; i<dstBr->bfLen; i++) {
dstBr->bfList[i].lit = 0;
}
dstBr->numlit = 0;
-@@ -4760,10 +4759,10 @@
+@@ -4760,10 +5334,10 @@
for (i=0; i<nlen; i++) {
char *name; BFIL *bf;
name = names[i];
@@ -8567,7 +14563,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
}
}
-@@ -4783,10 +4782,10 @@
+@@ -4783,10 +5357,10 @@
changedNumLit(srcBr, -1, 0);
@@ -8580,16 +14576,120 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
(cpymode) ? "copied" : "moved");
else buf[0] = '\0';
setBrowStr(srcBr, buf);
-@@ -4824,7 +4823,7 @@
+@@ -4794,7 +5368,51 @@
+ SetCursors(-1);
+ }
+
++static int recursive_remove(dir)
++ char *dir;
++{
++ DIR *dp = NULL;
++ struct dirent *di;
++ char name[MAXPATHLEN+1];
++
++ strncpy(name, dir, MAXPATHLEN);
++ name[MAXPATHLEN] = 0;
++
++ if (name[strlen(name) - 1] == '/')
++ name[strlen(name) - 1] = 0;
++
++ if ((dp = opendir(name)) == NULL)
++ goto err;
++
++ while ((di = readdir(dp)) != NULL) {
++ char buf[MAXPATHLEN+1];
++ struct stat st;
++
++ if (!strcmp(di->d_name, ".") || !strcmp(di->d_name, ".."))
++ continue;
++
++ snprintf(buf, MAXPATHLEN, "%s/%s", name, di->d_name);
++
++ if (stat(buf, &st) < 0)
++ continue;
++
++ if (S_ISDIR(st.st_mode)) {
++ if (recursive_remove(buf) < 0)
++ goto err;
++ } else
++ unlink(buf);
++ }
+
++ if (rmdir(name) < 0)
++ goto err;
++
++ closedir(dp);
++ return 0;
++
++err:
++ if (dp) closedir(dp);
++ return -1;
++}
+
+ /*************************************************/
+ static int moveFile(src,dst)
+@@ -4809,34 +5427,48 @@
+ One bit of noise: if destination file exists, pop up a Overwrite?
+ warning box. */
+
+- int i, srcdir, dstdir;
+- struct stat st;
+- char buf[512];
+- static char *owbuts[4] = { "\nOk", "dDon't ask", "nNo", "\033Cancel" };
++ int i, srcdir, dstdir;
++ struct stat st;
++ char buf[512];
++ static const char *owbuts[] = { "\nOk", "aAlways", "nNo", "NNever", "\033Cancel" };
+
+ if (DEBUG) fprintf(stderr,"moveFile %s %s\n", src, dst);
+
++#ifdef AUTO_EXPAND
++ Dirtosubst(src);
++#endif
++
+ if (stat(src, &st)) return 0; /* src doesn't exist, it would seem */
++#ifdef AUTO_EXPAND
++ srcdir = (stat2bf((u_int) st.st_mode , src) == BF_DIR);
++#else
+ srcdir = (stat2bf((u_int) st.st_mode) == BF_DIR);
++#endif
+
+ /* see if destination exists */
++
+ if (stat(dst, &st)==0) {
++ if (overwrite==OWRT_NEVER) return -1;
++#ifdef AUTO_EXPAND
++ dstdir = (stat2bf((u_int) st.st_mode , dst) == BF_DIR);
++#else
dstdir = (stat2bf((u_int) st.st_mode) == BF_DIR);
++#endif
if (overwrite==OWRT_ASK) {
- sprintf(buf, "%s '%s' exists.\n\nOverwrite?",
-+ sprintf(buf, "%s '%s' exists.\n\nOverwrite?",
++ snprintf(buf, sizeof(buf), "%s '%s' exists.\n\nOverwrite?",
dstdir ? "Directory" : "File", dst);
- i = PopUp(buf, owbuts, 4);
+- i = PopUp(buf, owbuts, 4);
+-
+- if (i==1) overwrite = OWRT_NOASK;
+- else if (i==2) return -1;
+- else if (i==3) { overwrite = OWRT_CANCEL; return 1; }
++ switch (PopUp(buf, owbuts, COUNT(owbuts))) {
++ case 1: overwrite = OWRT_ALWAYS; break;
++ case 2: return -1;
++ case 3: overwrite = OWRT_NEVER; return -1;
++ case 4: overwrite = OWRT_CANCEL; return 1;
++ }
+ }
-@@ -4848,7 +4847,7 @@
+ if (dstdir) {
+ #ifndef VMS /* we don't delete directories in VMS */
+- sprintf(buf, "rm -rf %s", dst);
+- if (system(buf)) { /* okay, so it's cheating... */
++ if (recursive_remove(dst)) { /* okay, so it's cheating... */
+ SetISTR(ISTR_WARNING, "Unable to remove directory %s", dst);
+ return 1;
+ }
+@@ -4848,7 +5480,7 @@
}
}
@@ -8598,7 +14698,19 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if (!rename(src, dst)) return 0; /* Ok */
if (errno != EXDEV) return 1; /* failure, of some sort */
-@@ -4896,7 +4895,7 @@
+@@ -4859,9 +5491,8 @@
+ if (i == 0) { /* copied okay, kill the original */
+ if (srcdir) {
+ #ifndef VMS /* we don't delete directories in VMS */
+- sprintf(buf, "rm -rf %s", src);
+- if (system(buf)) { /* okay, so it's cheating... */
+- SetISTR(ISTR_WARNING, "Unable to remove directory %s", dst);
++ if (recursive_remove(src)) { /* okay, so it's cheating... */
++ SetISTR(ISTR_WARNING, "Unable to remove directory %s", src);
+ return 1;
+ }
+ #endif /* VMS */
+@@ -4896,7 +5527,7 @@
/* possible cases: source is either a file or a directory, or doesn't exist,
destination is either a file, a directory, or doesn't exist.
@@ -8607,7 +14719,73 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if source is a file:
if dest is a file, popup 'overwriting' question, delete file if ok
if dest is a dir, popup 'overwriting dir' question, delete dir if ok
-@@ -4957,7 +4956,7 @@
+@@ -4907,38 +5538,51 @@
+ fall through: if dest doesn't exist, copy the directory, recurs */
+
+
+- int i, dstExists, srcdir, dstdir;
+- struct stat srcSt, dstSt;
+- char buf[1024];
+- static char *owdiff[3] = { "\nOk", "nNo", "\033Cancel" };
+- static char *owsame[4] = { "\nOk", "dDon't Ask", "nNo", "\033Cancel" };
++ int dstExists, srcdir, dstdir;
++ struct stat srcSt, dstSt;
++ char buf[1024];
++ static const char *owdiff[] = { "\nOk", "nNo", "\033Cancel" };
++ static const char *owsame[] = { "\nOk", "aAlways", "nNo", "NNever", "\033Cancel" };
+
+ if (DEBUG) fprintf(stderr,"copyFile %s %s\n", src, dst);
+
++#ifdef AUTO_EXPAND
++ Dirtosubst(src);
++#endif
++
+ if (stat(src,&srcSt)) return 0; /* source doesn't exist, it would seem */
+
+ dstExists = (stat(dst, &dstSt)==0);
+
+ if (dstExists) { /* ask about overwriting... */
+- srcdir = (stat2bf((u_int) srcSt.st_mode) == BF_DIR);
+- dstdir = (stat2bf((u_int) dstSt.st_mode) == BF_DIR);
++#ifdef AUTO_EXPAND
++ srcdir = (stat2bf((u_int) srcSt.st_mode , src) == BF_DIR);
++ dstdir = (stat2bf((u_int) dstSt.st_mode , dst) == BF_DIR);
++#else
++ srcdir = (stat2bf((u_int) srcSt.st_mode) == BF_DIR);
++ dstdir = (stat2bf((u_int) dstSt.st_mode) == BF_DIR);
++#endif
+
+ sprintf(buf, "%s '%s' already exists. Replace it with %s '%s'?",
+ (dstdir) ? "Directory" : "File", dst,
+ (srcdir) ? "contents of directory" : "file", src);
+
+ if (srcdir == dstdir) {
++ if (overwrite==OWRT_NEVER) return -1;
+ if (overwrite==OWRT_ASK) {
+- i = PopUp(buf, owsame, 4);
+- if (i==1) overwrite = OWRT_NOASK;
+- if (i==2) return -1;
+- else if (i==3) { overwrite = OWRT_CANCEL; return 1; }
++ switch (PopUp(buf, owsame, COUNT(owsame))) {
++ case 1: overwrite = OWRT_ALWAYS; break;
++ case 2: return -1;
++ case 3: overwrite = OWRT_NEVER; return -1;
++ case 4: overwrite = OWRT_CANCEL; return 1;
++ }
+ }
+ }
+ else { /* one's a dir, the other's a file. *ALWAYS* ask! */
+- i = PopUp(buf, owdiff, 3);
+- if (i==1) return -1;
+- else if (i==2) { overwrite = OWRT_CANCEL; return 1; }
++ switch (PopUp(buf, owdiff, COUNT(owdiff))) {
++ case 1: return -1;
++ case 2: overwrite = OWRT_CANCEL; return 1;
++ }
+ }
+
+
+@@ -4957,7 +5601,7 @@
/* destination doesn't exist no more, if it ever did... */
userMask = umask(0); /* grab the umask */
umask((mode_t) userMask); /* put it back... */
@@ -8616,7 +14794,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
strcpy(cpSrcPath, src);
strcpy(cpDstPath, dst);
-@@ -5017,7 +5016,7 @@
+@@ -5017,7 +5661,7 @@
called recursively by cp_dir, there are *no* guarantees that either file
exists or not */
@@ -8625,16 +14803,31 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
struct stat srcSt, dstSt;
if (stat(cpSrcPath, &srcSt)) { /* src doesn't exist, usefully... */
-@@ -5037,7 +5036,7 @@
+@@ -5036,8 +5680,11 @@
+ havedst = 1;
}
-
+-
- switch(stat2bf((u_int) srcSt.st_mode)) {
++#ifdef AUTO_EXPAND
++ switch(stat2bf((u_int) srcSt.st_mode , cpDstPath)) {
++#else
+ switch(stat2bf((u_int) srcSt.st_mode)) {
++#endif
/* determine how to copy, by filetype */
/* NOTE: There is no S_IFLNK case here, since we're using 'stat()' and
-@@ -5059,12 +5058,12 @@
+@@ -5053,18 +5700,22 @@
+ }
+ }
+ else {
++#ifdef AUTO_EXPAND
++ if (stat2bf((u_int) dstSt.st_mode , cpDstPath) != BF_DIR) {
++#else
+ if (stat2bf((u_int) dstSt.st_mode) != BF_DIR) {
++#endif
+ SetISTR(ISTR_WARNING,"%s: not a directory", cpDstPath);
+ copyerr++;
return;
}
}
@@ -8650,7 +14843,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
case BF_CHR:
case BF_BLK: cp_special(&srcSt, havedst); break;
-@@ -5089,12 +5088,12 @@
+@@ -5089,12 +5740,12 @@
{
int i, dirlen, oldsrclen, olddstlen, longpath;
char **names, *name;
@@ -8665,7 +14858,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
cpSrcPath, cpDstPath);
longpath = 0;
-@@ -5110,9 +5109,9 @@
+@@ -5110,9 +5761,9 @@
for (i=0; i<dirlen && overwrite!=OWRT_CANCEL; i++) {
name = names[i];
@@ -8677,13 +14870,19 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
/* add name to src and dst paths */
if ((strlen(name) + oldsrclen >= (MAXPATHLEN-3)) ||
(strlen(name) + olddstlen >= (MAXPATHLEN-3))) {
-@@ -5130,12 +5129,12 @@
+@@ -5130,12 +5781,17 @@
cpSrcPath[oldsrclen] = '\0';
goto done;
}
-
+- if (stat2bf((u_int) srcSt.st_mode) == BF_DIR) {
+
- if (stat2bf((u_int) srcSt.st_mode) == BF_DIR) {
++#ifdef AUTO_EXPAND
++ if (stat2bf((u_int) srcSt.st_mode , cpSrcPath) == BF_DIR)
++#else
++ if (stat2bf((u_int) srcSt.st_mode) == BF_DIR)
++#endif
++ {
cpSrcPath[oldsrclen] = '\0';
continue; /* don't remove from list, just skip */
}
@@ -8692,7 +14891,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
strcat(cpDstPath, "/");
strcat(cpDstPath, name);
cp(); /* RECURSE */
-@@ -5169,7 +5168,7 @@
+@@ -5169,7 +5825,7 @@
strcat(cpDstPath, name);
cp(); /* RECURSE */
@@ -8701,20 +14900,44 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
cpSrcPath[oldsrclen] = '\0';
cpDstPath[olddstlen] = '\0';
}
-@@ -5191,10 +5190,10 @@
+@@ -5190,11 +5846,11 @@
+ int exists;
/*****************************/
{
- register int srcFd, dstFd, rcount, wcount, i;
+- register int srcFd, dstFd, rcount, wcount, i;
- char str[512], buf[8192];
-+ char buf[8192];
- static char *owbuts[4] = { "\nOk", "dDon't Ask", "nNo", "\033Cancel" };
+- static char *owbuts[4] = { "\nOk", "dDon't Ask", "nNo", "\033Cancel" };
++ register int srcFd, dstFd, rcount, wcount;
++ char buf[8192];
++ static const char *owbuts[] = { "\nOk", "aAlways", "nNo", "NNever", "\033Cancel" };
- if (DEBUG) fprintf(stderr,"cp_file: src='%s', dst='%s'\n",
+ if (DEBUG) fprintf(stderr,"cp_file: src='%s', dst='%s'\n",
cpSrcPath, cpDstPath);
if ((srcFd = open(cpSrcPath, O_RDONLY, 0)) == -1) {
-@@ -5255,7 +5254,7 @@
+@@ -5204,13 +5860,15 @@
+ }
+
+ if (exists) {
++ if (overwrite==OWRT_NEVER) return;
+ if (overwrite==OWRT_ASK) {
+ sprintf(buf, "File '%s' exists.\n\nOverwrite?", cpDstPath);
+- i = PopUp(buf, owbuts, 4);
+-
+- if (i==1) overwrite = OWRT_NOASK;
+- else if (i==2) return;
+- else if (i==3) { overwrite = OWRT_CANCEL; return; }
++ switch (PopUp(buf, owbuts, 4)) {
++ case 1: overwrite = OWRT_ALWAYS; break;
++ case 2: return;
++ case 3: overwrite = OWRT_NEVER; return;
++ case 4: overwrite = OWRT_CANCEL; return;
++ }
+ }
+ dstFd = open(cpDstPath, O_WRONLY|O_TRUNC, 0);
+ }
+@@ -5255,7 +5913,7 @@
int exists;
/*********************************/
{
@@ -8723,7 +14946,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
cpSrcPath, cpDstPath);
if (exists && unlink(cpDstPath)) {
-@@ -5281,7 +5280,7 @@
+@@ -5281,7 +5939,7 @@
int exists;
/*********************************/
{
@@ -8732,22 +14955,38 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
cpSrcPath, cpDstPath);
#ifdef S_IFIFO
-@@ -5302,12 +5301,12 @@
+@@ -5302,12 +5960,18 @@
-
+
/*********************************/
++#ifdef AUTO_EXPAND
++static int stat2bf(uistmode, path)
++ u_int uistmode;
++ char *path;
++#else
static int stat2bf(uistmode)
u_int uistmode;
++#endif
{
- /* given the 'st.st_mode' field from a successful stat(), returns
+ /* given the 'st.st_mode' field from a successful stat(), returns
BF_FILE, BF_DIR, BF_BLK, BF_CHR, BF_FIFO, or BF_SOCK. Does *NOT*
return BF_EXE */
-@@ -5357,8 +5356,8 @@
+@@ -5319,6 +5983,9 @@
+ else if (S_ISBLK(stmode)) rv = BF_BLK;
+ else if (S_ISFIFO(stmode)) rv = BF_FIFO;
+ else if (S_ISSOCK(stmode)) rv = BF_SOCK;
++#ifdef AUTO_EXPAND
++ else if (Isarchive(path)) rv = BF_DIR;
++#endif
+ else rv = BF_FILE;
+
+ return rv;
+@@ -5357,8 +6024,8 @@
static int selmatch1(name, arg)
char *name, *arg;
{
@@ -8758,7 +14997,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
including zero. */
char *sp, *oldnp;
-@@ -5379,7 +5378,7 @@
+@@ -5379,7 +6046,7 @@
while (*name) name++;
while (*arg ) arg++;
name--; arg--;
@@ -8767,7 +15006,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
while (*arg != '*') {
if (*arg != *name || name<oldnp) return 0;
arg--; name--;
-@@ -5388,7 +5387,7 @@
+@@ -5388,7 +6055,7 @@
}
else { /* there are more '*'s in arg... */
@@ -8776,7 +15015,7 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
if the '*'s are next to each other, just throw away the first one */
arg++; /* points to char after first '*' */
-@@ -5410,7 +5409,7 @@
+@@ -5410,7 +6077,7 @@
arg = sp+1;
}
}
@@ -8785,9 +15024,108 @@ diff -ruN xv-3.10a/xvbrowse.c xv-3.10a-bugfixes/xvbrowse.c
}
if (!*arg && !*name) return 1;
-diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
+@@ -5419,4 +6086,98 @@
+ }
+
+
++static IVIS *icon_vis_list = NULL;
++
++/***************************************************************/
++static void recIconVisible(name, icon)
++ char *name;
++ int icon;
++{
++ IVIS *ptr, *prev = NULL;
++
++ for (ptr = icon_vis_list; ptr; prev = ptr, ptr = ptr->next) {
++ if (!strcmp(ptr->name, name)) {
++ ptr->icon = icon;
++ return;
++ }
++ }
++
++ ptr = calloc(sizeof(IVIS), 1);
++ if (!ptr)
++ return;
+
++ ptr->name = strdup(name);
++
++ if (!ptr->name) {
++ free(ptr);
++ return;
++ }
++
++ if (!prev) {
++ icon_vis_list = ptr;
++ } else {
++ prev->next = ptr;
++ }
++
++ ptr->next = NULL;
++ ptr->icon = icon;
++}
++
++/***************************************************************/
++static void restIconVisible(br)
++ BROWINFO *br;
++{
++ IVIS *ptr;
++
++ for (ptr = icon_vis_list; ptr; ptr = ptr->next) {
++ if (!strcmp(ptr->name, br->path)) {
++ if (ptr->icon >= 0) {
++ makeIconVisible(br, ptr->icon);
++ updateSel(br, ptr->icon, 0, 0);
++ }
++ return;
++ }
++ }
++}
++
++
++/*********************************/
++static void clipChanges(br)
++ BROWINFO *br;
++{
++ /* called whenever schnauzer activity should place file names in
++ the X11 clipboard, or change what it put there.
++
++ Implementation is simple because the UI is non-standard
++ (i.e., not like xterm(1)). The clipboard command causes the
++ current browser to dump all its currently selected files'
++ (if any) names to the clipboard, space-separated.
++ No effort is made to shell-escape blanks and other 'odd'
++ characters in the names. */
++
++ char buf[4000]; /* too much or too little, whatever... */
++ int n;
++ int i;
++
++ n = 0;
++ strcpy(buf, "");
++
++ for (i=0; i<br->bfLen; i++) {
++ if(br->bfList[i].lit == 1) {
++ int m;
++
++ m = strlen(br->bfList[i].name) + 1;
++
++ if(n+m+1 >= sizeof(buf)) return; /* names probably won't fit in buf, abort */
++ strcat(buf, br->bfList[i].name);
++ strcat(buf, " ");
++ n += m;
++ }
++ }
++
++ if(n) {
++ buf[n-1] = 0; /* trim last space */
++
++ NewCutBuffer(buf);
++ }
++}
+diff -ru xv-3.10a/xvbutt.c xv-3.10a-enhancements/xvbutt.c
--- xv-3.10a/xvbutt.c 1995-01-03 13:19:51.000000000 -0800
-+++ xv-3.10a-bugfixes/xvbutt.c 2004-05-16 18:01:29.000000000 -0700
++++ xv-3.10a-enhancements/xvbutt.c 2007-04-15 20:59:15.000000000 -0700
@@ -1,4 +1,4 @@
-/*
+/*
@@ -8812,6 +15150,15 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
* MBSelect() - similar to RBSelect() ...
* MBClick() - returns true if given MB was clicked on
* MBTrack() - tracks MBUTT after click, until release
+@@ -76,7 +76,7 @@
+ Window win;
+ int x,y;
+ unsigned int w,h;
+- char *str;
++ const char *str;
+ unsigned long fg,bg,hi,lo;
+ {
+ bp->win = win;
@@ -116,7 +116,7 @@
void BTRedraw(bp)
BUTT *bp;
@@ -8889,7 +15236,13 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
{ bp->lit = 0; BTRedraw(bp); XFlush(theDisp); }
return(rval);
-@@ -295,13 +295,13 @@
+@@ -290,18 +290,18 @@
+ RBUTT *rblist;
+ Window win;
+ int x,y;
+- char *str;
++ const char *str;
+ unsigned long fg,bg,hi,lo;
{
/* mallocs an RBUTT, fills in the fields, and appends it to rblist
if rblist is NULL, this is the first rb in the list. It will
@@ -9055,6 +15408,15 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
if (lit && !PTINRECT(x, y, rb->x, rb->y, RBSIZE, RBSIZE)) {
lit=0;
drawRB(rb, lit);
+@@ -671,7 +671,7 @@
+ CBUTT *cb;
+ Window win;
+ int x,y;
+- char *str;
++ const char *str;
+ unsigned long fg,bg,hi,lo;
+ {
+ /* fill in the fields of the structure */
@@ -690,14 +690,14 @@
do so. We'll be needing them, y'see... */
@@ -9156,7 +15518,23 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
/******************* MBUTT ROUTINES ************************/
-@@ -851,7 +850,7 @@
+@@ -838,20 +837,20 @@
+
+
+ /***********************************************/
+-void MBCreate(mb, win, x,y,w,h, str, list, nlist, fg, bg, hi, lo)
++void MBCreate(mb, win, x, y, w, h, title, list, nlist, fg, bg, hi, lo)
+ MBUTT *mb;
+ Window win;
+ int x,y;
+ unsigned int w,h;
+- char *str;
+- char **list;
++ const char *title;
++ const char * const *list;
+ int nlist;
+ unsigned long fg,bg,hi,lo;
+ {
XSetWindowAttributes xswa;
unsigned long xswamask;
int i;
@@ -9165,6 +15543,15 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
if (!mbpixmade) {
mbchk = XCreatePixmapFromBitmapData(theDisp, rootW, (char *) mb_chk_bits,
mb_chk_width, mb_chk_height, fg, bg, dispDEEP);
+@@ -865,7 +864,7 @@
+ mb->y = y;
+ mb->w = w;
+ mb->h = h;
+- mb->title = str;
++ mb->title = title;
+ mb->active = 1;
+ mb->list = list;
+ mb->nlist = nlist;
@@ -889,7 +888,7 @@
xswa.save_under = True;
xswamask = CWBackPixel | CWBorderPixel | CWSaveUnder;
@@ -9203,7 +15590,7 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
XSetForeground(theDisp, theGC, mb->bg);
XFillRectangle(theDisp, mb->win, theGC, x+1, y+1, w-1, h-1);
-@@ -940,7 +939,7 @@
+@@ -940,12 +939,14 @@
XSetBackground(theDisp, theGC, mb->bg);
XCopyPlane(theDisp, mb->pix, mb->win, theGC, 0,0,
(u_int) mb->pw, (u_int) mb->ph, x1,y1, 1L);
@@ -9212,7 +15599,24 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
DimRect(mb->win, x1,y1, (u_int) mb->pw, (u_int) mb->ph, mb->bg);
}
-@@ -997,14 +996,14 @@
+ else { /* draw string centered in butt */
+- char *str, stbuf[256];
++ const char *str;
++ char *tmp;
++ char stbuf[256];
+
+ if (mb->title) str = mb->title;
+ else { /* find first checked item, and show that as the title */
+@@ -961,7 +962,7 @@
+
+ /* truncate at TAB, if any */
+ strcpy(stbuf, str);
+- if ((str = (char *) index(stbuf, '\t')) != NULL) *str = '\0';
++ if ((tmp = (char *) index(stbuf, '\t')) != NULL) *tmp = '\0';
+ str = stbuf;
+
+ x1 = CENTERX(mfinfo, x + w/2, str);
+@@ -997,14 +998,14 @@
MBUTT *mb;
{
/* returns index of first checked selection, or '-1' if nothing selected */
@@ -9229,7 +15633,7 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
return -1;
}
-@@ -1017,13 +1016,13 @@
+@@ -1017,13 +1018,13 @@
/* makes entry #n the selected entry (ie, the only one with a check mark)
Does all redrawing. Does nothing if entry #n already selected.
Don't let it select 'dim' entries */
@@ -9246,7 +15650,7 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
for (i=0; i<MAXMBLEN; i++) mb->flags[i] = 0;
mb->flags[n] = 1;
-@@ -1083,7 +1082,7 @@
+@@ -1083,7 +1084,7 @@
}
}
mwide += 8; /* extra room at edges */
@@ -9255,7 +15659,7 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
/* make wider if any checked menu items */
for (i=0; i<mb->nlist && !mb->flags[i]; i++);
hascheck = (i<mb->nlist || mb->hascheck);
-@@ -1091,7 +1090,7 @@
+@@ -1091,7 +1092,7 @@
if (hascheck && mb->title) mwide += 8;
if (mwide < (mb->w+1)) mwide = mb->w+1; /* at least as wide as button */
@@ -9264,7 +15668,14 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
mhigh = mb->nlist * LINEHIGH + 2 + extratop;
mx = mb->x-1; my = mb->y - 1;
-@@ -1144,10 +1143,10 @@
+@@ -1138,16 +1139,17 @@
+ y = ASCENT + SPACING + extratop;
+ for (i=0; i<mb->nlist; i++) {
+ char txtstr[256], *tabstr;
++
+ strcpy(txtstr, mb->list[i]);
+ if ((tabstr = (char *) index(txtstr, '\t'))) {
+ *tabstr = '\0'; tabstr++;
}
if (mb->flags[i]) {
@@ -9277,7 +15688,7 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
if (!strcmp(mb->list[i], MBSEP)) {
mb->dim[i] = 1; /* don't select this one */
if (ctrlColor) {
-@@ -1161,15 +1160,15 @@
+@@ -1161,15 +1163,15 @@
XDrawLine(theDisp,win,theGC,4,y-(ASCENT/2)+1, mwide-5, y-(ASCENT/2)+1);
XSetForeground(theDisp, theGC, mb->fg);
}
@@ -9296,9 +15707,9 @@ diff -ruN xv-3.10a/xvbutt.c xv-3.10a-bugfixes/xvbutt.c
DimRect(win, x, y-ASCENT, (u_int) mwide, (u_int) CHIGH, mb->bg);
XSetForeground(theDisp, theGC, mb->fg);
}
-diff -ruN xv-3.10a/xvcolor.c xv-3.10a-bugfixes/xvcolor.c
+diff -ru xv-3.10a/xvcolor.c xv-3.10a-enhancements/xvcolor.c
--- xv-3.10a/xvcolor.c 1995-01-06 11:29:23.000000000 -0800
-+++ xv-3.10a-bugfixes/xvcolor.c 2004-05-16 18:01:37.000000000 -0700
++++ xv-3.10a-enhancements/xvcolor.c 2007-05-12 13:55:36.000000000 -0700
@@ -52,7 +52,7 @@
int pwide, phigh, *pnumcols;
{
@@ -9637,7 +16048,7 @@ diff -ruN xv-3.10a/xvcolor.c xv-3.10a-bugfixes/xvcolor.c
XSetWindowColormap(theDisp,gamW, LocalCmap);
cmap = LocalCmap;
-@@ -608,7 +608,7 @@
+@@ -608,12 +608,12 @@
}
else {
@@ -9646,6 +16057,13 @@ diff -ruN xv-3.10a/xvcolor.c xv-3.10a-bugfixes/xvcolor.c
colors into closest allocated desired colors */
if (nfcols==0 && !LocalCmap) {
+- char tstr[128], *tmp,
+- *foo = "No r/w cells available. Using r/o color.";
++ char tstr[128], *tmp;
++ const char *foo = "No r/w cells available. Using r/o color.";
+
+ tmp = GetISTR(ISTR_WARNING);
+ if (strlen(tmp) > (size_t) 0) sprintf(tstr, "%s %s", tmp, foo);
@@ -623,7 +623,7 @@
allocROColors();
return;
@@ -10108,9 +16526,9 @@ diff -ruN xv-3.10a/xvcolor.c xv-3.10a-bugfixes/xvcolor.c
if (oldmode == CM_STDCMAP && cmode != CM_STDCMAP && epicMode != EM_RAW) {
/* just left STDCMAP mode. Switch to using 'RAW' */
epicMode = EM_RAW;
-diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
+diff -ru xv-3.10a/xvctrl.c xv-3.10a-enhancements/xvctrl.c
--- xv-3.10a/xvctrl.c 1994-12-22 14:34:41.000000000 -0800
-+++ xv-3.10a-bugfixes/xvctrl.c 2004-05-23 11:56:37.000000000 -0700
++++ xv-3.10a-enhancements/xvctrl.c 2007-05-13 14:11:33.000000000 -0700
@@ -1,4 +1,4 @@
-/*
+/*
@@ -10138,27 +16556,154 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
#define CTRLWIDE 440 /* (fixed) size of control window */
#define CTRLHIGH 348 /* 379 */
-@@ -80,7 +83,7 @@
+@@ -80,73 +83,74 @@
in xv.h */
-static char *dispMList[] = { "Raw\tr",
-+static char *dispMList[] = { "Raw\tr",
- "Dithered\td",
- "Smooth\ts",
- MBSEP,
-@@ -91,7 +94,7 @@
- "Use Own Colormap",
- "Use Std. Colormap" };
-
+- "Dithered\td",
+- "Smooth\ts",
+- MBSEP,
+- "Read/Write Colors",
+- MBSEP,
+- "Normal Colors",
+- "Perfect Colors",
+- "Use Own Colormap",
+- "Use Std. Colormap" };
+-
-static char *rootMList[] = { "Window",
-+static char *rootMList[] = { "Window",
- "Root: tiled",
- "Root: integer tiled",
- "Root: mirrored",
-@@ -159,12 +162,12 @@
+- "Root: tiled",
+- "Root: integer tiled",
+- "Root: mirrored",
+- "Root: integer mirrored",
+- "Root: center tiled",
+- "Root: centered",
+- "Root: centered, warp",
+- "Root: centered, brick",
+- "Root: symmetrical tiled",
+- "Root: symmetrical mirrored" };
+-
+-static char *conv24MList[] = { "8-bit mode\t\2448",
+- "24-bit mode\t\2448",
+- MBSEP,
+- "Lock current mode",
+- MBSEP,
+- "Quick 24->8",
+- "Slow 24->8",
+- "Best 24->8" };
+-
+-static char *algMList[] = { "Undo All\t\244u",
+- MBSEP,
+- "Blur...\t\244b",
+- "Sharpen...\t\244s",
+- "Edge Detect\t\244e",
+- "Emboss\t\244m",
+- "Oil Painting\t\244o",
+- "Blend\t\244B",
+- "Copy Rotate...\t\244t",
+- "Clear Rotate...\t\244T",
+- "Pixelize...\t\244p",
+- "Spread...\t\244S",
+- "DeSpeckle...\t\244k"};
+-
+-static char *sizeMList[] = { "Normal\tn",
+- "Max Size\tm",
+- "Maxpect\tM",
+- "Double Size\t>",
+- "Half Size\t<",
+- "10% Larger\t.",
+- "10% Smaller\t,",
+- MBSEP,
+- "Set Size\tS",
+- "Re-Aspect\ta",
+- "4x3\t4",
+- "Int. Expand\tI" };
+-
+-static char *windowMList[] = { "Visual Schnauzer\t^v",
+- "Color Editor\te",
+- "Image Info\ti",
+- "Image Comments\t^c",
+- "Text View\t^t",
+- MBSEP,
+- "About XV\t^a",
+- "XV Keyboard Help"};
++static const char *dispMList[] = { "Raw\tr",
++ "Dithered\td",
++ "Smooth\ts",
++ MBSEP,
++ "Read/Write Colors",
++ MBSEP,
++ "Normal Colors",
++ "Perfect Colors",
++ "Use Own Colormap",
++ "Use Std. Colormap" };
++
++static const char *rootMList[] = { "Window",
++ "Root: tiled",
++ "Root: integer tiled",
++ "Root: mirrored",
++ "Root: integer mirrored",
++ "Root: center tiled",
++ "Root: centered",
++ "Root: centered, warp",
++ "Root: centered, brick",
++ "Root: symmetrical tiled",
++ "Root: symmetrical mirrored",
++ "Root: upper left corner" };
++
++static const char *conv24MList[] = { "8-bit mode\t\2448",
++ "24-bit mode\t\2448",
++ MBSEP,
++ "Lock current mode",
++ MBSEP,
++ "Quick 24->8",
++ "Slow 24->8",
++ "Best 24->8" };
++
++static const char *algMList[] = { "Undo All\t\244u",
++ MBSEP,
++ "Blur...\t\244b",
++ "Sharpen...\t\244s",
++ "Edge Detect\t\244e",
++ "Emboss\t\244m",
++ "Oil Painting\t\244o",
++ "Blend\t\244B",
++ "Copy Rotate...\t\244t",
++ "Clear Rotate...\t\244T",
++ "Pixelize...\t\244p",
++ "Spread...\t\244S",
++ "DeSpeckle...\t\244k"};
++
++static const char *sizeMList[] = { "Normal\tn",
++ "Max Size\tm",
++ "Maxpect\tM",
++ "Double Size\t>",
++ "Half Size\t<",
++ "10% Larger\t.",
++ "10% Smaller\t,",
++ MBSEP,
++ "Set Size\tS",
++ "Re-Aspect\ta",
++ "4x3\t4",
++ "Int. Expand\tI" };
++
++static const char *windowMList[] = { "Visual Schnauzer\t^v",
++ "Color Editor\te",
++ "Image Info\ti",
++ "Image Comments\t^c",
++ "Text View\t^t",
++ MBSEP,
++ "About XV\t^a",
++ "XV Keyboard Help"};
+
+
+
+@@ -157,14 +161,14 @@
+
+ /***************************************************/
void CreateCtrl(geom)
- char *geom;
+- char *geom;
++ const char *geom;
{
- int i, listh, topskip;
+ int listh, topskip;
@@ -10171,7 +16716,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
CTRLWIDE, CTRLHIGH, infofg, infobg, 0);
if (!ctrlW) FatalError("can't create controls window!");
-@@ -205,10 +208,10 @@
+@@ -205,10 +209,10 @@
oicon2Pix = MakePix1(ctrlW, oicon2_bits, oicon2_width, oicon2_height);
if (!grayTile || !dimStip || !fifoPix || !chrPix || !dirPix ||
@@ -10184,7 +16729,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
FatalError("unable to create all pixmaps in CreateCtrl()\n");
-@@ -226,7 +229,7 @@
+@@ -226,7 +230,7 @@
XFreePixmap(theDisp, oicon1Pix);
XFreePixmap(theDisp, oicon2Pix);
@@ -10193,7 +16738,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
if (ctrlColor) XSetWindowBackground(theDisp, ctrlW, locol);
else XSetWindowBackgroundPixmap(theDisp, ctrlW, grayTile);
-@@ -234,7 +237,7 @@
+@@ -234,7 +238,7 @@
listh = LINEHIGH * NLINES;
LSCreate(&nList, ctrlW, 5, 52, (CTRLWIDE-BUTTW-18),
@@ -10202,7 +16747,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
infofg, infobg, hicol, locol, RedrawNList, 0, 0);
nList.selected = 0; /* default to first name selected */
-@@ -245,8 +248,8 @@
+@@ -245,8 +249,8 @@
topskip = nList.y;
skip = ((double) (nList.h - (CHIGH+5))) / 6.0;
@@ -10213,7 +16758,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
topskip = nList.y + (nList.h - (6*skip + (CHIGH+5))) / 2;
}
-@@ -258,7 +261,7 @@
+@@ -258,7 +262,7 @@
#define R_BY3 (topskip + (int)(3*skip))
#define R_BY4 (topskip + (int)(4*skip))
#define R_BY5 (topskip + (int)(5*skip))
@@ -10222,7 +16767,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
BTCreate(&but[BNEXT], ctrlW, R_BX0, R_BY0, R_BW1, SBUTTH, "Next", BCLS);
BTCreate(&but[BPREV], ctrlW, R_BX0, R_BY1, R_BW1, SBUTTH, "Prev", BCLS);
BTCreate(&but[BLOAD], ctrlW, R_BX0, R_BY2, R_BW1, SBUTTH, "Load", BCLS);
-@@ -309,7 +312,7 @@
+@@ -309,7 +313,7 @@
BTCreate(&but[BABOUT], ctrlW,BX4, BY1,BUTTW,BUTTH,"About XV",BCLS);
BTCreate(&but[BQUIT], ctrlW,BX5, BY1,BUTTW,BUTTH,"Quit", BCLS);
@@ -10231,7 +16776,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
"", BCLS);
SetButtPix(&but[BCOPY], copyPix, copy_width, copy_height);
-@@ -329,7 +332,7 @@
+@@ -329,7 +333,7 @@
if (ctrlColor) {
SetButtPix(&but[BXV], oiconPix, oicon1_width, oicon1_height);
but[BXV].colorpix = 1;
@@ -10240,7 +16785,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
else SetButtPix(&but[BXV], iconPix, icon_width, icon_height);
#else
SetButtPix(&but[BXV], uiconPix, uicon_width, uicon_height);
-@@ -338,21 +341,21 @@
+@@ -338,21 +342,21 @@
XMapSubwindows(theDisp, ctrlW);
@@ -10269,7 +16814,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
"Image Size", sizeMList, SZMB_MAX, BCLS);
-@@ -395,7 +398,7 @@
+@@ -395,7 +399,7 @@
byte *bits;
int w,h;
{
@@ -10278,7 +16823,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
(u_int) w, (u_int) h, 1L,0L,1);
}
-@@ -404,7 +407,7 @@
+@@ -404,7 +408,7 @@
void CtrlBox(vis)
int vis;
{
@@ -10287,7 +16832,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
else XUnmapWindow(theDisp, ctrlW);
ctrlUp = vis;
-@@ -416,7 +419,6 @@
+@@ -416,7 +420,6 @@
int x,y,w,h;
{
int i;
@@ -10295,7 +16840,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
RANGE(w, 0, CTRLWIDE);
RANGE(h, 0, CTRLHIGH);
-@@ -452,7 +454,7 @@
+@@ -452,7 +455,7 @@
/***************************************************/
void DrawCtrlNumFiles()
{
@@ -10304,7 +16849,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
char foo[40];
x = but[BNEXT].x;
-@@ -463,14 +465,14 @@
+@@ -463,14 +466,14 @@
XSetBackground(theDisp, theGC, infobg);
sprintf(foo, "%d file%s", numnames, (numnames==1) ? "" : "s");
@@ -10321,7 +16866,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
R3D_IN, 2, hicol, locol, infobg);
XSetForeground(theDisp,theGC,infofg);
-@@ -489,7 +491,7 @@
+@@ -489,7 +492,7 @@
st1 = GetISTR(ISTR_WARNING);
XSetForeground(theDisp, theGC, infobg);
@@ -10330,7 +16875,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
CTRLWIDE, (u_int)((CHIGH+4)*2+1));
XSetForeground(theDisp, theGC, infofg);
-@@ -501,7 +503,7 @@
+@@ -501,7 +504,7 @@
XSetForeground(theDisp, theGC, locol);
XDrawLine(theDisp, ctrlW, theGC, 0, y+1, CTRLWIDE, y+1);
XDrawLine(theDisp, ctrlW, theGC, 0, y+CHIGH+5, CTRLWIDE, y+CHIGH+5);
@@ -10339,7 +16884,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
CTRLWIDE, y+(CHIGH+4)*2+1);
}
-@@ -542,16 +544,16 @@
+@@ -542,16 +545,16 @@
void ScrollToCurrent(lst)
LIST *lst;
{
@@ -10359,7 +16904,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
lst->selected < lst->scrl.val + lst->nlines-1) LSRedraw(lst, 0);
else {
halfway = (lst->nlines)/2; /* offset to the halfway pt. of the list */
-@@ -590,7 +592,7 @@
+@@ -590,7 +593,7 @@
lp->win = XCreateSimpleWindow(theDisp,win,x,y,(u_int) w, (u_int) h,1,fg,bg);
if (!lp->win) FatalError("can't create list window!");
@@ -10368,7 +16913,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
lp->w = w; lp->h = h;
lp->fg = fg; lp->bg = bg;
lp->hi = hi; lp->lo = lo;
-@@ -603,7 +605,7 @@
+@@ -603,7 +606,7 @@
XSelectInput(theDisp, lp->win, ExposureMask | ButtonPressMask);
@@ -10377,7 +16922,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
nstr-nlines, 0, nlines-1, fg, bg, hi, lo, fptr);
XMapSubwindows(theDisp, lp->win);
-@@ -646,7 +648,7 @@
+@@ -646,7 +649,7 @@
LIST *lp;
{
/* redraws lists 3d-effect, which can be trounced by drawSel() */
@@ -10386,7 +16931,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
lp->hi, lp->lo, lp->bg);
}
-@@ -675,43 +677,43 @@
+@@ -675,43 +678,43 @@
else { fg = lp->fg; bg = lp->bg; }
XSetForeground(theDisp, theGC, bg);
@@ -10439,7 +16984,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
XCopyPlane(theDisp, exePix, lp->win, theGC, 0, 0,
i_exe_width, i_exe_height, x0+3, ypos, 1L);
-@@ -720,8 +722,8 @@
+@@ -720,8 +723,8 @@
i_reg_width, i_reg_height, x0+3, ypos, 1L);
@@ -10450,7 +16995,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
lp->str[j]+1);
}
}
-@@ -735,7 +737,7 @@
+@@ -735,7 +738,7 @@
{
int i;
@@ -10459,7 +17004,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
drawSel(lp,i);
ls3d(lp);
}
-@@ -762,7 +764,7 @@
+@@ -762,7 +765,7 @@
if (sel >= lp->nstr) sel = lp->selected;
/* see if it's a double click */
@@ -10468,7 +17013,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
&& (lp->scrl.val + (y-y0)/LINEHIGH) < lp->nstr
&& !INACTIVE(lp,sel)) {
return (sel);
-@@ -782,7 +784,7 @@
+@@ -782,7 +785,7 @@
while (XQueryPointer(theDisp,lp->win,&rW,&cW,&rx,&ry,&x,&y,&mask)) {
if (!(mask & Button1Mask)) break; /* button released */
@@ -10477,7 +17022,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
if (lp->scrl.val > lp->scrl.min) {
lp->selected = lp->scrl.val - 1;
SCSetVal(&lp->scrl, lp->scrl.val - 1);
-@@ -804,7 +806,7 @@
+@@ -804,7 +807,7 @@
if (sel >= lp->nstr) sel = lp->nstr - 1;
if (sel != lp->selected && sel >= lp->scrl.val &&
@@ -10486,7 +17031,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
/* dragged to another on current page */
oldsel = lp->selected;
lp->selected = sel;
-@@ -829,17 +831,17 @@
+@@ -829,17 +832,17 @@
else if (key==LS_PAGEDOWN) SCSetVal(&lp->scrl,lp->scrl.val + (lp->nlines-1));
else if (key==LS_HOME) SCSetVal(&lp->scrl,lp->scrl.min);
else if (key==LS_END) SCSetVal(&lp->scrl,lp->scrl.max);
@@ -10507,7 +17052,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
/* if it's the top line... */
else if (lp->selected == lp->scrl.val) {
if (lp->selected > 0) {
-@@ -847,7 +849,7 @@
+@@ -847,7 +850,7 @@
SCSetVal(&lp->scrl, lp->selected);
}
}
@@ -10516,7 +17061,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
/* if it's not visible, put it on the bottom line */
else {
lp->selected = lp->scrl.val + lp->nlines - 1;
-@@ -856,10 +858,10 @@
+@@ -856,10 +859,10 @@
ls3d(lp);
}
}
@@ -10529,7 +17074,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
lp->selected < lp->scrl.val + lp->nlines - 1) {
if (lp->selected < lp->nstr-1) {
/* then just move it */
-@@ -868,7 +870,7 @@
+@@ -868,7 +871,7 @@
ls3d(lp);
}
}
@@ -10538,7 +17083,7 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
/* if it's the bottom line... */
else if (lp->selected == lp->scrl.val + lp->nlines - 1) {
if (lp->selected < lp->nstr-1) {
-@@ -876,7 +878,7 @@
+@@ -876,7 +879,7 @@
SCSetVal(&lp->scrl, lp->scrl.val+1);
}
}
@@ -10547,9 +17092,9 @@ diff -ruN xv-3.10a/xvctrl.c xv-3.10a-bugfixes/xvctrl.c
/* if it's not visible, put it on the top line */
else {
lp->selected = lp->scrl.val;
-diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
+diff -ru xv-3.10a/xvcut.c xv-3.10a-enhancements/xvcut.c
--- xv-3.10a/xvcut.c 1995-01-13 11:55:48.000000000 -0800
-+++ xv-3.10a-bugfixes/xvcut.c 2004-05-16 18:01:43.000000000 -0700
++++ xv-3.10a-enhancements/xvcut.c 2007-04-15 15:02:32.000000000 -0700
@@ -15,7 +15,7 @@
* static void clearSelectedArea();
* static void makeClipFName ();
@@ -10622,19 +17167,22 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
cy = (sy>=0) ? 0 : ((-sy) * cliph) / sh;
cw = (dw * clipw) / sw;
ch = (dh * cliph) / sh;
-@@ -302,26 +302,26 @@
+@@ -302,27 +302,29 @@
if (picType == PIC8) {
int ncc, keep8;
char buf[512];
-
+
if (clipis24) { /* pasting in a 24-bit image that *requires* promotion */
- static char *bnames[] = { "\nOkay", "\033Cancel" };
+- static char *bnames[] = { "\nOkay", "\033Cancel" };
++ static const char *labels[] = { "\nOkay", "\033Cancel" };
++
strcpy(buf, "Warning: Pasting this 24-bit image will require ");
strcat(buf, "promoting the current image to 24 bits.");
-
+- if (PopUp(buf, bnames, 2)) goto exit; /* Cancelled */
+
- if (PopUp(buf, bnames, 2)) goto exit; /* Cancelled */
++ if (PopUp(buf, labels, 2)) goto exit; /* Cancelled */
else Change824Mode(PIC24); /* promote pic to 24 bits */
}
@@ -10643,17 +17191,21 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
-
+
if (ncc + numcols > 256) {
- static char *bnames[] = { "\nPromote", "8Keep 8-bit", "\033Cancel" };
+- static char *bnames[] = { "\nPromote", "8Keep 8-bit", "\033Cancel" };
++ static const char *labels[] = { "\nPromote", "8Keep 8-bit", "\033Cancel" };
++
strcpy(buf,"Warning: The image and the clipboard combine to have ");
strcat(buf,"more than 256 unique colors. Promoting the ");
strcat(buf,"image to 24 bits is recommended, otherwise the contents ");
strcat(buf,"of the clipboard will probably lose some colors.");
-
+- keep8 = PopUp(buf, bnames, 3);
+
- keep8 = PopUp(buf, bnames, 3);
++ keep8 = PopUp(buf, labels, 3);
if (keep8==2) goto exit; /* Cancel */
else if (keep8==0) Change824Mode(PIC24); /* promote pic to 24 bits */
-@@ -331,8 +331,8 @@
+ }
+@@ -331,8 +333,8 @@
@@ -10664,7 +17216,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
/* legal possibilities at this point:
* pic is PIC24: clip is 8 or 24
* pic is PIC8: clip is 8, or clip is 24 but has 256 or fewer colors
-@@ -342,18 +342,18 @@
+@@ -342,18 +344,18 @@
if (picType == PIC8) {
int clx, cly, r,g,b,k,mind,close,newcols;
@@ -10688,7 +17240,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
if (!clipis24) { /* copy colormap from clip data into newr,g,b[] */
for (i=0; i<256; i++) {
newr[i] = clipcmap[i*3];
-@@ -366,22 +366,22 @@
+@@ -366,22 +368,22 @@
dp = dpic + i*dw;
cly = cy + (i * ch) / dh;
clp = clippic + (cly*clipw * bperpix);
@@ -10715,7 +17267,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
*dp = (byte) (k & 0xff);
}
}
-@@ -401,23 +401,23 @@
+@@ -401,23 +403,23 @@
}
}
}
@@ -10746,7 +17298,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
if (numcols < 256) {
rMap[numcols] = newr[i];
gMap[numcols] = newg[i];
-@@ -429,7 +429,7 @@
+@@ -429,7 +431,7 @@
r = newr[i]; g=newg[i]; b=newb[i];
mind = 256*256 + 256*256 + 256*256;
for (j=close=0; j<numcols; j++) {
@@ -10755,7 +17307,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
((gMap[j]-g) * (gMap[j]-g)) +
((bMap[j]-b) * (bMap[j]-b));
if (k<mind) { mind = k; close = j; }
-@@ -438,10 +438,10 @@
+@@ -438,10 +440,10 @@
}
}
}
@@ -10769,7 +17321,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
dp = dpic;
for (i=dy; i<dy+dh; i++) {
pp = pic + (i*pWIDE) + dx;
-@@ -451,7 +451,7 @@
+@@ -451,7 +453,7 @@
}
}
free(dpic);
@@ -10778,7 +17330,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
if (newcols) InstallNewPic(); /* does color reallocation, etc. */
else {
GenerateCpic();
-@@ -459,16 +459,16 @@
+@@ -459,16 +461,16 @@
DrawEpic();
}
}
@@ -10799,7 +17351,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
trr = trg = trb = 0;
if (istran) {
if (clipis24) {
-@@ -482,24 +482,24 @@
+@@ -482,24 +484,24 @@
trb = clipcmap[trval*3+2];
}
}
@@ -10830,7 +17382,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
if (!clipis24) {
for (i=0; i<256; i++) {
rmap[i] = clipcmap[i*3];
-@@ -507,15 +507,15 @@
+@@ -507,15 +509,15 @@
bmap[i] = clipcmap[i*3+2];
}
}
@@ -10850,7 +17402,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
dp = dpic;
for (i=dy; i<dy+dh; i++) {
pp = pic + (i*pWIDE + dx) * 3;
-@@ -536,11 +536,11 @@
+@@ -536,11 +538,11 @@
pp = pic + ((i+dy)*pWIDE + dx) * 3;
cly = cy + (i * ch) / dh;
clp = clippic + (cly*clipw * bperpix);
@@ -10864,7 +17416,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
if (clipis24) {
if (!istran || cp[0]!=trr || cp[1]!=trg || cp[2]==trb) {
pp[0] = *cp++; pp[1] = *cp++; pp[2] = *cp++;
-@@ -557,14 +557,14 @@
+@@ -557,14 +559,14 @@
}
}
@@ -10883,7 +17435,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
SetCursors(-1);
}
-@@ -577,20 +577,20 @@
+@@ -577,20 +579,20 @@
XColor cfg, cbg;
dragcurs = XCreateFontCursor(theDisp, XC_fleur);
@@ -10910,7 +17462,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
copy_x_hot, copy_y_hot);
if (!cutcurs || !copycurs) FatalError("can't create cut/copy cursors...");
}
-@@ -619,7 +619,7 @@
+@@ -619,7 +621,7 @@
if (!CutAllowed()) { XBell(theDisp, 0); return (byte *) NULL; }
if (!HaveSelection()) return (byte *) NULL;
@@ -10919,7 +17471,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
GetSelRCoords(&x,&y,&w,&h);
CropRect2Rect(&x,&y,&w,&h, 0,0,pWIDE,pHIGH);
-@@ -663,15 +663,15 @@
+@@ -663,15 +665,15 @@
if (picType == PIC24 && !do24) { /* 24-bit data as 8-bit */
int nc,pr,pg,pb;
byte *cm;
@@ -10938,7 +17490,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
cm = cimg + CIMG_CMAP;
for (k=0; k<nc; k++,cm+=3) {
if (pr==cm[0] && pg==cm[1] && pb==cm[2]) break;
-@@ -682,12 +682,12 @@
+@@ -682,12 +684,12 @@
cimg[CIMG_CMAP + nc*3 + 1] = pg;
cimg[CIMG_CMAP + nc*3 + 2] = pb;
}
@@ -10953,7 +17505,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
else if (picType == PIC24) { /* 24-bit data as 24-bit */
dp = cimg + CIMG_PIC24;
-@@ -705,26 +705,26 @@
+@@ -705,26 +707,26 @@
else if (picType == PIC8) { /* 8-bit selection */
byte *cm = cimg + CIMG_CMAP;
for (i=0; i<256; i++) { /* copy colormap */
@@ -10984,7 +17536,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
/********************************************/
static byte *getFromClip()
{
-@@ -743,14 +743,14 @@
+@@ -743,14 +745,14 @@
clipAtom = XInternAtom(theDisp, CLIPPROP, True);
if (clipAtom != None) XDeleteProperty(theDisp, rootW, clipAtom);
}
@@ -11003,7 +17555,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
(unsigned char **) &data);
if (i==Success && actType==XA_STRING && actFormat==8 && nleft>0) {
-@@ -763,9 +763,9 @@
+@@ -763,9 +765,9 @@
XFree((void *) data);
/* read the rest of the data (len bytes) */
@@ -11016,7 +17568,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
&nleft, (unsigned char **) &data);
if (i==Success) {
-@@ -791,8 +791,8 @@
+@@ -791,8 +793,8 @@
}
}
@@ -11027,7 +17579,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
use the file method, instead */
if (!clipfname) makeClipFName();
-@@ -800,7 +800,7 @@
+@@ -800,7 +802,7 @@
fp = fopen(clipfname, "r");
if (!fp) {
unlink(clipfname);
@@ -11036,7 +17588,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
clipfname, ERRSTR(errno));
ErrPopUp(str,"\nBletch!");
return (byte *) NULL;
-@@ -877,19 +877,19 @@
+@@ -877,19 +879,19 @@
clipAtom = XInternAtom(theDisp, CLIPPROP, True);
if (clipAtom != None) XDeleteProperty(theDisp, rootW, clipAtom);
}
@@ -11060,7 +17612,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
/* failed, use file method */
XDeleteProperty(theDisp, rootW, clipAtom);
}
-@@ -903,7 +903,7 @@
+@@ -903,7 +905,7 @@
fp = fopen(clipfname, "w");
if (!fp) {
unlink(clipfname);
@@ -11069,7 +17621,16 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
clipfname, ERRSTR(errno));
ErrPopUp(str,"\nBletch!");
return;
-@@ -996,7 +996,7 @@
+@@ -964,7 +966,7 @@
+ /********************************************/
+ static void makeClipFName()
+ {
+- char *homedir;
++ const char *homedir;
+
+ if (clipfname) return;
+
+@@ -996,7 +998,7 @@
byte *pp;
nc = 0;
@@ -11078,7 +17639,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
for (i=y; nc<257 && i<y+h; i++) {
pp = pic + i*pwide*3 + x*3;
for (j=x; nc<257 && j<x+w; j++, pp+=3) {
-@@ -1022,7 +1022,7 @@
+@@ -1022,7 +1024,7 @@
*/
int i, j, k, nc, r,g,b;
@@ -11087,7 +17648,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
byte newr[257], newg[257], newb[257];
if (picType != PIC8) return 0; /* shouldn't happen */
-@@ -1034,7 +1034,7 @@
+@@ -1034,7 +1036,7 @@
pp = newpic + i*w*3 + cx*3;
for (j=cx; j<cx+cw; j++) {
r = *pp++; g = *pp++; b = *pp++;
@@ -11096,7 +17657,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
/* lookup r,g,b in 'pic's colormap and the newcolors colormap */
for (k=0; k<nc && (r!=newr[k] || g!=newg[k] || b!=newb[k]); k++);
if (k==nc) {
-@@ -1062,11 +1062,11 @@
+@@ -1062,11 +1064,11 @@
/* now see which of the used colors are new */
for (i=0, nc=0; i<256; i++) {
if (!coluse[i]) continue;
@@ -11112,7 +17673,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
/* lookup r,g,b in pic's colormap */
for (k=0; k<numcols && (r!=rMap[k] || g!=gMap[k] || b!=bMap[k]);k++);
if (k==numcols) { /* it's a new color, alright */
-@@ -1075,7 +1075,7 @@
+@@ -1075,7 +1077,7 @@
}
}
}
@@ -11121,7 +17682,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
return nc;
}
-@@ -1143,7 +1143,7 @@
+@@ -1143,7 +1145,7 @@
/* NOTE: SELECTION IS *NOT* GUARANTEED to be within the bounds of 'pic'.
It is only guaranteed to *intersect* pic. */
@@ -11130,7 +17691,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
*wp = selrw; *hp = selrh;
}
-@@ -1200,7 +1200,7 @@
+@@ -1200,7 +1202,7 @@
if (lastClickButton==Button1 && (ev->time - lastClickTime) < DBLCLKTIME) {
lastClickButton=Button3;
if (HaveSelection() && PTINRECT(px, py, selrx, selry, selrw, selrh)) {
@@ -11139,7 +17700,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
rv = 1;
}
else {
-@@ -1225,7 +1225,7 @@
+@@ -1225,7 +1227,7 @@
else if (ev->button == Button2) { /* do a drag & drop operation */
if (HaveSelection() && PTINRECT(px,py,selrx,selry,selrw,selrh)) {
/* clip selection rect to pic */
@@ -11148,7 +17709,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
CropRect2Rect(&selrx, &selry, &selrw, &selrh, 0, 0, pWIDE, pHIGH);
if (selrw<1 || selrh<1) rv = 0;
-@@ -1253,8 +1253,8 @@
+@@ -1253,8 +1255,8 @@
* holding SHIFT constrains selection to be square,
* holding CTRL constrains selection to keep original aspect ratio
*/
@@ -11159,7 +17720,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
int sex, sey, sex2, sey2, sew, seh, sew2, seh2, hs, h2;
int istp, isbt, islf, isrt, isvm, ishm;
int cnstsq, cnstasp;
-@@ -1272,7 +1272,7 @@
+@@ -1272,7 +1274,7 @@
sew2 = sew/2;
seh2 = seh/2;
sex2--; sey2--;
@@ -11168,7 +17729,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
if (sew>=35 && seh>=35) hs=7;
else if (sew>=20 && seh>=20) hs=5;
else if (sew>= 9 && seh>= 9) hs=3;
-@@ -1307,7 +1307,7 @@
+@@ -1307,7 +1309,7 @@
/* it's definitely in a handle... track 'til released */
@@ -11177,7 +17738,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
DrawSelection(0);
selFilled = 1;
selTracking = 1;
-@@ -1366,12 +1366,12 @@
+@@ -1366,12 +1368,12 @@
else { chwide=1; newwide = (int) (seh*orgaspect); }
}
}
@@ -11192,7 +17753,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
if (chhigh) {
if (istp) { sey = (sey+seh) - newhigh; }
seh = newhigh;
-@@ -1380,7 +1380,7 @@
+@@ -1380,7 +1382,7 @@
if (sew<1) sew=1;
if (seh<1) seh=1;
@@ -11201,7 +17762,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
if (sex!=selrx || sey!=selry || sew!=selrw || seh!=selrh) {
DrawSelection(0);
selrx = sex; selry = sey; selrw = sew; selrh = seh;
-@@ -1395,14 +1395,14 @@
+@@ -1395,14 +1397,14 @@
Timer(100);
}
}
@@ -11218,7 +17779,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
selry < cYOFF+cHIGH && selry+selrh > cYOFF) EnableSelection(1);
return 1;
-@@ -1422,7 +1422,7 @@
+@@ -1422,7 +1424,7 @@
*
* if 'dragndrop', changes cursor, monitors CTRL status
*/
@@ -11227,7 +17788,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
int mpx, mpy, offx, offy;
int newsx, newsy, orgsx, orgsy, cnstrain, docopy, lastdocopy;
Window rW, cW;
-@@ -1436,9 +1436,9 @@
+@@ -1436,9 +1438,9 @@
CoordE2P(ev->x, ev->y, &mpx, &mpy);
offx = mpx - selrx; offy = mpy - selry;
@@ -11239,7 +17800,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
DrawSelection(0);
selFilled = 1;
selTracking = 1;
-@@ -1467,7 +1467,7 @@
+@@ -1467,7 +1469,7 @@
dx = newsx - orgsx; dy = newsy - orgsy;
if (abs(dx) > abs(dy)) dy = 0;
else if (abs(dy) > abs(dx)) dx = 0;
@@ -11248,7 +17809,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
newsx = orgsx + dx; newsy = orgsy + dy;
}
-@@ -1485,7 +1485,7 @@
+@@ -1485,7 +1487,7 @@
Timer(100);
}
}
@@ -11257,7 +17818,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
EnableSelection(0);
selFilled = 0;
-@@ -1495,7 +1495,7 @@
+@@ -1495,7 +1497,7 @@
/* only do <whatever> if the selection intersects CPIC */
@@ -11266,7 +17827,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
selry < cYOFF+cHIGH && selry+selrh > cYOFF) {
EnableSelection(1);
-@@ -1503,10 +1503,10 @@
+@@ -1503,10 +1505,10 @@
if (dragndrop) {
int tmpsx, tmpsy;
byte *data;
@@ -11279,7 +17840,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
data = getSelection(); /* copy old data */
if (data) {
if (!docopy) clearSelectedArea();
-@@ -1531,29 +1531,29 @@
+@@ -1531,29 +1533,29 @@
int rx,ry,ox,oy,x,y,active, x1, y1, x2, y2, cnstrain;
int i, px,py,px2,py2,pw,ph;
unsigned int mask;
@@ -11317,7 +17878,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
CoordE2P(x1, y1, &px, &py);
CoordE2P(x2, y2, &px2, &py2);
if (px>px2) { i=px; px=px2; px2=i; }
-@@ -1561,17 +1561,17 @@
+@@ -1561,17 +1563,17 @@
pw = px2-px+1; ph=py2-py+1;
/* keep px,py,pw,ph inside 'pic' */
@@ -11338,7 +17899,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
if (cnstrain) { /* make a square at smaller of w,h */
if (ph>pw) { if (y2<y1) py += (ph-pw); ph=pw; }
else if (pw>ph) { if (x2<x1) px += (pw-ph); pw=ph; }
-@@ -1579,12 +1579,12 @@
+@@ -1579,12 +1581,12 @@
/* put x,y,w,h -> selr{x,y,w,h}
if the rectangle has changed, erase old and draw new */
@@ -11353,7 +17914,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
haveSel = active = (pw>0 && ph>0);
if (infoUp) SetSelectionString();
XFlush(theDisp);
-@@ -1615,7 +1615,7 @@
+@@ -1615,7 +1617,7 @@
set, pick a new 'color' to invert the selection with */
int x,y,x1,y1,w,h;
@@ -11362,7 +17923,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
if (newcol) selColor = (selColor+1) & 0x7;
/* convert selr{x,y,w,h} into epic coords */
-@@ -1650,7 +1650,7 @@
+@@ -1650,7 +1652,7 @@
if (y<0 && y+h>eHIGH && selFilled!=1)
XDrawLine(theDisp, mainW, theGC, x, eHIGH/2, x+w, eHIGH/2);
@@ -11371,7 +17932,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
if (selFilled==0 || selFilled == 1) {
/* one little kludge: if w or h == eWIDE or eHIGH, make it one smaller */
if (x+w == eWIDE) w--;
-@@ -1664,17 +1664,17 @@
+@@ -1664,17 +1666,17 @@
else if (w>=20 && h>=20) { hs=5; h1=4; h2=2; }
else if (w>= 9 && h>= 9) { hs=3; h1=2; h2=1; }
else hs=h1=h2=0;
@@ -11392,7 +17953,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
XFillRectangle(theDisp,mainW,theGC,x+1, y+h-h1,
(u_int)h1,(u_int)h1);
XFillRectangle(theDisp,mainW,theGC,x+w/2-h2,y+h-h1,
-@@ -1683,7 +1683,7 @@
+@@ -1683,7 +1685,7 @@
(u_int)h1,(u_int)h1);
}
}
@@ -11401,7 +17962,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
if (selFilled==1) {
XDrawLine(theDisp, mainW, theGC, x+1, y+1, x+w-1, y+h-1);
XDrawLine(theDisp, mainW, theGC, x+1, y+h-1, x+w-1, y+1);
-@@ -1692,8 +1692,8 @@
+@@ -1692,8 +1694,8 @@
else if (selFilled==2) {
XFillRectangle(theDisp, mainW, theGC, x,y,(u_int) w, (u_int) h);
}
@@ -11412,7 +17973,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
XSetFunction(theDisp,theGC,GXcopy);
XSetPlaneMask(theDisp, theGC, AllPlanes);
}
-@@ -1703,7 +1703,7 @@
+@@ -1703,7 +1705,7 @@
void MoveGrowSelection(dx,dy,dw,dh)
int dx,dy,dw,dh;
{
@@ -11421,7 +17982,7 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
(in pic coords). keeps the selection entirely within 'pic'.
(called by 'CropKey()') */
-@@ -1729,7 +1729,7 @@
+@@ -1729,7 +1731,7 @@
}
}
@@ -11430,9 +17991,9 @@ diff -ruN xv-3.10a/xvcut.c xv-3.10a-bugfixes/xvcut.c
/***********************************/
void BlinkSelection(cnt)
int cnt;
-diff -ruN xv-3.10a/xvdflt.c xv-3.10a-bugfixes/xvdflt.c
+diff -ru xv-3.10a/xvdflt.c xv-3.10a-enhancements/xvdflt.c
--- xv-3.10a/xvdflt.c 1994-12-22 14:34:42.000000000 -0800
-+++ xv-3.10a-bugfixes/xvdflt.c 2004-05-16 18:01:46.000000000 -0700
++++ xv-3.10a-enhancements/xvdflt.c 2007-05-12 14:07:36.000000000 -0700
@@ -16,12 +16,12 @@
#include "bits/xv_rev"
#include "bits/xv_ver"
@@ -11448,6 +18009,15 @@ diff -ruN xv-3.10a/xvdflt.c xv-3.10a-bugfixes/xvdflt.c
#endif
+@@ -62,7 +62,7 @@
+ for (i=0; i<XVDFLT_HIGH; i++) {
+ nbytes = 0;
+ while (nbytes < XVDFLT_WIDE) {
+- char *sp;
++ const char *sp;
+ byte *dp;
+
+ j = XVDFLT_WIDE - nbytes;
@@ -100,21 +100,21 @@
setcolor(pinfo, 252, 0, 0, 0); /* black background for text */
@@ -11476,7 +18046,19 @@ diff -ruN xv-3.10a/xvdflt.c xv-3.10a-bugfixes/xvdflt.c
dfltpic, DWIDE, DHIGH, DWIDE/2 + (i/2) - xv_rev_width/2, 220, 250);
strcpy(str,"Press <right> mouse button for menu.");
-@@ -169,7 +169,7 @@
+@@ -136,7 +136,11 @@
+ pinfo->w = XVDFLT_WIDE;
+ pinfo->h = XVDFLT_HIGH;
+ pinfo->type = PIC8;
++#ifdef HAVE_PNG
++ pinfo->frmType = F_PNG;
++#else
+ pinfo->frmType = F_GIF;
++#endif
+ pinfo->colType = F_FULLCOLOR;
+
+ pinfo->normw = pinfo->w;
+@@ -169,7 +173,7 @@
for (i=k=0; i<DHIGH; i+=xf_left_height) {
for (j=0; j<DWIDE; j+=xf_left_width) {
k++;
@@ -11485,7 +18067,7 @@ diff -ruN xv-3.10a/xvdflt.c xv-3.10a-bugfixes/xvdflt.c
xbm2pic((byte *) xf_left_bits, xf_left_width, xf_left_height,
dfltpic, DWIDE, DHIGH, j + xf_left_width/2,
i + xf_left_height/2, 1);
-@@ -179,29 +179,29 @@
+@@ -179,29 +183,29 @@
@@ -11522,7 +18104,28 @@ diff -ruN xv-3.10a/xvdflt.c xv-3.10a-bugfixes/xvdflt.c
dfltpic, DWIDE, DHIGH, DWIDE/2 + (i/2) - xv_rev_width/2, 220, 102);
strcpy(str,"Press <right> mouse button for menu.");
-@@ -281,7 +281,7 @@
+@@ -240,7 +244,11 @@
+ pinfo->w = DWIDE;
+ pinfo->h = DHIGH;
+ pinfo->type = PIC8;
++#ifdef HAVE_PNG
++ pinfo->frmType = F_PNG;
++#else
+ pinfo->frmType = F_GIF;
++#endif
+ pinfo->colType = F_FULLCOLOR;
+
+ sprintf(pinfo->fullInfo, "<8-bit internal>");
+@@ -272,7 +280,7 @@
+ x = cx - bwide/2;
+
+ k = *bptr;
+- for (j=0,bit=0; j<bwide; j++, bit = (++bit)&7, x++) {
++ for (j=0,bit=0; j<bwide; j++, bit = (bit+1)&7, x++) {
+ if (!bit) k = *bptr++;
+ if ( (k&1) && (x>=0) && (x<pwide))
+ pptr[x] = col;
+@@ -281,7 +289,7 @@
}
}
}
@@ -11531,7 +18134,7 @@ diff -ruN xv-3.10a/xvdflt.c xv-3.10a-bugfixes/xvdflt.c
/*******************************************/
-@@ -300,7 +300,7 @@
+@@ -300,7 +308,7 @@
byte *dfltpic;
PICINFO *pinfo;
{
@@ -11540,7 +18143,7 @@ diff -ruN xv-3.10a/xvdflt.c xv-3.10a-bugfixes/xvdflt.c
byte *pp;
pp = dfltpic;
-@@ -357,7 +357,7 @@
+@@ -357,7 +365,7 @@
for ( ; *str; str++, cx+=6) {
i = (byte) *str;
@@ -11549,9 +18152,34 @@ diff -ruN xv-3.10a/xvdflt.c xv-3.10a-bugfixes/xvdflt.c
xbm2pic(font5x9[i - 32], 5, 9, pic, pw, ph, cx, cy, col);
}
}
-diff -ruN xv-3.10a/xvdial.c xv-3.10a-bugfixes/xvdial.c
+diff -ru xv-3.10a/xvdflt.h xv-3.10a-enhancements/xvdflt.h
+--- xv-3.10a/xvdflt.h 1994-12-22 14:34:56.000000000 -0800
++++ xv-3.10a-enhancements/xvdflt.h 2007-04-15 20:45:08.000000000 -0700
+@@ -2,7 +2,7 @@
+ #define XVDFLT_HIGH 270
+ #define XVDFLT_NPARTS 5
+ #define XVDFLT_PARTLEN 100
+-char *xvdflt_pic[1350] = {
++const char *xvdflt_pic[1350] = {
+ /* 0a */ "00000000000000000000000000000000000000000000000101010101010101010101010101010101010101010101010101010101010101000000000000000000000000000002020202020202020303030303030303030404040404040505050505060708",
+ /* 0b */ "0809090a0b0c0d0e0e0f101111121213131313141414141515151515151515151616161616161616161616161616161616161616161616161616161616171717171717171717171717171717161616161616161616161616161616161616161616161617",
+ /* 0c */ "171717181818181818181818181818181818181919181818181818191919191919191a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1b1b1b1b1b1b1b1b1b1c1c1c1c1c1c1c1c1d1d1d1d1d1d1d1d1d1c1c1c1c1c1c1c1c1c1c1c1c1c1c1b1b1b1b1b1b1b1b1b1a1a",
+@@ -1356,9 +1356,9 @@
+ };
+
+
+-byte xvdflt_r[256] = { 83,83,84,84,84,85,92,94,100,109,119,124,133,137,145,157,163,168,175,183,191,202,203,255,254,253,252,251,250,249,145,114,83,106,129,249,250,251,250,243,216,226,241,222,222,132,61,82,244,249,243,248,173,59,247,102,252,241,244,244,57,241,216,239,6,17,157,244,139,236,250,246,84,213,121,240,70,30,99,91,38,73,105,123,82,40,30,38,114,81,44,35,37,35,30,33,1,0,5,1,1,4,3,0,0,11,0,0,6,15,7,3,8,0,0,4,8,11,15,0,10,11,14,11,0,14,0,28,6,1,22,17,8,1,8,7,7,13,0,9,10,6,7,10,11,11,18,7,2,8,7,9,5,10,8,16,6,6,5,8,8,6,10,8,4,30,22,5,33,33,11,6,10,15,19,13,28,21,35,28,10,25,26,27,29,3,27,14,21,30,31,27,31,35,6,33,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
++const byte xvdflt_r[256] = { 83,83,84,84,84,85,92,94,100,109,119,124,133,137,145,157,163,168,175,183,191,202,203,255,254,253,252,251,250,249,145,114,83,106,129,249,250,251,250,243,216,226,241,222,222,132,61,82,244,249,243,248,173,59,247,102,252,241,244,244,57,241,216,239,6,17,157,244,139,236,250,246,84,213,121,240,70,30,99,91,38,73,105,123,82,40,30,38,114,81,44,35,37,35,30,33,1,0,5,1,1,4,3,0,0,11,0,0,6,15,7,3,8,0,0,4,8,11,15,0,10,11,14,11,0,14,0,28,6,1,22,17,8,1,8,7,7,13,0,9,10,6,7,10,11,11,18,7,2,8,7,9,5,10,8,16,6,6,5,8,8,6,10,8,4,30,22,5,33,33,11,6,10,15,19,13,28,21,35,28,10,25,26,27,29,3,27,14,21,30,31,27,31,35,6,33,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
+
+-byte xvdflt_g[256] = { 83,83,84,84,84,85,92,94,100,109,119,124,133,137,145,157,162,168,174,184,191,196,205,255,254,253,252,251,250,249,146,114,83,106,130,211,185,176,173,230,211,157,161,170,144,31,52,82,168,168,162,248,116,42,247,68,171,164,245,244,35,159,133,161,18,26,151,163,138,65,67,51,68,49,111,159,88,30,100,87,38,74,92,124,82,38,22,38,114,81,22,35,37,35,30,33,1,0,4,0,1,4,2,0,0,11,0,0,6,15,7,3,8,0,0,4,9,10,14,0,10,10,13,11,0,7,0,18,6,0,22,18,8,1,8,7,7,13,0,9,9,6,7,10,11,11,18,7,2,9,7,9,5,10,8,16,6,6,5,8,8,7,9,8,4,30,22,5,33,32,11,6,10,15,19,13,28,21,35,25,9,22,26,27,29,3,27,14,21,30,31,11,31,35,6,18,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
++const byte xvdflt_g[256] = { 83,83,84,84,84,85,92,94,100,109,119,124,133,137,145,157,162,168,174,184,191,196,205,255,254,253,252,251,250,249,146,114,83,106,130,211,185,176,173,230,211,157,161,170,144,31,52,82,168,168,162,248,116,42,247,68,171,164,245,244,35,159,133,161,18,26,151,163,138,65,67,51,68,49,111,159,88,30,100,87,38,74,92,124,82,38,22,38,114,81,22,35,37,35,30,33,1,0,4,0,1,4,2,0,0,11,0,0,6,15,7,3,8,0,0,4,9,10,14,0,10,10,13,11,0,7,0,18,6,0,22,18,8,1,8,7,7,13,0,9,9,6,7,10,11,11,18,7,2,9,7,9,5,10,8,16,6,6,5,8,8,7,9,8,4,30,22,5,33,32,11,6,10,15,19,13,28,21,35,25,9,22,26,27,29,3,27,14,21,30,31,11,31,35,6,18,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
+
+-byte xvdflt_b[256] = { 251,250,252,253,254,255,254,255,254,253,254,254,252,255,255,253,251,253,253,253,254,249,252,255,254,253,252,251,250,249,252,255,249,253,250,162,99,79,81,225,239,113,92,147,72,43,37,248,84,88,91,248,83,34,247,80,84,86,245,244,30,90,74,92,10,55,239,85,250,90,88,72,125,68,206,92,190,87,245,230,133,216,199,248,247,105,73,108,252,244,62,97,119,143,150,134,57,49,64,64,72,78,72,40,75,98,66,59,110,110,80,89,95,86,34,87,80,88,77,48,100,80,98,89,33,60,29,75,91,73,111,87,120,89,103,103,126,111,23,121,108,147,111,142,105,111,111,140,107,107,118,113,112,110,114,123,140,120,141,132,124,130,98,127,151,102,124,132,108,119,123,159,124,135,123,124,114,135,126,100,122,126,132,140,126,164,119,149,149,137,113,75,127,114,131,78,107,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
++const byte xvdflt_b[256] = { 251,250,252,253,254,255,254,255,254,253,254,254,252,255,255,253,251,253,253,253,254,249,252,255,254,253,252,251,250,249,252,255,249,253,250,162,99,79,81,225,239,113,92,147,72,43,37,248,84,88,91,248,83,34,247,80,84,86,245,244,30,90,74,92,10,55,239,85,250,90,88,72,125,68,206,92,190,87,245,230,133,216,199,248,247,105,73,108,252,244,62,97,119,143,150,134,57,49,64,64,72,78,72,40,75,98,66,59,110,110,80,89,95,86,34,87,80,88,77,48,100,80,98,89,33,60,29,75,91,73,111,87,120,89,103,103,126,111,23,121,108,147,111,142,105,111,111,140,107,107,118,113,112,110,114,123,140,120,141,132,124,130,98,127,151,102,124,132,108,119,123,159,124,135,123,124,114,135,126,100,122,126,132,140,126,164,119,149,149,137,113,75,127,114,131,78,107,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
+
+diff -ru xv-3.10a/xvdial.c xv-3.10a-enhancements/xvdial.c
--- xv-3.10a/xvdial.c 1995-01-03 13:20:31.000000000 -0800
-+++ xv-3.10a-bugfixes/xvdial.c 2004-05-16 18:01:57.000000000 -0700
++++ xv-3.10a-enhancements/xvdial.c 2007-04-15 17:55:50.000000000 -0700
@@ -1,11 +1,11 @@
-/*
+/*
@@ -11566,16 +18194,39 @@ diff -ruN xv-3.10a/xvdial.c xv-3.10a-bugfixes/xvdial.c
* DSetActive() - turns dial '.active' on and off
* DRedraw() - redraws the dial
* DTrack() - called when clicked. Operates control 'til mouseup
-@@ -50,7 +50,7 @@
+@@ -41,51 +41,53 @@
+
+
+ /* local functions */
+-static int whereInDial PARM((DIAL *, int, int));
+-static void drawArrow PARM((DIAL *));
+-static void drawValStr PARM((DIAL *));
+-static void drawButt PARM((DIAL *, int, int));
+-static int computeDialVal PARM((DIAL *, int, int));
+-static void dimDial PARM((DIAL *));
++static int whereInDial PARM((DIAL *, int, int));
++static void drawArrow PARM((DIAL *));
++static void drawValStr PARM((DIAL *));
++static void drawButt PARM((DIAL *, int, int));
++static double computeDialVal PARM((DIAL *, int, int));
++static void dimDial PARM((DIAL *));
/***************************************************/
-void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, page,
-+void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, page,
++void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, inc, page,
fg, bg, hi, lo, title, units)
- DIAL *dp;
- Window parent;
-@@ -60,13 +60,13 @@
+-DIAL *dp;
+-Window parent;
+-int x,y,w,h,minv,maxv,curv,page;
+-unsigned long fg,bg,hi,lo;
+-char *title, *units;
++DIAL *dp;
++Window parent;
++int x, y, w, h;
++double minv, maxv, curv, inc, page;
++unsigned long fg, bg, hi, lo;
++const char *title, *units;
{
if (!pixmaps_built) {
@@ -11593,7 +18244,81 @@ diff -ruN xv-3.10a/xvdial.c xv-3.10a-bugfixes/xvdial.c
(char *) dial_ccw2_bits, PW, PH, fg, bg, dispDEEP);
}
-@@ -126,14 +126,14 @@
+- dp->x = x;
+- dp->y = y;
+-
+- dp->w = w;
+- dp->h = h;
+- dp->fg = fg;
+- dp->bg = bg;
+- dp->hi = hi;
+- dp->lo = lo;
+- dp->title = title;
+- dp->units = units;
+- dp->active = 1;
++ dp->x = x;
++ dp->y = y;
++ dp->w = w;
++ dp->h = h;
++ dp->fg = fg;
++ dp->bg = bg;
++ dp->hi = hi;
++ dp->lo = lo;
++ dp->title = title;
++ dp->units = units;
++ dp->active = 1;
+ dp->drawobj = NULL;
+
+- if (w < h-24-16) dp->rad = (w - 8) / 2;
+- else dp->rad = (h - 24 - 16 - 8) / 2;
++ if (w < h-24-16)
++ dp->rad = (w - 8) / 2;
++ else
++ dp->rad = (h - 24 - 16 - 8) / 2;
+ dp->cx = w / 2;
+ dp->cy = dp->rad + 4 + 16;
+
+@@ -94,22 +96,22 @@
+ dp->bx[INCW1] = w-14-4; dp->by[INCW1] = h - 4 - 20;
+ dp->bx[INCW2] = w-14-4; dp->by[INCW2] = h - 4 - 10;
+
+- dp->win = XCreateSimpleWindow(theDisp, parent,x,y,(u_int) w,(u_int) h,
+- 1,fg,bg);
++ dp->win = XCreateSimpleWindow(theDisp, parent, x, y, (u_int) w, (u_int) h,
++ 1, fg, bg);
+ if (!dp->win) FatalError("can't create dial window");
+
+- DSetRange(dp, minv, maxv, curv, page);
++ DSetRange(dp, minv, maxv, curv, inc, page);
+ XSelectInput(theDisp, dp->win, ExposureMask | ButtonPressMask);
+ }
+
+
+ /***************************************************/
+-void DSetRange(dp, minv, maxv, curv, page)
+-DIAL *dp;
+-int minv, maxv, curv, page;
++void DSetRange(dp, minv, maxv, curv, inc, page)
++DIAL *dp;
++double minv, maxv, curv, inc, page;
+ {
+ if (maxv<minv) maxv=minv;
+- dp->min = minv; dp->max = maxv; dp->page = page;
++ dp->min = minv; dp->max = maxv; dp->inc = inc; dp->page = page;
+ dp->active = (minv < maxv);
+
+ DSetVal(dp, curv);
+@@ -118,22 +120,22 @@
+
+ /***************************************************/
+ void DSetVal(dp, curv)
+-DIAL *dp;
+-int curv;
++DIAL *dp;
++double curv;
+ {
+ RANGE(curv, dp->min, dp->max); /* make sure curv is in-range */
+
if (curv == dp->val) return;
/* erase old arrow */
@@ -11601,7 +18326,8 @@ diff -ruN xv-3.10a/xvdial.c xv-3.10a-bugfixes/xvdial.c
+ XSetForeground(theDisp, theGC, dp->bg);
drawArrow(dp);
- dp->val = curv;
+- dp->val = curv;
++ dp->val = (double)((int)(curv / dp->inc + (curv > 0 ? 0.5 : -0.5))) * dp->inc;
/* draw new arrow and string */
XSetForeground(theDisp, theGC, dp->fg);
@@ -11610,8 +18336,25 @@ diff -ruN xv-3.10a/xvdial.c xv-3.10a-bugfixes/xvdial.c
drawArrow(dp);
drawValStr(dp);
if (!dp->active) dimDial(dp);
-@@ -229,18 +229,18 @@
- case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1); break;
+@@ -202,7 +204,8 @@
+ int mx,my;
+ {
+ Window rW,cW;
+- int rx,ry, x,y, ipos, pos, lit, i, origval;
++ int rx, ry, x, y, ipos, pos, lit;
++ double origval;
+ unsigned int mask;
+
+ lit = 0;
+@@ -224,35 +227,36 @@
+ if (ipos != INDIAL) {
+ drawButt(dp, ipos, 1);
+ switch (ipos) {
+- case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+1); break;
++ case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->inc); break;
+ case INCW2: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page); break;
+- case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1); break;
++ case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->inc); break;
case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page); break;
}
- if (dp->drawobj != NULL) (dp->drawobj)();
@@ -11621,10 +18364,13 @@ diff -ruN xv-3.10a/xvdial.c xv-3.10a-bugfixes/xvdial.c
}
- else {
-+ else {
- i = computeDialVal(dp, mx, my);
- DSetVal(dp, i);
+- i = computeDialVal(dp, mx, my);
+- DSetVal(dp, i);
- if (dp->drawobj != NULL) (dp->drawobj)();
++ else {
++ double v;
++ v = computeDialVal(dp, mx, my);
++ DSetVal(dp, v);
+ if (dp->drawobj != NULL) (dp->drawobj)();
}
@@ -11633,25 +18379,38 @@ diff -ruN xv-3.10a/xvdial.c xv-3.10a-bugfixes/xvdial.c
/* loop until mouse is released */
while (XQueryPointer(theDisp,dp->win,&rW,&cW,&rx,&ry,&x,&y,&mask)) {
if (!(mask & Button1Mask)) break; /* button released */
-@@ -252,7 +252,7 @@
- DSetVal(dp, i);
- if (j != dp->val) {
+
+ if (ipos == INDIAL) {
+- int j;
+- i = computeDialVal(dp, x, y);
+- j = dp->val;
+- DSetVal(dp, i);
+- if (j != dp->val) {
++ double v, w;
++ v = computeDialVal(dp, x, y);
++ w = dp->val;
++ DSetVal(dp, v);
++ if (w != dp->val) {
/* track whatever dial controls */
- if (dp->drawobj != NULL) (dp->drawobj)();
+ if (dp->drawobj != NULL) (dp->drawobj)();
}
}
-@@ -266,7 +266,7 @@
+@@ -266,18 +270,18 @@
if (lit) {
switch (ipos) {
- case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+1);
-+ case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+1);
++ case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->inc);
break;
case INCW2: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page);
break;
-@@ -277,7 +277,7 @@
+- case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1);
++ case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->inc);
+ break;
+ case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page);
+ break;
}
/* track whatever dial controls */
@@ -11660,7 +18419,7 @@ diff -ruN xv-3.10a/xvdial.c xv-3.10a-bugfixes/xvdial.c
Timer(INC2WAIT);
}
-@@ -305,17 +305,17 @@
+@@ -305,34 +309,35 @@
/* returns region * that x,y is in. returns -1 if none */
@@ -11681,7 +18440,76 @@ diff -ruN xv-3.10a/xvdial.c xv-3.10a-bugfixes/xvdial.c
/***************************************************/
static void drawArrow(dp)
DIAL *dp;
-@@ -366,10 +366,10 @@
+ {
+- int i, rad, cx, cy;
++ int rad, cx, cy;
++ double v;
+ XPoint arrow[4];
+
+ rad = dp->rad; cx = dp->cx; cy = dp->cy;
+
+ /* map pos (range minv..maxv) into degrees (range 240..-60) */
+- i = 240 + (-300 * (dp->val - dp->min)) / (dp->max - dp->min);
+- arrow[0].x = cx + (int) ((double) rad * .80 * cos(i * DEG2RAD));
+- arrow[0].y = cy - (int) ((double) rad * .80 * sin(i * DEG2RAD));
+- arrow[1].x = cx + (int) ((double) rad * .33 * cos((i+160) * DEG2RAD));
+- arrow[1].y = cy - (int) ((double) rad * .33 * sin((i+160) * DEG2RAD));
+- arrow[2].x = cx + (int) ((double) rad * .33 * cos((i-160) * DEG2RAD));
+- arrow[2].y = cy - (int) ((double) rad * .33 * sin((i-160) * DEG2RAD));
++ v = 240 + (-300 * (dp->val - dp->min)) / (dp->max - dp->min);
++ arrow[0].x = cx + (int) ((double) rad * .80 * cos(v * DEG2RAD));
++ arrow[0].y = cy - (int) ((double) rad * .80 * sin(v * DEG2RAD));
++ arrow[1].x = cx + (int) ((double) rad * .33 * cos((v+160) * DEG2RAD));
++ arrow[1].y = cy - (int) ((double) rad * .33 * sin((v+160) * DEG2RAD));
++ arrow[2].x = cx + (int) ((double) rad * .33 * cos((v-160) * DEG2RAD));
++ arrow[2].y = cy - (int) ((double) rad * .33 * sin((v-160) * DEG2RAD));
+ arrow[3].x = arrow[0].x;
+ arrow[3].y = arrow[0].y;
+ XDrawLines(theDisp, dp->win, theGC, arrow, 4, CoordModeOrigin);
+@@ -343,33 +348,47 @@
+ static void drawValStr(dp)
+ DIAL *dp;
+ {
+- int i, x1, x2;
++ int tot, i, x1, x2;
+ char foo[60], foo1[60];
+
+ /* compute longest string necessary so we can right-align this thing */
+- sprintf(foo,"%d",dp->min); x1 = strlen(foo);
+- sprintf(foo,"%d",dp->max); x2 = strlen(foo);
++ sprintf(foo,"%d",(int)dp->min); x1 = strlen(foo);
++ sprintf(foo,"%d",(int)dp->max); x2 = strlen(foo);
+ if (dp->min < 0 && dp->max > 0) x2++; /* put '+' at beginning */
+ i = x1; if (x2>x1) i = x2;
+ if (dp->units) i += strlen(dp->units);
+
+- if (dp->min < 0 && dp->max > 0) sprintf(foo,"%+d", dp->val);
+- else sprintf(foo,"%d", dp->val);
++ sprintf(foo,"%g",dp->inc); /* space for decimal values */
++ tot = i + strlen(foo) - 1; /* Take away the 0 from the beginning */
++
++ if (dp->min < 0.0 && dp->max > 0.0) sprintf(foo,"%+g", dp->val);
++ else sprintf(foo,"%g", dp->val);
++
++ if (dp->inc < 1.0)
++ {
++ int j;
++
++ if (dp->val == (double)((int)dp->val))
++ strcat(foo,".");
++
++ for (j = strlen(foo); j < tot; j++)
++ strcat(foo,"0");
++ }
+
+ if (dp->units) strcat(foo,dp->units);
+ foo1[0] = '\0';
+ if (strlen(foo) < (size_t) i) {
+- for (i = i - strlen(foo); i>0; i--) strcat(foo1," ");
++ for (i-=strlen(foo);i>0;i--) strcat(foo1," ");
+ }
+ strcat(foo1, foo);
+
XSetForeground(theDisp, theGC, dp->fg);
XSetBackground(theDisp, theGC, dp->bg);
XSetFont(theDisp, theGC, monofont);
@@ -11694,7 +18522,24 @@ diff -ruN xv-3.10a/xvdial.c xv-3.10a-bugfixes/xvdial.c
foo1, (int) strlen(foo1));
XSetFont(theDisp, theGC, mfont);
}
-@@ -431,7 +431,7 @@
+@@ -411,12 +430,13 @@
+
+
+ /***************************************************/
+-static int computeDialVal(dp, x, y)
++static double computeDialVal(dp, x, y)
+ DIAL *dp;
+ int x, y;
+ {
+- int dx, dy, val;
+- double angle;
++ int dx, dy;
++
++ double angle, val;
+
+ /* compute dx, dy (distance from cx, cy). Note: +dy is *up* */
+ dx = x - dp->cx; dy = dp->cy - y;
+@@ -431,13 +451,15 @@
}
else if (dx>0) angle = atan((double) dy / (double) dx) * RAD2DEG;
else angle = atan((double) -dy / (double) -dx) * RAD2DEG + 180.0;
@@ -11703,25 +18548,110 @@ diff -ruN xv-3.10a/xvdial.c xv-3.10a-bugfixes/xvdial.c
/* map angle into range: -90..270, then into to value */
if (angle > 270.0) angle -= 360.0;
if (angle < -90.0) angle += 360.0;
-diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
+
+- val = (int) ((dp->max - dp->min) * (240.0 - angle) / 300.0) + dp->min;
++ val = ((dp->max - dp->min) * (240.0 - angle) / 300.0) + dp->min;
+
++ /* round value to be an even multiple of dp->inc */
++ val = (double)((int)(val / dp->inc + 0.5)) * dp->inc;
+ return val;
+ }
+
+diff -ru xv-3.10a/xvdir.c xv-3.10a-enhancements/xvdir.c
--- xv-3.10a/xvdir.c 1995-01-03 13:21:39.000000000 -0800
-+++ xv-3.10a-bugfixes/xvdir.c 2005-03-20 18:38:30.000000000 -0800
++++ xv-3.10a-enhancements/xvdir.c 2007-05-13 18:47:51.000000000 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* xvdir.c - Directory changin', file i/o dialog box
*
* callable functions:
-@@ -50,7 +50,7 @@
+@@ -50,32 +50,63 @@
#define COLWIDE 150 /* width of colMB */
/* NOTE: make sure these match up with F_* definitions in xv.h */
-static char *saveColors[] = { "Full Color",
-+static char *saveColors[] = { "Full Color",
- "Greyscale",
- "B/W Dithered",
- "Reduced Color" };
-@@ -83,14 +83,16 @@
+- "Greyscale",
+- "B/W Dithered",
+- "Reduced Color" };
+-
+-static char *saveFormats[] = { "GIF",
++static const char *saveColors[] = { "Full Color",
++ "Greyscale",
++ "B/W Dithered",
++ "Reduced Color" };
++
++static const char *saveFormats[] = {
++#ifdef HAVE_PNG
++ "PNG",
++#endif
+ #ifdef HAVE_JPEG
+- "JPEG",
++ "JPEG",
+ #endif
++#ifdef HAVE_JP2K
++ "JPEG 2000",
++ "JP2",
++#endif
++ "GIF",
+ #ifdef HAVE_TIFF
+- "TIFF",
++ "TIFF",
++#endif
++ "PostScript",
++ "PBM/PGM/PPM (raw)",
++ "PBM/PGM/PPM (ascii)",
++ "X11 Bitmap",
++ "XPM",
++ "BMP",
++ "Sun Rasterfile",
++ "IRIS RGB",
++ "Targa (24-bit)",
++ "FITS",
++ "PM",
++ "Spectrum SCREEN$", /* [JCE] */
++ "WBMP",
++#ifdef HAVE_MAG
++ "MAG",
++#endif
++#ifdef HAVE_PIC
++ "PIC",
++#endif
++#ifdef HAVE_MAKI
++ "MAKI (640x400 only)",
++#endif
++#ifdef HAVE_PI
++ "PI",
++#endif
++#ifdef HAVE_PIC2
++ "PIC2",
++#endif
++#ifdef HAVE_MGCSFX
++ "MgcSfx",
+ #endif
+- "PostScript",
+- "PBM/PGM/PPM (raw)",
+- "PBM/PGM/PPM (ascii)",
+- "X11 Bitmap",
+- "XPM",
+- "BMP",
+- "Sun Rasterfile",
+- "IRIS RGB",
+- "Targa (24-bit)",
+- "FITS",
+- "PM",
+- MBSEP,
+- "Filename List"};
++ MBSEP,
++ "Filename List" };
+
++#ifdef HAVE_PIC2
++extern int PIC2SaveParams PARM((char *, int));
++#endif
+
+ static void arrangeButts PARM((int));
+ static void RedrawDList PARM((int, SCRL *));
+@@ -83,34 +114,37 @@
static int dnamcmp PARM((const void *, const void *));
static int FNameCdable PARM((void));
static void loadCWD PARM((void));
@@ -11729,7 +18659,8 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
static int cd_able PARM((char *));
+#endif
static void scrollToFileName PARM((void));
- static void setFName PARM((char *));
+-static void setFName PARM((char *));
++static void setFName PARM((const char *));
static void showFName PARM((void));
static void changeSuffix PARM((void));
static int autoComplete PARM((void));
@@ -11739,7 +18670,44 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
byte **, byte **, byte **));
static byte *handleNormSel PARM((int *, int *, int *, int *));
-@@ -119,7 +121,7 @@
+
+-static char *fnames[MAXNAMES];
+-static int numfnames = 0, ndirs = 0;
+-static char path[MAXPATHLEN+1]; /* '/' terminated */
+-static char loadpath[MAXPATHLEN+1]; /* '/' terminated */
+-static char savepath[MAXPATHLEN+1]; /* '/' terminated */
+-static char *dirs[MAXDEEP]; /* list of directory names */
+-static char *dirMBlist[MAXDEEP]; /* list of dir names in right order */
+-static char *lastdir; /* name of the directory we're in */
+-static char filename[MAXFNLEN+100]; /* filename being entered */
+-static char deffname[MAXFNLEN+100]; /* default filename */
+-
+-static int savemode; /* if 0 'load box', if 1 'save box' */
+-static int curPos, stPos, enPos; /* filename textedit stuff */
+-static MBUTT dirMB; /* popup path menu */
+-static MBUTT fmtMB; /* 'format' menu button (Save only) */
+-static MBUTT colMB; /* 'colors' menu button (Save only) */
++static char *fnames[MAXNAMES];
++static int numfnames = 0, ndirs = 0;
++static char path[MAXPATHLEN+1]; /* '/' terminated */
++static char loadpath[MAXPATHLEN+1]; /* '/' terminated */
++static char savepath[MAXPATHLEN+1]; /* '/' terminated */
++static char *dirs[MAXDEEP]; /* list of directory names */
++static const char *dirMBlist[MAXDEEP]; /* list of dir names in right order */
++static char *lastdir; /* name of the directory we're in */
++static char filename[MAXFNLEN+100]; /* filename being entered */
++static char deffname[MAXFNLEN+100]; /* default filename */
++
++static int savemode; /* if 0 'load box', if 1 'save box' */
++static int curPos; /* insertion point in textedit filename */
++static int stPos, enPos; /* start and end of visible textedit filename */
++static MBUTT dirMB; /* popup path menu */
++static MBUTT fmtMB; /* 'format' menu button (Save only) */
++static MBUTT colMB; /* 'colors' menu button (Save only) */
+
+ static Pixmap d_loadPix, d_savePix;
+
+@@ -119,7 +153,7 @@
static char oldfname[MAXFNLEN+100];
/* the name of the file actually opened. (the temp file if we are piping) */
@@ -11748,7 +18716,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
static int dopipe;
-@@ -127,48 +129,46 @@
+@@ -127,48 +161,46 @@
void CreateDirW(geom)
char *geom;
{
@@ -11810,7 +18778,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
"Prev Name", infofg,infobg,hicol,locol);
SetDirFName("");
-@@ -180,33 +180,33 @@
+@@ -180,33 +212,33 @@
* create MBUTTs *after* calling XMapSubWindows() to keep popup unmapped
*/
@@ -11854,7 +18822,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/***************************************************/
void DirBox(mode)
-@@ -261,7 +261,7 @@
+@@ -261,7 +293,7 @@
BTSetActive(&dbut[S_BOLDSET], haveoldinfo);
BTSetActive(&dbut[S_BOLDNAM], haveoldinfo);
@@ -11863,7 +18831,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
CBSetActive(&saveselCB, HaveSelection());
MBSetActive(&fmtMB, 1);
-@@ -303,15 +303,15 @@
+@@ -303,15 +335,15 @@
if (gap>16) {
gap = 16;
top = dList.y + (dList.h - (nbts*BUTTH) - (ngaps*gap))/2;
@@ -11882,11 +18850,14 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/***************************************************/
-@@ -320,23 +320,22 @@
+@@ -319,24 +351,24 @@
+ int x,y,w,h;
{
int i, ypos, txtw;
- char foo[30], *str;
+- char foo[30], *str;
- XRectangle xr;
++ char foo[30];
++ const char *str;
if (dList.nstr==1) strcpy(foo,"1 file");
else sprintf(foo,"%d files",dList.nstr);
@@ -11909,7 +18880,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/* draw dividing line */
XSetForeground(theDisp, theGC, infofg);
XDrawLine(theDisp, dirW, theGC, 0, dirMB.y-6, DIRWIDE, dirMB.y-6);
-@@ -346,11 +345,11 @@
+@@ -346,11 +378,11 @@
XSetForeground(theDisp, theGC, hicol);
}
XDrawLine(theDisp, dirW, theGC, 0, dirMB.y-4, DIRWIDE, dirMB.y-4);
@@ -11925,7 +18896,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
MBRedraw(&dirMB);
MBRedraw(&fmtMB);
MBRedraw(&colMB);
-@@ -362,7 +361,7 @@
+@@ -362,7 +394,7 @@
if (StringWidth(COLLABEL) > txtw) txtw = StringWidth(COLLABEL);
if (!savemode) {
@@ -11934,7 +18905,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
10, (dirMB.y-6)/2 - d_load_height/2);
XSetFillStyle(theDisp, theGC, FillStippled);
-@@ -399,18 +398,18 @@
+@@ -399,18 +431,18 @@
i = v = 0;
if (MBClick(&fmtMB, x,y) && (v=MBTrack(&fmtMB))>=0) i=1;
else if (MBClick(&colMB, x,y) && (v=MBTrack(&colMB))>=0) i=2;
@@ -11957,7 +18928,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
else { /* SAVE */
if (CBClick(&savenormCB,x,y)) CBTrack(&savenormCB);
else if (CBClick(&saveselCB,x,y)) CBTrack(&saveselCB);
-@@ -482,7 +481,7 @@
+@@ -482,7 +514,7 @@
}
if (oldnumnames != numnames) { /* added some */
@@ -11966,7 +18937,44 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
windowMB.dim[WMB_TEXTVIEW] = (numnames==0);
LSNewData(&nList, dispnames, numnames);
-@@ -564,7 +563,7 @@
+@@ -501,10 +533,35 @@
+ }
+
+
+-
+ if (MBClick(&dirMB, x, y)) {
+ i = MBTrack(&dirMB);
+ if (i >= 0) changedDirMB(i);
++ return -1;
++ }
++
++ /* handle clicks inside the filename box */
++ if (x > 80 &&
++ y > dList.y + (int) dList.h + 30 &&
++ x < 80 + DNAMWIDE+6 &&
++ y < dList.y + (int) dList.h + 30 + LINEHIGH+5) {
++ int tx;
++ int dx;
++ int pos;
++
++ /* make coordinates relative to dnamW */
++ tx = x - (80 + 1 + 3); /* left side plus the border plus the space for the "more stuff" sign */
++
++ for (pos=stPos; pos+1 < enPos; pos++) {
++ if (XTextWidth(mfinfo, &filename[stPos], 1+pos-stPos) > tx)
++ break;
++ }
++ /* if we are more than halfway past this char, put the insertion point after it */
++ dx = tx - XTextWidth(mfinfo, &filename[stPos], pos-stPos);
++ if (dx > XTextWidth(mfinfo, &filename[pos], 1)/2)
++ pos++;
++
++ curPos = pos;
++ showFName();
+ }
+
+ return -1;
+@@ -564,14 +621,18 @@
* a special concealed device setup to provide a list of available
* disks).
*/
@@ -11975,7 +18983,18 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
strcat ( tmppath, "/000000" ); /* add root dir for device */
else if ((ndirs-sel) == 1 ) {
strcpy ( tmppath, "/XV_Root_Device/000000" ); /* fake top level */
-@@ -602,7 +601,7 @@
+ }
+ #endif
+
++#ifdef AUTO_EXPAND
++ if (Chvdir(tmppath)) {
++#else
+ if (chdir(tmppath)) {
++#endif
+ char str[512];
+ sprintf(str,"Unable to cd to '%s'\n", tmppath);
+ *trunc_point = '/'; /* restore the path */
+@@ -602,7 +663,7 @@
xv_getwd(path, sizeof(path));
LoadCurrentDirectory();
}
@@ -11984,7 +19003,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/***************************************************/
-@@ -621,7 +620,7 @@
+@@ -621,14 +682,14 @@
#else
struct dirent *dp;
#endif
@@ -11993,9 +19012,56 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/* get rid of previous file names */
for (i=0; i<numfnames; i++) free(fnames[i]);
-@@ -680,12 +679,12 @@
- strncpy(dirMBlist[j], dirs[i], stlen);
- dirMBlist[j][stlen] = '\0';
+ numfnames = 0;
+
+ /* get rid of old dirMBlist */
+- for (i=0; i<ndirs; i++) free(dirMBlist[i]);
++ for (i=0; i<ndirs; i++) free((char *) dirMBlist[i]);
+
+ #ifndef VMS
+ if (strlen(path) == 0) xv_getwd(path, sizeof(path)); /* no dir, use cwd */
+@@ -636,7 +697,11 @@
+ xv_getwd(path, sizeof(path));
+ #endif
+
++#ifdef AUTO_EXPAND
++ if (Chvdir(path)) {
++#else
+ if (chdir(path)) {
++#endif
+ ErrPopUp("Current load/save directory seems to have gone away!",
+ "\nYikes!");
+ #ifdef apollo
+@@ -644,7 +709,11 @@
+ #else
+ strcpy(path,"/");
+ #endif
++#ifdef AUTO_EXPAND
++ Chvdir(path);
++#else
+ chdir(path);
++#endif
+ }
+
+ changedDir = strcmp(path, oldpath);
+@@ -673,19 +742,22 @@
+
+ /* build dirMBlist */
+ for (i=ndirs-1,j=0; i>=0; i--,j++) {
+- size_t stlen = (i<(ndirs-1)) ? dirs[i+1] - dirs[i] : strlen(dirs[i]);
+- dirMBlist[j] = (char *) malloc(stlen+1);
+- if (!dirMBlist[j]) FatalError("unable to malloc dirMBlist[]");
++ size_t stlen = (i<(ndirs-1)) ? dirs[i+1] - dirs[i] : strlen(dirs[i]);
++ char *copy;
++
++ copy = malloc(stlen+1);
++ if (!copy) FatalError("unable to malloc dirMBlist[]");
+
+- strncpy(dirMBlist[j], dirs[i], stlen);
+- dirMBlist[j][stlen] = '\0';
++ strncpy(copy, dirs[i], stlen);
++ copy[stlen] = '\0';
++ dirMBlist[j] = copy;
}
-
+
@@ -12008,7 +19074,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
(u_int) dirMB.w+3, (u_int) dirMB.h+3, False);
i = StringWidth(dirMBlist[0]) + 10;
dirMB.x = dirMB.x + dirMB.w/2 - i/2;
-@@ -704,8 +703,8 @@
+@@ -704,8 +776,8 @@
i=0;
while ( (dp = readdir(dirp)) != NULL) {
@@ -12019,7 +19085,16 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
(strcmp(path,"/")==0 || strcmp(path,"//")==0)) ||
strcmp(dp->d_name, THUMBDIR)==0) {
/* skip over '.' and '..' and THUMBDIR */
-@@ -733,7 +732,7 @@
+@@ -714,7 +786,7 @@
+
+ if (i == MAXNAMES) {
+ fprintf(stderr,
+- "%s: too many directory entries. Only using first %d.\n",
++ "%s: too many directory entries. Using only first %d.\n",
+ cmd, MAXNAMES);
+ break;
+ }
+@@ -733,7 +805,7 @@
/* For VMS we will default all files EXCEPT directories to avoid
the high cost of the VAX C implementation of the stat function.
Suggested by Kevin Oberman (OBERMAN@icdc.llnl.gov) */
@@ -12028,7 +19103,17 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
if (xv_strstr (fnames[i]+1, ".DIR") != NULL) fnames[i][0] = C_DIR;
if (xv_strstr (fnames[i]+1, ".EXE") != NULL) fnames[i][0] = C_EXE;
if (xv_strstr (fnames[i]+1, ".OBJ") != NULL) fnames[i][0] = C_BLK;
-@@ -784,11 +783,13 @@
+@@ -749,6 +821,9 @@
+ else if (S_ISFIFO(ftype)) fnames[i][0] = C_FIFO;
+ else if (S_ISSOCK(ftype)) fnames[i][0] = C_SOCK;
+ else if (fnames[i][0] == C_REG && (mode&0111)) fnames[i][0] = C_EXE;
++#ifdef AUTO_EXPAND
++ else if (Isarchive(fnames[i]+1)) fnames[i][0] = C_DIR;
++#endif
+ }
+ else {
+ /* fprintf(stderr,"problems 'stat-ing' files\n");*/
+@@ -784,11 +859,13 @@
/***************************************************/
@@ -12042,7 +19127,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/***************************************************/
-@@ -829,7 +830,7 @@
+@@ -829,24 +906,28 @@
int len;
len = strlen(filename);
@@ -12051,7 +19136,38 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
if (c>=' ' && c<'\177') { /* printable characters */
/* note: only allow 'piped commands' in savemode... */
-@@ -918,19 +919,19 @@
++#undef PREVENT_SPACES /* Spaces are fine in filenames. */
++#ifdef PREVENT_SPACES
+ /* only allow spaces in 'piped commands', not filenames */
+ if (c==' ' && (!ISPIPE(filename[0]) || curPos==0)) return (-1);
++#endif
+
+ /* only allow vertbars in 'piped commands', not filenames */
+ if (c=='|' && curPos!=0 && !ISPIPE(filename[0])) return(-1);
+
+ if (len >= MAXFNLEN-1) return(-1); /* max length of string */
++
+ xvbcopy(&filename[curPos], &filename[curPos+1], (size_t) (len-curPos+1));
+ filename[curPos]=c; curPos++;
+
+ scrollToFileName();
+ }
+
+- else if (c=='\010' || c=='\177') { /* BS or DEL */
++ else if (c=='\010') { /* BS */
+ if (curPos==0) return(-1); /* at beginning of str */
+ xvbcopy(&filename[curPos], &filename[curPos-1], (size_t) (len-curPos+1));
+ curPos--;
+@@ -871,7 +952,7 @@
+ curPos = len;
+ }
+
+- else if (c=='\004') { /* ^D: delete character at curPos */
++ else if (c=='\004' || c=='\177') { /* ^D or DEL: delete character at curPos */
+ if (curPos==len) return(-1);
+ xvbcopy(&filename[curPos+1], &filename[curPos], (size_t) (len-curPos));
+ }
+@@ -918,19 +999,19 @@
{
/* called to 'auto complete' a filename being entered. If the name that
has been entered so far is anything but a simple filename (ie, has
@@ -12076,7 +19192,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
ISPIPE(filename[0]) ||
index(filename, '/') ||
filename[0]=='~' ) return 0;
-@@ -946,7 +947,7 @@
+@@ -946,7 +1027,7 @@
firstmatch = i;
/* count # of matches */
@@ -12085,7 +19201,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
i<dList.nstr && strncmp(filename, dList.str[i]+1, (size_t) slen)==0;
i++, nummatch++);
-@@ -960,14 +961,14 @@
+@@ -960,14 +1041,14 @@
while (dList.str[firstmatch][slen+1]!='\0') {
filename[slen] = dList.str[firstmatch][slen+1];
slen++; filename[slen] = '\0';
@@ -12103,7 +19219,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
XBell(theDisp, 0);
return 1;
-@@ -1003,7 +1004,7 @@
+@@ -1003,7 +1084,7 @@
i = pos - (NLINES/2);
SCSetVal(&dList.scrl, i);
}
@@ -12112,7 +19228,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/***************************************************/
void RedrawDNamW()
-@@ -1012,7 +1013,7 @@
+@@ -1012,7 +1093,7 @@
/* draw substring filename[stPos:enPos] and cursor */
@@ -12121,7 +19237,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
hicol, locol, infobg);
XSetForeground(theDisp, theGC, infofg);
-@@ -1023,7 +1024,7 @@
+@@ -1023,7 +1104,7 @@
XDrawLine(theDisp, dnamW, theGC, 2,0,2,LINEHIGH+5);
}
@@ -12130,7 +19246,37 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/* draw a "there's more over here" doowah */
XDrawLine(theDisp, dnamW, theGC, DNAMWIDE+5,0,DNAMWIDE+5,LINEHIGH+5);
XDrawLine(theDisp, dnamW, theGC, DNAMWIDE+4,0,DNAMWIDE+4,LINEHIGH+5);
-@@ -1057,7 +1058,7 @@
+@@ -1032,6 +1113,7 @@
+
+ XDrawString(theDisp, dnamW, theGC,3,ASCENT+3,filename+stPos, enPos-stPos);
+
++ /* draw insertion point */
+ cpos = XTextWidth(mfinfo, &filename[stPos], curPos-stPos);
+ XDrawLine(theDisp, dnamW, theGC, 3+cpos, 2, 3+cpos, 2+CHIGH+1);
+ XDrawLine(theDisp, dnamW, theGC, 3+cpos, 2+CHIGH+1, 5+cpos, 2+CHIGH+3);
+@@ -1054,10 +1136,29 @@
+
+ fullname = GetDirFullName();
+
++#ifdef AUTO_EXPAND
++ {
++ char path[MAXPATHLEN];
++
++ GetDirPath(path);
++ Mkvdir(path);
++ if ((i = Isvdir(fullname)) & 01) {
++ char buf[128];
++ sprintf(buf,
++ "Sorry, you can't save file in the virtual directory, '%s'",
++ path);
++ ErrPopUp(buf, "\nBummer!");
++ return -1;
++ }
++ if (i & 06)
++ Rmvdir(fullname);
++ }
++#endif
++
fmt = MBWhich(&fmtMB);
col = MBWhich(&colMB);
@@ -12139,7 +19285,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
FatalError("xv: no 'checked' format or color. shouldn't happen!\n");
-@@ -1068,19 +1069,19 @@
+@@ -1068,19 +1169,19 @@
dbut[S_BOK].lit = 0; BTRedraw(&dbut[S_BOK]);
return -1;
}
@@ -12162,7 +19308,67 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
SetCursors(-1);
dbut[S_BOK].lit = 0; BTRedraw(&dbut[S_BOK]);
return i;
-@@ -1147,34 +1148,41 @@
+@@ -1100,7 +1201,16 @@
+ #ifdef HAVE_JPEG
+ else if (fmt == F_JPEG) { /* JPEG */
+ JPEGSaveParams(fullname, col);
+- JPEGDialog(1); /* open JPEGDialog box */
++ JPEGDialog(1); /* open JPEGDialog box */
++ dbut[S_BOK].lit = 0; BTRedraw(&dbut[S_BOK]);
++ return 0; /* always 'succeeds' */
++ }
++#endif
++
++#ifdef HAVE_JP2K
++ else if (fmt == F_JPC || fmt == F_JP2) { /* JPEG 2000 */
++ JP2KSaveParams(fmt, fullname, col);
++ JP2KDialog(1); /* open JP2KDialog box */
+ dbut[S_BOK].lit = 0; BTRedraw(&dbut[S_BOK]);
+ return 0; /* always 'succeeds' */
+ }
+@@ -1109,13 +1219,40 @@
+ #ifdef HAVE_TIFF
+ else if (fmt == F_TIFF) { /* TIFF */
+ TIFFSaveParams(fullname, col);
+- TIFFDialog(1); /* open TIFF Dialog box */
++ TIFFDialog(1); /* open TIFF Dialog box */
++ dbut[S_BOK].lit = 0; BTRedraw(&dbut[S_BOK]);
++ return 0; /* always 'succeeds' */
++ }
++#endif
++
++#ifdef HAVE_PNG
++ else if (fmt == F_PNG) { /* PNG */
++ PNGSaveParams(fullname, col);
++ PNGDialog(1); /* open PNG Dialog box */
+ dbut[S_BOK].lit = 0; BTRedraw(&dbut[S_BOK]);
+ return 0; /* always 'succeeds' */
+ }
+ #endif
+
++#ifdef HAVE_PIC2
++ else if (fmt == F_PIC2) { /* PIC2 */
++ if (PIC2SaveParams(fullname, col) < 0)
++ return 0;
++ PIC2Dialog(1); /* open PIC2 Dialog box */
++ dbut[S_BOK].lit = 0; BTRedraw(&dbut[S_BOK]);
++ return 0; /* always 'succeeds' */
++ }
++#endif /* HAVE_PIC2 */
+
++#ifdef HAVE_MGCSFX
++ else if (fmt == F_MGCSFX) { /* MGCSFX */
++ if (MGCSFXSaveParams(fullname, col) < 0)
++ return 0;
++ MGCSFXDialog(1); /* open MGCSFX Dialog box */
++ dbut[S_BOK].lit = 0; BTRedraw(&dbut[S_BOK]);
++ return 0; /* always 'succeeds' */
++ }
++#endif /* HAVE_MGCSFX */
+
+
+ WaitCursor();
+@@ -1147,34 +1284,74 @@
rv = WritePBM (fp, thepic, ptype, w, h, rp,gp,bp, nc,col,1,picComments);
break;
@@ -12185,6 +19391,10 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
- rv = WriteBMP (fp, thepic, ptype, w, h, rp, gp, bp, nc, col); break;
+ rv = WriteBMP (fp, thepic, ptype, w, h, rp, gp, bp, nc, col);
+ break;
++
++ case F_WBMP:
++ rv = WriteWBMP (fp, thepic, ptype, w, h, rp, gp, bp, nc, col);
++ break;
case F_IRIS:
- rv = WriteIRIS (fp, thepic, ptype, w, h, rp, gp, bp, nc, col); break;
@@ -12210,14 +19420,43 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
- picComments);
+ rv = WriteFITS (fp, thepic, ptype, w, h, rp, gp, bp, nc, col,
+ picComments);
++ break;
++
++ case F_ZX: /* [JCE] Spectrum SCREEN$ */
++ rv = WriteZX (fp, thepic, ptype, w, h, rp, gp, bp, nc, col,
++ picComments);
++ break;
++#ifdef HAVE_MAG
++ case F_MAG:
++ rv = WriteMAG (fp, thepic, ptype, w, h, rp, gp, bp, nc, col,
++ picComments);
++ break;
++#endif /* HAVE_MAG */
++#ifdef HAVE_PIC
++ case F_PIC:
++ rv = WritePIC (fp, thepic, ptype, w, h, rp, gp, bp, nc, col,
++ picComments);
break;
++#endif /* HAVE_PIC */
++#ifdef HAVE_MAKI
++ case F_MAKI:
++ rv = WriteMAKI (fp, thepic, ptype, w, h, rp, gp, bp, nc, col);
++ break;
++#endif /* HAVE_MAKI */
++
++#ifdef HAVE_PI
++ case F_PI:
++ rv = WritePi (fp, thepic, ptype, w, h, rp, gp, bp, nc, col,
++ picComments);
++ break;
++#endif /* HAVE_PI */
}
-
+
if (CloseOutFile(fp, fullname, rv) == 0) {
DirBox(0);
-@@ -1184,12 +1192,12 @@
+@@ -1184,12 +1361,12 @@
}
}
@@ -12233,15 +19472,25 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
return rv;
}
-@@ -1200,6 +1208,7 @@
- char *st;
+@@ -1197,22 +1374,23 @@
+
+ /***************************************************/
+ void SetDirFName(st)
+- char *st;
++ const char *st;
{
strncpy(deffname, st, (size_t) MAXFNLEN-1);
+ deffname[MAXFNLEN-1] = '\0';
setFName(st);
}
-@@ -1212,7 +1221,7 @@
+
+ /***************************************************/
+ static void setFName(st)
+- char *st;
++ const char *st;
+ {
+ strncpy(filename, st, (size_t) MAXFNLEN-1);
filename[MAXFNLEN-1] = '\0'; /* make sure it's terminated */
curPos = strlen(st);
stPos = 0; enPos = curPos;
@@ -12250,7 +19499,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
showFName();
}
-@@ -1221,17 +1230,17 @@
+@@ -1221,17 +1399,17 @@
static void showFName()
{
int len;
@@ -12273,7 +19522,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
while (XTextWidth(mfinfo, &filename[stPos], enPos-stPos) < DNAMWIDE
&& enPos<len) { enPos++; }
-@@ -1244,7 +1253,7 @@
+@@ -1244,7 +1422,7 @@
}
@@ -12282,7 +19531,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
(u_int) LINEHIGH+4-3, False);
else XClearWindow(theDisp, dnamW);
-@@ -1270,7 +1279,7 @@
+@@ -1270,7 +1448,7 @@
else {
strcpy(globname, filename);
if (globname[0] == '~') Globify(globname);
@@ -12291,7 +19540,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
if (globname[0] != '/') sprintf(fullname, "%s%s", path, globname);
else strcpy(fullname, globname);
}
-@@ -1294,10 +1303,10 @@
+@@ -1294,14 +1472,15 @@
MBRedraw(&fmtMB);
}
}
@@ -12304,7 +19553,13 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
else if (group == F_FORMAT) {
MBSelect(&fmtMB, bnum);
-@@ -1322,10 +1331,10 @@
+- if (MBWhich(&fmtMB) == F_XBM) { /* turn off all but B/W */
++ if (MBWhich(&fmtMB) == F_XBM ||
++ MBWhich(&fmtMB) == F_WBMP) { /* turn off all but B/W */
+ colMB.dim[F_FULLCOLOR] = 1;
+ colMB.dim[F_GREYSCALE] = 1;
+ colMB.dim[F_BWDITHER] = 0;
+@@ -1322,10 +1501,10 @@
colMB.dim[F_GREYSCALE] = 0;
colMB.dim[F_BWDITHER] = 0;
colMB.dim[F_REDUCED] = (picType==PIC8) ? 0 : 1;
@@ -12317,7 +19572,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
if (MBWhich(&fmtMB) == F_FILELIST) {
MBSetActive(&colMB, 0);
CBSetActive(&savenormCB, 0);
-@@ -1337,12 +1346,12 @@
+@@ -1337,12 +1516,12 @@
}
}
@@ -12332,7 +19587,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
if there is, remember what case it was (all caps or all lower), lop
it off, and replace it with a new appropriate suffix, in the
same case */
-@@ -1356,7 +1365,7 @@
+@@ -1356,7 +1535,7 @@
suffix++; /* point to first letter of the suffix */
/* check for all-caposity */
@@ -12341,7 +19596,43 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
if (islower(*sp)) allcaps = 0;
/* copy the suffix into an all-lower-case buffer */
-@@ -1401,7 +1410,7 @@
+@@ -1380,14 +1559,33 @@
+ (strcmp(lowsuf,"eps" )==0) ||
+ (strcmp(lowsuf,"rgb" )==0) ||
+ (strcmp(lowsuf,"tga" )==0) ||
+- (strcmp(lowsuf,"xpm" )==0) ||
+ (strcmp(lowsuf,"fits")==0) ||
+ (strcmp(lowsuf,"fts" )==0) ||
++#ifdef HAVE_JPEG
+ (strcmp(lowsuf,"jpg" )==0) ||
+ (strcmp(lowsuf,"jpeg")==0) ||
+ (strcmp(lowsuf,"jfif")==0) ||
++#endif
++#ifdef HAVE_JP2K
++ (strcmp(lowsuf,"jpc" )==0) ||
++ (strcmp(lowsuf,"jp2" )==0) ||
++#endif
++#ifdef HAVE_TIFF
+ (strcmp(lowsuf,"tif" )==0) ||
+- (strcmp(lowsuf,"tiff")==0)) {
++ (strcmp(lowsuf,"tiff")==0) ||
++#endif
++#ifdef HAVE_PNG
++ (strcmp(lowsuf,"png" )==0) ||
++#endif
++ (strcmp(lowsuf,"wbmp")==0) ||
++ (strcmp(lowsuf,"xpm" )==0) ||
++ (strcmp(lowsuf,"tiff")==0) ||
++ (strcmp(lowsuf,"mag" )==0) ||
++ (strcmp(lowsuf,"pic" )==0) ||
++ (strcmp(lowsuf,"mki" )==0) ||
++ (strcmp(lowsuf,"pi" )==0) ||
++ (strcmp(lowsuf,"p2" )==0) ||
++ (strcmp(lowsuf,"pcd" )==0)) {
+
+ /* found one. set lowsuf = to the new suffix, and tack on to filename */
+
+@@ -1401,7 +1599,7 @@
case F_GIF: strcpy(lowsuf,"gif"); break;
case F_PM: strcpy(lowsuf,"pm"); break;
case F_PBMRAW:
@@ -12350,9 +19641,53 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
strcpy(lowsuf,"ppm");
else if (col == F_GREYSCALE) strcpy(lowsuf,"pgm");
else if (col == F_BWDITHER) strcpy(lowsuf,"pbm");
-@@ -1426,10 +1435,10 @@
+@@ -1410,6 +1608,7 @@
+ case F_XBM: strcpy(lowsuf,"xbm"); break;
+ case F_SUNRAS: strcpy(lowsuf,"ras"); break;
+ case F_BMP: strcpy(lowsuf,"bmp"); break;
++ case F_WBMP: strcpy(lowsuf,"wbmp"); break;
+ case F_PS: strcpy(lowsuf,"ps"); break;
+ case F_IRIS: strcpy(lowsuf,"rgb"); break;
+ case F_TARGA: strcpy(lowsuf,"tga"); break;
+@@ -1420,16 +1619,46 @@
+ case F_JPEG: strcpy(lowsuf,"jpg"); break;
+ #endif
+
++#ifdef HAVE_JP2K
++ case F_JPC: strcpy(lowsuf,"jpc"); break;
++ case F_JP2: strcpy(lowsuf,"jp2"); break;
++#endif
++
+ #ifdef HAVE_TIFF
+ case F_TIFF: strcpy(lowsuf,"tif"); break;
+ #endif
++
++#ifdef HAVE_PNG
++ case F_PNG: strcpy(lowsuf,"png"); break;
++#endif
++
++#ifdef HAVE_MAG
++ case F_MAG: strcpy(lowsuf,"mag"); break;
++#endif
++
++#ifdef HAVE_PIC
++ case F_PIC: strcpy(lowsuf,"pic"); break;
++#endif
++
++#ifdef HAVE_MAKI
++ case F_MAKI: strcpy(lowsuf,"mki"); break;
++#endif
++
++#ifdef HAVE_PI
++ case F_PI: strcpy(lowsuf,"pi"); break;
++#endif
++
++#ifdef HAVE_PIC2
++ case F_PIC2: strcpy(lowsuf,"p2"); break;
++#endif
}
++
if (allcaps) { /* upper-caseify lowsuf */
- for (sp=lowsuf; *sp; sp++)
+ for (sp=lowsuf; *sp; sp++)
@@ -12363,7 +19698,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/* one other case: if the original suffix started with a single
capital letter, make the new suffix start with a single cap */
if (isupper(suffix[0])) lowsuf[0] = toupper(lowsuf[0]);
-@@ -1439,7 +1448,7 @@
+@@ -1439,7 +1668,7 @@
}
}
@@ -12372,7 +19707,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/***************************************************/
int DirCheckCD()
-@@ -1462,7 +1471,7 @@
+@@ -1462,7 +1691,7 @@
static int FNameCdable()
{
/* returns '1' if filename is a directory, and goes there */
@@ -12381,7 +19716,19 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
char newpath[1024];
struct stat st;
int retval = 0;
-@@ -1518,7 +1527,7 @@
+@@ -1490,6 +1719,11 @@
+ }
+ #endif
+
++#ifdef AUTO_EXPAND
++ Mkvdir(newpath);
++ Dirtovd(newpath);
++#endif
++
+ if (stat(newpath, &st)==0) {
+ int isdir;
+
+@@ -1518,7 +1752,7 @@
retval = 1;
}
}
@@ -12390,16 +19737,24 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
return retval;
}
-@@ -1550,7 +1559,7 @@
+@@ -1549,8 +1783,8 @@
+ *up='\0';
if (*uname=='\0') { /* no name. substitute ~ with $HOME */
- char *homedir;
+- char *homedir;
- homedir = (char *) getenv("HOME");
-+ homedir = (char *) getenv("HOME");
++ const char *homedir;
++ homedir = (const char *) getenv("HOME");
if (homedir == NULL) homedir = ".";
strcpy(tmp,homedir);
strcat(tmp,sp);
-@@ -1579,7 +1588,7 @@
+@@ -1574,12 +1808,12 @@
+
+ /***************************************/
+ FILE *OpenOutFile(filename)
+- char *filename;
++ const char *filename;
+ {
/* opens file for output. does various error handling bits. Returns
an open file pointer if success, NULL if failure */
@@ -12408,7 +19763,19 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
struct stat st;
if (!filename || filename[0] == '\0') return NULL;
-@@ -1596,23 +1605,34 @@
+@@ -1587,7 +1821,11 @@
+ dopipe = 0;
+
+ /* make sure we're in the correct directory */
++#ifdef AUTO_EXPAND
++ if (strlen(path)) Chvdir(path);
++#else
+ if (strlen(path)) chdir(path);
++#endif
+
+ if (ISPIPE(filename[0])) { /* do piping */
+ /* make up some bogus temp file to put this in */
+@@ -1596,23 +1834,34 @@
#else
strcpy(outFName, "[]xvXXXXXX.lis");
#endif
@@ -12430,15 +19797,15 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
+#endif
+ /* see if file exists (i.e., we're overwriting) */
+ if (stat(outFName, &st)==0) { /* stat succeeded, file must exist */
-+ static char *foo[] = { "\nOk", "\033Cancel" };
-+ char str[512];
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char str[512];
- sprintf(str,"Overwrite existing file '%s'?", outFName);
- if (PopUp(str, foo, 2)) return NULL;
- }
-
+ sprintf(str,"Overwrite existing file '%s'?", outFName);
-+ if (PopUp(str, foo, 2)) return NULL;
++ if (PopUp(str, labels, 2)) return NULL;
+ }
+
+
@@ -12453,7 +19820,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
if (!fp) {
char str[512];
sprintf(str,"Can't write file '%s'\n\n %s.",outFName, ERRSTR(errno));
-@@ -1622,7 +1642,7 @@
+@@ -1622,12 +1871,12 @@
return fp;
}
@@ -12462,7 +19829,13 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/***************************************/
int CloseOutFile(fp, filename, failed)
-@@ -1642,9 +1662,8 @@
+ FILE *fp;
+- char *filename;
++ const char *filename;
+ int failed;
+ {
+ char buf[64];
+@@ -1642,9 +1891,8 @@
return 1;
}
@@ -12473,7 +19846,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
char str[512];
sprintf(str,"Can't close file '%s'\n\n %s.",outFName, ERRSTR(errno));
ErrPopUp(str, "\nWeird!");
-@@ -1666,7 +1685,7 @@
+@@ -1666,7 +1914,7 @@
}
SetISTR(ISTR_INFO,"Successfully wrote '%s'%s", outFName, buf);
@@ -12482,7 +19855,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
if (dopipe) {
char cmd[512], str[1024];
int i;
-@@ -1709,7 +1728,7 @@
+@@ -1709,7 +1957,7 @@
return 0;
}
@@ -12491,7 +19864,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
static byte rBW[2], gBW[2], bBW[2];
-@@ -1732,7 +1751,7 @@
+@@ -1732,7 +1980,7 @@
bwpic = (byte *) NULL;
*nc = numcols; *rpp = rMap; *gpp = gMap; *bpp = bMap;
@@ -12500,7 +19873,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
complicated 'reduced'/dithered/smoothed business comes into play.
'reduced' is disabled, for semi-obvious reasons, in 24-bit mode,
as is 'dithered'. If 'smoothed', and we're saving at current
-@@ -1744,32 +1763,32 @@
+@@ -1744,32 +1992,32 @@
if we're saving B/W DITHERED, and deal accordingly */
@@ -12541,7 +19914,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/* ptype == PIC8 ... */
-@@ -1777,7 +1796,7 @@
+@@ -1777,7 +2025,7 @@
*nc = numcols; *rpp = rMap; *gpp = gMap; *bpp = bMap;
if (color==F_REDUCED) { *rpp = rdisp; *gpp = gdisp; *bpp = bdisp; }
@@ -12550,7 +19923,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
make color=REDUCED, so it will be written with the correct colortable */
if ((epicMode == EM_DITH || epicMode == EM_SMOOTH) && color != F_REDUCED) {
-@@ -1789,7 +1808,7 @@
+@@ -1789,7 +2037,7 @@
*rpp = gray; *gpp = gray; *bpp = gray;
}
}
@@ -12559,7 +19932,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
-@@ -1823,8 +1842,8 @@
+@@ -1823,8 +2071,8 @@
* and whether or not it should be freed when we're done with it. The 'pic'
* returned is the desired portion of 'cpic' or 'epic' if there is a
* selection, and the saveselCB is enabled, or alternately, it's the
@@ -12570,7 +19943,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
* if selection does not intersect cpic/epic, returns cpic/epic
* NEVER RETURNS NULL
*/
-@@ -1837,7 +1856,7 @@
+@@ -1837,7 +2085,7 @@
if (savenormCB.val) { thepic = cpic; pw = cWIDE; ph = cHIGH; }
else { thepic = epic; pw = eWIDE; ph = eHIGH; }
@@ -12579,7 +19952,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
if (saveselCB.active && saveselCB.val && HaveSelection()) {
-@@ -1862,7 +1881,7 @@
+@@ -1862,7 +2110,7 @@
CoordP2E(x2,y2, &x2, &y2);
slx = x1; sly = y1; slw = x2-x1; slh = y2-y1;
CropRect2Rect(&slx, &sly, &slw, &slh, 0,0,pw,ph);
@@ -12588,7 +19961,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
if (slw<1 || slh<1) { slx = sly = 0; slw=pw; slh=ph; }
if (slx!=0 || sly!=0 || slw!=pw || slh!=ph) {
-@@ -1871,7 +1890,7 @@
+@@ -1871,7 +2119,7 @@
}
}
@@ -12597,7 +19970,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
}
return thepic;
-@@ -1884,11 +1903,11 @@
+@@ -1884,11 +2132,11 @@
byte **rmapP, **gmapP, **bmapP;
{
/* handles the whole ugly mess of the various save options.
@@ -12611,7 +19984,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
*/
byte *pic1, *pic2;
-@@ -1896,9 +1915,9 @@
+@@ -1896,9 +2144,9 @@
pic1 = handleNormSel(&ptype, &w, &h, &pfree);
@@ -12623,7 +19996,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
if (pfree) free(pic1);
pic1 = pic2;
pfree = 1;
-@@ -1906,7 +1925,7 @@
+@@ -1906,7 +2154,7 @@
}
@@ -12632,7 +20005,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
pic2 = GammifyPic24(pic1, w, h);
if (pic2) {
if (pfree) free(pic1);
-@@ -1920,7 +1939,7 @@
+@@ -1920,7 +2168,7 @@
return pic1;
}
@@ -12641,7 +20014,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
/***************************************/
void GetSaveSize(wP, hP)
int *wP, *hP;
-@@ -1947,7 +1966,7 @@
+@@ -1947,7 +2195,7 @@
CoordP2E(x2,y2, &x2, &y2);
slx = x1; sly = y1; slw = x2-x1; slh = y2-y1;
CropRect2Rect(&slx, &sly, &slw, &slh, 0,0,eWIDE,eHIGH);
@@ -12650,16 +20023,18 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
if (slw<1 || slh<1) { slx = sly = 0; slw=eWIDE; slh=eHIGH; }
}
}
-@@ -1982,7 +2001,7 @@
+@@ -1982,8 +2230,8 @@
if (stat(namelist[curname], &origStat)==0) {
haveStat = 1;
- if (DEBUG) fprintf(stderr," origStat.size=%ld, origStat.mtime=%d\n",
+- origStat.st_size, origStat.st_mtime);
+ if (DEBUG) fprintf(stderr," origStat.size=%ld, origStat.mtime=%ld\n",
- origStat.st_size, origStat.st_mtime);
++ (long)origStat.st_size, (long)origStat.st_mtime);
}
}
-@@ -1993,7 +2012,7 @@
+ }
+@@ -1993,7 +2241,7 @@
int CheckPoll(del)
int del;
{
@@ -12668,13 +20043,14 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
A) the file has stabilized (st = lastStat), or
B) 'del' seconds have gone by since the file last changed size
*/
-@@ -2007,14 +2026,14 @@
+@@ -2007,14 +2255,14 @@
(strcmp(namelist[curname], STDINSTR)!=0)) {
if (stat(namelist[curname], &st)==0) {
- if (DEBUG) fprintf(stderr," st.size=%ld, st.mtime=%d\n",
+- st.st_size, st.st_mtime);
+ if (DEBUG) fprintf(stderr," st.size=%ld, st.mtime=%ld\n",
- st.st_size, st.st_mtime);
++ (long)st.st_size, (long)st.st_mtime);
if ((st.st_size == origStat.st_size) &&
(st.st_mtime == origStat.st_mtime)) return 0; /* no change */
@@ -12685,7 +20061,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
st.st_size != lastStat.st_size ||
st.st_mtime != lastStat.st_mtime) {
xvbcopy((char *) &st, (char *) &lastStat, sizeof(struct stat));
-@@ -2031,7 +2050,7 @@
+@@ -2031,7 +2279,7 @@
}
}
}
@@ -12694,7 +20070,7 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
return 0;
}
-@@ -2042,14 +2061,13 @@
+@@ -2042,14 +2290,13 @@
{
/* called when file 'name' has been deleted. If any of the browsers
were showing the directory that the file was in, does a rescan() */
@@ -12704,26 +20080,253 @@ diff -ruN xv-3.10a/xvdir.c xv-3.10a-bugfixes/xvdir.c
char buf[MAXPATHLEN + 2], *tmp;
strcpy(buf, name);
- tmp = BaseName(buf);
+- tmp = BaseName(buf);
++ tmp = (char *) BaseName(buf); /* intentionally losing constness */
*tmp = '\0'; /* truncate after last '/' */
-
+
if (strcmp(path, buf)==0) LoadCurrentDirectory();
}
-diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
+@@ -2062,3 +2309,164 @@
+ }
+
+
++#ifdef HAVE_PIC2
++/**** Stuff for PIC2Dialog box ****/
++FILE *pic2_OpenOutFile(filename, append)
++char *filename;
++int *append;
++{
++ /* opens file for output. does various error handling bits. Returns
++ an open file pointer if success, NULL if failure */
++
++ FILE *fp = NULL;
++ struct stat st;
++
++ if (!filename || filename[0] == '\0')
++ return (NULL);
++ strcpy(outFName, filename);
++ dopipe = 0;
++
++ /* make sure we're in the correct directory */
++#ifdef AUTO_EXPAND
++ if (strlen(path)) Chvdir(path);
++#else
++ if (strlen(path)) chdir(path);
++#endif
++
++ if (ISPIPE(filename[0])) { /* do piping */
++ /* make up some bogus temp file to put this in */
++#ifndef VMS
++ sprintf(outFName, "%s/xvXXXXXX", tmpdir);
++#else
++ strcpy(outFName, "[]xvXXXXXX.lis");
++#endif
++#ifdef USE_MKSTEMP
++ fp = fdopen(mkstemp(outFName), "w");
++#else
++ mktemp(outFName);
++#endif
++ dopipe = 1;
++ }
++
++
++ /* see if file exists (i.e., we're overwriting) */
++ *append = 0;
++#ifdef USE_MKSTEMP
++ if (!dopipe)
++#endif
++ if (stat(outFName, &st)==0) { /* stat succeeded, file must exist */
++ if (ReadFileType(outFName) != RFT_PIC2) {
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char str[512];
++
++ sprintf(str,"Overwrite existing file '%s'?", outFName);
++ if (PopUp(str, labels, 2))
++ return (NULL);
++ } else {
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char str[512];
++
++ sprintf(str,"Append to existing file '%s'?", outFName);
++ if (PopUp(str, labels, 2)) {
++ sprintf(str,"Overwrite existing file '%s'?", outFName);
++ if (PopUp(str, labels, 2))
++ return (NULL);
++ } else
++ *append = 1;
++ }
++ }
++
++ /* Open file */
++#ifdef USE_MKSTEMP
++ if (!dopipe)
++#endif
++ fp = *append ? fopen(outFName, "r+") : fopen(outFName, "w");
++ if (!fp) {
++ char str[512];
++ sprintf(str,"Can't write file '%s'\n\n %s.",outFName, ERRSTR(errno));
++ ErrPopUp(str, "\nBummer");
++ return (NULL);
++ }
++
++ return (fp);
++}
++
++
++/***************************************/
++void pic2_KillNullFile(fp)
++FILE *fp;
++{
++ fseek(fp, (size_t) 0, SEEK_END);
++ if (ftell(fp) > 0) {
++ fclose(fp);
++ return;
++ } else {
++ fclose(fp);
++ unlink(outFName);
++ return;
++ }
++}
++#endif /* HAVE_PIC2 */
++
++
++#ifdef HAVE_MGCSFX
++/**** Stuff for MGCSFX Dialog box ****/
++/***************************************/
++int OpenOutFileDesc(filename)
++ char *filename;
++{
++ /* opens file for output. does various error handling bits. Returns
++ an open file pointer if success, NULL if failure */
++
++ int fd;
++ struct stat st;
++
++ if (!filename || filename[0] == '\0') return -1;
++ strcpy(outFName, filename);
++ dopipe = 0;
++
++ /* make sure we're in the correct directory */
++#ifdef AUTO_EXPAND
++ if (strlen(path)) Chvdir(path);
++#else
++ if (strlen(path)) chdir(path);
++#endif
++
++ if (ISPIPE(filename[0])) { /* do piping */
++ /* make up some bogus temp file to put this in */
++#ifndef VMS
++ sprintf(outFName, "%s/xvXXXXXX", tmpdir);
++#else
++ strcpy(outFName, "[]xvXXXXXX.lis");
++#endif
++#ifdef USE_MKSTEMP
++ close(mkstemp(outFName));
++#else
++ mktemp(outFName);
++#endif
++ dopipe = 1;
++ }
++
++
++ /* if didn't just create it, see if file exists (i.e., we're overwriting) */
++ if (!dopipe && stat(outFName, &st)==0) { /* stat succeeded, file exists */
++ static const char *labels[] = { "\nOk", "\033Cancel" };
++ char str[512];
++
++ sprintf(str,"Overwrite existing file '%s'?", outFName);
++ if (PopUp(str, labels, 2)) return -1;
++ }
++
++
++ /* Open file */
++ fd = open(outFName, O_WRONLY | O_CREAT | O_TRUNC, (0644));
++ if (fd < 0) {
++ char str[512];
++ sprintf(str,"Can't write file '%s'\n\n %s.", outFName, ERRSTR(errno));
++ ErrPopUp(str, "\nBummer");
++ return -1;
++ }
++
++ return fd;
++}
++#endif /* HAVE_MGCSFX */
+diff -ru xv-3.10a/xvevent.c xv-3.10a-enhancements/xvevent.c
--- xv-3.10a/xvevent.c 1995-01-23 15:20:24.000000000 -0800
-+++ xv-3.10a-bugfixes/xvevent.c 2004-05-16 18:02:03.000000000 -0700
-@@ -101,15 +101,15 @@
++++ xv-3.10a-enhancements/xvevent.c 2007-05-12 15:27:11.000000000 -0700
+@@ -39,8 +39,15 @@
+ static Cursor dropper = 0, pen = 0, blur = 0;
+
+
++static void SelectDispMB PARM((int));
++static void Select24to8MB PARM((int));
++static void SelectRootMB PARM((int));
++static void SelectWindowMB PARM((int));
++static void SelectSizeMB PARM((int));
++
++static void DoPrint PARM((void));
+ static void debugEvent PARM((XEvent *));
+-static char *win2name PARM((Window));
++static const char *win2name PARM((Window));
+ static void handleButtonEvent PARM((XEvent *, int *, int *));
+ static void handleKeyEvent PARM((XEvent *, int *, int *));
+ static void zoomCurs PARM((u_int));
+@@ -64,6 +71,8 @@
+
+ static void annotatePic PARM((void));
+
++static int debkludge_offx;
++static int debkludge_offy;
+
+ /****************/
+ int EventLoop()
+@@ -71,13 +80,25 @@
+ {
+ XEvent event;
+ int retval,done,waiting;
+- time_t orgtime, curtime;
++#ifdef USE_TICKS
++ clock_t waitsec_ticks=0L, orgtime_ticks=0L, curtime_ticks;
++ clock_t elapsed_ticks=0L, remaining_interval;
++#else
++ time_t orgtime=0L, curtime;
++#endif
+
+
+ #ifndef NOSIGNAL
+ signal(SIGQUIT, onInterrupt);
+ #endif
+
++ if (startGrab == 1) {
++ startGrab = 2;
++ FakeButtonPress(&but[BGRAB]);
++ FakeKeyPress(ctrlW, XK_Return);
++ return(1);
++ }
++
+ /* note: there's no special event handling if we're using the root window.
+ if we're using the root window, we will recieve NO events for mainW */
+
+@@ -100,18 +121,24 @@
+
while (!done) {
- if (waitsec > -1 && canstartwait && !waiting && XPending(theDisp)==0) {
+- if (waitsec > -1 && canstartwait && !waiting && XPending(theDisp)==0) {
- /* we wanna wait, we can wait, we haven't started waiting yet, and
- all pending events (ie, drawing the image the first time)
++ if (waitsec >= 0.0 && canstartwait && !waiting && XPending(theDisp)==0) {
+ /* we wanna wait, we can wait, we haven't started waiting yet, and
+ all pending events (ie, drawing the image the first time)
have been dealt with: START WAITING */
- time((time_t *) &orgtime);
+- time((time_t *) &orgtime);
++#ifdef USE_TICKS
++ waitsec_ticks = (clock_t)(waitsec * CLK_TCK);
++ orgtime_ticks = times(NULL); /* unclear if NULL valid, but OK on Linux */
++#else
++ orgtime = time(NULL);
++#endif
waiting = 1;
}
@@ -12731,9 +20334,91 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
- /* if there's an XEvent pending *or* we're not doing anything
+ /* if there's an XEvent pending *or* we're not doing anything
in real-time (polling, flashing the selection, etc.) get next event */
- if ((waitsec==-1 && !polling && !HaveSelection()) || XPending(theDisp)>0) {
+- if ((waitsec==-1 && !polling && !HaveSelection()) || XPending(theDisp)>0) {
++ if ((waitsec<0.0 && !polling && !HaveSelection()) || XPending(theDisp)>0)
++ {
XNextEvent(theDisp, &event);
-@@ -187,7 +187,7 @@
+ retval = HandleEvent(&event,&done);
+ }
+@@ -121,7 +148,7 @@
+ DrawSelection(0);
+ DrawSelection(1);
+ XFlush(theDisp);
+- Timer(200);
++ Timer(200); /* milliseconds */
+ }
+
+ if (polling) {
+@@ -129,13 +156,32 @@
+ else if (!XPending(theDisp)) sleep(1);
+ }
+
+- if (waitsec>-1 && waiting) {
+- time((time_t *) &curtime);
+- if (curtime - orgtime < waitsec) sleep(1);
+- else {
+- if (waitloop) return NEXTLOOP;
+- else return NEXTQUIT;
+- }
++ if (waitsec>=0.0 && waiting) {
++#ifdef USE_TICKS
++ curtime_ticks = times(NULL); /* value in ticks */
++ if (curtime_ticks < orgtime_ticks) {
++ /* clock ticks rolled over: need to correct for that (i.e.,
++ * curtime_ticks is presumably quite small, while orgtime_ticks
++ * should be close to LONG_MAX, so do math accordingly--any way
++ * to check whether clock_t is *not* a signed long?) */
++ elapsed_ticks = curtime_ticks + (LONG_MAX - orgtime_ticks);
++ } else
++ elapsed_ticks = curtime_ticks - orgtime_ticks;
++ remaining_interval = waitsec_ticks - elapsed_ticks;
++ if (remaining_interval >= (clock_t)(1 * CLK_TCK))
++ sleep(1);
++ else {
++ /* less than one second remaining: do delay in msec, then return */
++ Timer((remaining_interval * 1000L) / CLK_TCK); /* can't overflow */
++ return waitloop? NEXTLOOP : NEXTQUIT;
++ }
++#else
++ curtime = time(NULL); /* value in seconds */
++ if (curtime - orgtime < (time_t)waitsec)
++ sleep(1);
++ else
++ return waitloop? NEXTLOOP : NEXTQUIT;
++#endif
+ }
+ }
+ } /* while (!done) */
+@@ -154,7 +200,27 @@
+ int *donep;
+ {
+ static int wasInfoUp=0, wasCtrlUp=0, wasDirUp=0, wasGamUp=0, wasPsUp=0;
+- static int wasJpegUp=0, wasTiffUp=0;
++#ifdef HAVE_JPEG
++ static int wasJpegUp=0;
++#endif
++#ifdef HAVE_JP2K
++ static int wasJp2kUp=0;
++#endif
++#ifdef HAVE_TIFF
++ static int wasTiffUp=0;
++#endif
++#ifdef HAVE_PNG
++ static int wasPngUp=0;
++#endif
++#ifdef HAVE_PCD
++ static int wasPcdUp=0;
++#endif
++#ifdef HAVE_PIC2
++ static int wasPic2Up=0;
++#endif
++#ifdef HAVE_MGCSFX
++ static int wasMgcSfxUp=0;
++#endif
+
+ static int mainWKludge=0; /* force first mainW expose after a mainW config
+ to redraw all of mainW */
+@@ -187,7 +253,7 @@
#ifdef VMS
static int borders_sized = 0;
@@ -12742,7 +20427,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (!borders_sized && !useroot && exp_event->window == mainW) {
/*
* Initial expose of main window, find the size of the ancestor
-@@ -198,13 +198,13 @@
+@@ -198,13 +264,13 @@
int status, count, mwid, mhgt, x, y, w, h, b, d, mbrd;
Window root, parent, *children, crw = exp_event->window;
borders_sized = 1;
@@ -12759,7 +20444,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
&children, &count );
if ( children != NULL ) XFree ( children );
}
-@@ -221,7 +221,7 @@
+@@ -221,7 +287,7 @@
win = exp_event->window;
x = exp_event->x; y = exp_event->y;
w = exp_event->width; h = exp_event->height;
@@ -12768,7 +20453,42 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (PUCheckEvent (event)) break; /* event has been processed */
if (PSCheckEvent (event)) break; /* event has been processed */
-@@ -238,7 +238,7 @@
+@@ -229,16 +295,42 @@
+ if (JPEGCheckEvent(event)) break; /* event has been processed */
+ #endif
+
++#ifdef HAVE_JP2K
++ if (JP2KCheckEvent(event)) break; /* event has been processed */
++#endif
++
+ #ifdef HAVE_TIFF
+ if (TIFFCheckEvent(event)) break; /* event has been processed */
+ #endif
+
++#ifdef HAVE_PNG
++ if (PNGCheckEvent (event)) break; /* event has been processed */
++#endif
++
++ if (PCDCheckEvent(event)) break; /* event has been processed */
++
++#ifdef HAVE_PIC2
++ if (PIC2CheckEvent(event)) break; /* event has been processed */
++#endif
++
++#ifdef HAVE_PCD
++ if (PCDCheckEvent (event)) break; /* event has been processed */
++#endif
++
++#ifdef HAVE_MGCSFX
++ if (MGCSFXCheckEvent(event)) break; /* event has been processed */
++#endif
++
++#ifdef TV_MULTILINGUAL
++ if (CharsetCheckEvent(event)) break; /* event has been processed */
++#endif
++
+ if (GamCheckEvent (event)) break; /* event has been processed */
+ if (BrowseCheckEvent (event, &retval, &done)) break; /* event eaten */
if (TextCheckEvent (event, &retval, &done)) break; /* event eaten */
/* if the window doesn't do intelligent redraw, drop but last expose */
@@ -12777,7 +20497,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
win != mainW && win != ctrlW && win != dirW && win != infoW) break;
-@@ -301,7 +301,7 @@
+@@ -301,7 +393,7 @@
if (DEBUG) fprintf(stderr,"No configs pending.\n");
/* if (DEBUG) XClearArea(theDisp, mainW, x,y,w,h, False); */
DrawWindow(x,y,w,h);
@@ -12786,7 +20506,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (HaveSelection()) DrawSelection(0);
canstartwait = 1; /* finished drawing */
-@@ -314,7 +314,7 @@
+@@ -314,7 +406,7 @@
else if (win == infoW) RedrawInfo(x,y,w,h);
else if (win == ctrlW) RedrawCtrl(x,y,w,h);
else if (win == dirW) RedrawDirW(x,y,w,h);
@@ -12795,7 +20515,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
XSetClipMask(theDisp, theGC, None);
XDestroyRegion(reg);
}
-@@ -324,10 +324,10 @@
+@@ -324,10 +416,10 @@
else if (win == dList.win) LSRedraw(&dList,0);
else if (win == dList.scrl.win) SCRedraw(&dList.scrl);
else if (win == dnamW) RedrawDNamW();
@@ -12808,27 +20528,78 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
case ClientMessage: {
Atom proto, delwin;
-@@ -382,8 +382,8 @@
+@@ -344,6 +436,9 @@
+
+ if (BrowseDelWin(client_event->window)) break;
+ if (TextDelWin(client_event->window)) break;
++#ifdef TV_MULTILINGUAL
++ if (CharsetDelWin(client_event->window)) break;
++#endif
+
+ if (client_event->window == infoW) InfoBox(0);
+ else if (client_event->window == gamW) GamBox(0);
+@@ -355,10 +450,32 @@
+ else if (client_event->window == jpegW) JPEGDialog(0);
+ #endif
+
++#ifdef HAVE_JP2K
++ else if (client_event->window == jp2kW) JP2KDialog(0);
++#endif
++
+ #ifdef HAVE_TIFF
+ else if (client_event->window == tiffW) TIFFDialog(0);
+ #endif
+
++#ifdef HAVE_PNG
++ else if (client_event->window == pngW) PNGDialog(0);
++#endif
++
++ else if (client_event->window == pcdW) PCDDialog(0);
++
++#ifdef HAVE_PIC2
++ else if (client_event->window == pic2W) PIC2Dialog(0);
++#endif
++
++#ifdef HAVE_PCD
++ else if (client_event->window == pcdW) PCDDialog(0);
++#endif
++
++#ifdef HAVE_MGCSFX
++ else if (client_event->window == mgcsfxW) MGCSFXDialog(0);
++#endif
++
+ else if (client_event->window == mainW) Quit(0);
+ }
+ }
+@@ -381,31 +498,35 @@
+ if (win==ctrlW || win==gamW || win==infoW || win==mainW || win==dirW) {
XSizeHints hints;
++#define BAD_IDEA
++#ifdef BAD_IDEA
/*
- * if there's a virtual window manager running (e.g. tvtwm / olvwm),
- * we're going to get 'cevt' values in terms of the
-+ * if there's a virtual window manager running (e.g. tvtwm / olvwm),
++ * if there is a virtual window manager running (e.g., tvtwm / olvwm),
+ * we're going to get 'cevt' values in terms of the
* 'real' root window (the one that is the size of the screen).
* We'll want to translate them into values that are in terms of
* the 'virtual' root window (the 'big' one)
-@@ -392,7 +392,7 @@
+ */
+
if (vrootW != rootW) {
- int x1,y1; Window child;
+- int x1,y1; Window child;
++ int x1,y1;
++ Window child;
- XTranslateCoordinates(theDisp, rootW, vrootW, cevt->x, cevt->y,
+ XTranslateCoordinates(theDisp, rootW, vrootW, cevt->x, cevt->y,
&x1, &y1, &child);
if (DEBUG) fprintf(stderr," CONFIG trans %d,%d root -> %d,%d vroot\n",
cevt->x, cevt->y, x1, y1);
-@@ -401,11 +401,11 @@
+ cevt->x = x1; cevt->y = y1;
+ }
++#endif
#ifndef VMS
/* read hints for this window and adjust any position hints, but
@@ -12842,7 +20613,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
XGetNormalHints(theDisp, cevt->window, &hints)) {
if (DEBUG) fprintf(stderr," CONFIG got hints (0x%x %d,%d)\n",
-@@ -439,11 +439,11 @@
+@@ -439,11 +560,11 @@
* This sucks!
*
* So, if we have just loaded an image, and we get a Synthetic conf
@@ -12856,7 +20627,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
* ignoring them won't be a big performance problem, and it'll get
* around the 'I only got one config in the wrong size' problem when
* initially displaying small images
-@@ -453,7 +453,7 @@
+@@ -453,7 +574,7 @@
/* fprintf(stderr,"***mainw, ignore=%d, send_event=%d, evtSize=%d,%d, size=%d,%d\n", ignoreConfigs, cevt->send_event, cevt->width, cevt->height, eWIDE, eHIGH); */
@@ -12865,7 +20636,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
(cevt->width != eWIDE || cevt->height != eHIGH)) {
ignoreConfigs=0; /* ignore this one only */
break;
-@@ -470,7 +470,7 @@
+@@ -470,7 +591,7 @@
else {
XEvent xev;
if (DEBUG) fprintf(stderr,"No configs pend.");
@@ -12874,7 +20645,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (cevt->width == eWIDE && cevt->height == eHIGH) {
if (DEBUG) fprintf(stderr,"No redraw\n");
}
-@@ -478,12 +478,12 @@
+@@ -478,12 +599,12 @@
if (DEBUG) fprintf(stderr,"Do full redraw\n");
Resize(cevt->width, cevt->height);
@@ -12889,7 +20660,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
fprintf(stderr," ate expose (%s) (count=%d) %d,%d %dx%d\n",
exp->send_event ? "synth" : "real", exp->count,
exp->x, exp->y, exp->width, exp->height);
-@@ -508,9 +508,9 @@
+@@ -508,9 +629,9 @@
}
break;
@@ -12901,7 +20672,33 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
case CirculateNotify:
case DestroyNotify:
case GravityNotify: break;
-@@ -554,7 +554,7 @@
+@@ -534,10 +655,24 @@
+ #ifdef HAVE_JPEG
+ if (wasJpegUp) { JPEGDialog(wasJpegUp); wasJpegUp=0; }
+ #endif
+-
++#ifdef HAVE_JP2K
++ if (wasJp2kUp) { JP2KDialog(wasJpegUp); wasJp2kUp=0; }
++#endif
+ #ifdef HAVE_TIFF
+ if (wasTiffUp) { TIFFDialog(wasTiffUp); wasTiffUp=0; }
+ #endif
++#ifdef HAVE_PNG
++ if (wasPngUp) { PNGDialog(wasPngUp); wasPngUp=0; }
++#endif
++#ifdef HAVE_PCD
++ if (wasPcdUp) { PCDDialog(wasPcdUp); wasPcdUp=0; }
++#endif
++#ifdef HAVE_PIC2
++ if (wasPic2Up) { PIC2Dialog(wasPic2Up); wasPic2Up=0; }
++#endif
++#ifdef HAVE_MGCSFX
++ if (wasMgcSfxUp) { MGCSFXDialog(wasMgcSfxUp); wasMgcSfxUp=0; }
++#endif
+ }
+ }
+ }
+@@ -554,7 +689,7 @@
/* don't do it if we've just switched to a root mode */
if ((unmap_event->window == mainW && dispMode == 0) ||
@@ -12910,7 +20707,33 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (autoclose) {
if (autoclose>1) autoclose -= 2; /* grab kludge */
-@@ -586,8 +586,8 @@
+@@ -572,10 +707,24 @@
+ #ifdef HAVE_JPEG
+ if (jpegUp) { wasJpegUp = jpegUp; JPEGDialog(0); }
+ #endif
+-
++#ifdef HAVE_JP2K
++ if (jp2kUp) { wasJp2kUp = jp2kUp; JP2KDialog(0); }
++#endif
+ #ifdef HAVE_TIFF
+ if (tiffUp) { wasTiffUp = tiffUp; TIFFDialog(0); }
+ #endif
++#ifdef HAVE_PNG
++ if (pngUp) { wasPngUp = pngUp; PNGDialog(0); }
++#endif
++#ifdef HAVE_PCD
++ if (pcdUp) { wasPcdUp = pcdUp; PCDDialog(0); }
++#endif
++#ifdef HAVE_PIC2
++ if (pic2Up) { wasPic2Up = pic2Up; PIC2Dialog(0); }
++#endif
++#ifdef HAVE_MGCSFX
++ if (mgcsfxUp) { wasMgcSfxUp = mgcsfxUp; MGCSFXDialog(0); }
++#endif
+ }
+ }
+ }
+@@ -586,8 +735,8 @@
XReparentEvent *reparent_event = (XReparentEvent *) event;
if (DEBUG) {
@@ -12921,7 +20744,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
(u_int) reparent_event->event, (u_int) reparent_event->parent);
fprintf(stderr,"%d,%d\n", reparent_event->x, reparent_event->y);
}
-@@ -598,7 +598,7 @@
+@@ -598,7 +747,7 @@
p_offx = p_offy = 0; /* topleft correction for WMs titlebar */
@@ -12930,7 +20753,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
/* looks like the user is running MWM or OLWM */
XWindowAttributes xwa;
-@@ -609,8 +609,8 @@
+@@ -609,8 +758,8 @@
XSync(theDisp, False);
XGetWindowAttributes(theDisp, mainW, &xwa);
@@ -12941,7 +20764,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
fprintf(stderr,"XGetAttr: mainW %d,%d %dx%d\n", xwa.x, xwa.y,
xwa.width, xwa.height);
-@@ -620,8 +620,8 @@
+@@ -620,8 +769,8 @@
XSync(theDisp, False);
XGetWindowAttributes(theDisp, reparent_event->parent, &xwa);
@@ -12952,29 +20775,65 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
fprintf(stderr,"XGetAttr: parent %d,%d %dx%d\n", xwa.x, xwa.y,
xwa.width, xwa.height);
}
-@@ -641,42 +641,42 @@
+@@ -641,42 +790,75 @@
p_offy = xwa.y;
}
-
++ /* Gather info to keep right border inside */
++ {
++ Window current;
++ Window root_r;
++ Window parent_r;
++ Window *children_r;
++ unsigned int nchildren_r;
++ XWindowAttributes xwa;
++
++ parent_r=mainW;
++ current=mainW;
++ do {
++ current=parent_r;
++ XQueryTree(theDisp, current, &root_r, &parent_r,
++ &children_r, &nchildren_r);
++ if (children_r!=NULL) {
++ XFree(children_r);
++ }
++ } while (parent_r!=root_r && parent_r!=vrootW);
++ XGetWindowAttributes(theDisp, current, &xwa);
++ debkludge_offx = eWIDE-xwa.width+p_offx;
++ debkludge_offy = eHIGH-xwa.height+p_offy;
++ }
+
++#if 0
++ /* FIXME: if we want to do this, we first have to wait for a configure
++ * notify to avoid a race condition because the location might be in-
++ * correct if the window manager does placement after managing the window.
++ */
/* move window around a bit... */
{
XWindowAttributes xwa;
++
GetWindowPos(&xwa);
++ //fprintf(stderr, "RAC: orig window pos %d,%d\n", xwa.x, xwa.y);
++
xwa.width = eWIDE; xwa.height = eHIGH;
-
++ //fprintf(stderr, "RAC: image size now %d,%d\n", xwa.width, xwa.height);
+
/* try to keep the damned thing on-screen, if possible */
- if (xwa.x + xwa.width > dispWIDE) xwa.x = dispWIDE - xwa.width;
- if (xwa.y + xwa.height > dispHIGH) xwa.y = dispHIGH - xwa.height;
+- if (xwa.x + xwa.width > dispWIDE) xwa.x = dispWIDE - xwa.width;
+- if (xwa.y + xwa.height > dispHIGH) xwa.y = dispHIGH - xwa.height;
++ if (xwa.x + xwa.width > vrWIDE) xwa.x = vrWIDE - xwa.width;
++ if (xwa.y + xwa.height > vrHIGH) xwa.y = vrHIGH - xwa.height;
if (xwa.x < 0) xwa.x = 0;
if (xwa.y < 0) xwa.y = 0;
-
+
++ //fprintf(stderr, "RAC: moving window to %d,%d\n", xwa.x, xwa.y);
SetWindowPos(&xwa);
}
-
+-
++#endif
}
}
break;
@@ -13002,7 +20861,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
XUninstallColormap(theDisp,LocalCmap);
}
}
-@@ -685,12 +685,12 @@
+@@ -685,12 +867,12 @@
case SelectionClear: break;
@@ -13017,7 +20876,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
xsrevt->selection != XA_PRIMARY ||
xsrevt->target != XA_STRING) { /* can't do it. */
xse.property = None;
-@@ -702,7 +702,7 @@
+@@ -702,7 +884,7 @@
if (xse.property != None) {
xerrcode = 0;
XChangeProperty(theDisp, xsrevt->requestor, xse.property,
@@ -13026,7 +20885,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
(byte *) ((xevPriSel) ? xevPriSel : "\0"),
(int) ((xevPriSel) ? strlen(xevPriSel)+1 : 1));
XSync(theDisp, False);
-@@ -721,9 +721,9 @@
+@@ -721,9 +903,9 @@
XSync(theDisp, False);
}
break;
@@ -13039,7 +20898,12 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
default: break; /* ignore unexpected events */
} /* switch */
-@@ -738,7 +738,7 @@
+@@ -734,11 +916,11 @@
+
+
+ /***********************************/
+-void SelectDispMB(i)
++static void SelectDispMB(i)
int i;
{
/* called to handle selection of a dispMB item */
@@ -13048,7 +20912,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (i<0 || i>=DMB_MAX) return;
if (dispMB.dim[i]) return; /* disabled */
-@@ -747,36 +747,36 @@
+@@ -747,36 +929,36 @@
if (i==DMB_RAW) epicMode = EM_RAW;
else if (i==DMB_DITH) epicMode = EM_DITH;
else epicMode = EM_SMOOTH;
@@ -13098,7 +20962,12 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
break;
}
}
-@@ -788,17 +788,17 @@
+@@ -784,27 +966,27 @@
+
+
+ /***********************************/
+-void SelectRootMB(i)
++static void SelectRootMB(i)
int i;
{
/* called to handle selection of a rootMB item */
@@ -13119,7 +20988,14 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
HandleDispMode();
}
-@@ -818,25 +818,25 @@
+
+ /***********************************/
+-void Select24to8MB(i)
++static void Select24to8MB(i)
+ int i;
+ {
+ if (i<0 || i>=CONV24_MAX) return;
+@@ -818,25 +1000,25 @@
else if (i==CONV24_24BIT && state824==1) {
/* went 24->8->24 */
char buf[512];
@@ -13150,7 +21026,16 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
else if (i>=CONV24_FAST && i<=CONV24_BEST) {
conv24 = i;
for (i=CONV24_FAST; i<=CONV24_BEST; i++) {
-@@ -859,15 +859,15 @@
+@@ -847,7 +1029,7 @@
+
+
+ /***********************************/
+-void SelectWindowMB(i)
++static void SelectWindowMB(i)
+ int i;
+ {
+ if (i<0 || i>=WMB_MAX) return;
+@@ -859,15 +1041,15 @@
else chdir(initdir);
OpenBrowse();
break;
@@ -13170,7 +21055,16 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
case WMB_TEXTVIEW: textViewCmd(); break;
case WMB_ABOUTXV: ShowLicense(); break;
case WMB_KEYHELP: ShowKeyHelp(); break;
-@@ -892,19 +892,19 @@
+@@ -878,7 +1060,7 @@
+
+
+ /***********************************/
+-void SelectSizeMB(i)
++static void SelectSizeMB(i)
+ int i;
+ {
+ int w,h;
+@@ -892,19 +1074,19 @@
double r,wr,hr;
wr = ((double) cWIDE) / maxWIDE;
hr = ((double) cHIGH) / maxHIGH;
@@ -13193,7 +21087,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
{
int w1,h1;
w1 = eWIDE; h1 = eHIGH;
-@@ -925,24 +925,24 @@
+@@ -925,24 +1107,24 @@
if (h==eHIGH) h++;
WResize(w,h);
break;
@@ -13224,7 +21118,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (eWIDE >= cWIDE) {
w = ((double) eWIDE) / cWIDE;
w = floor(w + 0.5);
-@@ -961,7 +961,7 @@
+@@ -961,7 +1143,7 @@
}
w = pick;
}
@@ -13233,7 +21127,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (eHIGH >= cHIGH) {
h = ((double) eHIGH) / cHIGH;
h = floor(h + 0.5);
-@@ -980,11 +980,11 @@
+@@ -980,25 +1162,26 @@
}
h = pick;
}
@@ -13247,16 +21141,27 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
default: break;
}
}
-@@ -998,7 +998,7 @@
- int i;
- char txt[512], str[PRINTCMDLEN + 10];
- static char *labels[] = { " Color", " Grayscale", " B/W", "\033Cancel" };
+
+
+ /***********************************/
+-void DoPrint()
++static void DoPrint()
+ {
+ /* pops open appropriate dialog boxes, issues print command */
+
+- int i;
+- char txt[512], str[PRINTCMDLEN + 10];
+- static char *labels[] = { " Color", " Grayscale", " B/W", "\033Cancel" };
-
++ int i;
++ char txt[512], str[PRINTCMDLEN + 10];
++ static const char *labels[] = { "\03Color", "\07Grayscale", " B/W", "\033Cancel" };
++ /* ^B ("\02") already used for moving cursor back */
+
strcpy(txt, "Print: Enter a command that will read a PostScript file ");
strcat(txt, "from stdin and print it to the desired printer.\n\n");
#ifndef VMS
-@@ -1011,11 +1011,11 @@
+@@ -1011,11 +1194,11 @@
if (i == 3 || strlen(printCmd)==0) return; /* CANCEL */
if (dirUp == BLOAD) DirBox(0);
@@ -13270,7 +21175,12 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
sprintf(str, "| %s", printCmd);
else strcpy(str, printCmd);
-@@ -1090,7 +1090,7 @@
+@@ -1086,11 +1269,11 @@
+ }
+ }
+
+-static char *win2name(win)
++static const char *win2name(win)
Window win;
{
static char foo[16];
@@ -13279,7 +21189,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (win == mainW) return "mainW";
else if (win == rootW) return "rootW";
else if (win == vrootW) return "vrootW";
-@@ -1106,7 +1106,7 @@
+@@ -1106,7 +1289,7 @@
}
}
@@ -13288,7 +21198,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
/***********************************/
static void handleButtonEvent(event, donep, retvalp)
XEvent *event;
-@@ -1127,38 +1127,36 @@
+@@ -1127,38 +1310,60 @@
case ButtonPress:
/* *always* check for pop-up events, as errors can happen... */
if (PUCheckEvent (event)) break;
@@ -13314,11 +21224,35 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
#endif
-
+
++#ifdef HAVE_JP2K
++ if (JP2KCheckEvent(event)) break;
++#endif
++
#ifdef HAVE_TIFF
if (TIFFCheckEvent(event)) break;
#endif
-
+
++#ifdef HAVE_PNG
++ if (PNGCheckEvent (event)) break;
++#endif
++
++#ifdef HAVE_PCD
++ if (PCDCheckEvent (event)) break; /* event has been processed */
++#endif
++
++#ifdef HAVE_PIC2
++ if (PIC2CheckEvent(event)) break;
++#endif
++
++#ifdef HAVE_MGCSFX
++ if (MGCSFXCheckEvent(event)) break;
++#endif
++
++#ifdef TV_MULTILINGUAL
++ if (CharsetCheckEvent(event)) break;
++#endif
++
if (GamCheckEvent (event)) break;
if (BrowseCheckEvent (event, &retval, &done)) break;
if (TextCheckEvent (event, &retval, &done)) break;
@@ -13338,7 +21272,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (MBClick(&dispMB, x,y)) SelectDispMB (MBTrack(&dispMB) );
else if (MBClick(&conv24MB, x,y)) Select24to8MB (MBTrack(&conv24MB));
else if (MBClick(&rootMB, x,y)) SelectRootMB (MBTrack(&rootMB) );
-@@ -1170,9 +1168,9 @@
+@@ -1170,9 +1375,9 @@
if (i>=0) DoAlg(i);
break;
}
@@ -13350,7 +21284,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
switch (i) {
case BNEXT: retval= NEXTPIC; done=1; break;
case BPREV: retval= PREVPIC; done=1; break;
-@@ -1192,21 +1190,21 @@
+@@ -1192,21 +1397,21 @@
case BROTR: Rotate(0); break;
case BFLIPH: Flip(0); break;
case BFLIPV: Flip(1); break;
@@ -13378,7 +21312,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
break;
case BANNOT: annotatePic(); break;
-@@ -1214,27 +1212,27 @@
+@@ -1214,85 +1419,127 @@
case BABOUT: SelectWindowMB(WMB_ABOUTXV); break;
case BXV: retval = DFLTPIC; done=1; break;
case BQUIT: retval = QUIT; done=1; break;
@@ -13411,10 +21345,21 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
+
switch (i) {
case S_BOK: if (dirUp == BLOAD) {
- if (!DirCheckCD()) {
-@@ -1246,53 +1244,53 @@
- DoSave();
- }
+- if (!DirCheckCD()) {
+- retval = LOADPIC;
+- done=1;
++ if (!DirCheckCD()) {
++ retval = LOADPIC;
++ done=1;
++ }
++ }
++ else if (dirUp == BSAVE) {
++ DoSave();
+ }
+- }
+- else if (dirUp == BSAVE) {
+- DoSave();
+- }
break;
-
+
@@ -13459,6 +21404,48 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
break;
-
+
++ case Button4: /* note min vs. max, + vs. - */
++ if (win == ctrlW || win == nList.win || win == nList.scrl.win) {
++ SCRL *sp=&nList.scrl;
++ int halfpage=sp->page/2;
++
++ if (sp->val > sp->min+halfpage)
++ SCSetVal(sp,sp->val-halfpage);
++ else
++ SCSetVal(sp,sp->min);
++ }
++ else if (win == dirW || win == dList.win || win == dList.scrl.win) {
++ SCRL *sp=&dList.scrl;
++ int halfpage=sp->page/2;
++
++ if (sp->val > sp->min+halfpage)
++ SCSetVal(sp,sp->val-halfpage);
++ else
++ SCSetVal(sp,sp->min);
++ }
++ break;
++
++ case Button5: /* note max vs. min, - vs. + */
++ if (win == ctrlW || win == nList.win || win == nList.scrl.win) {
++ SCRL *sp=&nList.scrl;
++ int halfpage=sp->page/2;
++
++ if (sp->val < sp->max-halfpage)
++ SCSetVal(sp,sp->val+halfpage);
++ else
++ SCSetVal(sp,sp->max);
++ }
++ else if (win == dirW || win == dList.win || win == dList.scrl.win) {
++ SCRL *sp=&dList.scrl;
++ int halfpage=sp->page/2;
++
++ if (sp->val < sp->max-halfpage)
++ SCSetVal(sp,sp->val+halfpage);
++ else
++ SCSetVal(sp,sp->max);
++ }
++ break;
++
default: break;
}
}
@@ -13480,7 +21467,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
XKeyEvent *key_event;
KeySym ks;
char buf[128];
-@@ -1306,26 +1304,26 @@
+@@ -1306,26 +1553,26 @@
switch (event->type) {
case KeyRelease:
if (viewonly) break; /* ignore all user input */
@@ -13514,7 +21501,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
case KeyPress:
svkeystate = key_event->state;
-@@ -1343,11 +1341,11 @@
+@@ -1343,11 +1590,11 @@
if (PUCheckEvent (event)) break; /* always check popups */
if (autoquit && key_event->window == mainW) Quit(0);
@@ -13529,16 +21516,55 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (key_event->window == mainW) {
u_int foo = key_event->state;
-@@ -1371,7 +1369,7 @@
+@@ -1362,20 +1609,43 @@
+ if (JPEGCheckEvent(event)) break;
+ #endif
+
++#ifdef HAVE_JP2K
++ if (JP2KCheckEvent(event)) break;
++#endif
++
+ #ifdef HAVE_TIFF
+ if (TIFFCheckEvent(event)) break;
+ #endif
+
++#ifdef HAVE_PNG
++ if (PNGCheckEvent (event)) break;
++#endif
++
++ if (PCDCheckEvent (event)) break;
++
++#ifdef HAVE_PIC2
++ if (PIC2CheckEvent(event)) break;
++#endif
++
++#ifdef HAVE_PCD
++ if (PCDCheckEvent (event)) break;
++#endif
++
++#ifdef HAVE_MGCSFX
++ if (MGCSFXCheckEvent(event)) break;
++#endif
++
+ if (GamCheckEvent (event)) break;
+ if (BrowseCheckEvent (event, &retval, &done)) break;
if (TextCheckEvent (event, &retval, &done)) break;
- /* check for pageup/pagedown, 'p' in main window
-+ /* check for pageup/pagedown, 'p' in main window
- (you can use shift-up or shift-down if no crop rectangle drawn)
- (for viewing multipage docs) */
-
-@@ -1386,7 +1384,7 @@
+- (you can use shift-up or shift-down if no crop rectangle drawn)
+- (for viewing multipage docs) */
++ /* Support for multi-image files ("multipage docs"). Check for PgUp/PgDn
++ or 'p' in any window but control or directory; PgUp/PgDn are already
++ used to page through the file list in those windows. If no cropping
++ rectangle is active, shift-Up and shift-Down also work. */
+
+- if (key_event->window == mainW) {
++ if (key_event->window != ctrlW && key_event->window != dirW) {
+ dealt = 1;
+
+ ck = CursorKey(ks, shift, 0);
+@@ -1386,7 +1656,7 @@
else XBell(theDisp,0);
}
@@ -13547,7 +21573,20 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
(ck==CK_DOWN && shift && !but[BCROP].active)) {
if (strlen(pageBaseName) && numPages>1) {
done = 1; retval = OP_PAGEDN;
-@@ -1429,7 +1427,7 @@
+@@ -1396,9 +1666,9 @@
+
+ else if (buf[0] == 'p' && stlen>0) {
+ if (strlen(pageBaseName) && numPages>1) {
+- int i,j, okay;
+- char buf[64], txt[512];
+- static char *labels[] = { "\nOk", "\033Cancel" };
++ int i,j, okay;
++ char buf[64], txt[512];
++ static const char *labels[] = { "\nOk", "\033Cancel" };
+
+ /* ask what page to go to */
+ sprintf(txt, "Go to page number... (1-%d)", numPages);
+@@ -1429,7 +1699,7 @@
if (dealt) break;
}
@@ -13556,7 +21595,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
/* check for crop rect keys */
-@@ -1468,7 +1466,7 @@
+@@ -1468,15 +1738,17 @@
if (theList == &dList && dealt) { /* changed dir selection */
SelectDir(-1); /* nothing was double-clicked */
}
@@ -13565,7 +21604,20 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (dealt) break;
}
-@@ -1491,7 +1489,7 @@
+
+ /* check dir filename arrows */
+- ck = CursorKey(ks, shift, 1);
+- if (key_event->window == dirW && ck==CK_LEFT) { DirKey('\002'); break; }
+- if (key_event->window == dirW && ck==CK_RIGHT) { DirKey('\006'); break; }
++ if (key_event->window == dirW) {
++ ck = CursorKey(ks, shift, 1);
++ if (ck==CK_LEFT) { DirKey('\002'); break; }
++ if (ck==CK_RIGHT) { DirKey('\006'); break; }
++ }
+
+
+ /* check for preset keys (meta-1, meta-2, meta-3, meta-4, meta-0)
+@@ -1491,7 +1763,7 @@
else if (ks==XK_2) FakeButtonPress(&gbut[G_B2]);
else if (ks==XK_3) FakeButtonPress(&gbut[G_B3]);
else if (ks==XK_4) FakeButtonPress(&gbut[G_B4]);
@@ -13574,7 +21626,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
FakeButtonPress(&gbut[G_BRESET]);
else if (ks==XK_x) FakeButtonPress(&but[BCUT]);
-@@ -1521,7 +1519,7 @@
+@@ -1521,7 +1793,7 @@
else if (ks==XK_a) FakeButtonPress(&gbut[G_BAPPLY]);
@@ -13583,12 +21635,39 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (picType==PIC8) Select24to8MB(CONV24_24BIT);
else Select24to8MB(CONV24_8BIT);
}
-@@ -1530,20 +1528,20 @@
+@@ -1530,20 +1802,47 @@
if (dealt) break;
}
-
+
++ /* Check for function keys */
++ if (key_event->window == ctrlW || key_event->window == mainW) {
++ if (ks >= XK_F1 && ks <= XK_F1 + FSTRMAX - 1) {
++ int fkey = ks - XK_F1;
++ if (fkeycmds[fkey] && fullfname[0]) {
++#define CMDLEN 4096
++ char cmd[CMDLEN];
++ /* If a command begins with '@', we do not reload the current file */
++ int noreload = (fkeycmds[fkey][0] == '@');
++ int x = 0, y = 0, w = 0, h = 0;
++ if (HaveSelection())
++ GetSelRCoords(&x, &y, &w, &h);
++ snprintf(cmd, CMDLEN, fkeycmds[fkey] + noreload, fullfname, x, y, w, h);
++#undef CMDLEN
++ if (DEBUG) fprintf(stderr, "Executing '%s'\n", cmd);
++ WaitCursor();
++ system(cmd);
++ SetCursors(-1);
++ if (!noreload) {
++ retval = RELOAD;
++ done = 1;
++ }
++ break;
++ }
++ }
++ }
++
if (!stlen) break;
-
+
@@ -13608,7 +21687,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
/* things in sizeMB */
case 'n': SelectSizeMB(SZMB_NORM); break;
case 'm': SelectSizeMB(SZMB_MAXPIC); break;
-@@ -1556,7 +1554,7 @@
+@@ -1556,7 +1855,7 @@
case 'a': SelectSizeMB(SZMB_ASPECT); break;
case '4': SelectSizeMB(SZMB_4BY3); break;
case 'I': SelectSizeMB(SZMB_INTEXP); break;
@@ -13617,7 +21696,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
/* things in windowMB */
case '\026':
case 'V': SelectWindowMB(WMB_BROWSE); break; /* ^V or V */
-@@ -1565,36 +1563,36 @@
+@@ -1565,36 +1864,36 @@
case '\003': SelectWindowMB(WMB_COMMENT); break; /* ^C */
case '\024': SelectWindowMB(WMB_TEXTVIEW); break; /* ^T */
case '\001': SelectWindowMB(WMB_ABOUTXV); break; /* ^A */
@@ -13641,16 +21720,18 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
}
break;
-
-+
- case '\010':
- case '\177': FakeButtonPress(&but[BPREV]); break;
+- case '\010':
+- case '\177': FakeButtonPress(&but[BPREV]); break;
-
-
+
++ case '\010': FakeButtonPress(&but[BPREV]); break;
++
+
case '\014': FakeButtonPress(&but[BLOAD]); break; /* ^L */
case '\023': FakeButtonPress(&but[BSAVE]); break; /* ^S */
case '\020': FakeButtonPress(&but[BPRINT]); break; /* ^P */
++ case '\177':
case '\004': FakeButtonPress(&but[BDELETE]); break; /* ^D */
-
+
@@ -13666,7 +21747,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
case 'T': FakeButtonPress(&but[BROTL]); break;
case 't': FakeButtonPress(&but[BROTR]); break;
case 'h': FakeButtonPress(&but[BFLIPH]); break;
-@@ -1604,24 +1602,24 @@
+@@ -1604,24 +1903,24 @@
case 'C': FakeButtonPress(&but[BACROP]); break;
case 'P': FakeButtonPress(&but[BPAD]); break;
case 'A': FakeButtonPress(&but[BANNOT]); break;
@@ -13697,7 +21778,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
*donep = done; *retvalp = retval;
}
-@@ -1657,7 +1655,7 @@
+@@ -1657,7 +1956,7 @@
else name = namelist[i];
TextView(name);
@@ -13706,16 +21787,22 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (name != namelist[i]) free(name);
}
-@@ -1671,7 +1669,7 @@
- int i, arg1, arg2, numargs, pct1, pct2, state, neww, newh;
- char txt[512], buf[64], *sp, ch;
- static char *labels[] = { "\nOk", "\033Cancel" };
+@@ -1668,10 +1967,10 @@
+ /* open 'set size' prompt window, get a string, parse it, and try to
+ set the window size accordingly */
+
+- int i, arg1, arg2, numargs, pct1, pct2, state, neww, newh;
+- char txt[512], buf[64], *sp, ch;
+- static char *labels[] = { "\nOk", "\033Cancel" };
-
++ int i, arg1, arg2, numargs, pct1, pct2, state, neww, newh;
++ char txt[512], buf[64], *sp, ch;
++ static const char *labels[] = { "\nOk", "\033Cancel" };
+
sprintf(txt, "Enter new image display size (ex. '400 x 300'),\n");
strcat (txt, "expansion ratio (ex. '75%'),\n");
strcat (txt, "or expansion ratios (ex. '200% x 125%'):");
-@@ -1685,7 +1683,7 @@
+@@ -1685,7 +1984,7 @@
/* attempt to parse the string accordingly...
@@ -13724,7 +21811,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
* (-ish. <num> all by itself isn't legal)
* there may be any # of spaces between items, including zero
*/
-@@ -1825,7 +1823,7 @@
+@@ -1825,7 +2124,7 @@
if (theImage)
XPutImage(theDisp,mainW,theGC,theImage,x,y,x,y, (u_int) w, (u_int) h);
@@ -13733,7 +21820,24 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (DEBUG) fprintf(stderr,"Tried to DrawWindow when theImage was NULL\n");
}
-@@ -1872,7 +1870,7 @@
+@@ -1845,12 +2144,14 @@
+ return;
+ }
+
++ GetWindowPos(&xwa);
++
+ /* determine if new size goes off edge of screen. if so move window so it
+ doesn't go off screen */
+-
+- GetWindowPos(&xwa);
+ if (xwa.x + w > vrWIDE) xwa.x = vrWIDE - w;
+ if (xwa.y + h > vrHIGH) xwa.y = vrHIGH - h;
++ if (xwa.x < 0) xwa.x = 0;
++ if (xwa.y < 0) xwa.y = 0;
+
+ if (DEBUG) fprintf(stderr,"%s: resizing window to %d,%d at %d,%d\n",
+ cmd,w,h,xwa.x,xwa.y);
+@@ -1872,7 +2173,7 @@
XWindowAttributes xwa;
xvbzero((char *) &xwa, sizeof(XWindowAttributes));
xwa.x = xwa.y = 0;
@@ -13742,7 +21846,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
xwa.height = dispHIGH;
SetWindowPos(&xwa);
}
-@@ -1898,14 +1896,14 @@
+@@ -1898,14 +2199,14 @@
rotatesLeft++;
XClearWindow(theDisp, mainW); /* get rid of old bits */
GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
@@ -13759,7 +21863,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
r = (wr>hr) ? wr : hr; /* r is the max(wr,hr) */
ew = (int) ((ew / r) + 0.5);
eh = (int) ((eh / r) + 0.5);
-@@ -1920,7 +1918,7 @@
+@@ -1920,7 +2221,7 @@
void WCrop(w,h,dx,dy)
int w,h,dx,dy;
{
@@ -13768,7 +21872,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
XWindowAttributes xwa;
if (useroot) {
-@@ -1931,7 +1929,7 @@
+@@ -1931,7 +2232,7 @@
else {
/* we want to move window to old x,y + dx,dy (in pic coords) */
GetWindowPos(&xwa);
@@ -13777,7 +21881,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (!origcropvalid) { /* first crop. remember win pos */
origcropvalid = 1;
origcropx = xwa.x;
-@@ -1939,7 +1937,7 @@
+@@ -1939,7 +2240,7 @@
}
CoordC2E(dx, dy, &ex, &ey);
@@ -13786,16 +21890,26 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
xwa.x += ex; xwa.y += ey;
xwa.width = w; xwa.height = h;
GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
-@@ -1980,7 +1978,7 @@
- if (xwa.x<0) xwa.x = 0;
- if (xwa.y<0) xwa.y = 0;
+@@ -1974,13 +2275,14 @@
+ xwa.y = origcropy;
+ }
+
+- if (xwa.x + w > vrWIDE) xwa.x = vrWIDE - w; /* keep on screen */
++ /* keep on screen */
++ if (xwa.x + w > vrWIDE) xwa.x = vrWIDE - w;
+ if (xwa.y + h > vrHIGH) xwa.y = vrHIGH - h;
++ if (xwa.x < 0) xwa.x = 0;
++ if (xwa.y < 0) xwa.y = 0;
+
+- if (xwa.x<0) xwa.x = 0;
+- if (xwa.y<0) xwa.y = 0;
xwa.width = w; xwa.height = h;
-
+
if (!useroot) {
SetWindowPos(&xwa);
GenExpose(mainW, 0, 0, (u_int) eWIDE, (u_int) eHIGH);
-@@ -1995,8 +1993,8 @@
+@@ -1995,8 +2297,8 @@
XWindowAttributes *xwa;
{
Window child;
@@ -13806,7 +21920,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
the border is not included (x,y map to top-left pixel in window) */
/* Get the window width/height */
-@@ -2023,7 +2021,7 @@
+@@ -2023,36 +2325,58 @@
/* if we're less than max size in one axis, allow window manager doohickeys
on the screen */
@@ -13815,7 +21929,32 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (xwa->width < dispWIDE && xwc.x < p_offx) xwc.x = p_offx;
if (xwa->height < dispHIGH && xwc.y < p_offy) xwc.y = p_offy;
-@@ -2034,9 +2032,9 @@
++ /* Try to keep bottom right decorations inside */
++#ifdef CRAP
++ if (xwc.x+eWIDE-debkludge_offx>dispWIDE) {
++ xwc.x=dispWIDE-eWIDE+debkludge_offx;
++ if (xwc.x<0) xwc.x=0;
++ }
++ if (xwc.y+eHIGH-debkludge_offy>dispHIGH) {
++ xwc.y=dispHIGH-eHIGH+debkludge_offy;
++ if (xwc.y<0) xwc.y=0;
++ }
++#else
++ if (xwc.x+eWIDE+p_offx>dispWIDE) {
++ xwc.x=dispWIDE-(eWIDE+debkludge_offx);
++ if (xwc.x<0) xwc.x=0;
++ }
++ if (xwc.y+eHIGH+p_offy>dispHIGH) {
++ xwc.y=dispHIGH-(eHIGH+debkludge_offy);
++ if (xwc.y<0) xwc.y=0;
++ }
++#endif
++
+ xwc.width = xwa->width;
+ xwc.height = xwa->height;
+
+-
++#define BAD_IDEA
#ifdef BAD_IDEA
/* if there is a virtual window manager running, then we should translate
the coordinates that are in terms of 'real' screen into coordinates
@@ -13827,8 +21966,12 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (vrootW != rootW) { /* virtual window manager running */
int x1,y1;
Window child;
-@@ -2045,14 +2043,14 @@
- xwc.x,xwc.y,x1,y1);
+- XTranslateCoordinates(theDisp, rootW, vrootW,xwc.x,xwc.y,&x1,&y1,&child);
++
++ XTranslateCoordinates(theDisp, rootW, vrootW, xwc.x, xwc.y, &x1, &y1, &child);
+ if (DEBUG) fprintf(stderr,"SWP: translate: %d,%d -> %d,%d\n",
+- xwc.x,xwc.y,x1,y1);
++ xwc.x, xwc.y, x1, y1);
xwc.x = x1; xwc.y = y1;
}
-#endif
@@ -13844,7 +21987,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
xwa->border_width, kludge_offx, kludge_offy);
}
-@@ -2080,7 +2078,7 @@
+@@ -2080,7 +2404,7 @@
/* all non-DXWM window managers (?) */
/* Move/Resize the window. */
@@ -13853,7 +21996,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
CWX | CWY | CWWidth | CWHeight /*| CWBorderWidth*/, &xwc);
}
-@@ -2090,7 +2088,7 @@
+@@ -2090,7 +2414,7 @@
static void CropKey(dx,dy,grow,crop)
int dx,dy,grow,crop;
{
@@ -13862,7 +22005,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (crop) { /* chop off a pixel from the appropriate edge */
int dealt=1;
-@@ -2112,7 +2110,7 @@
+@@ -2112,7 +2436,7 @@
}
return;
}
@@ -13871,16 +22014,16 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (grow) MoveGrowSelection(0, 0, dx, dy);
else MoveGrowSelection(dx, dy, 0, 0);
}
-@@ -2128,7 +2126,7 @@
+@@ -2128,7 +2452,7 @@
u_long wh, bl;
int ty, w, ecol, done1;
char foo[128];
- char *str =
-+ char *str =
++ const char *str =
"8888,8888 = 123,123,123 #123456 (123,123,123 HSV) [-2345,-2345]";
ecol = 0; wh = infobg; bl = infofg;
-@@ -2136,14 +2134,14 @@
+@@ -2136,14 +2460,14 @@
if (!dropper) {
Pixmap pix, mask;
XColor cfg, cbg;
@@ -13899,7 +22042,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
dropper_x_hot, dropper_y_hot);
if (pix) XFreePixmap(theDisp, pix);
if (mask) XFreePixmap(theDisp, mask);
-@@ -2151,7 +2149,7 @@
+@@ -2151,7 +2475,7 @@
if (dropper) XDefineCursor(theDisp, mainW, dropper);
@@ -13908,7 +22051,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
and use those colors instead of infobg and infofg */
if (LocalCmap) {
-@@ -2159,7 +2157,7 @@
+@@ -2159,7 +2483,7 @@
for (i=0; i<nfcols; i++) ctab[i].pixel = freecols[i];
XQueryColors(theDisp,LocalCmap,ctab,nfcols);
@@ -13917,7 +22060,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
/* find 'blackest' pixel */
cval = 0x10000 * 3;
for (i=0; i<nfcols; i++)
-@@ -2176,7 +2174,7 @@
+@@ -2176,7 +2500,7 @@
wh = ctab[i].pixel;
}
}
@@ -13926,7 +22069,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
XSetFont(theDisp, theGC, monofont);
w = XTextWidth(monofinfo, str, (int) strlen(str));
-@@ -2185,7 +2183,7 @@
+@@ -2185,7 +2509,7 @@
else ty = eHIGH-(monofinfo->ascent + mfinfo->descent)-4;
XSetForeground(theDisp, theGC, bl);
@@ -13935,7 +22078,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
(u_int) (monofinfo->ascent+monofinfo->descent) + 4);
XSetForeground(theDisp, theGC, wh);
XSetBackground(theDisp, theGC, bl);
-@@ -2198,15 +2196,15 @@
+@@ -2198,15 +2522,15 @@
if (!XQueryPointer(theDisp,mainW,&rW,&cW,&rx,&ry,&x,&y,&mask)) continue;
if (done1 && !(mask & Button2Mask)) break; /* button released */
@@ -13955,7 +22098,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (picType == PIC8) {
ecol = pix = pic[py * pWIDE + px];
rval = rcmap[pix]; gval = gcmap[pix]; bval = bcmap[pix];
-@@ -2216,7 +2214,7 @@
+@@ -2216,7 +2540,7 @@
gval = pic[py * pWIDE * 3 + px * 3 + 1];
bval = pic[py * pWIDE * 3 + px * 3 + 2];
}
@@ -13964,7 +22107,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
clearR = rval; clearG = gval; clearB = bval;
rgb2hsv(rval, gval, bval, &h1, &s1, &v1);
-@@ -2229,8 +2227,8 @@
+@@ -2229,8 +2553,8 @@
px, py, rval, gval, bval, rval, gval, bval,
(int) h1, (int) (s1 * 100), (int) (v1 * 100),
px-orgx, py-orgy);
@@ -13975,7 +22118,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
foo, (int) strlen(foo));
ox = px; oy = py;
done1 = 1;
-@@ -2275,7 +2273,7 @@
+@@ -2275,7 +2599,7 @@
/* returns true if there's a config event in which mainW changes size
in the event queue */
@@ -13984,7 +22127,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
XSync(theDisp, False);
foo = 0;
XCheckIfEvent(theDisp, &ev, IsConfig, &foo);
-@@ -2328,7 +2326,7 @@
+@@ -2328,7 +2652,7 @@
* BadMatch errors on XGetImage
*/
@@ -13993,7 +22136,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
(xerrcode == BadAccess && err->request_code==88 /* X_FreeColors */ ) ||
(err->request_code == 113 /* X_KillClient */ ) ||
(xerrcode == BadLength && err->request_code==18 /* X_ChangeProp */ ) ||
-@@ -2361,7 +2359,7 @@
+@@ -2361,17 +2685,39 @@
{
/* but first, if any input-grabbing popups are active, we have to 'cancel'
them. */
@@ -14002,7 +22145,39 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
if (psUp) PSDialog(0); /* close PS window */
#ifdef HAVE_JPEG
-@@ -2400,14 +2398,14 @@
+ if (jpegUp) JPEGDialog(0); /* close jpeg window */
+ #endif
+
++#ifdef HAVE_JP2K
++ if (jp2kUp) JP2KDialog(0); /* close jpeg 2000 window */
++#endif
++
+ #ifdef HAVE_TIFF
+ if (tiffUp) TIFFDialog(0); /* close tiff window */
+ #endif
+
++#ifdef HAVE_PNG
++ if (pngUp) PNGDialog(0); /* close png window */
++#endif
++
++ if (pcdUp) PCDDialog(0); /* close pcd window */
++
++#ifdef HAVE_PIC2
++ if (pic2Up) PIC2Dialog(0); /* close pic2 window */
++#endif
++
++#ifdef HAVE_PCD
++ if (pcdUp) PCDDialog(0); /* close pcd window */
++#endif
++
++#ifdef HAVE_MGCSFX
++ if (mgcsfxUp) MGCSFXDialog(0); /* close mgcsfx window */
++#endif
++
+ ClosePopUp();
+
+ /* make the interrupt signal look like a '\n' keypress in ctrlW */
+@@ -2400,14 +2746,14 @@
if (!pen) {
Pixmap pix, pmask;
XColor cfg, cbg;
@@ -14021,7 +22196,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
pen_x_hot, pen_y_hot);
if (pix) XFreePixmap(theDisp, pix);
if (pmask) XFreePixmap(theDisp, pmask);
-@@ -2416,7 +2414,7 @@
+@@ -2416,7 +2762,7 @@
if (pen) XDefineCursor(theDisp, mainW, pen);
@@ -14030,7 +22205,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
| StructureNotifyMask /* | ButtonPressMask */
| KeyReleaseMask | ColormapChangeMask
| EnterWindowMask | LeaveWindowMask );
-@@ -2435,7 +2433,7 @@
+@@ -2435,7 +2781,7 @@
switch (state) {
case 0: /* initial state: make sure we do one pixel */
@@ -14039,7 +22214,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
paintPixel(px, py);
if (nmask & ShiftMask ) state = 99;
-@@ -2444,7 +2442,7 @@
+@@ -2444,7 +2790,7 @@
else state = 10;
break;
@@ -14048,7 +22223,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
case 1: /* waiting for click */
if (nmask & ShiftMask) state = 99;
else if ( mask & Button2Mask) {
-@@ -2459,7 +2457,7 @@
+@@ -2459,7 +2805,7 @@
}
break;
@@ -14057,7 +22232,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
case 10: /* in freehand drawing mode */
if (nmask & ShiftMask ) state = 99;
else if (nmask & Button2Mask) state = 1;
-@@ -2507,11 +2505,11 @@
+@@ -2507,11 +2853,11 @@
XSync(theDisp, False);
Timer(100);
}
@@ -14071,7 +22246,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
case 99: /* EXIT loop: cleanup */
if (line) { /* erase old xor-line */
paintXLine(lx, ly, px1, py1, 0);
-@@ -2521,11 +2519,11 @@
+@@ -2521,11 +2867,11 @@
break;
}
}
@@ -14087,7 +22262,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
| StructureNotifyMask | ButtonPressMask
| KeyReleaseMask | ColormapChangeMask
| EnterWindowMask | LeaveWindowMask );
-@@ -2557,17 +2555,17 @@
+@@ -2557,17 +2903,17 @@
byte *pp = pic + (y * pWIDE + x) * 3;
pp[0] = clearR; pp[1] = clearG; pp[2] = clearB;
}
@@ -14110,17 +22285,63 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
XFillRectangle(theDisp,mainW,theGC, ex,ey, (u_int) ew, (u_int) eh);
}
-@@ -2577,7 +2575,7 @@
+@@ -2576,29 +2922,46 @@
+ static void paintLine(x,y,x1,y1)
int x,y,x1,y1;
{
- int dx,dy,i,lx,ly,adx,ady;
+- int dx,dy,i,lx,ly,adx,ady;
-
-+
- dx = x1-x; dy = y1-y;
- adx = abs(dx); ady = abs(dy);
-
-@@ -2598,7 +2596,7 @@
- paintPixel(lx,ly);
+- dx = x1-x; dy = y1-y;
+- adx = abs(dx); ady = abs(dy);
+-
+- if (dx == 0 && dy == 0) paintPixel(x,y);
+-
+- else if (adx > ady) { /* X is major axis */
+- for (i=0; i<=adx; i++) {
+- lx = x + (i * dx + (adx/2)) / abs(dx);
+- ly = y + (i * dy + (adx/2)) / abs(dx);
+- paintPixel(lx,ly);
++ int t,dx,dy,d,dd;
++
++ dx = abs(x1-x); dy = abs(y1-y);
++
++ if (dx >= dy) { /* X is major axis */
++ if (x > x1) {
++ t = x; x = x1; x1 = t;
++ t = y; y = y1; y1 = t;
++ }
++ d = dy + dy - dx;
++ dd = y < y1 ? 1 : -1;
++ while (x <= x1) {
++ paintPixel(x,y);
++ if (d > 0) {
++ y += dd;
++ d -= dx + dx;
++ }
++ ++x;
++ d += dy + dy;
+ }
+ }
+
+ else { /* Y is major axis */
+- for (i=0; i<=ady; i++) {
+- lx = x + (i * dx + (ady/2)) / ady;
+- ly = y + (i * dy + (ady/2)) / ady;
+- paintPixel(lx,ly);
++ if (y > y1) {
++ t = x; x = x1; x1 = t;
++ t = y; y = y1; y1 = t;
++ }
++ d = dx + dx - dy;
++ dd = x < x1 ? 1 : -1;
++ while (y <= y1) {
++ paintPixel(x,y);
++ if (d > 0) {
++ x += dd;
++ d -= dy + dy;
++ }
++ ++y;
++ d += dx + dx;
}
}
-
@@ -14128,7 +22349,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
}
-@@ -2618,14 +2616,14 @@
+@@ -2618,14 +2981,14 @@
CoordP2E(x+1,y+1,&tx1,&ty1);
ex = tx + (tx1 - tx)/2;
ey = ty + (ty1 - ty)/2;
@@ -14146,7 +22367,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
XSetPlaneMask(theDisp, theGC, xorMasks[pntxlcol]);
XSetFunction(theDisp, theGC, GXinvert);
XDrawLine(theDisp, mainW, theGC, ex, ey, ex1, ey1);
-@@ -2638,10 +2636,8 @@
+@@ -2638,10 +3001,8 @@
static void BlurPaint()
{
Window rW,cW;
@@ -14158,7 +22379,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
/* blurs pixels in either editCol (PIC8) or clear{R,G,B} (PIC24) until
'shift' key is released. */
-@@ -2653,14 +2649,14 @@
+@@ -2653,14 +3014,14 @@
if (!blur) {
Pixmap pix, mask;
XColor cfg, cbg;
@@ -14177,7 +22398,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
blur_x_hot, blur_y_hot);
if (pix) XFreePixmap(theDisp, pix);
if (mask) XFreePixmap(theDisp, mask);
-@@ -2669,7 +2665,7 @@
+@@ -2669,7 +3030,7 @@
if (blur) XDefineCursor(theDisp, mainW, blur);
@@ -14186,7 +22407,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
| StructureNotifyMask /* | ButtonPressMask */
| KeyReleaseMask | ColormapChangeMask
| EnterWindowMask | LeaveWindowMask );
-@@ -2682,12 +2678,12 @@
+@@ -2682,12 +3043,12 @@
if (!(mask & Button3Mask)) { dragging = 0; continue; }
CoordE2P(x,y, &px, &py);
@@ -14201,7 +22422,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
dx = px-ox; dy = py-oy; /* at least one will be non-zero */
if (abs(dx) > abs(dy)) { /* X is major axis */
for (i=0; i<=abs(dx); i++) {
-@@ -2707,10 +2703,10 @@
+@@ -2707,10 +3068,10 @@
done1 = 1; dragging = 1; ox = px; oy = py;
}
}
@@ -14215,7 +22436,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
| StructureNotifyMask | ButtonPressMask
| KeyReleaseMask | ColormapChangeMask
| EnterWindowMask | LeaveWindowMask );
-@@ -2731,9 +2727,9 @@
+@@ -2731,9 +3092,9 @@
{
/* returns position of highest set bit in 'ul' as an integer (0-31),
or -1 if none */
@@ -14227,7 +22448,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
hb = 0x80; hb = hb << 24; /* hb = 0x80000000UL */
for (i=31; ((ul & hb) == 0) && i>=0; i--, ul<<=1);
return i;
-@@ -2757,7 +2753,7 @@
+@@ -2757,7 +3118,7 @@
d = 3*(256*256); j=0;
for (i=0; i<numcols; i++) {
@@ -14236,7 +22457,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
((g-gMap[i]) + (g-gMap[i])) +
((b-bMap[i]) * (b-bMap[i]));
if (i==0 || di<d) { j=i; d=di; }
-@@ -2771,45 +2767,45 @@
+@@ -2771,45 +3132,45 @@
if (theVisual->class==TrueColor || theVisual->class==DirectColor) {
unsigned long rmask, gmask, bmask;
int rshift, gshift, bshift, cshift, maplen;
@@ -14294,7 +22515,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
else { /* non-TrueColor/DirectColor visual */
if (!ncols)
rv = ((r + g + b >= 128*3) ? white : black);
-@@ -2820,14 +2816,14 @@
+@@ -2820,14 +3181,14 @@
return rv;
}
@@ -14312,7 +22533,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
around the pixel, and replaces it with the average value (PIC24), or
the closest existing color to the average value (PIC8) */
-@@ -2861,7 +2857,7 @@
+@@ -2861,7 +3222,7 @@
if (picType == PIC8) { /* find nearest actual color */
d = 3*(256*256); j=0;
for (i=0; i<numcols; i++) {
@@ -14321,7 +22542,7 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
((ag-gMap[i]) + (ag-gMap[i])) +
((ab-bMap[i]) * (ab-bMap[i]));
if (i==0 || di<d) { j=i; d=di; }
-@@ -2874,17 +2870,17 @@
+@@ -2874,17 +3235,17 @@
pp = pic + (y * pWIDE + x) * 3;
pp[0] = ar; pp[1] = ag; pp[2] = ab;
}
@@ -14344,9 +22565,20 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
XFillRectangle(theDisp,mainW,theGC, ex,ey, (u_int) ew, (u_int) eh);
}
-@@ -2901,13 +2897,13 @@
- static char buf[256] = {'\0'};
- static char *labels[] = {"\nOk", "\033Cancel" };
+@@ -2895,19 +3256,19 @@
+ /***********************/
+ static void annotatePic()
+ {
+- int i, w,h, len;
+- byte *cimg;
+- char txt[256];
+- static char buf[256] = {'\0'};
+- static char *labels[] = {"\nOk", "\033Cancel" };
++ int i, w,h, len;
++ byte *cimg;
++ char txt[256];
++ static char buf[256] = {'\0'};
++ static const char *labels[] = {"\nOk", "\033Cancel" };
- sprintf(txt, "Image Annotation:\n\n%s",
+ sprintf(txt, "Image Annotation:\n\n%s",
@@ -14362,19 +22594,59 @@ diff -ruN xv-3.10a/xvevent.c xv-3.10a-bugfixes/xvevent.c
/* build a 'cimg' array to be pasted on clipboard */
w = strlen(buf) * 6 - 1; h = 9;
len = CIMG_PIC8 + w*h;
-diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
+diff -ru xv-3.10a/xvfits.c xv-3.10a-enhancements/xvfits.c
--- xv-3.10a/xvfits.c 1994-12-27 23:43:29.000000000 -0800
-+++ xv-3.10a-bugfixes/xvfits.c 2005-04-02 21:08:45.000000000 -0800
-@@ -63,7 +63,7 @@
++++ xv-3.10a-enhancements/xvfits.c 2007-05-12 15:46:55.000000000 -0700
+@@ -14,7 +14,7 @@
+ * provided "as is" without express or implied warranty.
+ */
+
+-
++#define NEEDSDIR /* for S_IRUSR|S_IWUSR */
+ #include "xv.h"
+
+ #define NCARDS (36)
+@@ -39,17 +39,17 @@
+ static char *fits_block=NULL;
+
+
+-static int splitfits PARM((byte *, char *, int, int, int, char *));
+-static char *ftopen3d PARM((FITS *, char *, int *, int *, int *, int *));
+-static void ftclose PARM((FITS *));
+-static int ftgbyte PARM((FITS *, byte *, int));
+-static char *rdheader PARM((FITS *));
+-static char *wrheader PARM((FILE *, int, int, char *));
+-static char *rdcard PARM((char *, char *, DATTYPE, long int *));
+-static void wrcard PARM((char *, char *, DATTYPE, int, char *));
+-static int ftgdata PARM((FITS *, void *, int));
+-static void ftfixdata PARM((FITS *, void *, int));
+-static void flip PARM((byte *, int, int));
++static int splitfits PARM((byte *, char *, int, int, int, char *));
++static const char *ftopen3d PARM((FITS *, char *, int *, int *, int *, int *));
++static void ftclose PARM((FITS *));
++static int ftgbyte PARM((FITS *, byte *, int));
++static const char *rdheader PARM((FITS *));
++static const char *wrheader PARM((FILE *, int, int, char *));
++static const char *rdcard PARM((char *, const char *, DATTYPE, long int *));
++static void wrcard PARM((char *, const char *, DATTYPE, int, char *));
++static int ftgdata PARM((FITS *, void *, int));
++static void ftfixdata PARM((FITS *, void *, int));
++static void flip PARM((byte *, int, int));
+
+
+
+@@ -63,16 +63,16 @@
/* returns '1' on success */
FITS fs;
- int i, nx, ny, nz, bitpix, np, nrd, ioerror;
+ int i, nx, ny, nz, bitpix, nrd, ioerror, npixels, bufsize;
byte *image;
- char *error;
+- char *error;
++ const char *error;
char basename[64];
-@@ -72,7 +72,7 @@
+
+ if (fits_block == NULL) {
fits_block = (char *) malloc((size_t) BLOCKSIZE);
if (!fits_block) FatalError("Insufficient memory for FITS block buffer");
}
@@ -14474,7 +22746,8 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
- int i, j, np, nend;
+ int i, j, npixels, nend;
byte *ptr;
- char *error;
+- char *error;
++ const char *error;
byte rgb[256];
-
+
@@ -14517,10 +22790,11 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
-
- int i, np=nx * ny, ioerror, nwrt;
+
-+ int i, npixels=nx * ny, nwrt;
++ int i, npixels=nx * ny, nwrt, tmpfd;
FILE *fp;
- char *error;
+- char *error;
- byte *work;
++ const char *error;
char filename[70];
#ifndef VMS
@@ -14538,7 +22812,18 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
if (basename[0] == '\0') {
SetISTR(ISTR_WARNING, "%s", "Unable to build temporary filename");
return 1;
-@@ -251,7 +259,7 @@
+@@ -246,28 +254,37 @@
+
+ for (i=0; i < nz && !error; i++) {
+ sprintf(filename, "%s%d", basename, i+1);
+- fp = xv_fopen(filename, "w");
++ tmpfd = open(filename,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
++ if (tmpfd < 0) {
++ error = "Unable to open temporary file";
++ break;
++ }
++ fp = fdopen(tmpfd, "w");
+ if (!fp) {
error = "Unable to open temporary file";
break;
}
@@ -14546,14 +22831,18 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
+
if (wrheader(fp, nx, ny, comment)) {
error = "I/O error writing temporary file";
++ fflush(fp);
fclose(fp);
-@@ -259,15 +267,15 @@
+ unlink(filename);
++ close(tmpfd);
break;
}
- nwrt = fwrite(image+i*np, sizeof(byte), (size_t) np, fp);
+ nwrt = fwrite(image+i*npixels, sizeof(byte), (size_t) npixels, fp);
++ fflush(fp);
fclose(fp);
++ close(tmpfd);
if (nwrt == 0) { /* failed to write any data */
error = "I/O error writing temporary file";
@@ -14566,7 +22855,14 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
error = "I/O error writing temporary file";
}
-@@ -291,13 +299,13 @@
+@@ -285,19 +302,19 @@
+
+
+ /************************************/
+-static char *wrheader(fp, nx, ny, comment)
++static const char *wrheader(fp, nx, ny, comment)
+ FILE *fp;
+ int nx, ny;
char *comment;
{
/* Writes a minimalist FITS file header */
@@ -14583,7 +22879,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
sprintf(history, "Written by XV %s", VERSTR);
lenhist = strlen(history);
-@@ -309,7 +317,7 @@
+@@ -309,7 +326,7 @@
wrcard(&block[80*i++], "NAXIS2", T_INT, ny, NULL); /* write NAXIS2 card */
/* Write HISTORY keyword */
@@ -14592,7 +22888,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
if (comment && *comment != '\0') {
while (*comment == '\n') comment++; /* Skip any blank lines */
-@@ -317,7 +325,7 @@
+@@ -317,7 +334,7 @@
for (j=0; j<72; j++)
if (comment[j] == '\0' || comment[j] == '\n') break;
@@ -14601,7 +22897,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
* Check to see if it is an xv history record; if so, then avoid
* duplicating it.
*/
-@@ -330,7 +338,7 @@
+@@ -330,7 +347,7 @@
for (i=0, bp=block; i<BLOCKSIZE; i++, bp++) *bp = ' ';
i = 0;
}
@@ -14610,7 +22906,16 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
comment += j;
while (*comment == '\n') comment++; /* Skip any blank lines */
}
-@@ -358,40 +366,40 @@
+@@ -346,7 +363,7 @@
+
+
+ /************************************/
+-static char *ftopen3d(fs, file, nx, ny, nz, bitpix)
++static const char *ftopen3d(fs, file, nx, ny, nz, bitpix)
+ FITS *fs;
+ char *file;
+ int *nx, *ny, *nz, *bitpix;
+@@ -358,40 +375,40 @@
* Will return an error message if the primary data unit is not a
* 2 or 3-dimensional array.
*/
@@ -14618,8 +22923,9 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
+
FILE *fp;
int naxis, i;
- char *error;
+- char *error;
-
++ const char *error;
+
fp = xv_fopen(file, "r");
if (!fp) return "Unable to open FITS file";
@@ -14661,9 +22967,21 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
return NULL;
}
-@@ -418,11 +426,11 @@
+@@ -406,7 +423,7 @@
+
+
+ /************************************/
+-static char *rdheader(fs)
++static const char *rdheader(fs)
+ FITS *fs;
+ {
+ /* reads the fits header, and updates the FITS structure fs.
+@@ -416,13 +433,13 @@
+ int i, j, res, commlen, commsize;
+ char name[9];
char *block=fits_block, *p;
- char *error;
+- char *error;
++ const char *error;
long int val; /* the value */
-
+
@@ -14675,7 +22993,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
res = fread(block, sizeof(char), (size_t) BLOCKSIZE, fs->fp);
if (res != BLOCKSIZE) return "Error reading FITS file";
i = 0;
-@@ -464,13 +472,13 @@
+@@ -464,13 +481,13 @@
if (res != BLOCKSIZE) return "Error reading FITS file";
i = 0;
}
@@ -14691,7 +23009,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
if (j < 3) fs->axes[j] = val;
else if (val != 1) return "FITS file has more than three dimensions";
i++;
-@@ -488,21 +496,21 @@
+@@ -488,21 +505,21 @@
if (res != BLOCKSIZE) return "Unexpected eof in FITS file";
i = 0;
}
@@ -14717,7 +23035,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
if (commlen + j + 2 > commsize) { /* if too small */
char *new;
commsize += commsize; /* double size of array */
-@@ -515,7 +523,7 @@
+@@ -515,7 +532,7 @@
free(fs->comment);
fs->comment = new;
}
@@ -14726,7 +23044,17 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
xvbcopy(p, &fs->comment[commlen], (size_t) j); /* add string */
commlen += j;
fs->comment[commlen++] = '\n'; /* with trailing cr */
-@@ -556,9 +564,9 @@
+@@ -531,7 +548,8 @@
+
+ /************************************/
+ static void wrcard(card, name, dtype, kvalue, svalue)
+- char *card, *name;
++ char *card;
++ const char *name;
+ DATTYPE dtype; /* type of value */
+ int kvalue;
+ char *svalue;
+@@ -556,9 +574,9 @@
l = strlen(name);
if (l) xvbcopy(name, card, (size_t) l); /* copy name */
@@ -14738,7 +23066,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
if (dtype == T_STR) {
l = kvalue;
if (l <= 0) return;
-@@ -566,9 +574,9 @@
+@@ -566,9 +584,9 @@
xvbcopy(svalue, &card[8], (size_t) l);
return;
}
@@ -14750,7 +23078,19 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
if (dtype == T_LOG)
card[29] = kvalue ? 'T' : 'F';
else { /* T_INT */
-@@ -599,7 +607,7 @@
+@@ -579,8 +597,9 @@
+
+
+ /************************************/
+-static char *rdcard(card, name, dtype, kvalue)
+- char *card, *name;
++static const char *rdcard(card, name, dtype, kvalue)
++ char *card;
++ const char *name;
+ DATTYPE dtype; /* type of value */
+ long int *kvalue;
+ {
+@@ -599,7 +618,7 @@
int i, ptr;
char namestr[9];
static char error[45];
@@ -14759,7 +23099,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
xvbcopy(card, namestr, (size_t) 8);
for (i=7; i>=0 && namestr[i] == ' '; i--);
-@@ -609,24 +617,24 @@
+@@ -609,24 +628,24 @@
sprintf(error, "Keyword %s not found in FITS file", name);
return error;
}
@@ -14788,7 +23128,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
if (ptr > 29) return "Keyword has bad integer value in FITS file";
xvbcopy(&card[ptr], num, (size_t) (30-ptr));
num[30-ptr] = '\0';
-@@ -634,7 +642,7 @@
+@@ -634,7 +653,7 @@
if (j != 1) return "Keyword has bad integer value in FITS file";
*kvalue = ival;
}
@@ -14797,7 +23137,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
return NULL;
}
-@@ -660,13 +668,13 @@
+@@ -660,13 +679,13 @@
*/
int res;
@@ -14814,7 +23154,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
size is always a factor of BLOCKSIZE */
int loffs, nblock=BLOCKSIZE/fs->size;
-@@ -714,7 +722,7 @@
+@@ -714,7 +733,7 @@
byte *ptr=buffer;
/*
@@ -14823,7 +23163,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
* variables.
* Because the native int types may be larger than the types in the file,
* we start from the end and work backwards to avoid overwriting data
-@@ -741,12 +749,12 @@
+@@ -741,12 +760,12 @@
((unsigned int)ptr[2] << 8) |
((unsigned int)ptr[3]);
}
@@ -14838,7 +23178,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
if (exps == NULL) {
exps = (float *)malloc(256 * sizeof(float));
if (exps == NULL) FatalError("Insufficient memory for exps store");
-@@ -754,7 +762,7 @@
+@@ -754,7 +773,7 @@
for (i=151; i < 256; i++) exps[i] = 2.*exps[i-1];
for (i=149; i >= 0; i--) exps[i] = 0.5*exps[i+1];
}
@@ -14847,7 +23187,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
for (i=0; i < n; i++, ptr+=4) {
k = (int)*ptr;
j = ((int)ptr[1] << 16) | ((int)ptr[2] << 8) | (int)ptr[3];
-@@ -765,13 +773,13 @@
+@@ -765,13 +784,13 @@
}
}
@@ -14863,7 +23203,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
if (exps == NULL) {
exps = (double *)malloc(2048 * sizeof(double));
if (exps == NULL) FatalError("Insufficient memory for exps store");
-@@ -779,7 +787,7 @@
+@@ -779,7 +798,7 @@
for (i=1076; i < 2048; i++) exps[i] = 2.*exps[i-1];
for (i=1074; i >= 0; i--) exps[i] = 0.5*exps[i+1];
}
@@ -14872,7 +23212,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
for (i=0; i < n; i++, ptr+=8) {
k = (int)*ptr;
j = ((unsigned int)ptr[1] << 24) | ((unsigned int)ptr[2] << 16) |
-@@ -813,23 +821,36 @@
+@@ -813,23 +832,36 @@
*/
void *voidbuff;
@@ -14918,7 +23258,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
nelem*fs->size);
FatalError(emess);
}
-@@ -843,28 +864,28 @@
+@@ -843,28 +875,28 @@
short int *buffer=voidbuff;
int max, min, maxmin_t;
float scale;
@@ -14953,7 +23293,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
/* rescale and convert */
if (scale < 255./2.1e9) /* is max-min too big for an int ? */
for (i=0, buffer=voidbuff; i < n; i++)
-@@ -872,34 +893,34 @@
+@@ -872,34 +904,34 @@
else /* use integer subtraction */
for (i=0, buffer=voidbuff; i < n; i++)
cbuff[i] = (byte)(scale*(float)(buffer[i]-min));
@@ -14997,7 +23337,7 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
/* rescale and convert */
for (i=0, buffer=voidbuff; i < n; i++)
cbuff[i] = (byte)(scale*(buffer[i]-min));
-@@ -923,7 +944,7 @@
+@@ -923,7 +955,7 @@
int i;
int j, v;
byte *buff1, *buff2;
@@ -15006,9 +23346,9 @@ diff -ruN xv-3.10a/xvfits.c xv-3.10a-bugfixes/xvfits.c
for (i=0; i < ny/2; i++) {
buff1 = &buffer[i*nx];
buff2 = &buffer[(ny-1-i)*nx];
-diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
+diff -ru xv-3.10a/xvgam.c xv-3.10a-enhancements/xvgam.c
--- xv-3.10a/xvgam.c 1995-01-13 11:51:14.000000000 -0800
-+++ xv-3.10a-bugfixes/xvgam.c 2004-05-16 18:02:11.000000000 -0700
++++ xv-3.10a-enhancements/xvgam.c 2007-05-13 14:12:04.000000000 -0700
@@ -1,4 +1,4 @@
-/*
+/*
@@ -15024,16 +23364,59 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
static struct gamstate *defLoadState;
static int uptr, uhead, utail;
-@@ -153,7 +153,7 @@
+@@ -99,7 +99,7 @@
+ int stval; /* start of range (ONLY val ifnot range) */
+ int enval; /* end of range */
+ int ccwise; /* 1 if range goes ccwise, 0 if cwise */
+- char *str; /* title string */
++ const char *str; /* title string */
+ u_long fg,bg; /* colors */
+ int satval; /* saturation value on non-range dial */
+ BUTT hdbutt[N_HDBUTT];
+@@ -122,7 +122,7 @@
+ static int defAutoApply;
+ static int hsvnonlinear = 0;
+
+-static void printUTime PARM((char *));
++static void printUTime PARM((const char *));
+
+ static void computeHSVlinear PARM((void));
+ static void changedGam PARM((void));
+@@ -153,8 +153,8 @@
static void dragHueDial PARM((void));
static void dragEditColor PARM((void));
-static void HDCreate PARM((HDIAL *, Window, int, int, int, int,
+- int, int, char *, u_long, u_long));
+static void HDCreate PARM((HDIAL *, Window, int, int, int, int,
- int, int, char *, u_long, u_long));
++ int, int, const char *, u_long, u_long));
static void HDRedraw PARM((HDIAL *, int));
-@@ -212,13 +212,13 @@
+ static int HDClick PARM((HDIAL *, int, int));
+@@ -191,10 +191,11 @@
+
+ /***************************/
+ static void printUTime(str)
+- char *str;
++ const char *str;
+ {
+ #ifdef TIMING_TEST
+- int i; struct rusage ru;
++ int i;
++ struct rusage ru;
+
+ i = getrusage(RUSAGE_SELF, &ru);
+ fprintf(stderr,"%s: utime = %ld.%ld seconds\n",
+@@ -206,19 +207,19 @@
+
+ /***************************************************/
+ void CreateGam(geom, gam, rgam, ggam, bgam, defpreset)
+- char *geom;
+- double gam, rgam, ggam, bgam;
+- int defpreset;
++ const char *geom;
++ double gam, rgam, ggam, bgam;
++ int defpreset;
{
XSetWindowAttributes xswa;
@@ -15050,7 +23433,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
1,infofg,infobg);
modF = XCreateSimpleWindow(theDisp,gamW, 10, 438,MODF_WIDE,MODF_HIGH,
1,infofg,infobg);
-@@ -227,7 +227,7 @@
+@@ -227,7 +228,7 @@
rgbF = XCreateSimpleWindow(theDisp,gamW, 467, 8,RGBF_WIDE,RGBF_HIGH,
1,infofg,infobg);
@@ -15059,7 +23442,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
FatalError("couldn't create frame windows");
#ifdef BACKING_STORE
-@@ -251,25 +251,25 @@
+@@ -251,25 +252,25 @@
/********** COLORMAP editing doo-wahs ***********/
@@ -15084,17 +23467,17 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
"Random", infofg, infobg, hicol, locol);
- DCreate(&rhDial, cmapF, 5, 215, 66, 100, 0,360,180, 5,
-+ DCreate(&rhDial, cmapF, 5, 215, 66, 100, 0,360,180, 5,
++ DCreate(&rhDial, cmapF, 5, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0,
infofg, infobg, hicol, locol, "Hue", NULL);
- DCreate(&gsDial, cmapF, 72, 215, 66, 100, 0,360,180, 5,
-+ DCreate(&gsDial, cmapF, 72, 215, 66, 100, 0,360,180, 5,
++ DCreate(&gsDial, cmapF, 72, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0,
infofg, infobg, hicol, locol, "Sat.", NULL);
- DCreate(&bvDial, cmapF, 139, 215, 66, 100, 0,360,180, 5,
-+ DCreate(&bvDial, cmapF, 139, 215, 66, 100, 0,360,180, 5,
++ DCreate(&bvDial, cmapF, 139, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0,
infofg, infobg, hicol, locol, "Value", NULL);
rhDial.drawobj = gsDial.drawobj = bvDial.drawobj = dragEditColor;
-@@ -291,44 +291,44 @@
+@@ -291,44 +292,44 @@
#define BY2 (BY0 + BYSPACE*2)
#define BY3 (BY0 + BYSPACE*3)
@@ -15154,7 +23537,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
infofg,infobg,hicol,locol);
-@@ -338,11 +338,11 @@
+@@ -338,11 +339,11 @@
CBCreate(&enabCB, modF,2,2, "Display with HSV/RGB mods.",
infofg,infobg,hicol,locol);
@@ -15168,12 +23551,12 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
infofg,infobg,hicol,locol);
enabCB.val = autoCB.val = resetCB.val = dragCB.val = 1;
-@@ -359,23 +359,23 @@
+@@ -359,23 +360,23 @@
srcHD.drawobj = dstHD.drawobj = whtHD.drawobj = dragHueDial;
- DCreate(&satDial, hsvF, 100, 199, 100, 121, -100, 100, 0, 5,
-+ DCreate(&satDial, hsvF, 100, 199, 100, 121, -100, 100, 0, 5,
++ DCreate(&satDial, hsvF, 100, 199, 100, 121, -100.0, 100.0, 0.0, 1.0, 5.0,
infofg, infobg,hicol,locol, "Saturation", "%");
- hueRB = RBCreate(NULL, hsvF, 7, 153, "1",
@@ -15200,7 +23583,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
infofg, infobg,hicol,locol);
initHmap();
-@@ -394,13 +394,13 @@
+@@ -394,13 +395,13 @@
InitGraf(&gGraf);
CreateGraf(&gGraf, rgbF, 10, 179, infofg, infobg, "Green");
@@ -15216,7 +23599,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
SetHSVmode();
ctrls2gamstate(&defstate);
-@@ -415,14 +415,14 @@
+@@ -415,14 +416,14 @@
Str2Graf(&preset[1].rstate,"L 4 : 0,0 : 127,0 : 128,255 : 255,255");
Str2Graf(&preset[1].gstate,"L 4 : 0,0 : 127,0 : 128,255 : 255,255");
Str2Graf(&preset[1].bstate,"L 4 : 0,0 : 127,0 : 128,255 : 255,255");
@@ -15233,7 +23616,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
/* set up preset3 as a 'map' pseudo-color preset */
ctrls2gamstate(&preset[3]);
-@@ -480,7 +480,7 @@
+@@ -480,7 +481,7 @@
computeHSVlinear();
}
@@ -15242,7 +23625,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
/***************************************************/
int GamCheckEvent(xev)
-@@ -492,14 +492,14 @@
+@@ -492,14 +493,14 @@
int rv;
rv = 1;
@@ -15259,7 +23642,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
(e->window == satDial.win || e->window == rhDial.win ||
e->window == gsDial.win || e->window == bvDial.win ||
e->window == cmapF || e->window == modF ||
-@@ -600,7 +600,7 @@
+@@ -600,7 +601,7 @@
else if (e->window == hsvF) {
@@ -15268,7 +23651,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
dials2hmap();
build_hremap();
changedGam();
-@@ -654,7 +654,7 @@
+@@ -654,7 +655,7 @@
e->window == gsDial.win ||
e->window == bvDial.win) {
@@ -15277,7 +23660,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
(e->window == gsDial.win && DTrack(&gsDial, x,y)) ||
(e->window == bvDial.win && DTrack(&bvDial, x,y))) {
saveCMap(&prevcmap);
-@@ -683,7 +683,7 @@
+@@ -683,7 +684,7 @@
XKeyEvent *e = (XKeyEvent *) xev;
char buf[128]; KeySym ks;
int stlen;
@@ -15286,7 +23669,16 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
stlen = XLookupString(e,buf,128,&ks,(XComposeStatus *) NULL);
buf[stlen] = '\0';
-@@ -792,7 +792,7 @@
+@@ -722,7 +723,7 @@
+
+ if (whtHD.enabCB.val && whtHD.satval) hsvnonlinear++;
+
+- if (satDial.val != 0) hsvnonlinear++;
++ if (satDial.val != 0.0) hsvnonlinear++;
+
+ /* check intensity graf */
+ for (i=0; i<256 && intGraf.func[i]==i; i++);
+@@ -792,7 +793,7 @@
int x,y;
{
XPoint pts[8];
@@ -15295,7 +23687,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
pts[0].x = x+10; pts[0].y = y;
pts[1].x = x-4; pts[1].y = y-100;
pts[2].x = x-4; pts[2].y = y-40;
-@@ -873,11 +873,11 @@
+@@ -873,11 +874,11 @@
XSetForeground(theDisp, theGC, infofg);
if (picType != PIC8) {
@@ -15309,7 +23701,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
for (i=0; i<numcols; i++) {
-@@ -941,14 +941,14 @@
+@@ -941,14 +942,14 @@
if (bp->win == butF && PTINRECT(x, y, bp->x, bp->y, bp->w, bp->h)) break;
}
@@ -15327,7 +23719,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
if (i<G_NBUTTS) { /* found one */
if (BTTrack(bp)) doCmd(i);
-@@ -1003,7 +1003,7 @@
+@@ -1003,7 +1004,7 @@
} /* if i<numcols */
} /* if but==1 */
@@ -15336,7 +23728,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
else if (but==2) { /* color smooth */
int cellnum, delc, col1, j, delr, delg, delb;
-@@ -1025,9 +1025,9 @@
+@@ -1025,9 +1026,9 @@
gcmap[col1 + i] = gcmap[col1] + (delg * i) / delc;
bcmap[col1 + i] = bcmap[col1] + (delb * i) / delc;
@@ -15348,7 +23740,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
if (cellgroup[j] == cellgroup[col1 + i]) {
rcmap[j] = rcmap[col1 + i];
gcmap[j] = gcmap[col1 + i];
-@@ -1043,7 +1043,7 @@
+@@ -1043,7 +1044,7 @@
}
if (i<numcols) { /* something changed */
@@ -15357,7 +23749,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
sizeof(struct cmapstate));
BTSetActive(&gbut[G_BCOLUNDO],1);
applyGamma(1);
-@@ -1067,7 +1067,7 @@
+@@ -1067,7 +1068,7 @@
lastcell = curcell;
@@ -15366,7 +23758,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
GrabModeAsync, None, None, (Time) CurrentTime);
while (1) {
Window rW,cW;
-@@ -1076,7 +1076,7 @@
+@@ -1076,7 +1077,7 @@
if (XQueryPointer(theDisp,cmapF,&rW,&cW,&rx,&ry,&x,&y,&mask)) {
/* if button3 and shift released */
@@ -15375,7 +23767,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
/* if user lets go of B3, reset addonly/delonly flag & lastcell */
if (!(mask & Button3Mask) && (mask & ShiftMask)) {
-@@ -1112,7 +1112,7 @@
+@@ -1112,7 +1113,7 @@
if (recolor) {
/* colors changed. save to color undo area */
@@ -15384,7 +23776,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
sizeof(struct cmapstate));
BTSetActive(&gbut[G_BCOLUNDO],1);
applyGamma(1); /* have to regen entire image when groupings chg */
-@@ -1146,12 +1146,12 @@
+@@ -1146,12 +1147,12 @@
/* cases: curgroup>0, clicked on something in same group
remove target from group
curgroup>0, clicked on something in different group
@@ -15399,7 +23791,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
set curgroup = target group
target group gets current values
curgroup=0, clicked on something in no group
-@@ -1185,7 +1185,7 @@
+@@ -1185,7 +1186,7 @@
}
}
@@ -15408,7 +23800,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
cellgroup[cnum]>0) {
/* merge clicked-on group into curgroup */
mode = ADDONLY;
-@@ -1196,11 +1196,11 @@
+@@ -1196,11 +1197,11 @@
selectCell(i,1);
rcmap[i] = rcmap[editColor];
gcmap[i] = gcmap[editColor];
@@ -15422,7 +23814,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
else if ((mode!=DELONLY) && cellgroup[cnum] == 0) {
/* merge clicked-on cell into curgroup */
mode = ADDONLY;
-@@ -1209,7 +1209,7 @@
+@@ -1209,7 +1210,7 @@
selectCell(cnum,1);
rcmap[cnum] = rcmap[editColor];
gcmap[cnum] = gcmap[editColor];
@@ -15431,7 +23823,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
}
}
-@@ -1224,14 +1224,14 @@
+@@ -1224,14 +1225,14 @@
selectCell(i,1);
rcmap[i] = rcmap[editColor];
gcmap[i] = gcmap[editColor];
@@ -15449,7 +23841,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
&& (cnum != editColor)) {
/* create new group for these two cells (cnum and editColor) */
mode = ADDONLY;
-@@ -1247,14 +1247,14 @@
+@@ -1247,14 +1248,14 @@
}
return rv;
@@ -15467,8 +23859,24 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
highlighting/unhighlighting, copy editColor's rgb values to
the rgb/hsv dials */
-@@ -1301,8 +1301,8 @@
- DSetVal(&bvDial, bcmap[editColor]);
+@@ -1291,18 +1292,18 @@
+ rgb2hsv(rcmap[editColor], gcmap[editColor], bcmap[editColor], &h, &s, &v);
+ if (h<0) h = 0;
+
+- DSetVal(&rhDial, (int) h);
+- DSetVal(&gsDial, (int) (s*100));
+- DSetVal(&bvDial, (int) (v*100));
++ DSetVal(&rhDial, h);
++ DSetVal(&gsDial, s*100);
++ DSetVal(&bvDial, v*100);
+ }
+ else {
+- DSetVal(&rhDial, rcmap[editColor]);
+- DSetVal(&gsDial, gcmap[editColor]);
+- DSetVal(&bvDial, bcmap[editColor]);
++ DSetVal(&rhDial, (double)rcmap[editColor]);
++ DSetVal(&gsDial, (double)gcmap[editColor]);
++ DSetVal(&bvDial, (double)bcmap[editColor]);
}
}
-
@@ -15478,15 +23886,27 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
/*********************/
void ApplyECctrls()
{
-@@ -1310,7 +1310,7 @@
+@@ -1310,16 +1311,15 @@
if (hsvmode) {
int rv, gv, bv;
- hsv2rgb((double) rhDial.val, ((double) gsDial.val) / 100.0,
-+ hsv2rgb((double) rhDial.val, ((double) gsDial.val) / 100.0,
- ((double) bvDial.val) / 100.0, &rv, &gv, &bv);
+- ((double) bvDial.val) / 100.0, &rv, &gv, &bv);
++ hsv2rgb(rhDial.val, gsDial.val / 100.0, bvDial.val / 100.0, &rv, &gv, &bv);
rcmap[editColor] = rv;
gcmap[editColor] = gv;
+ bcmap[editColor] = bv;
+ }
+ else {
+- rcmap[editColor] = rhDial.val;
+- gcmap[editColor] = gsDial.val;
+- bcmap[editColor] = bvDial.val;
++ rcmap[editColor] = (int)rhDial.val;
++ gcmap[editColor] = (int)gsDial.val;
++ bcmap[editColor] = (int)bvDial.val;
+ }
+ }
+
@@ -1330,7 +1330,7 @@
{
/* this function generates the Floyd-Steinberg gamma curve (fsgamcr)
@@ -15605,15 +24025,34 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
case G_BCOLUNDO:
for (i=0; i<numcols && cellgroup[i]==prevcmap.cellgroup[i]; i++);
-@@ -1560,7 +1560,7 @@
+@@ -1560,10 +1560,10 @@
rhDial.title = "Red";
gsDial.title = "Green";
bvDial.title = "Blue";
-
-+
- DSetRange(&rhDial, 0, 255, rcmap[editColor], 16);
- DSetRange(&gsDial, 0, 255, gcmap[editColor], 16);
- DSetRange(&bvDial, 0, 255, bcmap[editColor], 16);
+- DSetRange(&rhDial, 0, 255, rcmap[editColor], 16);
+- DSetRange(&gsDial, 0, 255, gcmap[editColor], 16);
+- DSetRange(&bvDial, 0, 255, bcmap[editColor], 16);
++
++ DSetRange(&rhDial, 0.0, 255.0, (double)rcmap[editColor], 1.0, 16.0);
++ DSetRange(&gsDial, 0.0, 255.0, (double)gcmap[editColor], 1.0, 16.0);
++ DSetRange(&bvDial, 0.0, 255.0, (double)bcmap[editColor], 1.0, 16.0);
+
+ XClearWindow(theDisp, rhDial.win); DRedraw(&rhDial);
+ XClearWindow(theDisp, gsDial.win); DRedraw(&gsDial);
+@@ -1581,9 +1581,9 @@
+ &h, &s, &v);
+
+ if (h<0.0) h = 0.0;
+- DSetRange(&rhDial, 0, 360, (int) h, 5);
+- DSetRange(&gsDial, 0, 100, (int) (s*100), 5);
+- DSetRange(&bvDial, 0, 100, (int) (v*100), 5);
++ DSetRange(&rhDial, 0.0, 360.0, h, 1.0, 5.0);
++ DSetRange(&gsDial, 0.0, 100.0, s*100, 1.0, 5.0);
++ DSetRange(&bvDial, 0.0, 100.0, v*100, 1.0, 5.0);
+
+ XClearWindow(theDisp, rhDial.win); DRedraw(&rhDial);
+ XClearWindow(theDisp, gsDial.win); DRedraw(&gsDial);
@@ -1615,12 +1615,12 @@
GammifyColors();
@@ -15724,7 +24163,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
if (hi<0) hi += 360;
if (hi>=360) hi -= 360;
h = (double) hremap[hi];
-@@ -1884,7 +1884,7 @@
+@@ -1884,14 +1884,14 @@
if (whtHD.enabCB.val) {
h = (double) whtHD.stval;
s = (double) whtHD.satval / 100.0;
@@ -15733,6 +24172,14 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
/* special case: if stval = satval = 0, set hue = -1 */
if (whtHD.stval == 0 && whtHD.satval == 0) h = -1.0;
}
+ }
+
+ /* apply satDial value to s */
+- s = s + ((double) satDial.val) / 100.0;
++ s = s + satDial.val / 100.0;
+ if (s<0.0) s = 0.0;
+ if (s>1.0) s = 1.0;
+
@@ -1899,13 +1899,13 @@
if (DEBUG>1) fprintf(stderr," -> %d,%d,%d",rv,gv,bv);
}
@@ -15751,7 +24198,7 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
? white : black;
if (DEBUG>1) fprintf(stderr," -> %d,%d,%d\n",rMap[col],gMap[col],bMap[col]);
-@@ -2001,8 +2001,8 @@
+@@ -2001,13 +2001,13 @@
{
xvbcopy((char *) hmap, (char *) gs->hmap, sizeof(hmap));
@@ -15762,6 +24209,12 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
gs->wht_enab = whtHD.enabCB.val;
gs->hueRBnum = RBWhich(hueRB);
+
+- gs->satval = satDial.val;
++ gs->satval = (int)satDial.val;
+ GetGrafState(&intGraf,&gs->istate);
+ GetGrafState(&rGraf, &gs->rstate);
+ GetGrafState(&gGraf, &gs->gstate);
@@ -2042,7 +2042,7 @@
srcHD.ccwise = hm->src_ccw;
HDRedraw(&srcHD, HD_ALL | HD_CLEAR);
@@ -15780,15 +24233,19 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
if (whtHD.stval != gs->wht_stval || whtHD.satval != gs->wht_satval ||
-@@ -2063,7 +2063,7 @@
+@@ -2063,9 +2063,9 @@
HDRedraw(&whtHD, HD_ALL | HD_CLEAR);
changed++;
}
-
+- if (gs->satval != satDial.val) {
+- DSetVal(&satDial,gs->satval);
+
- if (gs->satval != satDial.val) {
- DSetVal(&satDial,gs->satval);
++ if (gs->satval != (int)satDial.val) {
++ DSetVal(&satDial,(double)gs->satval);
changed++;
+ }
+
@@ -2203,7 +2203,7 @@
}
@@ -15927,6 +24384,23 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
/**********************************************/
/************* HUE wheel functions ***********/
+@@ -2435,11 +2435,11 @@
+
+ /**************************************************/
+ static void HDCreate(hd, win, x, y, r, st, en, ccwise, str, fg, bg)
+-HDIAL *hd;
+-Window win;
+-int x,y,r,st,en,ccwise;
+-char *str;
+-u_long fg,bg;
++ HDIAL *hd;
++ Window win;
++ int x, y, r, st, en, ccwise;
++ const char *str;
++ u_long fg, bg;
+ {
+ int i;
+
@@ -2470,7 +2470,7 @@
hdbpix2[HDB_ROTR] = hdbpix1[HDB_ROTR];
}
@@ -15936,7 +24410,14 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
#define BCOLS fg,bg,hicol,locol
if (hd->range) {
-@@ -2526,7 +2526,7 @@
+@@ -2520,13 +2520,13 @@
+ }
+
+ if (flags & HD_FRAME) {
+- static char *colstr = "RYGCBM";
++ static const char *colstr = "RYGCBM";
+ char tstr[2];
+
XSetForeground(theDisp, theGC, hd->fg);
XDrawArc(theDisp, hd->win, theGC, hd->x - HD_RADIUS, hd->y - HD_RADIUS,
HD_RADIUS*2, HD_RADIUS*2, 0, 360*64);
@@ -16168,6 +24649,15 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
byte *outpic;
int min, max, del, h, s, v;
int f, p, q, t, vs100, vsf10000;
+@@ -3200,7 +3200,7 @@
+
+ if (whtHD.enabCB.val && whtHD.satval) hsvmod++;
+
+- if (satDial.val != 0) hsvmod++;
++ if (satDial.val != 0.0) hsvmod++;
+
+ /* check intensity graf */
+ for (i=0; i<256; i++) {
@@ -3270,7 +3270,7 @@
/* map near-black to black to avoid weird effects */
@@ -16177,6 +24667,15 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
/* apply intGraf.func[] function to 'v' (the intensity) */
v = intGraf.func[v];
+@@ -3284,7 +3284,7 @@
+ }
+
+ /* apply satDial value to s */
+- s = s + satDial.val;
++ s = s + (int)satDial.val;
+ if (s< 0) s = 0;
+ if (s>100) s = 100;
+
@@ -3295,7 +3295,7 @@
if (h==NOHUE || !s) { rv = gv = bv = v; }
else {
@@ -16204,30 +24703,91 @@ diff -ruN xv-3.10a/xvgam.c xv-3.10a-bugfixes/xvgam.c
*op++ = gGraf.func[gv];
*op++ = bGraf.func[bv];
}
-diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
+diff -ru xv-3.10a/xvgif.c xv-3.10a-enhancements/xvgif.c
--- xv-3.10a/xvgif.c 1995-01-10 11:54:41.000000000 -0800
-+++ xv-3.10a-bugfixes/xvgif.c 2005-04-03 11:53:13.000000000 -0700
-@@ -28,13 +28,14 @@
++++ xv-3.10a-enhancements/xvgif.c 2007-05-13 17:33:51.000000000 -0700
+@@ -28,17 +28,19 @@
typedef int boolean;
#define NEXTBYTE (*dataptr++)
+#define SKIPBYTE (dataptr++) /* quiet some compiler warnings */
#define EXTENSION 0x21
- #define IMAGESEP 0x2c
+-#define IMAGESEP 0x2c
++#define IMAGESEP 0x2c /* a.k.a. Image Descriptor */
#define TRAILER 0x3b
#define INTERLACEMASK 0x40
#define COLORMAPMASK 0x80
-
-+
-
- FILE *fp;
-
-@@ -82,11 +83,11 @@
- char *id89 = "GIF89a";
- static int EGApalette[16][3] = {
+-FILE *fp;
+
+-int BitOffset = 0, /* Bit Offset of next code */
++static FILE *fp;
++
++static int
++ BitOffset = 0, /* Bit Offset of next code */
+ XC = 0, YC = 0, /* Output X and Y coords of current pixel */
+ Pass = 0, /* Used by output routine if interlaced pic */
+ OutCount = 0, /* Decompressor output 'stack count' */
+@@ -46,9 +48,10 @@
+ Width, Height, /* image dimensions */
+ LeftOfs, TopOfs, /* image offset */
+ BitsPerPixel, /* Bits per pixel, read from GIF header */
+- BytesPerScanline, /* bytes per scanline in output raster */
++/* BytesPerScanline, */ /* bytes per scanline in output raster */
+ ColorMapSize, /* number of colors */
+ Background, /* background color */
++ Transparent, /* transparent color (GRR 19980314) */
+ CodeSize, /* Code size, read from GIF header */
+ InitCodeSize, /* Starting code size, used during Clear */
+ Code, /* Value returned by ReadCode */
+@@ -57,47 +60,49 @@
+ EOFCode, /* GIF end-of-information code */
+ CurCode, OldCode, InCode, /* Decompressor variables */
+ FirstFree, /* First free code, generated per GIF spec */
+- FreeCode, /* Decompressor,next free slot in hash table */
++ FreeCode, /* Decompressor, next free slot in hash table */
+ FinChar, /* Decompressor variable */
+ BitMask, /* AND mask for data size */
+ ReadMask, /* Code AND mask for current code size */
+- Misc; /* miscellaneous bits (interlace, local cmap)*/
++ Misc, /* miscellaneous bits (interlace, local cmap)*/
++ GlobalBitsPerPixel, /* may have local colormap of different size */
++ GlobalColorMapSize, /* (ditto) */
++ GlobalBitMask; /* (ditto) */
+
+
+-boolean Interlace, HasColormap;
++static boolean Interlace, HasGlobalColormap;
+
+-byte *RawGIF; /* The heap array to hold it, raw */
+-byte *Raster; /* The raster data stream, unblocked */
+-byte *pic8;
++static byte *RawGIF; /* The heap array to hold it, raw */
++static byte *Raster; /* The raster data stream, unblocked */
++static byte *pic8;
+
+ /* The hash table used by the decompressor */
+-int Prefix[4096];
+-int Suffix[4096];
++static int Prefix[4096];
++static int Suffix[4096];
+
+ /* An output array used by the decompressor */
+-int OutCode[4097];
++static int OutCode[4097];
+
+-int gif89 = 0;
+-char *id87 = "GIF87a";
+-char *id89 = "GIF89a";
++static int gif89 = 0;
++static const char *id87 = "GIF87a";
++static const char *id89 = "GIF89a";
+
+-static int EGApalette[16][3] = {
- {0,0,0}, {0,0,128}, {0,128,0}, {0,128,128},
++static int const EGApalette[16][3] = {
+ {0,0,0}, {0,0,128}, {0,128,0}, {0,128,128},
{128,0,0}, {128,0,128}, {128,128,0}, {200,200,200},
{100,100,100}, {100,100,255}, {100,255,100}, {100,255,255},
@@ -16237,23 +24797,49 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
static int readImage PARM((PICINFO *));
static int readCode PARM((void));
-@@ -108,12 +109,13 @@
+ static void doInterlace PARM((int));
+-static int gifError PARM((PICINFO *, char *));
+-static void gifWarning PARM((char *));
++static int gifError PARM((PICINFO *, const char *));
++static void gifWarning PARM((const char *));
+
+-int filesize;
+-char *bname;
+-
+-byte *dataptr;
++static int filesize;
++static const char *bname;
++static byte *dataptr;
+
+
+ /*****************************/
+@@ -108,17 +113,22 @@
{
/* returns '1' if successful */
- register byte ch, ch1, *origptr;
+ register byte ch, *origptr;
register int i, block;
- int aspect, gotimage;
+- int aspect, gotimage;
++ int aspect;
++ char tmpname[256];
++ byte r[256], g[256], b[256];
/* initialize variables */
- BitOffset = XC = YC = Pass = OutCount = gotimage = 0;
-+ BitOffset = XC = YC = OutCount = gotimage = 0;
++ BitOffset = XC = YC = OutCount = 0;
+ Pass = -1;
RawGIF = Raster = pic8 = NULL;
gif89 = 0;
++ Transparent = -1;
-@@ -129,16 +131,19 @@
+ pinfo->pic = (byte *) NULL;
+ pinfo->comment = (char *) NULL;
++ pinfo->numpages= 0;
+
+ bname = BaseName(fname);
+ fp = xv_fopen(fname,"r");
+@@ -129,67 +139,87 @@
fseek(fp, 0L, 2);
filesize = ftell(fp);
fseek(fp, 0L, 0);
@@ -16272,16 +24858,18 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
- return( gifError(pinfo, "not enough memory to read gif file") );
-
- if (fread(dataptr, (size_t) filesize, (size_t) 1, fp) != 1)
+- return( gifError(pinfo, "GIF data read failed") );
+ FatalError("LoadGIF: not enough memory to read GIF file");
-+
+
+ if (!(Raster = (byte *) calloc((size_t) filesize+256,(size_t) 1)))
+ FatalError("LoadGIF: not enough memory to read GIF file");
+
+ if (fread(dataptr, (size_t) filesize, (size_t) 1, fp) != 1)
- return( gifError(pinfo, "GIF data read failed") );
++ return( gifError(pinfo, "GIF data read failed") );
++ fclose(fp);
+ origptr = dataptr;
-@@ -147,35 +152,35 @@
if (strncmp((char *) dataptr, id87, (size_t) 6)==0) gif89 = 0;
else if (strncmp((char *) dataptr, id89, (size_t) 6)==0) gif89 = 1;
else return( gifError(pinfo, "not a GIF file"));
@@ -16298,15 +24886,22 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
ch = NEXTBYTE;
RHeight = ch + 0x100 * NEXTBYTE;
-
++ if (DEBUG) fprintf(stderr,"GIF89 logical screen = %d x %d\n",RWidth,RHeight);
+
ch = NEXTBYTE;
- HasColormap = ((ch & COLORMAPMASK) ? True : False);
+- HasColormap = ((ch & COLORMAPMASK) ? True : False);
-
-+
- BitsPerPixel = (ch & 7) + 1;
- numcols = ColorMapSize = 1 << BitsPerPixel;
- BitMask = ColorMapSize - 1;
+- BitsPerPixel = (ch & 7) + 1;
+- numcols = ColorMapSize = 1 << BitsPerPixel;
+- BitMask = ColorMapSize - 1;
-
++ HasGlobalColormap = ((ch & COLORMAPMASK) ? True : False);
++
++ /* GRR 20070318: fix decoding bug when global and local color-table sizes
++ * differ */
++ GlobalBitsPerPixel = BitsPerPixel = (ch & 7) + 1;
++ GlobalColorMapSize = ColorMapSize = numcols = 1 << BitsPerPixel;
++ GlobalBitMask = BitMask = ColorMapSize - 1;
+
Background = NEXTBYTE; /* background color... not used. */
-
@@ -16316,6 +24911,8 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
if (!gif89) return(gifError(pinfo,"corrupt GIF file (screen descriptor)"));
else normaspect = (float) (aspect + 15) / 64.0; /* gif89 aspect ratio */
if (DEBUG) fprintf(stderr,"GIF89 aspect = %f\n", normaspect);
++ /* FIXME: apparently this _should_ apply to all frames in a multi-image
++ * GIF (i.e., PgUp/PgDn), but it doesn't */
}
-
-
@@ -16323,11 +24920,46 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
+
/* Read in global colormap. */
-
+- if (HasColormap)
+
- if (HasColormap)
++ if (HasGlobalColormap)
for (i=0; i<ColorMapSize; i++) {
- pinfo->r[i] = NEXTBYTE;
-@@ -221,19 +226,19 @@
+- pinfo->r[i] = NEXTBYTE;
+- pinfo->g[i] = NEXTBYTE;
+- pinfo->b[i] = NEXTBYTE;
++ r[i] = NEXTBYTE;
++ g[i] = NEXTBYTE;
++ b[i] = NEXTBYTE;
+ }
+- else { /* no colormap in GIF file */
++ else { /* no _global_ colormap in GIF file (but may have local one(s)) */
+ /* put std EGA palette (repeated 16 times) into colormap, for lack of
+- anything better to do */
++ anything better to do at the moment */
+
+ for (i=0; i<256; i++) {
+- pinfo->r[i] = EGApalette[i&15][0];
+- pinfo->g[i] = EGApalette[i&15][1];
+- pinfo->b[i] = EGApalette[i&15][2];
++ r[i] = EGApalette[i&15][0];
++ g[i] = EGApalette[i&15][1];
++ b[i] = EGApalette[i&15][2];
++ }
++ }
++ memcpy(pinfo->r, r, sizeof r);
++ memcpy(pinfo->g, g, sizeof g);
++ memcpy(pinfo->b, b, sizeof b);
++
++ if (DEBUG > 1) {
++ fprintf(stderr," global color table%s:\n",
++ HasGlobalColormap? "":" (repeated EGA palette)");
++ for (i=0; i<ColorMapSize; i++) {
++ fprintf(stderr," (%3d %02x,%02x,%02x)\n", i, pinfo->r[i],
++ pinfo->g[i], pinfo->b[i]);
+ }
+ }
+
+@@ -221,19 +251,19 @@
if (blocksize == 2) {
aspnum = NEXTBYTE;
aspden = NEXTBYTE;
@@ -16351,7 +24983,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
}
}
-@@ -254,9 +259,11 @@
+@@ -254,9 +284,11 @@
if (cmtlen>0) { /* build into one un-blocked comment */
@@ -16365,7 +24997,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
sp = cmt;
do {
sbsize = (*ptr1++);
-@@ -267,10 +274,10 @@
+@@ -267,10 +299,10 @@
if (pinfo->comment) { /* have to strcat onto old comments */
cmt1 = (byte *) malloc(strlen(pinfo->comment) + cmtlen + 2);
if (!cmt1) {
@@ -16378,7 +25010,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
strcpy((char *) cmt1, (char *) pinfo->comment);
strcat((char *) cmt1, (char *) "\n");
strcat((char *) cmt1, (char *) cmt);
-@@ -288,8 +295,8 @@
+@@ -288,8 +320,8 @@
else if (fn == 0x01) { /* PlainText Extension */
int j,sbsize,ch;
int tgLeft, tgTop, tgWidth, tgHeight, cWidth, cHeight, fg, bg;
@@ -16389,7 +25021,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
"PlainText extension found in GIF file. Ignored.");
sbsize = NEXTBYTE;
-@@ -302,12 +309,12 @@
+@@ -302,12 +334,12 @@
fg = NEXTBYTE;
bg = NEXTBYTE;
i=12;
@@ -16405,20 +25037,39 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
/* read (and ignore) data sub-blocks */
do {
j = 0;
-@@ -326,16 +333,16 @@
+@@ -326,16 +358,32 @@
if (DEBUG) fprintf(stderr,"Graphic Control extension\n\n");
- SetISTR(ISTR_INFO, "%s: %s", bname,
-+ SetISTR(ISTR_INFO, "%s: %s", bname,
- "Graphic Control Extension in GIF file. Ignored.");
+- "Graphic Control Extension in GIF file. Ignored.");
-
+- /* read (and ignore) data sub-blocks */
++ SetISTR(ISTR_INFO, "%s: %s", bname,
++ "Graphic Control Extension ignored.");
+
- /* read (and ignore) data sub-blocks */
++ /* read (and ignore) data sub-blocks, unless compositing with
++ * user-defined background */
do {
- j = 0; sbsize = NEXTBYTE;
+- j = 0; sbsize = NEXTBYTE;
- while (j<sbsize) { NEXTBYTE; j++; }
-+ while (j<sbsize) { SKIPBYTE; j++; }
++ j = 0;
++ sbsize = NEXTBYTE;
++ /* GRR 19980314: get transparent index out of block */
++ if (have_imagebg && sbsize == 4 && Transparent < 0) {
++ byte packed_fields = NEXTBYTE;
++
++ j++;
++ SKIPBYTE; j++;
++ SKIPBYTE; j++;
++ if (packed_fields & 1) {
++ Transparent = NEXTBYTE;
++ j++;
++ }
++ }
++ while (j<sbsize) {
++ SKIPBYTE; j++;
++ }
} while (sbsize);
}
-
@@ -16426,7 +25077,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
else if (fn == 0xFF) { /* Application Extension */
int j, sbsize;
-@@ -345,10 +352,10 @@
+@@ -345,10 +393,10 @@
/* read (and ignore) data sub-blocks */
do {
j = 0; sbsize = NEXTBYTE;
@@ -16439,7 +25090,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
else { /* unknown extension */
int j, sbsize;
-@@ -358,11 +365,11 @@
+@@ -358,48 +406,68 @@
SetISTR(ISTR_INFO,
"%s: Unknown extension 0x%02x in GIF file. Ignored.",
bname, fn);
@@ -16453,71 +25104,146 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
} while (sbsize);
}
}
-@@ -370,36 +377,36 @@
+
else if (block == IMAGESEP) {
- if (DEBUG) fprintf(stderr,"imagesep (got=%d) ",gotimage);
+- if (DEBUG) fprintf(stderr,"imagesep (got=%d) ",gotimage);
- if (DEBUG) fprintf(stderr," at start: offset=0x%lx\n",dataptr-RawGIF);
-+ if (DEBUG) fprintf(stderr," at start: offset=0x%x\n",dataptr-RawGIF);
-
- if (gotimage) { /* just skip over remaining images */
- int i,misc,ch,ch1;
-
- /* skip image header */
+-
+- if (gotimage) { /* just skip over remaining images */
+- int i,misc,ch,ch1;
+-
+- /* skip image header */
- NEXTBYTE; NEXTBYTE; /* left position */
- NEXTBYTE; NEXTBYTE; /* top position */
- NEXTBYTE; NEXTBYTE; /* width */
- NEXTBYTE; NEXTBYTE; /* height */
-+ SKIPBYTE; SKIPBYTE; /* left position */
-+ SKIPBYTE; SKIPBYTE; /* top position */
-+ SKIPBYTE; SKIPBYTE; /* width */
-+ SKIPBYTE; SKIPBYTE; /* height */
- misc = NEXTBYTE; /* misc. bits */
-
- if (misc & 0x80) { /* image has local colormap. skip it */
- for (i=0; i< 1 << ((misc&7)+1); i++) {
+- misc = NEXTBYTE; /* misc. bits */
+-
+- if (misc & 0x80) { /* image has local colormap. skip it */
+- for (i=0; i< 1 << ((misc&7)+1); i++) {
- NEXTBYTE; NEXTBYTE; NEXTBYTE;
-+ SKIPBYTE; SKIPBYTE; SKIPBYTE;
++ if (DEBUG) fprintf(stderr, "imagesep (page=%d)\n", pinfo->numpages+1);
++ if (DEBUG) fprintf(stderr, " at start: offset=0x%lx\n",
++ (unsigned long)(dataptr-RawGIF));
++
++ BitOffset = XC = YC = Pass = OutCount = 0;
++
++ if (pinfo->numpages > 0) { /* do multipage stuff */
++ if (pinfo->numpages == 1) { /* first time only... */
++ xv_mktemp(pinfo->pagebname, "xvpgXXXXXX"); // a.k.a. close(mkstemp())
++ if (pinfo->pagebname[0] == '\0') {
++ ErrPopUp("LoadGIF: Unable to create temporary filename???",
++ "\nHow unlikely!");
++ return 0;
++ }
++ /* GRR 20070328: basename file doesn't go away, at least on Linux
++ * (though all appended-number ones do); ergo, open for reading (see
++ * if it's there), close, and explicitly unlink() if necessary */
++ /* GRR 20070506: could/should call KillPageFiles() (xv.c) instead */
++ fp = xv_fopen(pinfo->pagebname, "r");
++ if (fp) {
++ fclose(fp);
++ unlink(pinfo->pagebname); /* no errors during testing */
}
}
-
+-
- NEXTBYTE; /* minimum code size */
-+ SKIPBYTE; /* minimum code size */
-
- /* skip image data sub-blocks */
- do {
- ch = ch1 = NEXTBYTE;
+-
+- /* skip image data sub-blocks */
+- do {
+- ch = ch1 = NEXTBYTE;
- while (ch--) NEXTBYTE;
-+ while (ch--) SKIPBYTE;
- if ((dataptr - RawGIF) > filesize) break; /* EOF */
- } while(ch1);
- }
-
- else if (readImage(pinfo)) gotimage = 1;
+- if ((dataptr - RawGIF) > filesize) break; /* EOF */
+- } while(ch1);
+- }
+-
+- else if (readImage(pinfo)) gotimage = 1;
- if (DEBUG) fprintf(stderr," at end: dataptr=0x%lx\n",dataptr-RawGIF);
-+ if (DEBUG) fprintf(stderr," at end: dataptr=0x%x\n",dataptr-RawGIF);
++ sprintf(tmpname, "%s%d", pinfo->pagebname, pinfo->numpages);
++ fp = xv_fopen(tmpname, "w");
++ if (!fp) {
++ ErrPopUp("LoadGIF: Unable to open temp file", "\nDang!");
++ return 0;
++ }
++ if (WriteGIF(fp, pinfo->pic, pinfo->type, pinfo->w, pinfo->h, pinfo->r,
++ pinfo->g, pinfo->b, numcols, pinfo->colType, NULL)) {
++ fclose(fp);
++ ErrPopUp("LoadGIF: Error writing temp file", "\nBummer!");
++ return 0;
++ }
++ fclose(fp);
++ free(pinfo->pic);
++ pinfo->pic = (byte *) NULL;
++ if (HasGlobalColormap) {
++ memcpy(pinfo->r, r, sizeof r);
++ memcpy(pinfo->g, g, sizeof g);
++ memcpy(pinfo->b, b, sizeof b);
++ }
++ BitsPerPixel = GlobalBitsPerPixel;
++ numcols = ColorMapSize = GlobalColorMapSize;
++ BitMask = GlobalBitMask;
++ }
++ if (readImage(pinfo)) ++pinfo->numpages;
++ if (DEBUG) fprintf(stderr, " at end: offset=0x%lx\n",
++ (unsigned long)(dataptr-RawGIF));
}
-@@ -415,7 +422,7 @@
-
+@@ -416,9 +484,9 @@
/* don't mention bad block if file was trunc'd, as it's all bogus */
if ((dataptr - origptr) < filesize) {
-- sprintf(str, "Unknown block type (0x%02x) at offset 0x%lx",
-+ sprintf(str, "Unknown block type (0x%02x) at offset 0x%x",
- block, (dataptr - origptr) - 1);
+ sprintf(str, "Unknown block type (0x%02x) at offset 0x%lx",
+- block, (dataptr - origptr) - 1);
++ block, (unsigned long)(dataptr - origptr) - 1);
- if (!gotimage) return gifError(pinfo, str);
-@@ -431,7 +438,7 @@
+- if (!gotimage) return gifError(pinfo, str);
++ if (!pinfo->numpages) return gifError(pinfo, str);
+ else gifWarning(str);
+ }
+
+@@ -431,8 +499,34 @@
free(RawGIF); RawGIF = NULL;
free(Raster); Raster = NULL;
- if (!gotimage)
-+ if (!gotimage)
++ if (!pinfo->numpages)
return( gifError(pinfo, "no image data found in GIF file") );
++ if (pinfo->numpages > 1) {
++ /* write the last page temp file */
++ int numpages = pinfo->numpages;
++ char *comment = pinfo->comment;
++ sprintf(tmpname, "%s%d", pinfo->pagebname, pinfo->numpages);
++ fp = xv_fopen(tmpname, "w");
++ if (!fp) {
++ ErrPopUp("LoadGIF: Unable to open temp file", "\nDang!");
++ return 0;
++ }
++ if (WriteGIF(fp, pinfo->pic, pinfo->type, pinfo->w, pinfo->h, pinfo->r,
++ pinfo->g, pinfo->b, numcols, pinfo->colType, NULL)) {
++ fclose(fp);
++ ErrPopUp("LoadGIF: Error writing temp file", "\nBummer!");
++ return 0;
++ }
++ fclose(fp);
++ free(pinfo->pic);
++ pinfo->pic = (byte *) NULL;
++
++ /* load the first page temp file */
++ sprintf(tmpname, "%s%d", pinfo->pagebname, 1);
++ i = LoadGIF(tmpname, pinfo);
++ pinfo->numpages = numpages;
++ pinfo->comment = comment;
++ }
return 1;
-@@ -448,7 +455,7 @@
+ }
+@@ -444,11 +538,12 @@
+ {
+ register byte ch, ch1, *ptr1, *picptr;
+ int i, npixels, maxpixels;
++ boolean HasLocalColormap;
+
npixels = maxpixels = 0;
/* read in values from the image descriptor */
@@ -16526,9 +25252,36 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
ch = NEXTBYTE;
LeftOfs = ch + 0x100 * NEXTBYTE;
ch = NEXTBYTE;
-@@ -472,33 +479,33 @@
+@@ -460,45 +555,68 @@
+
+ Misc = NEXTBYTE;
+ Interlace = ((Misc & INTERLACEMASK) ? True : False);
++ HasLocalColormap = ((Misc & COLORMAPMASK) ? True : False);
+
+- if (Misc & 0x80) {
+- for (i=0; i< 1 << ((Misc&7)+1); i++) {
++ if (HasLocalColormap) {
++ BitsPerPixel = (Misc & 7) + 1;
++ ColorMapSize = numcols = 1 << BitsPerPixel; /* GRR 20070318 */
++ BitMask = ColorMapSize - 1;
++ if (DEBUG) fprintf(stderr," local color table, %d bits (%d entries)\n",
++ (Misc&7)+1, ColorMapSize);
++ for (i=0; i<ColorMapSize; i++) {
+ pinfo->r[i] = NEXTBYTE;
+ pinfo->g[i] = NEXTBYTE;
+ pinfo->b[i] = NEXTBYTE;
+ }
++ if (DEBUG > 1) {
++ for (i=0; i<ColorMapSize; i++) {
++ fprintf(stderr," (%3d %02x,%02x,%02x)\n", i, pinfo->r[i],
++ pinfo->g[i], pinfo->b[i]);
++ }
++ }
+ }
- if (!HasColormap && !(Misc&0x80)) {
+
+- if (!HasColormap && !(Misc&0x80)) {
++ if (!HasGlobalColormap && !HasLocalColormap) {
/* no global or local colormap */
- SetISTR(ISTR_WARNING, "%s: %s", bname,
+ SetISTR(ISTR_WARNING, "%s: %s", bname,
@@ -16538,6 +25291,17 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
-
+
++ /* GRR 19980314 */
++ /* need not worry about size of EGA palette: full 256 colors */
++ if (have_imagebg && Transparent >= 0 &&
++ Transparent < ((Misc&0x80)? (1 << ((Misc&7)+1)) : ColorMapSize) )
++ {
++ pinfo->r[Transparent] = (imagebgR >> 8);
++ pinfo->g[Transparent] = (imagebgG >> 8);
++ pinfo->b[Transparent] = (imagebgB >> 8);
++ }
++
++
+
/* Start reading the raster data. First we get the intial code size
* and compute decompressor constant values, based on this code size.
@@ -16567,7 +25331,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
/* UNBLOCK:
-@@ -506,7 +513,7 @@
+@@ -506,7 +624,7 @@
* to the Raster array, turning it from a series of blocks into one long
* data stream, which makes life much easier for readCode().
*/
@@ -16576,8 +25340,12 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
ptr1 = Raster;
do {
ch = ch1 = NEXTBYTE;
-@@ -525,18 +532,21 @@
- fprintf(stderr,"xv: LoadGIF() - picture is %dx%d, %d bits, %sinterlaced\n",
+@@ -522,21 +640,24 @@
+
+
+ if (DEBUG) {
+- fprintf(stderr,"xv: LoadGIF() - picture is %dx%d, %d bits, %sinterlaced\n",
++ fprintf(stderr,"LoadGIF: image is %dx%d, %d bits, %sinterlaced\n",
Width, Height, BitsPerPixel, Interlace ? "" : "non-");
}
-
@@ -16591,7 +25359,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
picptr = pic8 = (byte *) malloc((size_t) maxpixels);
- if (!pic8) return( gifError(pinfo, "couldn't malloc 'pic8'") );
+ if (!pic8) FatalError("LoadGIF: couldn't malloc 'pic8'");
-+
++
+
-
@@ -16603,7 +25371,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
Code = readCode();
while (Code != EOFCode) {
/* Clear code sets everything back to its initial value, then reads the
-@@ -563,58 +573,58 @@
+@@ -563,58 +684,58 @@
break; }
CurCode = InCode = Code;
@@ -16674,7 +25442,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
FreeCode++;
if (FreeCode >= MaxCode) {
if (CodeSize < 12) {
-@@ -627,7 +637,7 @@
+@@ -627,20 +748,19 @@
Code = readCode();
if (npixels >= maxpixels) break;
}
@@ -16683,7 +25451,14 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
if (npixels != maxpixels) {
SetISTR(ISTR_WARNING,"%s: %s", bname,
"This GIF file seems to be truncated. Winging it.");
-@@ -640,7 +650,7 @@
+ if (!Interlace) /* clear->EOBuffer */
+- xvbzero((char *) pic8+npixels, (size_t) (maxpixels-npixels));
++ xvbzero((char *) pic8+npixels,
++ (size_t) (maxpixels-npixels<0 ? 0 : maxpixels-npixels));
+ }
+
+- fclose(fp);
+-
/* fill in the PICINFO structure */
pinfo->pic = pic8;
@@ -16692,7 +25467,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
pinfo->h = Height;
pinfo->type = PIC8;
pinfo->frmType = F_GIF;
-@@ -650,8 +660,8 @@
+@@ -650,8 +770,8 @@
sprintf(pinfo->fullInfo,
"GIF%s, %d bit%s per pixel, %sinterlaced. (%d bytes)",
@@ -16703,7 +25478,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
Interlace ? "" : "non-", filesize);
sprintf(pinfo->shrtInfo, "%dx%d GIF%s.",Width,Height,(gif89) ? "89" : "87");
-@@ -668,13 +678,13 @@
+@@ -668,13 +788,13 @@
* maintain our location in the Raster array as a BIT Offset. We compute
* the byte Offset into the raster array by dividing this by 8, pick up
* three bytes, compute the bit Offset into our 24-bit chunk, shift to
@@ -16719,7 +25494,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
ByteOffset = BitOffset / 8;
RawCode = Raster[ByteOffset] + (Raster[ByteOffset + 1] << 8);
if (CodeSize >= 8)
-@@ -692,42 +702,47 @@
+@@ -692,42 +812,47 @@
{
static byte *ptr = NULL;
static int oldYC = -1;
@@ -16778,7 +25553,7 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
default:
break;
}
-@@ -735,7 +750,7 @@
+@@ -735,11 +860,11 @@
}
@@ -16786,10 +25561,25 @@ diff -ruN xv-3.10a/xvgif.c xv-3.10a-bugfixes/xvgif.c
+
/*****************************/
static int gifError(pinfo, st)
- PICINFO *pinfo;
-diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
+- PICINFO *pinfo;
+- char *st;
++ PICINFO *pinfo;
++ const char *st;
+ {
+ gifWarning(st);
+
+@@ -760,7 +885,7 @@
+
+ /*****************************/
+ static void gifWarning(st)
+- char *st;
++ const char *st;
+ {
+ SetISTR(ISTR_WARNING,"%s: %s", bname, st);
+ }
+diff -ru xv-3.10a/xvgifwr.c xv-3.10a-enhancements/xvgifwr.c
--- xv-3.10a/xvgifwr.c 1995-01-03 13:22:21.000000000 -0800
-+++ xv-3.10a-bugfixes/xvgifwr.c 2004-05-16 18:03:27.000000000 -0700
++++ xv-3.10a-enhancements/xvgifwr.c 2007-03-31 16:33:23.000000000 -0700
@@ -2,11 +2,11 @@
* xvgifwr.c - handles writing of GIF files. based on flgife.c and
* flgifc.c from the FBM Library, by Michael Maudlin
@@ -16821,7 +25611,26 @@ diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
static void putword PARM((int, FILE *));
static void compress PARM((int, FILE *, byte *, int));
-@@ -97,7 +96,7 @@
+@@ -56,7 +55,7 @@
+ static void flush_char PARM((void));
+
+
+-static byte pc2nc[256],r1[256],g1[256],b1[256];
++static byte pc2nc[256];
+
+
+ /*************************************************************/
+@@ -74,7 +73,8 @@
+ int ColorMapSize, InitCodeSize, Background, BitsPerPixel;
+ int i,j,nc;
+ byte *pic8;
+- byte rtemp[256],gtemp[256],btemp[256];
++ byte rtemp[256],gtemp[256],btemp[256]; /* for 24-bit to 8-bit conversion */
++ byte r1[256],g1[256],b1[256]; /* for duplicated-color remapping */
+
+ if (ptype == PIC24) { /* have to quantize down to 8 bits */
+ pic8 = Conv24to8(pic, w, h, 256, rtemp,gtemp,btemp);
+@@ -97,7 +97,7 @@
for (i=0; i<numcols; i++) {
/* see if color #i is already used */
for (j=0; j<i; j++) {
@@ -16830,7 +25639,7 @@ diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
bmap[i] == bmap[j]) break;
}
-@@ -115,15 +114,15 @@
+@@ -115,15 +115,15 @@
/* figure out 'BitsPerPixel' */
for (i=1; i<8; i++)
if ( (1<<i) >= nc) break;
@@ -16849,7 +25658,7 @@ diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
CountDown = w * h; /* # of pixels we'll be doing */
if (BitsPerPixel <= 1) InitCodeSize = 2;
-@@ -137,7 +136,7 @@
+@@ -137,7 +137,7 @@
return (1);
}
@@ -16858,7 +25667,7 @@ diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
fprintf(stderr,"WrGIF: pic=%lx, w,h=%dx%d, numcols=%d, Bits%d,Cmap=%d\n",
(u_long) pic8, w,h,numcols,BitsPerPixel,ColorMapSize);
-@@ -152,7 +151,7 @@
+@@ -152,7 +152,7 @@
i = 0x80; /* Yes, there is a color map */
i |= (8-1)<<4; /* OR in the color resolution (hardwired 8) */
i |= (BitsPerPixel - 1); /* OR in the # of bits per pixel */
@@ -16867,7 +25676,7 @@ diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
fputc(Background, fp); /* background color */
-@@ -290,7 +289,7 @@
+@@ -290,7 +290,7 @@
/*
* compress stdin to stdout
*
@@ -16876,7 +25685,7 @@ diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
* prefix code / next character combination. We do a variant of Knuth's
* algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
* secondary probe. Here, the modular division first probe is gives way
-@@ -370,7 +369,7 @@
+@@ -370,7 +370,7 @@
cl_hash( (count_int) hsize_reg); /* clear hash table */
output(ClearCode);
@@ -16885,7 +25694,7 @@ diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
while (len) {
c = pc2nc[*data++]; len--;
in_count++;
-@@ -399,7 +398,7 @@
+@@ -399,7 +399,7 @@
continue;
}
@@ -16894,7 +25703,7 @@ diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
goto probe;
nomatch:
-@@ -454,7 +453,7 @@
+@@ -454,7 +454,7 @@
cur_accum |= ((long)code << cur_bits);
else
cur_accum = code;
@@ -16903,7 +25712,7 @@ diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
cur_bits += n_bits;
while( cur_bits >= 8 ) {
-@@ -482,7 +481,7 @@
+@@ -482,7 +482,7 @@
maxcode = MAXCODE(n_bits);
}
}
@@ -16912,7 +25721,7 @@ diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
if( code == EOFCode ) {
/* At EOF, write the rest of the buffer */
while( cur_bits > 0 ) {
-@@ -492,11 +491,11 @@
+@@ -492,11 +492,11 @@
}
flush_char();
@@ -16926,7 +25735,7 @@ diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
FatalError("unable to write GIF file");
#endif
}
-@@ -582,7 +581,7 @@
+@@ -582,7 +582,7 @@
int c;
{
accum[ a_count++ ] = c;
@@ -16935,15 +25744,15 @@ diff -ruN xv-3.10a/xvgifwr.c xv-3.10a-bugfixes/xvgifwr.c
flush_char();
}
-@@ -596,4 +595,4 @@
+@@ -596,4 +596,4 @@
fwrite(accum, (size_t) 1, (size_t) a_count, g_outfile );
a_count = 0;
}
-}
+}
-diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
+diff -ru xv-3.10a/xvgrab.c xv-3.10a-enhancements/xvgrab.c
--- xv-3.10a/xvgrab.c 1994-12-22 14:34:47.000000000 -0800
-+++ xv-3.10a-bugfixes/xvgrab.c 2004-05-16 18:03:30.000000000 -0700
++++ xv-3.10a-enhancements/xvgrab.c 2005-04-25 23:39:32.000000000 -0700
@@ -6,7 +6,7 @@
* Contains:
* int Grab() - handles the GRAB command
@@ -16953,7 +25762,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
*/
#include "copyright.h"
-@@ -14,29 +14,54 @@
+@@ -14,28 +14,60 @@
#define NEEDSTIME
#include "xv.h"
@@ -16976,20 +25785,27 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
-static int lowbitnum PARM((unsigned long));
-static int getxcolors PARM((XWindowAttributes *, XColor **));
-static Window xvClientWindow PARM((Display *, Window));
-+
++/* Allow flexibility in use of buttons JPD */
++#define WINDOWGRABMASK Button1Mask /* JPD prefers Button2Mask */
++#define RECTGTRACKMASK Button2Mask /* JPD prefers Button1Mask*/
++#define CANCELGRABMASK Button3Mask
+
++#define DO_GRABFLASH /* JPD prefers not to do that; just a loss of time ... */
+
+
+union swapun {
+ CARD32 l;
+ CARD16 s;
+ CARD8 b[sizeof(CARD32)];
+};
-
-
++
++
+struct rectlist {
+ int x,y,w,h;
+ struct rectlist *next;
+};
-
-
++
++
+static byte *grabPic = (byte *) NULL;
+static int gptype;
+static byte grabmapR[256], grabmapG[256], grabmapB[256];
@@ -17023,21 +25839,30 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
+
+static int Trivial24to8 PARM((byte *, int, int, byte *,
+ byte *, byte *, byte *, int));
-+
+
/***********************************/
int Grab()
- {
-@@ -45,8 +70,7 @@
+@@ -44,13 +76,15 @@
+ 0 if cancelled */
int i, x, y, x1, y1, x2, y2, ix, iy, iw, ih, rv;
- int rx, ry, pretendGotB1, autograb;
+- int rx, ry, pretendGotB1, autograb;
- int oldaclose;
- Window rW, cW, clickWin, tmpwin;
++ int rx, ry, GotButton, autograb;
++ int cancelled = 0;
+ Window rW, cW, clickWin;
unsigned int mask;
++#ifdef RECOLOR_GRAB_CURSOR
XColor fc, bc;
++#endif
-@@ -75,7 +99,7 @@
+- pretendGotB1 = 0;
++ GotButton = 0;
+
+ if (grabInProgress) return 0; /* avoid recursive grabs during delay */
+
+@@ -75,7 +109,7 @@
grabInProgress = 1; /* guard against recursive grabs during delay */
time(&startT);
while (1) {
@@ -17046,7 +25871,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
if (t >= startT + grabDelay) break;
if (XPending(theDisp)>0) {
XEvent evt;
-@@ -91,25 +115,25 @@
+@@ -91,25 +125,33 @@
grabInProgress = 0;
}
@@ -17059,17 +25884,26 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
free(grabPic); grabPic = (byte *) NULL;
}
-
+-
++ /* recolor cursor to indicate that grabbing is active? */
++ /* Instead, change cursor JPD */
++#ifdef RECOLOR_GRAB_CURSOR
fc.flags = bc.flags = DoRed | DoGreen | DoBlue;
- fc.red = fc.green = fc.blue = 0xffff;
+ fc.red = fc.green = fc.blue = 0xffff;
bc.red = bc.green = bc.blue = 0x0000;
XRecolorCursor(theDisp, tcross, &fc, &bc);
++#endif
XBell(theDisp, 0); /* beep once at start of grab */
- if (!autograb) XGrabButton(theDisp, (u_int) AnyButton, 0, rootW, False, 0,
++ /* Change cursor to top_left_corner JPD */
++ XGrabPointer(theDisp, rootW, False,
++ PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
++ GrabModeAsync, GrabModeAsync, None, tlcorner, CurrentTime);
++
+ if (!autograb) XGrabButton(theDisp, (u_int) AnyButton, 0, rootW, False, 0,
GrabModeAsync, GrabModeSync, None, tcross);
-
@@ -17077,7 +25911,16 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
if (autograb) {
XGrabServer(theDisp); /* until we've done the grabImage */
if (!XQueryPointer(theDisp,rootW,&rW,&cW,&rx,&ry,&x1,&y1,&mask)) {
-@@ -136,7 +160,7 @@
+@@ -118,7 +160,7 @@
+ rv = 0;
+ goto exit;
+ }
+- else { pretendGotB1 = 1; mask = Button1Mask; }
++ else { GotButton = 1; mask = WINDOWGRABMASK; }
+ }
+
+ else { /* !autograb */
+@@ -136,7 +178,7 @@
XNextEvent(theDisp, &evt);
i = HandleEvent(&evt, &done);
if (done) { /* only 'new image' cmd accepted=quit */
@@ -17086,24 +25929,30 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
XUngrabButton(theDisp, (u_int) AnyButton, 0, rootW);
Quit(0);
}
-@@ -145,12 +169,12 @@
+@@ -145,99 +187,75 @@
}
}
-
-
+
++ XUngrabPointer(theDisp, CurrentTime);
++ /* Reset cursor to XC_tcross JPD */
++ XGrabPointer(theDisp, rootW, False,
++ PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
++ GrabModeAsync, GrabModeAsync, None, tcross, CurrentTime);
+
/***
*** got button click (or pretending we did, if autograb)
***/
-
-+
- if (mask & Button3Mask || rW!=rootW) { /* Button3: CANCEL GRAB */
+- if (mask & Button3Mask || rW!=rootW) { /* Button3: CANCEL GRAB */
++ if (mask & CANCELGRABMASK || rW!=rootW) { /* CANCEL GRAB */
while (1) { /* wait for button to be released */
-@@ -158,7 +182,7 @@
- if (!(mask & Button3Mask)) break;
+ if (XQueryPointer(theDisp,rootW,&rW,&cW,&rx,&ry,&x1,&y1,&mask)) {
+- if (!(mask & Button3Mask)) break;
++ if (!(mask & CANCELGRABMASK)) break;
}
}
-
@@ -17111,8 +25960,21 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
XUngrabButton(theDisp, (u_int) AnyButton, 0, rootW);
XBell(theDisp, 0);
XBell(theDisp, 0);
-@@ -175,69 +199,40 @@
- if (!(mask & Button1Mask)) break;
+ rv = 0;
++ cancelled = 1;
+ goto exit;
+ }
+
+
+-
+- if (mask & Button1Mask) { /* Button1: GRAB WINDOW (& FRAME, maybe) */
+- while (!pretendGotB1) { /* wait for button to be released, if clicked */
++ if (mask & WINDOWGRABMASK) { /* GRAB WINDOW (& FRAME, maybe) */
++ while (!GotButton) { /* wait for button to be released, if clicked */
+ int rx,ry,x1,y1; Window rW, cW;
+ if (XQueryPointer(theDisp,rootW,&rW,&cW,&rx,&ry,&x1,&y1,&mask)) {
+- if (!(mask & Button1Mask)) break;
++ if (!(mask & WINDOWGRABMASK)) break;
}
}
-
@@ -17148,6 +26010,8 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
-
-
+
++ grabwin:
++
+ clickWin = (cW) ? cW : rootW;
+
if (clickWin == rootW) { /* grab entire screen */
@@ -17178,7 +26042,6 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
-
-
+
-+
/* range checking: keep rectangle fully on-screen */
if (ix<0) { iw += ix; ix = 0; }
if (iy<0) { ih += iy; iy = 0; }
@@ -17194,9 +26057,13 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
/* flash the rectangle a bit... */
startflash();
for (i=0; i<5; i++) {
-@@ -252,13 +247,12 @@
+@@ -249,23 +267,21 @@
+ endflash();
+ }
- else { /* Button2: TRACK A RECTANGLE */
+-
+- else { /* Button2: TRACK A RECTANGLE */
++ else { /* TRACK A RECTANGLE */
int origrx, origry;
- Window origcW;
@@ -17210,7 +26077,15 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
XGrabServer(theDisp);
startflash();
-@@ -276,51 +270,36 @@
+ /* Wait for button release while tracking rectangle on screen */
+ while (1) {
+ if (XQueryPointer(theDisp,rootW,&rW,&cW,&rx,&ry,&x,&y,&mask)) {
+- if (!(mask & Button2Mask)) break;
++ if (!(mask & RECTGTRACKMASK)) break;
+ }
+
+ flashrect(ix, iy, iw, ih, 0); /* turn off rect */
+@@ -276,57 +292,63 @@
iw = abs(rx - x1); ih = abs(ry - y1);
x2 = rx; y2 = ry;
}
@@ -17221,6 +26096,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
flashrect(ix, iy, iw, ih, 0); /* turn off rect */
+
++#ifdef DO_GRABFLASH
+ /* flash the rectangle a bit... */
+ for (i=0; i<5; i++) {
+ flashrect(ix, iy, iw, ih, 1);
@@ -17228,10 +26104,11 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
+ flashrect(ix, iy, iw, ih, 0);
+ XFlush(theDisp); Timer(100);
+ }
++#endif
++
endflash();
-
-+
- XUngrabServer(theDisp);
+- XUngrabServer(theDisp);
-
-
- if (origcW == cW) { /* maybe it's entirely in one window??? */
@@ -17256,13 +26133,25 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
- if (DEBUG) fprintf(stderr,"\n");
- }
- else clickWin = rootW;
-- }
++
++ /* if rectangle has zero width or height, search for child window JPD */
++ if (iw==0 && ih==0) {
++ int xr, yr;
++ Window childW = 0;
++ if (rW && cW)
++ XTranslateCoordinates(theDisp, rW, cW, rx, ry, &xr, &yr, &childW);
++ if (childW)
++ cW = childW;
++ goto grabwin;
+ }
++
++ XUngrabServer(theDisp);
}
-
-+
/***
- *** now that clickWin,ix,iy,iw,ih are known, try to grab the bits...
++ *** now that clickWin,ix,iy,iw,ih are known, try to grab the bits :
+ *** grab screen area (ix,iy,iw,ih)
***/
@@ -17277,7 +26166,21 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
SetCursors(-1);
-@@ -337,25 +316,25 @@
+-
+ exit:
+
++ XUngrabPointer(theDisp, CurrentTime);
++ XUngrabServer(theDisp);
++
++ if (startGrab) {
++ startGrab = 0;
++ if (cancelled) Quit(0);
++ }
++
+ if (hidewins) { /* remap XV windows */
+ autoclose += 2; /* force it on once */
+ if (mainW && dispMode == RMB_WINDOW) {
+@@ -337,25 +359,25 @@
if (DEBUG) fprintf(stderr,"==remapped mainW. waiting for Config.\n");
@@ -17310,7 +26213,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
else if (ctrlW) CtrlBox(1);
}
-@@ -364,6 +343,45 @@
+@@ -364,6 +386,45 @@
/***********************************/
@@ -17356,7 +26259,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
static void flashrect(x,y,w,h,show)
int x,y,w,h,show;
{
-@@ -373,7 +391,7 @@
+@@ -373,7 +434,7 @@
XSetPlaneMask(theDisp, rootGC, xorMasks[maskno]);
if (!show) { /* turn off rectangle */
@@ -17365,7 +26268,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
XDrawRectangle(theDisp, rootW, rootGC, x, y, (u_int) w-1, (u_int) h-1);
isvis = 0;
-@@ -391,15 +409,16 @@
+@@ -391,15 +452,16 @@
/***********************************/
static void startflash()
@@ -17384,7 +26287,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
XSetFunction(theDisp, rootGC, GXcopy);
XSetSubwindowMode(theDisp, rootGC, ClipByChildren);
XSetPlaneMask(theDisp, rootGC, AllPlanes);
-@@ -408,21 +427,157 @@
+@@ -408,21 +470,157 @@
/***********************************/
@@ -17552,7 +26455,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
/* range checking */
if (x<0) { w += x; x = 0; }
-@@ -430,86 +585,246 @@
+@@ -430,86 +628,246 @@
if (x+w>dispWIDE) w = dispWIDE-x;
if (y+h>dispHIGH) h = dispHIGH-y;
@@ -17629,19 +26532,19 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
+ }
+ regrabList = (struct rectlist *) NULL;
+ }
-+
-+ if (i) {
-+ ErrPopUp("Warning: Problems occurred during grab.","\nWYSInWYG!");
-+ return 0;
-+ }
- /* DO *NOT* use xvDestroyImage(), as the 'data' field was alloc'd by X, not
- necessarily through 'malloc() / free()' */
- XDestroyImage(image);
-
- if (colors) free((char *) colors);
++ if (i) {
++ ErrPopUp("Warning: Problems occurred during grab.","\nWYSInWYG!");
++ return 0;
++ }
- return i;
++
+ /* if 256 or fewer colors in grabPic, make it a PIC8 */
+ i = CountColors24(grabPic, gWIDE, gHIGH, 0,0,gWIDE,gHIGH);
+ if (i<=256) {
@@ -17842,7 +26745,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
/* this code owes a lot to 'xwdtopnm.c', part of the pbmplus package,
written by Jef Poskanzer */
-@@ -528,7 +843,6 @@
+@@ -528,7 +886,6 @@
int isLsbMachine, flipBytes;
Visual *visual;
char errstr[256];
@@ -17850,7 +26753,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
/* quiet compiler warnings */
-@@ -538,20 +852,20 @@
+@@ -538,20 +895,20 @@
pixvalue = 0;
rmask = gmask = bmask = 0;
rshift = gshift = bshift = 0;
@@ -17877,7 +26780,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
? "XYPixmap" : "ZPixmap");
fprintf(stderr,"byte_order = %s, bitmap_bit_order = %s, unit=%d, pad=%d\n",
-@@ -575,41 +889,17 @@
+@@ -575,41 +932,17 @@
sprintf(errstr, "%s\nReturned image bitmap_unit (%d) non-standard.",
"Can't deal with this display.", image->bitmap_unit);
ErrPopUp(errstr, "\nThat Sucks!");
@@ -17921,7 +26824,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
if (visual->class == TrueColor || visual->class == DirectColor) {
unsigned int tmp;
-@@ -634,16 +924,35 @@
+@@ -634,16 +967,35 @@
while (tmp >= 256) { tmp >>= 1; b8shift -= 1; }
while (tmp < 128) { tmp <<= 1; b8shift += 1; }
@@ -17960,7 +26863,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
if (bits_per_pixel == 32) pixmask = 0xffffffff;
else pixmask = (((CARD32) 1) << bits_per_pixel) - 1;
-@@ -652,14 +961,15 @@
+@@ -652,14 +1004,15 @@
/* if we're on an lsbfirst machine, or the image came from an lsbfirst
machine, we should flip the bytes around. NOTE: if we're on an
@@ -17978,7 +26881,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
lineptr = (byte *) image->data + (i * image->bytes_per_line);
bptr = ((CARD8 *) lineptr) - 1;
sptr = ((CARD16 *) lineptr) - 1;
-@@ -667,35 +977,39 @@
+@@ -667,35 +1020,39 @@
bits_used = bits_per_item;
for (j=0; j<image->width; j++) {
@@ -18042,7 +26945,7 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
bits_used = 0;
if (bit_order == MSBFirst) bit_shift = bits_per_item - bits_per_pixel;
else bit_shift = 0;
-@@ -711,11 +1025,11 @@
+@@ -711,11 +1068,11 @@
else bit_shift += bits_per_pixel;
bits_used += bits_per_pixel;
@@ -18057,22 +26960,22 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
break it out into individual r,g,b components */
rval = (pixvalue & rmask) >> rshift;
gval = (pixvalue & gmask) >> gshift;
-@@ -741,212 +1055,169 @@
+@@ -741,212 +1098,165 @@
/* use pixel value as an index into colors array */
if (pixvalue >= ncolors) {
- FatalError("convertImage(): pixvalue >= ncolors");
-- }
--
++ fprintf(stderr, "WARNING: convertImage(): pixvalue >= ncolors\n");
++ return 1;
+ }
+
- if (gbits == 24) { /* too many colors for 8-bit colormap */
- *pptr++ = (colors[pixvalue].red) >> 8;
- *pptr++ = (colors[pixvalue].green) >> 8;
- *pptr++ = (colors[pixvalue].blue) >> 8;
-+ fprintf(stderr, "WARNING: convertImage(): pixvalue >= ncolors\n");
-+ return 1;
- }
+- }
- else *pptr++ = pixvalue & 0xff;
-
+-
+ *pptr++ = (colors[pixvalue].red) >> 8;
+ *pptr++ = (colors[pixvalue].green) >> 8;
+ *pptr++ = (colors[pixvalue].blue) >> 8;
@@ -18095,32 +26998,30 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
{
- /* returns position of lowest set bit in 'ul' as an integer (0-31),
- or -1 if none */
--
++ /* returns 0 if rectangles A and B do not intersect
++ returns 1 if A partially intersects B
++ returns 2 if rectangle A is fully enclosed by B */
+
- int i;
- for (i=0; ((ul&1) == 0) && i<32; i++, ul>>=1);
- if (i==32) i = -1;
- return i;
-}
-+ /* returns 0 if rectangles A and B do not intersect
-+ returns 1 if A partially intersects B
-+ returns 2 if rectangle A is fully enclosed by B */
-
+ int ax1,ay1, bx1,by1;
+ ax1 = ax+aw-1; ay1 = ay+ah-1;
+ bx1 = bx+bw-1; by1 = by+bh-1;
++ if (ax1<bx || ax>bx1 || ay1<by || ay>by1) return 0;
+
-/**************************************/
-/* following code snarfed from 'xwd.c' */
-/**************************************/
-+ if (ax1<bx || ax>bx1 || ay1<by || ay>by1) return 0;
-
--#define lowbit(x) ((x) & (~(x) + 1))
+ if (ax>=bx && ax1<=bx1 && ay>=by && ay1<=by) return 2;
-+ return 1;
-+}
-
+-#define lowbit(x) ((x) & (~(x) + 1))
+-
+-
-static int getxcolors(win_info, colors)
- XWindowAttributes *win_info;
- XColor **colors;
@@ -18129,7 +27030,9 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
- Colormap cmap;
-
- *colors = (XColor *) NULL;
--
++ return 1;
++}
+
- if (win_info->visual->class == TrueColor) {
- if (DEBUG) fprintf(stderr,"TrueColor visual: no colormap needed\n");
- return 0;
@@ -18215,10 +27118,10 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
+ return nc;
}
-
+-
-
--
-/***********************************/
-int LoadGrab(pinfo)
- PICINFO *pinfo;
@@ -18284,14 +27187,16 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
- pinfo->normh = pinfo->h = gHIGH;
- pinfo->frmType = -1;
- pinfo->colType = -1;
--
+
- sprintf(pinfo->fullInfo,"<%s internal>",
- (pinfo->type == PIC8) ? "8-bit" : "24-bit");
-
- sprintf(pinfo->shrtInfo,"%dx%d image.",gWIDE, gHIGH);
-
- pinfo->comment = (char *) NULL;
--
++ /* run through the data a second time, this time mapping pixel values in
++ pic24 into colormap offsets into 'colors' */
+
- grabPic = (byte *) NULL;
-
- return 1;
@@ -18305,11 +27210,9 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
-#include <X11/Xatom.h>
-
-static Window TryChildren PARM((Display *, Window, Atom));
-
+-
-/* Find a window with WM_STATE, else return '0' */
-+ /* run through the data a second time, this time mapping pixel values in
-+ pic24 into colormap offsets into 'colors' */
-
+-
-static Window xvClientWindow (dpy, win)
- Display *dpy;
- Window win;
@@ -18323,42 +27226,16 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
-
- WM_STATE = XInternAtom(dpy, "WM_STATE", True);
- if (!WM_STATE) return win;
-+ for (i=w*h,p=pic24, pix=pic8; i; i--,pix++) {
-+ col = (((u_long) *p++) << 16);
-+ col += (((u_long) *p++) << 8);
-+ col += *p++;
-+
-+ /* binary search the 'colors' array. It *IS* in there */
-+ low = 0; high = nc-1;
-+ while (low <= high) {
-+ mid = (low+high)/2;
-+ if (col < colors[mid]) high = mid - 1;
-+ else if (col > colors[mid]) low = mid + 1;
-+ else break;
-+ }
-
+-
- XGetWindowProperty(dpy, win, WM_STATE, 0L, 0L, False, AnyPropertyType,
- &type, &format, &nitems, &after, &data);
- if (type) return win;
-+ if (high < low) {
-+ fprintf(stderr,"Trivial24to8: impossible situation!\n");
-+ exit(1);
-+ }
-+ *pix = mid;
-+ }
-
+-
- inf = TryChildren(dpy, win, WM_STATE);
-+ /* and load up the 'desired colormap' */
-+ for (i=0; i<nc; i++) {
-+ rmap[i] = colors[i]>>16;
-+ gmap[i] = (colors[i]>>8) & 0xff;
-+ bmap[i] = colors[i] & 0xff;
-+ }
-
+-
- return inf;
-+ return 1;
- }
-
+-}
+-
-static Window TryChildren (dpy, win, WM_STATE)
- Display *dpy;
- Window win;
@@ -18376,6 +27253,19 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
-
- if (!XQueryTree(dpy, win, &root, &parent, &children, &nchildren))
- return 0;
++ for (i=w*h,p=pic24, pix=pic8; i; i--,pix++) {
++ col = (((u_long) *p++) << 16);
++ col += (((u_long) *p++) << 8);
++ col += *p++;
++
++ /* binary search the 'colors' array. It *IS* in there */
++ low = 0; high = nc-1;
++ while (low <= high) {
++ mid = (low+high)/2;
++ if (col < colors[mid]) high = mid - 1;
++ else if (col > colors[mid]) low = mid + 1;
++ else break;
++ }
- for (i = 0; !inf && (i < nchildren); i++) {
- XGetWindowProperty(dpy, children[i], WM_STATE, 0L, 0L, False,
@@ -18383,23 +27273,44 @@ diff -ruN xv-3.10a/xvgrab.c xv-3.10a-bugfixes/xvgrab.c
- &after, &data);
- if (type)
- inf = children[i];
-- }
++ if (high < low) {
++ fprintf(stderr,"Trivial24to8: impossible situation!\n");
++ exit(1);
+ }
++ *pix = mid;
++ }
- for (i = 0; !inf && (i < nchildren); i++)
- inf = TryChildren(dpy, children[i], WM_STATE);
++ /* and load up the 'desired colormap' */
++ for (i=0; i<nc; i++) {
++ rmap[i] = colors[i]>>16;
++ gmap[i] = (colors[i]>>8) & 0xff;
++ bmap[i] = colors[i] & 0xff;
++ }
- if (children) XFree((char *)children);
- return inf;
--}
-diff -ruN xv-3.10a/xvgraf.c xv-3.10a-bugfixes/xvgraf.c
++ return 1;
+ }
+diff -ru xv-3.10a/xvgraf.c xv-3.10a-enhancements/xvgraf.c
--- xv-3.10a/xvgraf.c 1994-12-22 14:34:42.000000000 -0800
-+++ xv-3.10a-bugfixes/xvgraf.c 2004-05-16 18:03:34.000000000 -0700
++++ xv-3.10a-enhancements/xvgraf.c 2007-05-12 14:03:08.000000000 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* xvgraf.c - GRAF window handling functions
*
* callable functions:
+@@ -52,7 +52,7 @@
+ Window parent;
+ int x,y;
+ unsigned long fg,bg;
+- char *title;
++ const char *title;
+ {
+ /* NOTE: CreateGraf does not initialize hands[], nhands, or spline,
+ as these could be initialized by X resources (or whatever),
@@ -88,7 +88,7 @@
gp->win = XCreateSimpleWindow(theDisp, parent, x,y, GWIDE, GHIGH, 1, fg,bg);
if (!gp->win) FatalError("can't create graph (main) window");
@@ -18436,7 +27347,7 @@ diff -ruN xv-3.10a/xvgraf.c xv-3.10a-bugfixes/xvgraf.c
XSetForeground(theDisp, theGC, gp->fg);
XSetBackground(theDisp, theGC, gp->bg);
DrawString(gp->win, 2, 1+ASCENT, gp->str);
-@@ -165,7 +165,7 @@
+@@ -165,11 +165,11 @@
{
int i,x,y;
XPoint pts[129], *pt;
@@ -18444,7 +27355,13 @@ diff -ruN xv-3.10a/xvgraf.c xv-3.10a-bugfixes/xvgraf.c
+
if (gp->entergamma) {
- char *str1 = "Enter gamma";
+- char *str1 = "Enter gamma";
+- char *str2 = "value: ";
++ const char *str1 = "Enter gamma";
++ const char *str2 = "value: ";
+
+ XSetForeground(theDisp, theGC, gp->fg);
+ XSetBackground(theDisp, theGC, gp->bg);
@@ -181,15 +181,15 @@
x = 10 + StringWidth(str2) + 8;
y = 30 + ASCENT + CHIGH + 3;
@@ -18566,11 +27483,13 @@ diff -ruN xv-3.10a/xvgraf.c xv-3.10a-bugfixes/xvgraf.c
gp->hands[h].x/2, (255-gp->hands[h].y)/2);
if (grab) XUngrabPointer(theDisp, (Time) CurrentTime);
}
-@@ -481,9 +481,9 @@
+@@ -480,24 +480,24 @@
+ int hnum;
{
int w;
- char *tstr = "888,888";
+- char *tstr = "888,888";
-
++ const char *tstr = "888,888";
+
/* if hnum < 0, clears the text area */
-
@@ -18578,13 +27497,17 @@ diff -ruN xv-3.10a/xvgraf.c xv-3.10a-bugfixes/xvgraf.c
XSetFont(theDisp, theGC, monofont);
w = XTextWidth(monofinfo, tstr, (int) strlen(tstr));
-@@ -492,12 +492,12 @@
+- if (hnum >= 0) sprintf(str,"%3d,%3d",gp->hands[hnum].x,gp->hands[hnum].y);
+- else sprintf(str," ");
++ if (hnum >= 0) sprintf(dummystr,"%3d,%3d",gp->hands[hnum].x,gp->hands[hnum].y);
++ else sprintf(dummystr," ");
XSetForeground(theDisp, theGC, gp->fg);
XSetBackground(theDisp, theGC, gp->bg);
- XDrawImageString(theDisp, gp->win, theGC, 130-w, 1+ASCENT,
+- str, (int) strlen(str));
+ XDrawImageString(theDisp, gp->win, theGC, 130-w, 1+ASCENT,
- str, (int) strlen(str));
++ dummystr, (int) strlen(dummystr));
XSetFont(theDisp, theGC, mfont);
}
@@ -18672,17 +27595,41 @@ diff -ruN xv-3.10a/xvgraf.c xv-3.10a-bugfixes/xvgraf.c
for (i=0; i<256; i++) {
yd = EvalSpline(x, y, yf, gp->nhands, (double) i);
j = (int) floor(yd + 0.5);
-@@ -750,7 +750,7 @@
+@@ -729,8 +729,8 @@
+
+ /*********************/
+ int Str2Graf(gp, str)
+-GRAF_STATE *gp;
+-char *str;
++ GRAF_STATE *gp;
++ const char *str;
+ {
+ /* parses strings of the form: "S 3 : 0,0 : 63,63 : 255,255",
+ (meaning SPLINE, 3 points, and the 3 sets of handle coordinates)
+@@ -744,14 +744,15 @@
+ thing tends to break optimizers */
+
+ char tstr[256], tstr1[256], *sp, *dp;
++ const char *csp;
+ XPoint coords[MAX_GHANDS];
+ int spline, nhands, i, x, y;
+
if (!str) return 1; /* NULL strings don't parse well! */
/* first, strip all pesky whitespace from str */
- for (sp=str, dp=tstr; *sp; sp++)
-+ for (sp=str, dp=tstr; *sp; sp++)
- if (*sp > ' ') { *dp = *sp; dp++; }
+- if (*sp > ' ') { *dp = *sp; dp++; }
++ for (csp=str, dp=tstr; *csp; csp++)
++ if (*csp > ' ') { *dp = *csp; dp++; }
*dp = '\0';
-@@ -764,7 +764,7 @@
- }
+ /* check for 'gamma'-style str */
+@@ -761,10 +762,10 @@
+ gp->gammamode = 1;
+ sprintf(gp->gvstr, "%.5g", gp->gamma);
+ return 0;
+- }
++ }
else return 1;
}
-
@@ -18690,7 +27637,7 @@ diff -ruN xv-3.10a/xvgraf.c xv-3.10a-bugfixes/xvgraf.c
/* read Spline, or Line (S/L) character */
sp = tstr;
if (*sp == 'S' || *sp == 's') spline = 1;
-@@ -784,7 +784,7 @@
+@@ -784,7 +785,7 @@
while (*sp && *sp != ':') {*dp = *sp; dp++; sp++; }
*dp++ = '\0';
if (sscanf(tstr1,"%d,%d",&x, &y) != 2) return 1;
@@ -18699,7 +27646,7 @@ diff -ruN xv-3.10a/xvgraf.c xv-3.10a-bugfixes/xvgraf.c
y < 0 || y > 255) return 1; /* out of range */
coords[i].x = x; coords[i].y = y;
}
-@@ -837,7 +837,7 @@
+@@ -837,7 +838,7 @@
IFSET(gp->gamma, gsp->gamma);
IFSET(gp->nhands, gsp->nhands);
@@ -18708,7 +27655,7 @@ diff -ruN xv-3.10a/xvgraf.c xv-3.10a-bugfixes/xvgraf.c
{ strcpy(gp->gvstr, gsp->gvstr); rv++; }
for (i=0; i<gp->nhands; i++) {
-@@ -880,7 +880,7 @@
+@@ -880,7 +881,7 @@
sig = ((double) x[i]-x[i-1]) / ((double) x[i+1] - x[i-1]);
p = sig * y2[i-1] + 2.0;
y2[i] = (sig-1.0) / p;
@@ -18717,7 +27664,7 @@ diff -ruN xv-3.10a/xvgraf.c xv-3.10a-bugfixes/xvgraf.c
(((double) y[i]-y[i-1]) / (x[i]-x[i-1]));
u[i] = (6.0 * u[i]/(x[i+1]-x[i-1]) - sig*u[i-1]) / p;
}
-@@ -912,9 +912,9 @@
+@@ -912,9 +913,9 @@
if (h==0.0) FatalError("bad xvalues in splint\n");
a = (xa[khi]-x)/h;
b = (x-xa[klo])/h;
@@ -18729,18 +27676,27 @@ diff -ruN xv-3.10a/xvgraf.c xv-3.10a-bugfixes/xvgraf.c
+
-diff -ruN xv-3.10a/xviff.c xv-3.10a-bugfixes/xviff.c
+diff -ru xv-3.10a/xviff.c xv-3.10a-enhancements/xviff.c
--- xv-3.10a/xviff.c 1995-01-13 11:54:54.000000000 -0800
-+++ xv-3.10a-bugfixes/xviff.c 2005-04-03 11:57:56.000000000 -0700
-@@ -39,7 +39,7 @@
++++ xv-3.10a-enhancements/xviff.c 2007-05-13 17:50:59.000000000 -0700
+@@ -39,14 +39,14 @@
static long filesize;
-static int readID PARM((FILE *, char *));
+-static int iffError PARM((char *, char *));
+/* static int readID PARM((FILE *, char *)); DOES NOT EXIST */
- static int iffError PARM((char *, char *));
++static int iffError PARM((const char *, const char *));
static void decomprle PARM((byte *, byte *, long, long));
static unsigned int iff_getword PARM((byte *));
+ static unsigned long iff_getlong PARM((byte *));
+
+
+-static char *bname;
++static const char *bname;
+
+
+ /* Define internal ILBM types */
@@ -65,16 +65,16 @@
/*******************************************/
{
@@ -19013,19 +27969,317 @@ diff -ruN xv-3.10a/xviff.c xv-3.10a-bugfixes/xviff.c
if (codeByte < 0x80) {
codeByte++;
if ((slen > (long) codeByte) && (dlen >= (long) codeByte)) {
-diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
+@@ -522,7 +545,7 @@
+
+ /*******************************************/
+ static int iffError(fname, st)
+- char *fname, *st;
++ const char *fname, *st;
+ {
+ SetISTR(ISTR_WARNING,"%s: %s", fname, st);
+ return 0;
+diff -ru xv-3.10a/xvimage.c xv-3.10a-enhancements/xvimage.c
--- xv-3.10a/xvimage.c 1995-01-13 16:11:36.000000000 -0800
-+++ xv-3.10a-bugfixes/xvimage.c 2005-03-31 07:23:39.000000000 -0800
-@@ -34,7 +34,7 @@
++++ xv-3.10a-enhancements/xvimage.c 2007-03-18 18:13:51.000000000 -0700
+@@ -21,6 +21,16 @@
+ * int LoadPad(pinfo, fname);
+ */
+
++/* The following switch should better be provided at runtime for
++ * comparison purposes.
++ * At the moment it's only compile time, unfortunately.
++ * Who can make adaptions for use as a runtime switch by a menu option?
++ * [GRR 19980607: now via do_fixpix_smooth global; macro renamed to ENABLE_]
++ * [see http://sylvana.net/fixpix/ for home page, further info]
++ */
++/* #define ENABLE_FIXPIX_SMOOTH */ /* GRR 19980607: moved into xv.h */
++
++#define NEEDSDIR /* for S_IRUSR|S_IWUSR */
+ #include "copyright.h"
+
+ #include "xv.h"
+@@ -34,9 +44,11 @@
static void do_pan_calc PARM((int, int, int *, int *));
static void crop1 PARM((int, int, int, int, int));
static int doAutoCrop24 PARM((void));
-static void floydDitherize1 PARM((XImage *, byte *, int, int, int,
+static void floydDitherize1 PARM((XImage *, byte *, int, int, int,
byte *, byte *,byte *));
++#if 0 /* NOTUSED */
static int highbit PARM((unsigned long));
++#endif
-@@ -74,7 +74,7 @@
+ static int doPadSolid PARM((char *, int, int, int, int));
+ static int doPadBggen PARM((char *, int, int, int, int));
+@@ -46,6 +58,267 @@
+ static int ReadImageFile1 PARM((char *, PICINFO *));
+
+
++/* The following array represents the pixel values for each shade
++ * of the primary color components.
++ * If 'p' is a pointer to a source image rgb-byte-triplet, we can
++ * construct the output pixel value simply by 'oring' together
++ * the corresponding components:
++ *
++ * unsigned char *p;
++ * unsigned long pixval;
++ *
++ * pixval = screen_rgb[0][*p++];
++ * pixval |= screen_rgb[1][*p++];
++ * pixval |= screen_rgb[2][*p++];
++ *
++ * This is both efficient and generic, since the only assumption
++ * is that the primary color components have separate bits.
++ * The order and distribution of bits does not matter, and we
++ * don't need additional variables and shifting/masking code.
++ * The array size is 3 KBytes total and thus very reasonable.
++ */
++
++static unsigned long screen_rgb[3][256];
++
++/* The following array holds the exact color representations
++ * reported by the system.
++ * This is useful for less than 24 bit deep displays as a base
++ * for additional dithering to get smoother output.
++ */
++
++static byte screen_set[3][256];
++
++/* The following routine initializes the screen_rgb and screen_set
++ * arrays.
++ * Since it is executed only once per program run, it does not need
++ * to be super-efficient.
++ *
++ * The method is to draw points in a pixmap with the specified shades
++ * of primary colors and then get the corresponding XImage pixel
++ * representation.
++ * Thus we can get away with any Bit-order/Byte-order dependencies.
++ *
++ * The routine uses some global X variables: theDisp, theScreen,
++ * and dispDEEP. Adapt these to your application as necessary.
++ * I've not passed them in as parameters, since for other platforms
++ * than X these may be different (see vfixpix.c), and so the
++ * screen_init() interface is unique.
++ *
++ * BUG: I've read in the "Xlib Programming Manual" from O'Reilly &
++ * Associates, that the DefaultColormap in TrueColor might not
++ * provide the full shade representation in XAllocColor.
++ * In this case one had to provide a 'best' colormap instead.
++ * However, my tests with Xaccel on a Linux-Box with a Mach64
++ * card were fully successful, so I leave that potential problem
++ * to you at the moment and would appreciate any suggestions...
++ */
++
++static void screen_init()
++{
++ static int init_flag; /* assume auto-init as 0 */
++ Pixmap check_map;
++ GC check_gc;
++ XColor check_col;
++ XImage *check_image;
++ int ci, i;
++
++ if (init_flag) return;
++ init_flag = 1;
++
++ check_map = XCreatePixmap(theDisp, RootWindow(theDisp,theScreen),
++ 1, 1, dispDEEP);
++ check_gc = XCreateGC(theDisp, check_map, 0, NULL);
++ for (ci = 0; ci < 3; ci++) {
++ for (i = 0; i < 256; i++) {
++ check_col.red = 0;
++ check_col.green = 0;
++ check_col.blue = 0;
++ /* Do proper upscaling from unsigned 8 bit (image data values)
++ to unsigned 16 bit (X color representation). */
++ ((unsigned short *)&check_col.red)[ci] = (unsigned short)((i << 8) | i);
++ if (theVisual->class == TrueColor)
++ XAllocColor(theDisp, theCmap, &check_col);
++ else
++ xvAllocColor(theDisp, theCmap, &check_col);
++ screen_set[ci][i] =
++ (((unsigned short *)&check_col.red)[ci] >> 8) & 0xff;
++ XSetForeground(theDisp, check_gc, check_col.pixel);
++ XDrawPoint(theDisp, check_map, check_gc, 0, 0);
++ check_image = XGetImage(theDisp, check_map, 0, 0, 1, 1,
++ AllPlanes, ZPixmap);
++ if (check_image) {
++ switch (check_image->bits_per_pixel) {
++ case 8:
++ screen_rgb[ci][i] = *(CARD8 *)check_image->data;
++ break;
++ case 16:
++ screen_rgb[ci][i] = *(CARD16 *)check_image->data;
++ break;
++ case 24:
++ screen_rgb[ci][i] =
++ ((unsigned long)*(CARD8 *)check_image->data << 16) |
++ ((unsigned long)*(CARD8 *)(check_image->data + 1) << 8) |
++ (unsigned long)*(CARD8 *)(check_image->data + 2);
++ break;
++ case 32:
++ screen_rgb[ci][i] = *(CARD32 *)check_image->data;
++ break;
++ }
++ XDestroyImage(check_image);
++ }
++ }
++ }
++ XFreeGC(theDisp, check_gc);
++ XFreePixmap(theDisp, check_map);
++}
++
++
++#ifdef ENABLE_FIXPIX_SMOOTH
++
++/* The following code is based in part on:
++ *
++ * jquant1.c
++ *
++ * Copyright (C) 1991-1996, Thomas G. Lane.
++ * This file is part of the Independent JPEG Group's software.
++ * For conditions of distribution and use, see the accompanying README file.
++ *
++ * This file contains 1-pass color quantization (color mapping) routines.
++ * These routines provide mapping to a fixed color map using equally spaced
++ * color values. Optional Floyd-Steinberg or ordered dithering is available.
++ */
++
++/* Declarations for Floyd-Steinberg dithering.
++ *
++ * Errors are accumulated into the array fserrors[], at a resolution of
++ * 1/16th of a pixel count. The error at a given pixel is propagated
++ * to its not-yet-processed neighbors using the standard F-S fractions,
++ * ... (here) 7/16
++ * 3/16 5/16 1/16
++ * We work left-to-right on even rows, right-to-left on odd rows.
++ *
++ * We can get away with a single array (holding one row's worth of errors)
++ * by using it to store the current row's errors at pixel columns not yet
++ * processed, but the next row's errors at columns already processed. We
++ * need only a few extra variables to hold the errors immediately around the
++ * current column. (If we are lucky, those variables are in registers, but
++ * even if not, they're probably cheaper to access than array elements are.)
++ *
++ * We provide (#columns + 2) entries per component; the extra entry at each
++ * end saves us from special-casing the first and last pixels.
++ */
++
++typedef INT16 FSERROR; /* 16 bits should be enough */
++typedef int LOCFSERROR; /* use 'int' for calculation temps */
++
++typedef struct { byte *colorset;
++ FSERROR *fserrors;
++ } FSBUF;
++
++/* Floyd-Steinberg initialization function.
++ *
++ * It is called 'fs2_init' since it's specialized for our purpose and
++ * could be embedded in a more general FS-package.
++ *
++ * Returns a malloced FSBUF pointer which has to be passed as first
++ * parameter to subsequent 'fs2_dither' calls.
++ * The FSBUF structure does not need to be referenced by the calling
++ * application, it can be treated from the app like a void pointer.
++ *
++ * The current implementation does only require to free() this returned
++ * pointer after processing.
++ *
++ * Returns NULL if malloc fails.
++ *
++ * NOTE: The FSBUF structure is designed to allow the 'fs2_dither'
++ * function to work with an *arbitrary* number of color components
++ * at runtime! This is an enhancement over the IJG code base :-).
++ * Only fs2_init() specifies the (maximum) number of components.
++ */
++
++static FSBUF *fs2_init(width)
++int width;
++{
++ FSBUF *fs;
++ FSERROR *p;
++
++ fs = (FSBUF *)
++ malloc(sizeof(FSBUF) * 3 + ((size_t)width + 2) * sizeof(FSERROR) * 3);
++ if (fs == 0) return fs;
++
++ fs[0].colorset = screen_set[0];
++ fs[1].colorset = screen_set[1];
++ fs[2].colorset = screen_set[2];
++
++ p = (FSERROR *)(fs + 3);
++ memset(p, 0, ((size_t)width + 2) * sizeof(FSERROR) * 3);
++
++ fs[0].fserrors = p;
++ fs[1].fserrors = p + 1;
++ fs[2].fserrors = p + 2;
++
++ return fs;
++}
++
++/* Floyd-Steinberg dithering function.
++ *
++ * NOTE:
++ * (1) The image data referenced by 'ptr' is *overwritten* (input *and*
++ * output) to allow more efficient implementation.
++ * (2) Alternate FS dithering is provided by the sign of 'nc'. Pass in
++ * a negative value for right-to-left processing. The return value
++ * provides the right-signed value for subsequent calls!
++ * (3) This particular implementation assumes *no* padding between lines!
++ * Adapt this if necessary.
++ */
++
++static int fs2_dither(fs, ptr, nc, num_rows, num_cols)
++FSBUF *fs;
++byte *ptr;
++int nc, num_rows, num_cols;
++{
++ int abs_nc, ci, row, col;
++ LOCFSERROR delta, cur, belowerr, bpreverr;
++ byte *dataptr, *colsetptr;
++ FSERROR *errorptr;
++
++ if ((abs_nc = nc) < 0) abs_nc = -abs_nc;
++ for (row = 0; row < num_rows; row++) {
++ for (ci = 0; ci < abs_nc; ci++, ptr++) {
++ dataptr = ptr;
++ colsetptr = fs[ci].colorset;
++ errorptr = fs[ci].fserrors;
++ if (nc < 0) {
++ dataptr += (num_cols - 1) * abs_nc;
++ errorptr += (num_cols + 1) * abs_nc;
++ }
++ cur = belowerr = bpreverr = 0;
++ for (col = 0; col < num_cols; col++) {
++ cur += errorptr[nc];
++ cur += 8; cur >>= 4;
++ if ((cur += *dataptr) < 0) cur = 0;
++ else if (cur > 255) cur = 255;
++ *dataptr = cur & 0xff;
++ cur -= colsetptr[cur];
++ delta = cur << 1; cur += delta;
++ bpreverr += cur; cur += delta;
++ belowerr += cur; cur += delta;
++ errorptr[0] = (FSERROR)bpreverr;
++ bpreverr = belowerr;
++ belowerr = delta >> 1;
++ dataptr += nc;
++ errorptr += nc;
++ }
++ errorptr[0] = (FSERROR)bpreverr;
++ }
++ ptr += (num_cols - 1) * abs_nc;
++ nc = -nc;
++ }
++ return nc;
++}
++
++#endif /* ENABLE_FIXPIX_SMOOTH */
++
+
+ #define DO_CROP 0
+ #define DO_ZOOM 1
+@@ -74,7 +347,7 @@
GenerateEpic(w,h);
CreateXImage();
}
@@ -19034,7 +28288,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/********************************************/
-@@ -90,15 +90,15 @@
+@@ -90,15 +363,15 @@
cp = cpic;
bperpix = (picType == PIC8) ? 1 : 3;
@@ -19053,7 +28307,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/***********************************/
-@@ -112,10 +112,10 @@
+@@ -112,10 +385,10 @@
clptr = NULL; cxarrp = NULL; cy = 0; /* shut up compiler */
SetISTR(ISTR_EXPAND, "%.5g%% x %.5g%% (%d x %d)",
@@ -19066,7 +28320,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
fprintf(stderr,"GenerateEpic(%d,%d) eSIZE=%d,%d cSIZE=%d,%d epicode=%d\n",
w,h,eWIDE,eHIGH,cWIDE,cHIGH, epicMode);
-@@ -124,7 +124,7 @@
+@@ -124,7 +397,7 @@
eWIDE = w; eHIGH = h;
@@ -19075,7 +28329,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (picType == PIC8) {
epic = SmoothResize(cpic, cWIDE, cHIGH, eWIDE, eHIGH,
rMap,gMap,bMap, rdisp,gdisp,bdisp, numcols);
-@@ -143,7 +143,7 @@
+@@ -143,7 +416,7 @@
/* generate a 'raw' epic, as we'll need it for ColorDither if EM_DITH */
@@ -19084,7 +28338,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (eWIDE==cWIDE && eHIGH==cHIGH) { /* 1:1 expansion. point epic at cpic */
epic = cpic;
}
-@@ -163,13 +163,13 @@
+@@ -163,13 +436,13 @@
/* the scaling routine. not really all that scary after all... */
/* OPTIMIZATON: Malloc an eWIDE array of ints which will hold the
@@ -19100,7 +28354,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
cxarr[ex] = bperpix * ((cWIDE * ex) / eWIDE);
elptr = epptr = epic;
-@@ -182,7 +182,7 @@
+@@ -182,7 +455,7 @@
clptr = cpic + (cy * cWIDE * bperpix);
if (bperpix == 1) {
@@ -19109,7 +28363,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
*epptr = clptr[*cxarrp++];
}
else {
-@@ -190,7 +190,7 @@
+@@ -190,7 +463,7 @@
for (ex=0, cxarrp = cxarr; ex<eWIDE; ex++,cxarrp++) {
cp = clptr + *cxarrp;
@@ -19118,7 +28372,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
*epptr++ = *cp++;
}
}
-@@ -203,7 +203,7 @@
+@@ -203,7 +476,7 @@
if (picType == PIC8 && epicMode == EM_DITH) {
byte *tmp;
@@ -19127,7 +28381,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
rdisp,gdisp,bdisp, numcols);
if (tmp) { /* success */
FreeEpic();
-@@ -214,7 +214,7 @@
+@@ -214,7 +487,7 @@
}
}
}
@@ -19136,7 +28390,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/***********************************/
-@@ -233,7 +233,7 @@
+@@ -233,7 +506,7 @@
static void do_zoom(mx,my)
int mx,my;
{
@@ -19145,7 +28399,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
int rx,ry,rx2,ry2, orx, ory, orw, orh;
int px,py,pw,ph,opx,opy,opw,oph,m;
Window rW, cW; unsigned int mask; int rtx, rty;
-@@ -254,10 +254,10 @@
+@@ -254,10 +527,10 @@
while (1) {
if (!XQueryPointer(theDisp,mainW,&rW,&cW,&rtx,&rty,
&mx,&my,&mask)) continue;
@@ -19158,7 +28412,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
compute_zoom_rect(mx, my, &px, &py, &pw, &ph);
if (px!=opx || py!=opy) {
XDrawRectangle(theDisp,mainW,theGC, orx,ory, (u_int)orw, (u_int)orh);
-@@ -283,7 +283,7 @@
+@@ -283,7 +556,7 @@
XSetPlaneMask(theDisp, theGC, AllPlanes);
return;
}
@@ -19167,7 +28421,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
for (i=0; i<4; i++) {
XDrawRectangle(theDisp, mainW, theGC, orx, ory, (u_int) orw, (u_int) orh);
-@@ -297,7 +297,7 @@
+@@ -297,7 +570,7 @@
/* if rectangle is *completely* outside epic, don't zoom */
if (orx+orw<0 || ory+orh<0 || orx>=eWIDE || ory>=eHIGH) return;
@@ -19176,7 +28430,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
crop1(opx, opy, opw, oph, DO_ZOOM);
}
-@@ -306,15 +306,15 @@
+@@ -306,15 +579,15 @@
static void compute_zoom_rect(x, y, px, py, pw, ph)
int x, y, *px, *py, *pw, *ph;
{
@@ -19196,7 +28450,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
*py = *py - (*ph)/2;
RANGE(*px, 0, pWIDE - *pw);
-@@ -327,7 +327,7 @@
+@@ -327,7 +600,7 @@
{
int x,y,w,h, x2,y2, ex,ey,ew,eh;
@@ -19205,7 +28459,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
the size of eWIDE,eHIGH, centered around eWIDE/2, eHIGH/2, but no
larger than pWIDE,PHIGH */
-@@ -362,7 +362,7 @@
+@@ -362,7 +635,7 @@
int i, ox,oy,offx,offy, rw,rh, px, py, dx, dy,m;
Window rW, cW; unsigned int mask; int rx, ry;
@@ -19214,7 +28468,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
offy = oy = my;
rw = eWIDE-1; rh = eHIGH-1;
m = 0;
-@@ -374,50 +374,50 @@
+@@ -374,50 +647,50 @@
/* track until Button2 is released */
while (1) {
@@ -19277,7 +28531,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
(u_int) rw, (u_int) rh);
XFlush(theDisp);
Timer(100);
-@@ -430,7 +430,7 @@
+@@ -430,7 +703,7 @@
dx = px - cXOFF; dy = py - cYOFF;
if (dx==0 && dy==0) { /* didn't pan anywhere */
@@ -19286,7 +28540,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
(u_int) rw, (u_int) rh);
XSetFunction(theDisp, theGC, GXcopy);
XSetPlaneMask(theDisp, theGC, AllPlanes);
-@@ -485,7 +485,7 @@
+@@ -485,7 +758,7 @@
/***********************************/
void Crop()
{
@@ -19295,7 +28549,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (!HaveSelection()) return;
-@@ -499,8 +499,7 @@
+@@ -499,8 +772,7 @@
static void crop1(x,y,w,h,zm)
int x,y,w,h,zm;
{
@@ -19305,7 +28559,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
oldcx = cXOFF; oldcy = cYOFF;
oldew = eWIDE; oldeh = eHIGH;
-@@ -529,7 +528,7 @@
+@@ -529,7 +801,7 @@
if (cpic == pic) return; /* not cropped */
BTSetActive(&but[BUNCROP],0);
@@ -19314,7 +28568,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (epicMode == EM_SMOOTH) { /* turn off smoothing */
epicMode = EM_RAW; SetEpicMode();
}
-@@ -538,7 +537,7 @@
+@@ -538,7 +810,7 @@
FreeEpic();
if (cpic && cpic != pic) free(cpic);
cpic = NULL;
@@ -19323,7 +28577,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
w = (pWIDE * eWIDE) / cWIDE; h = (pHIGH * eHIGH) / cHIGH;
if (w>maxWIDE || h>maxHIGH) {
-@@ -566,7 +565,7 @@
+@@ -566,7 +838,7 @@
WUnCrop();
SetCropString();
}
@@ -19332,7 +28586,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/***********************************/
void AutoCrop()
-@@ -583,7 +582,7 @@
+@@ -583,7 +855,7 @@
WCrop(eWIDE, eHIGH, cXOFF-oldcx, cYOFF-oldcy);
}
}
@@ -19341,7 +28595,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
SetCursors(-1);
}
-@@ -650,7 +649,7 @@
+@@ -650,7 +922,7 @@
/* do the actual cropping */
if (cleft || ctop || cbot || cright) {
@@ -19350,7 +28604,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
cWIDE-(cleft+cright), cHIGH-(ctop+cbot));
return 1;
}
-@@ -673,7 +672,7 @@
+@@ -673,7 +945,7 @@
# define NEIGHBOR 16 /* within 6% of neighboring pixels */
# define MISSPCT 6 /* and up to 6% that don't match */
# define inabsrange(a,n) ( (a) < n && (a) > -n )
@@ -19359,7 +28613,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (cHIGH<3 || cWIDE<3) return 0;
-@@ -739,7 +738,7 @@
+@@ -739,7 +1011,7 @@
while (cleft + 1 < cWIDE) { /* see if we can delete this line */
oldr = bgR; oldg = bgG; oldb = bgB;
@@ -19368,7 +28622,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
i++, cp1 += (cWIDE * 3)) {
r=cp1[0]-bgR; g=cp1[1]-bgG; b=cp1[2]-bgB;
R=cp1[0]-oldr; G=cp1[1]-oldg; B=cp1[2]-oldb;
-@@ -763,7 +762,7 @@
+@@ -763,7 +1035,7 @@
while (cleft + cright + 1 < cWIDE) { /* see if we can delete this line */
oldr = bgR; oldg = bgG; oldb = bgB;
@@ -19377,7 +28631,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
i++, cp1 += (cWIDE*3)) {
r=cp1[0]-bgR; g=cp1[1]-bgG; b=cp1[2]-bgB;
R=cp1[0]-oldr; G=cp1[1]-oldg; B=cp1[2]-oldb;
-@@ -784,8 +783,8 @@
+@@ -784,8 +1056,8 @@
if (cleft || ctop || cbot || cright) {
if (cWIDE - (cleft + cright) < 1 ||
cHIGH - (ctop + cbot ) < 1) return 0; /* sanity check */
@@ -19388,7 +28642,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
cWIDE-(cleft+cright), cHIGH-(ctop+cbot));
return 1;
}
-@@ -802,7 +801,7 @@
+@@ -802,7 +1074,7 @@
and sticks likely values into eWIDE,eHIGH, assuming you wanted to
crop. epic is not regnerated (but is freed) */
@@ -19397,7 +28651,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
byte *cp, *pp;
double expw, exph;
-@@ -837,7 +836,7 @@
+@@ -837,7 +1109,7 @@
else {
/* at this point, we want to generate cpic, which will contain a
cWIDE*cHIGH subsection of 'pic', top-left at cXOFF,cYOFF */
@@ -19406,7 +28660,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
cpic = (byte *) malloc((size_t) (cWIDE * cHIGH * bperpix));
if (cpic == NULL) {
-@@ -852,7 +851,7 @@
+@@ -852,7 +1124,7 @@
cp = cpic;
for (i=0; i<cHIGH; i++) {
pp = pic + (i+cYOFF) * (pWIDE*bperpix) + (cXOFF * bperpix);
@@ -19415,7 +28669,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
*cp++ = *pp++;
}
}
-@@ -861,7 +860,7 @@
+@@ -861,7 +1133,7 @@
SetCropString();
BTSetActive(&but[BUNCROP], (cpic!=pic));
@@ -19424,7 +28678,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
eHIGH = (int) (cHIGH * exph);
if (eWIDE>maxWIDE || eHIGH>maxHIGH) { /* make 'normal' size */
-@@ -869,7 +868,7 @@
+@@ -869,7 +1141,7 @@
double r,wr,hr;
wr = ((double) cWIDE) / maxWIDE;
hr = ((double) cHIGH) / maxHIGH;
@@ -19433,7 +28687,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
r = (wr>hr) ? wr : hr; /* r is the max(wr,hr) */
eWIDE = (int) ((cWIDE / r) + 0.5);
eHIGH = (int) ((cHIGH / r) + 0.5);
-@@ -906,12 +905,12 @@
+@@ -906,12 +1178,12 @@
int dir;
{
int i;
@@ -19449,7 +28703,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/* rotate clipped version and modify 'clip' coords */
if (cpic != pic && cpic != NULL) {
if (!dir) {
-@@ -928,7 +927,7 @@
+@@ -928,7 +1200,7 @@
RotatePic(cpic, picType, &cWIDE, &cHIGH,dir);
}
else { cWIDE = pWIDE; cHIGH = pHIGH; }
@@ -19458,7 +28712,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/* rotate expanded version */
if (epic != cpic && epic != NULL) {
WaitCursor();
-@@ -940,7 +939,7 @@
+@@ -940,7 +1212,7 @@
SetISTR(ISTR_RES,"%d x %d",pWIDE,pHIGH);
SetISTR(ISTR_EXPAND, "%.5g%% x %.5g%% (%d x %d)",
@@ -19467,7 +28721,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
100.0 * ((float) eHIGH) / cHIGH, eWIDE, eHIGH);
}
-@@ -951,7 +950,7 @@
+@@ -951,7 +1223,7 @@
int *wp, *hp;
int ptype, dir;
{
@@ -19476,7 +28730,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
or counter-clockwise (dir != 0). swaps w and h */
byte *pic1, *pix1, *pix;
-@@ -960,7 +959,7 @@
+@@ -960,7 +1232,7 @@
bperpix = (ptype == PIC8) ? 1 : 3;
@@ -19485,7 +28739,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
pix1 = pic1 = (byte *) malloc((size_t) (w*h*bperpix));
if (!pic1) FatalError("Not enough memory to rotate!");
-@@ -968,15 +967,15 @@
+@@ -968,15 +1240,15 @@
if (dir==0) {
for (i=0; i<w; i++) { /* CW */
if (bperpix == 1) {
@@ -19505,7 +28759,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
for (k=0; k<bperpix; k++) *pix1++ = pix[k];
}
}
-@@ -984,25 +983,25 @@
+@@ -984,25 +1256,25 @@
else {
for (i=w-1; i>=0; i--) { /* CCW */
if (bperpix == 1) {
@@ -19538,7 +28792,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/* swap w and h */
*wp = h; *hp = w;
}
-@@ -1017,7 +1016,7 @@
+@@ -1017,7 +1289,7 @@
*
* Note: flips pic, cpic, and epic. Doesn't touch Ximage, nor does it draw
*/
@@ -19547,7 +28801,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
WaitCursor();
if (HaveSelection()) { /* only flip selection region */
-@@ -1026,7 +1025,7 @@
+@@ -1026,7 +1298,7 @@
}
FlipPic(pic, pWIDE, pHIGH, dir);
@@ -19556,7 +28810,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/* flip clipped version */
if (cpic && cpic != pic) {
WaitCursor();
-@@ -1048,21 +1047,21 @@
+@@ -1048,21 +1320,21 @@
int dir;
{
/* flips a w*h array of bytes horizontally (dir=0) or vertically (dir!=0) */
@@ -19583,7 +28837,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
for (j=0; j<w/2; j++, rightp -= (2*bperpix)) {
for (l=0; l<bperpix; l++, leftp++, rightp++) {
k = *leftp; *leftp = *rightp; *rightp = k;
-@@ -1070,14 +1069,14 @@
+@@ -1070,14 +1342,14 @@
}
}
}
@@ -19601,7 +28855,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
for (j=0; j<h/2; j++, topp+=(w-1)*bperpix, botp-=(w+1)*bperpix) {
for (l=0; l<bperpix; l++, topp++, botp++) {
k = *topp; *topp = *botp; *botp = k;
-@@ -1093,26 +1092,26 @@
+@@ -1093,26 +1365,26 @@
int dir;
{
/* flips selected area in 'pic', regens cpic and epic appropriately */
@@ -19634,7 +28888,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
for (j=0; j<w/2; j++, rightp -= (2*bperpix)) {
for (l=0; l<bperpix; l++, leftp++, rightp++) {
k = *leftp; *leftp = *rightp; *rightp = k;
-@@ -1120,14 +1119,14 @@
+@@ -1120,14 +1392,14 @@
}
}
}
@@ -19652,7 +28906,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
for (j=0; j<h/2; j++, topp+=(pWIDE-1)*bperpix, botp-=(pWIDE+1)*bperpix) {
for (l=0; l<bperpix; l++, topp++, botp++) {
k = *topp; *topp = *botp; *botp = k;
-@@ -1139,22 +1138,22 @@
+@@ -1139,22 +1411,22 @@
GenerateCpic();
GenerateEpic(eWIDE,eHIGH);
}
@@ -19679,7 +28933,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/* generate cpic,epic,theImage from new 'pic' */
crop1(cXOFF, cYOFF, cWIDE, cHIGH, DO_ZOOM);
HandleDispMode();
-@@ -1166,15 +1165,15 @@
+@@ -1166,15 +1438,15 @@
void DrawEpic()
{
/* given an 'epic', builds a new Ximage, and draws it. Basically
@@ -19699,7 +28953,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (HaveSelection()) DrawSelection(0);
}
-@@ -1189,7 +1188,7 @@
+@@ -1189,7 +1461,7 @@
if (pic) free(pic);
xvDestroyImage(theImage); theImage = NULL;
pic = egampic = epic = cpic = NULL;
@@ -19708,7 +28962,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (picComments) free(picComments);
picComments = (char *) NULL;
ChangeCommentText();
-@@ -1203,7 +1202,7 @@
+@@ -1203,7 +1475,7 @@
byte *pic824, *rmap, *gmap, *bmap;
int ptype, wide, high;
{
@@ -19717,7 +28971,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
*
* takes a wide*high input image, of type 'ptype' (PIC8, PIC24)
* (if PIC8, colormap is specified by rmap,gmap,bmap)
-@@ -1212,14 +1211,14 @@
+@@ -1212,14 +1484,14 @@
*
* Note: this algorithm is *only* used when running on a 1-bit display
*/
@@ -19735,7 +28989,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (ptype == PIC8) { /* monoify colormap */
for (i=0; i<256; i++)
rgb[i] = MONO(rmap[i], gmap[i], bmap[i]);
-@@ -1234,7 +1233,7 @@
+@@ -1234,7 +1506,7 @@
thisline = (int *) malloc(wide * sizeof(int));
nextline = (int *) malloc(wide * sizeof(int));
@@ -19744,7 +28998,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
FatalError("ran out of memory in floydDitherize1()\n");
-@@ -1249,10 +1248,10 @@
+@@ -1249,10 +1521,10 @@
*tmpptr++ = fsgamcr[rgb[*pp]];
}
@@ -19757,7 +29011,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
for (i=0; i<high; i++) {
if ((i&0x3f) == 0) WaitCursor();
-@@ -1326,7 +1325,7 @@
+@@ -1326,7 +1598,7 @@
/************************/
@@ -19766,7 +29020,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
bval, wval)
byte *inpic, *rmap, *gmap, *bmap;
int w,h, intype, bval, wval;
-@@ -1338,14 +1337,21 @@
+@@ -1338,14 +1610,21 @@
* and 'wval' as the 'black' and 'white' pixel values, respectively
*/
@@ -19783,7 +29037,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
+ SetISTR(ISTR_WARNING, "Invalid image dimensions for dithering");
+ return (byte *)NULL;
+ }
-+
++
+ outpic = (byte *) malloc((size_t) npixels);
if (!outpic) return outpic;
-
@@ -19791,7 +29045,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (intype == PIC8) { /* monoify colormap */
for (i=0; i<256; i++)
-@@ -1353,9 +1359,9 @@
+@@ -1353,9 +1632,9 @@
}
@@ -19804,7 +29058,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
FatalError("ran out of memory in FSDither()\n");
-@@ -1394,13 +1400,13 @@
+@@ -1394,13 +1673,13 @@
pp = outpic + i * w;
thisptr = thisline; nextptr = nextline;
@@ -19821,7 +29075,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (i<h1) {
nextptr[0] += ((err*5)/16);
if (j>0) nextptr[-1] += ((err*3)/16);
-@@ -1414,9 +1420,9 @@
+@@ -1414,9 +1693,9 @@
for (j=w-1; j>=0; j--, pp--, thisptr--, nextptr--) {
if (*thisptr<128) { err = *thisptr; *pp = (byte) bval; }
else { err = *thisptr-255; *pp = (byte) wval; }
@@ -19833,7 +29087,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (i<h1) {
nextptr[0] += ((err*5)/16);
if (j>0) nextptr[-1] += (err/16);
-@@ -1449,8 +1455,8 @@
+@@ -1449,8 +1728,8 @@
}
@@ -19844,7 +29098,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
cols, rMap, gMap, bMap);
else if (picType == PIC24)
theImage = Pic24ToXImage(egampic, (u_int) eWIDE, (u_int) eHIGH);
-@@ -1482,7 +1488,7 @@
+@@ -1482,7 +1761,7 @@
if (!pic8) return xim; /* shouldn't happen */
@@ -19853,7 +29107,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
fprintf(stderr,"Pic8ToXImage(): creating a %dx%d Ximage, %d bits deep\n",
wide, high, dispDEEP);
-@@ -1491,7 +1497,7 @@
+@@ -1491,7 +1770,7 @@
if (dispDEEP == 1) {
byte *imagedata;
@@ -19862,7 +29116,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
wide, high, 32, 0);
if (!xim) FatalError("couldn't create xim!");
-@@ -1506,11 +1512,11 @@
+@@ -1506,11 +1785,11 @@
/* if ncols==0, do a 'black' and 'white' dither */
if (ncols == 0) {
@@ -19876,7 +29130,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
(int) ((dispDEEP <= 8) ? white : 1));
}
-@@ -1521,14 +1527,14 @@
+@@ -1521,14 +1800,14 @@
case 8: {
byte *imagedata, *ip, *pp;
int j, imWIDE, nullCount;
@@ -19894,7 +29148,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
pp = (dithpic) ? dithpic : pic8;
for (i=0, ip=imagedata; i<high; i++) {
-@@ -1543,9 +1549,9 @@
+@@ -1543,9 +1822,9 @@
for (j=0; j<nullCount; j++, ip++) *ip = 0;
}
@@ -19906,7 +29160,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
32, imWIDE);
if (!xim) FatalError("couldn't create xim!");
}
-@@ -1554,13 +1560,13 @@
+@@ -1554,13 +1833,13 @@
/*********************************/
@@ -19922,7 +29176,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
wide, high, 8, 0);
if (!xim) FatalError("couldn't create xim!");
-@@ -1569,7 +1575,7 @@
+@@ -1569,7 +1848,7 @@
if (!imagedata) FatalError("couldn't malloc imagedata");
xim->data = (char *) imagedata;
@@ -19931,7 +29185,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
pp = (dithpic) ? dithpic : pic8;
if (xim->bits_per_pixel == 4) {
-@@ -1601,20 +1607,20 @@
+@@ -1601,20 +1880,20 @@
else FatalError("This display's too bizarre. Can't create XImage.");
}
break;
@@ -19956,7 +29210,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
wide, high, 8, 0);
if (!xim) FatalError("couldn't create xim!");
-@@ -1674,11 +1680,11 @@
+@@ -1674,11 +1953,11 @@
*ip = (dithpic) ? *pp : (byte) xcolors[*pp];
}
}
@@ -19970,7 +29224,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/*********************************/
-@@ -1686,8 +1692,8 @@
+@@ -1686,8 +1965,8 @@
case 6: {
byte *imagedata, *ip, *pp;
int bperline;
@@ -19981,7 +29235,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
wide, high, 8, 0);
if (!xim) FatalError("couldn't create xim!");
-@@ -1707,17 +1713,16 @@
+@@ -1707,17 +1986,16 @@
}
}
break;
@@ -20002,7 +29256,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (!imagedata) FatalError("couldn't malloc imagedata");
xim = XCreateImage(theDisp,theVisual,dispDEEP,ZPixmap,0,
-@@ -1736,10 +1741,12 @@
+@@ -1736,10 +2014,12 @@
if (xim->byte_order == MSBFirst) {
for (i=wide*high, ip=imagedata; i>0; i--,pp++) {
if (((i+1)&0x1ffff) == 0) WaitCursor();
@@ -20019,7 +29273,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
}
}
else { /* LSBFirst */
-@@ -1749,14 +1756,14 @@
+@@ -1749,14 +2029,14 @@
if (dithpic) xcol = ((*pp) ? white : black) & 0xffff;
else xcol = xcolors[*pp];
@@ -20037,7 +29291,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/*********************************/
case 24:
-@@ -1766,7 +1773,7 @@
+@@ -1766,7 +2046,7 @@
imagedata = (byte *) malloc((size_t) (4*wide*high));
if (!imagedata) FatalError("couldn't malloc imagedata");
@@ -20046,7 +29300,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
xim = XCreateImage(theDisp,theVisual,dispDEEP,ZPixmap,0,
(char *) imagedata, wide, high, 32, 0);
if (!xim) FatalError("couldn't create xim!");
-@@ -1774,7 +1781,7 @@
+@@ -1774,7 +2054,7 @@
do32 = (xim->bits_per_pixel == 32);
pp = (dithpic) ? dithpic : pic8;
@@ -20055,18 +29309,23 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (xim->byte_order == MSBFirst) {
for (i=0, ip=imagedata; i<high; i++) {
if (((i+1)&0x7f) == 0) WaitCursor();
-@@ -1809,8 +1816,8 @@
+@@ -1809,11 +2089,11 @@
/*********************************/
-
- default:
+- sprintf(str,"no code to handle this display type (%d bits deep)",
+
+ default:
- sprintf(str,"no code to handle this display type (%d bits deep)",
++ sprintf(dummystr,"no code to handle this display type (%d bits deep)",
dispDEEP);
- FatalError(str);
-@@ -1823,7 +1830,7 @@
+- FatalError(str);
++ FatalError(dummystr);
+ break;
+ }
+
+@@ -1823,7 +2103,7 @@
return(xim);
}
@@ -20075,7 +29334,16 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/***********************************/
XImage *Pic24ToXImage(pic24, wide, high)
-@@ -1840,8 +1847,8 @@
+@@ -1831,7 +2111,7 @@
+ unsigned int wide, high;
+ {
+ /*
+- * this has to do the none-to-simple bit of converting the data in 'pic24'
++ * This has to do the none-too-simple bit of converting the data in 'pic24'
+ * into something usable by X.
+ *
+ * There are two major approaches: if we're displaying on a TrueColor
+@@ -1840,12 +2120,12 @@
* variation of RGB the X device in question wants. No color allocation
* is involved.
*
@@ -20086,7 +29354,12 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
* mode. (In that by this point, a 3/3/2 standard colormap has been
* created for our use (though all 256 colors may not be unique...), and
* we're just going to display the 24-bit picture by dithering with those
-@@ -1861,7 +1868,7 @@
+- * colors
++ * colors.)
+ *
+ */
+
+@@ -1861,7 +2141,7 @@
if (dispDEEP == 1) {
byte *imagedata;
@@ -20095,27 +29368,259 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
wide, high, 32, 0);
if (!xim) FatalError("couldn't create xim!");
-@@ -1929,8 +1936,8 @@
- for (j=0, ip=lip; j<wide; j++) {
- r = *pp++; g = *pp++; b = *pp++;
+@@ -1883,33 +2163,17 @@
+ /* Non-ColorMapped Visuals: TrueColor, DirectColor */
+ /************************************************************************/
+
+- unsigned long r, g, b, rmask, gmask, bmask, xcol;
+- int rshift, gshift, bshift, bperpix, bperline, border, cshift;
+- int maplen;
++ unsigned long xcol;
++ int bperpix, bperline;
+ byte *imagedata, *lip, *ip, *pp;
+
+- /* compute various shifting constants that we'll need... */
+-
+- rmask = theVisual->red_mask;
+- gmask = theVisual->green_mask;
+- bmask = theVisual->blue_mask;
+-
+- rshift = 7 - highbit(rmask);
+- gshift = 7 - highbit(gmask);
+- bshift = 7 - highbit(bmask);
+-
+- maplen = theVisual->map_entries;
+- if (maplen>256) maplen=256;
+- cshift = 7 - highbit((u_long) (maplen-1));
+-
+ xim = XCreateImage(theDisp, theVisual, dispDEEP, ZPixmap, 0, NULL,
+ wide, high, 32, 0);
+ if (!xim) FatalError("couldn't create X image!");
+
+ bperline = xim->bytes_per_line;
+ bperpix = xim->bits_per_pixel;
+- border = xim->byte_order;
+
+ imagedata = (byte *) malloc((size_t) (high * bperline));
+ if (!imagedata) FatalError("couldn't malloc imagedata");
+@@ -1923,85 +2187,141 @@
+ FatalError(buf);
+ }
+
++ screen_init();
+
+- lip = imagedata; pp = pic24;
+- for (i=0; i<high; i++, lip+=bperline) {
+- for (j=0, ip=lip; j<wide; j++) {
+- r = *pp++; g = *pp++; b = *pp++;
+-
- /* shift r,g,b so that high bit of 8-bit color specification is
- * aligned with high bit of r,g,b-mask in visual,
-+ /* shift r,g,b so that high bit of 8-bit color specification is
-+ * aligned with high bit of r,g,b-mask in visual,
- * AND each component with its mask,
- * and OR the three components together
- */
-@@ -1945,7 +1952,7 @@
- /* shift the bits around */
- if (rshift<0) r = r << (-rshift);
- else r = r >> rshift;
+- * AND each component with its mask,
+- * and OR the three components together
+- */
+-
+- if (theVisual->class == DirectColor) {
+- r = (u_long) directConv[(r>>cshift) & 0xff] << cshift;
+- g = (u_long) directConv[(g>>cshift) & 0xff] << cshift;
+- b = (u_long) directConv[(b>>cshift) & 0xff] << cshift;
+- }
+-
+-
+- /* shift the bits around */
+- if (rshift<0) r = r << (-rshift);
+- else r = r >> rshift;
-
-+
- if (gshift<0) g = g << (-gshift);
- else g = g >> gshift;
+- if (gshift<0) g = g << (-gshift);
+- else g = g >> gshift;
+-
+- if (bshift<0) b = b << (-bshift);
+- else b = b >> bshift;
+-
+- r = r & rmask;
+- g = g & gmask;
+- b = b & bmask;
+-
+- xcol = r | g | b;
+-
+- if (bperpix == 32) {
+- if (border == MSBFirst) {
+- *ip++ = (xcol>>24) & 0xff;
+- *ip++ = (xcol>>16) & 0xff;
+- *ip++ = (xcol>>8) & 0xff;
+- *ip++ = xcol & 0xff;
+- }
+- else { /* LSBFirst */
+- *ip++ = xcol & 0xff;
+- *ip++ = (xcol>>8) & 0xff;
+- *ip++ = (xcol>>16) & 0xff;
+- *ip++ = (xcol>>24) & 0xff;
+- }
+- }
+-
+- else if (bperpix == 24) {
+- if (border == MSBFirst) {
+- *ip++ = (xcol>>16) & 0xff;
+- *ip++ = (xcol>>8) & 0xff;
+- *ip++ = xcol & 0xff;
+- }
+- else { /* LSBFirst */
+- *ip++ = xcol & 0xff;
+- *ip++ = (xcol>>8) & 0xff;
+- *ip++ = (xcol>>16) & 0xff;
+- }
+- }
++#ifdef ENABLE_FIXPIX_SMOOTH
++ if (do_fixpix_smooth) {
++#if 0
++ /* If we wouldn't have to save the original pic24 image data,
++ * the following code would do the dither job by overwriting
++ * the image data, and the normal render code would then work
++ * without any change on that data.
++ * Unfortunately, this approach would hurt the xv assumptions...
++ */
++ if (bperpix < 24) {
++ FSBUF *fs = fs2_init(wide);
++ if (fs) {
++ fs2_dither(fs, pic24, 3, high, wide);
++ free(fs);
++ }
++ }
++#else
++ /* ...so we have to take a different approach with linewise
++ * dithering/rendering in a loop using a temporary line buffer.
++ */
++ if (bperpix < 24) {
++ FSBUF *fs = fs2_init(wide);
++ if (fs) {
++ byte *row_buf = malloc((size_t)wide * 3);
++ if (row_buf) {
++ int nc = 3;
++ byte *picp = pic24; lip = imagedata;
++
++ switch (bperpix) {
++ case 8:
++ for (i=0; i<high; i++, lip+=bperline, picp+=(size_t)wide*3) {
++ memcpy(row_buf, picp, (size_t)wide * 3);
++ nc = fs2_dither(fs, row_buf, nc, 1, wide);
++ for (j=0, ip=lip, pp=row_buf; j<wide; j++) {
++ xcol = screen_rgb[0][*pp++];
++ xcol |= screen_rgb[1][*pp++];
++ xcol |= screen_rgb[2][*pp++];
++ *ip++ = xcol & 0xff;
++ }
++ }
++ break;
++
++ case 16:
++ for (i=0; i<high; i++, lip+=bperline, picp+=(size_t)wide*3) {
++ CARD16 *ip16 = (CARD16 *)lip;
++ memcpy(row_buf, picp, (size_t)wide * 3);
++ nc = fs2_dither(fs, row_buf, nc, 1, wide);
++ for (j=0, pp=row_buf; j<wide; j++) {
++ xcol = screen_rgb[0][*pp++];
++ xcol |= screen_rgb[1][*pp++];
++ xcol |= screen_rgb[2][*pp++];
++ *ip16++ = (CARD16)xcol;
++ }
++ }
++ break;
++ } /* end switch */
++
++ free(row_buf);
++ free(fs);
+
+- else if (bperpix == 16) {
+- if (border == MSBFirst) {
+- *ip++ = (xcol>>8) & 0xff;
+- *ip++ = xcol & 0xff;
+- }
+- else { /* LSBFirst */
+- *ip++ = xcol & 0xff;
+- *ip++ = (xcol>>8) & 0xff;
++ return xim;
+ }
+- }
+-
+- else if (bperpix == 8) {
+- *ip++ = xcol & 0xff;
+- }
++ free(fs);
++ }
+ }
++#endif /* 0? */
+ }
++#endif /* ENABLE_FIXPIX_SMOOTH */
++
++ lip = imagedata; pp = pic24;
++
++ switch (bperpix) {
++ case 8:
++ for (i=0; i<high; i++, lip+=bperline) {
++ for (j=0, ip=lip; j<wide; j++) {
++ xcol = screen_rgb[0][*pp++];
++ xcol |= screen_rgb[1][*pp++];
++ xcol |= screen_rgb[2][*pp++];
++ *ip++ = xcol & 0xff;
++ }
++ }
++ break;
++
++ case 16:
++ for (i=0; i<high; i++, lip+=bperline) {
++ CARD16 *ip16 = (CARD16 *)lip;
++ for (j=0; j<wide; j++) {
++ xcol = screen_rgb[0][*pp++];
++ xcol |= screen_rgb[1][*pp++];
++ xcol |= screen_rgb[2][*pp++];
++ *ip16++ = (CARD16)xcol;
++ }
++ }
++ break;
++
++ case 24:
++ for (i=0; i<high; i++, lip+=bperline) {
++ for (j=0, ip=lip; j<wide; j++) {
++ xcol = screen_rgb[0][*pp++];
++ xcol |= screen_rgb[1][*pp++];
++ xcol |= screen_rgb[2][*pp++];
++#ifdef USE_24BIT_ENDIAN_FIX
++ if (border == MSBFirst) {
++ *ip++ = (xcol>>16) & 0xff;
++ *ip++ = (xcol>>8) & 0xff;
++ *ip++ = xcol & 0xff;
++ }
++ else { /* LSBFirst */
++ *ip++ = xcol & 0xff;
++ *ip++ = (xcol>>8) & 0xff;
++ *ip++ = (xcol>>16) & 0xff;
++ }
++#else /* GRR: this came with the FixPix patch, but I don't think it's right */
++ *ip++ = (xcol >> 16) & 0xff; /* (no way to test, however, so */
++ *ip++ = (xcol >> 8) & 0xff; /* it's left enabled by default) */
++ *ip++ = xcol & 0xff;
++#endif
++ }
++ }
++ break;
++
++ case 32:
++ for (i=0; i<high; i++, lip+=bperline) {
++ CARD32 *ip32 = (CARD32 *)lip;
++ for (j=0; j<wide; j++) {
++ xcol = screen_rgb[0][*pp++];
++ xcol |= screen_rgb[1][*pp++];
++ xcol |= screen_rgb[2][*pp++];
++ *ip32++ = (CARD32)xcol;
++ }
++ }
++ break;
++ } /* end switch */
+ }
-@@ -2019,17 +2026,17 @@
+ else {
+@@ -2019,17 +2339,17 @@
bwdith = 0;
if (ncols == 0 && dispDEEP != 1) { /* do 'black' and 'white' dither */
@@ -20137,7 +29642,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
NULL, NULL, NULL,
stdrdisp, stdgdisp, stdbdisp, 256);
}
-@@ -2046,14 +2053,14 @@
+@@ -2046,14 +2366,14 @@
case 8: {
byte *imagedata, *ip, *pp;
int j, imWIDE, nullCount;
@@ -20155,7 +29660,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
for (i=0, pp=pic8, ip=imagedata; i<high; i++) {
if (((i+1)&0x7f) == 0) WaitCursor();
-@@ -2066,7 +2073,7 @@
+@@ -2066,7 +2386,7 @@
}
xim = XCreateImage(theDisp, theVisual, dispDEEP, ZPixmap, 0,
@@ -20164,7 +29669,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
32, imWIDE);
if (!xim) FatalError("couldn't create xim!");
}
-@@ -2074,14 +2081,14 @@
+@@ -2074,14 +2394,14 @@
/*********************************/
@@ -20182,7 +29687,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
wide, high, 32, 0);
if (!xim) FatalError("couldn't create xim!");
-@@ -2123,14 +2130,14 @@
+@@ -2123,14 +2443,14 @@
else FatalError("This display's too bizarre. Can't create XImage.");
}
break;
@@ -20200,7 +29705,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
(Randolf Werner) for NeXT 2bit grayscale with MouseX */
byte *imagedata, *ip, *pp;
-@@ -2138,7 +2145,7 @@
+@@ -2138,7 +2458,7 @@
int bperline, half, j;
unsigned long xcol;
@@ -20209,7 +29714,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
wide, high, 32, 0);
if (!xim) FatalError("couldn't create xim!");
-@@ -2201,22 +2208,22 @@
+@@ -2201,22 +2521,22 @@
}
}
}
@@ -20238,7 +29743,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (xim->bits_per_pixel != 8)
FatalError("This display's too bizarre. Can't create XImage.");
-@@ -2238,7 +2245,7 @@
+@@ -2238,7 +2558,7 @@
}
break;
@@ -20247,7 +29752,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/*********************************/
case 15:
-@@ -2282,7 +2289,7 @@
+@@ -2282,7 +2602,7 @@
}
break;
@@ -20256,7 +29761,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/*********************************/
/* this wouldn't seem likely to happen, but what the heck... */
-@@ -2295,7 +2302,7 @@
+@@ -2295,7 +2615,7 @@
imagedata = (byte *) malloc((size_t) (4*wide*high));
if (!imagedata) FatalError("couldn't malloc imagedata");
@@ -20265,7 +29770,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
xim = XCreateImage(theDisp,theVisual,dispDEEP,ZPixmap,0,
(char *) imagedata, wide, high, 32, 0);
if (!xim) FatalError("couldn't create xim!");
-@@ -2303,7 +2310,7 @@
+@@ -2303,7 +2623,7 @@
bperpix = xim->bits_per_pixel;
pp = pic8;
@@ -20274,7 +29779,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (xim->byte_order == MSBFirst) {
for (i=wide*high, ip=imagedata; i>0; i--,pp++) {
if (((i+1)&0x1ffff) == 0) WaitCursor();
-@@ -2327,7 +2334,7 @@
+@@ -2327,7 +2647,7 @@
if (bperpix == 32) *ip++ = 0;
}
}
@@ -20283,7 +29788,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
break;
} /* end of the switch */
-@@ -2346,7 +2353,7 @@
+@@ -2346,7 +2666,7 @@
int mode;
{
/* move checkmark */
@@ -20292,7 +29797,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
conv24MB.flags[CONV24_24BIT] = (mode==PIC24);
if (mode == PIC24) {
-@@ -2383,15 +2390,13 @@
+@@ -2383,15 +2703,13 @@
void Change824Mode(mode)
int mode;
{
@@ -20309,7 +29814,23 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
}
/* should probably actually *do* something involving colors, regenrating
-@@ -2474,7 +2479,7 @@
+@@ -2453,6 +2771,7 @@
+
+
+ /***********************/
++#if 0 /* NOTUSED */
+ static int highbit(ul)
+ unsigned long ul;
+ {
+@@ -2465,6 +2784,7 @@
+ for (i=31; ((ul & hb) == 0) && i>=0; i--, ul<<=1);
+ return i;
+ }
++#endif /* 0 - NOTUSED */
+
+
+
+@@ -2474,7 +2794,7 @@
int ptype, w,h, sx,sy,sw,sh;
{
/* mallocs and returns the selected subimage (sx,sy,sw,sh) of pic.
@@ -20318,7 +29839,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
NEVER RETURNS NULL */
byte *rpic, *sp, *dp;
-@@ -2520,7 +2525,6 @@
+@@ -2520,7 +2840,6 @@
installs the new pic and all that... Returns '0' on failure */
int rv;
@@ -20326,7 +29847,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (padPic) free(padPic);
if (holdcomment) free(holdcomment);
-@@ -2530,8 +2534,8 @@
+@@ -2530,8 +2849,8 @@
rv = 1;
@@ -20337,7 +29858,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
"\nI see");
return 0;
}
-@@ -2539,8 +2543,8 @@
+@@ -2539,8 +2858,8 @@
WaitCursor();
if (mode == PAD_SOLID) rv = doPadSolid(str, wide, high, opaque,omode);
@@ -20348,7 +29869,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
SetCursors(-1);
-@@ -2556,7 +2560,7 @@
+@@ -2556,7 +2875,7 @@
return 1;
}
@@ -20357,7 +29878,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/***********************************/
int LoadPad(pinfo, fname)
-@@ -2645,7 +2649,7 @@
+@@ -2645,7 +2964,7 @@
return 0;
}
}
@@ -20366,7 +29887,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
pic24 = (byte *) malloc(wide * high * 3 * sizeof(byte));
-@@ -2656,7 +2660,7 @@
+@@ -2656,7 +2975,7 @@
return 0;
}
@@ -20375,7 +29896,17 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/* fill pic24 with solidRGB */
for (i=0,pp=pic24; i<wide*high; i++, pp+=3) {
pp[0] = (solidRGB>>16) & 0xff;
-@@ -2697,7 +2701,11 @@
+@@ -2676,6 +2995,9 @@
+ char *str;
+ int wide, high, opaque,omode;
+ {
++#ifndef USE_MKSTEMP
++ int tmpfd;
++#endif
+ int i;
+ byte *bgpic24;
+ char syscmd[512], fname[128], errstr[512];
+@@ -2697,7 +3019,18 @@
#else
strcpy(fname, "Sys$Disk:[]xvuXXXXXX");
#endif
@@ -20383,11 +29914,18 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
+ close(mkstemp(fname));
+#else
mktemp(fname);
++ tmpfd = open(fname, O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
++ if (tmpfd < 0) {
++ sprintf(errstr, "Error: can't create temporary file %s", fname);
++ ErrPopUp(errstr, "\nDoh!");
++ return 0;
++ }
++ close(tmpfd);
+#endif
/* run bggen to generate the background */
sprintf(syscmd, "bggen -g %dx%d %s > %s", wide, high, str, fname);
-@@ -2713,7 +2721,7 @@
+@@ -2713,7 +3046,7 @@
ErrPopUp(errstr, "\nDoh!");
return 0;
}
@@ -20396,7 +29934,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/* read the file that's been created */
if (!ReadImageFile1(fname, &pinfo)) {
-@@ -2791,7 +2799,7 @@
+@@ -2791,7 +3124,7 @@
int wide, high, opaque,omode;
{
/* copies 'pic' onto the given 24-bit background image, converts back to
@@ -20405,7 +29943,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
frees pic24 if necessary */
byte *pp, *p24;
-@@ -2806,30 +2814,30 @@
+@@ -2806,30 +3139,30 @@
/* copy 'pic' centered onto pic24. */
@@ -20447,7 +29985,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (omode == PAD_ORGB) {
rval = (r * fg) / 100 + ((int) p24[0] * bg) / 100;
gval = (g * fg) / 100 + ((int) p24[1] * bg) / 100;
-@@ -2845,7 +2853,7 @@
+@@ -2845,7 +3178,7 @@
if (omode == PAD_OINT) {
h = fh;
@@ -20456,7 +29994,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/* v = (fv * fg) / 100.0 + (bv * bg) / 100.0; */
v = (fv * bv * bw) + (fv * fw);
}
-@@ -2855,18 +2863,18 @@
+@@ -2855,18 +3188,18 @@
h = fh;
/* s = (fs * fg) / 100.0 + (bs * bg) / 100.0; */
s = (fs * bs * bw) + (fs * fw);
@@ -20479,7 +30017,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
double fx,fy, bx,by, ox,oy;
if (fg == 100 || bg == 100) { /* E-Z special case */
-@@ -2874,17 +2882,17 @@
+@@ -2874,17 +3207,17 @@
else { h = bh; s = fs; v=fv; }
}
else { /* general case */
@@ -20501,7 +30039,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
/* convert ox,oy back into hue,sat */
s = sqrt((ox * ox) + (oy * oy));
if (ox == 0.0) {
-@@ -2897,7 +2905,7 @@
+@@ -2897,7 +3230,7 @@
while (h<0.0) h += 360.0;
while (h>=360.0) h -= 360.0;
}
@@ -20510,7 +30048,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
v = fv;
}
}
-@@ -2924,7 +2932,7 @@
+@@ -2924,7 +3257,7 @@
v = (fv * bv * bw) + (fv * fw);
hsv2rgb(h,s,v, &rval,&gval,&bval);
}
@@ -20519,7 +30057,7 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
RANGE(rval, 0, 255); RANGE(gval, 0, 255); RANGE(bval, 0, 255);
*p24++ = rval; *p24++ = gval; *p24++ = bval;
}
-@@ -2958,12 +2966,15 @@
+@@ -2958,16 +3291,19 @@
/*******************************/
@@ -20537,16 +30075,23 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
ftype = ReadFileType(name);
-@@ -2976,7 +2987,7 @@
+- if (ftype == RFT_COMPRESS) { /* handle compressed/gzipped files */
++ if ((ftype == RFT_COMPRESS) || (ftype == RFT_BZIP2)) { /* handle .Z,gz,bz2 */
+ #ifdef VMS
+ basefname[0] = '\0';
+ strcpy(basefname, name); /* remove trailing .Z */
+@@ -2976,8 +3312,8 @@
#else
uncName = name;
#endif
-
+- if (UncompressFile(uncName, uncompname)) {
+
- if (UncompressFile(uncName, uncompname)) {
++ if (UncompressFile(uncName, uncompname, ftype)) {
ftype = ReadFileType(uncompname);
readname = uncompname;
-@@ -3004,7 +3015,7 @@
+ }
+@@ -3004,7 +3340,7 @@
KillPageFiles(pinfo->pagebname, pinfo->numpages);
if (!i || (i && (pinfo->w<=0 || pinfo->h<=0))) {
@@ -20555,35 +30100,42 @@ diff -ruN xv-3.10a/xvimage.c xv-3.10a-bugfixes/xvimage.c
if (pinfo->pic) free(pinfo->pic);
if (pinfo->comment) free(pinfo->comment);
}
-@@ -3021,6 +3032,6 @@
-
-
+@@ -3018,9 +3354,3 @@
+ return 1;
+ }
+-
+-
+-
-
-+
-
-
-diff -ruN xv-3.10a/xvinfo.c xv-3.10a-bugfixes/xvinfo.c
+-
+-
+diff -ru xv-3.10a/xvinfo.c xv-3.10a-enhancements/xvinfo.c
--- xv-3.10a/xvinfo.c 1994-12-22 14:34:41.000000000 -0800
-+++ xv-3.10a-bugfixes/xvinfo.c 2004-05-16 18:03:43.000000000 -0700
++++ xv-3.10a-enhancements/xvinfo.c 2007-05-13 14:11:03.000000000 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* xvinfo.c - 'Info' box handling functions
*
* callable functions:
-@@ -8,7 +8,7 @@
+@@ -8,8 +8,8 @@
* maps/unmaps window, etc.
* RedrawInfo(x,y,w,h) - called by 'expose' events
* SetInfoMode(mode) - changes amount of info Info window shows
- * SetISTR(st, fmt, args) - sprintf's into ISTR #st. Redraws it in window
-+ * SetISTR(st, fmt, args) - sprintf's into ISTR #st. Redraws it in window
- * char *GetISTR(st) - returns pointer to ISTR #st, or NULL if st bogus
+- * char *GetISTR(st) - returns pointer to ISTR #st, or NULL if st bogus
++ * SetISTR(st, fmt, args) - sprintf's into ISTR #st. Redraws it in window
++ * char *GetISTR(st) - returns pointer to ISTR #st, or NULL if st bogus
*/
-@@ -45,18 +45,18 @@
+ #include "copyright.h"
+@@ -43,20 +43,20 @@
+
+ /***************************************************/
void CreateInfo(geom)
- char *geom;
+-char *geom;
++ const char *geom;
{
- infoW = CreateWindow("xv info", "XVinfo", geom, INFOWIDE, INFOHIGH,
+ infoW = CreateWindow("xv info", "XVinfo", geom, INFOWIDE, INFOHIGH,
@@ -20614,7 +30166,7 @@ diff -ruN xv-3.10a/xvinfo.c xv-3.10a-bugfixes/xvinfo.c
infoUp = vis;
}
-@@ -74,15 +74,15 @@
+@@ -74,23 +74,23 @@
int x,y,w,h;
{
int i;
@@ -20633,8 +30185,10 @@ diff -ruN xv-3.10a/xvinfo.c xv-3.10a-bugfixes/xvinfo.c
36 - pennnet_height/2);
/* draw the credits */
-@@ -90,7 +90,7 @@
- CenterString(infoW, INFOWIDE/2, 36-LINEHIGH, str);
+- sprintf(str,"XV - %s",REVDATE);
+- CenterString(infoW, INFOWIDE/2, 36-LINEHIGH, str);
++ snprintf(dummystr, sizeof(dummystr), "XV - %s", REVDATE);
++ CenterString(infoW, INFOWIDE/2, 36-LINEHIGH, dummystr);
CenterString(infoW, INFOWIDE/2, 36,
"by John Bradley (bradley@dccs.upenn.edu)");
- CenterString(infoW, INFOWIDE/2, 36+LINEHIGH,
@@ -20642,7 +30196,17 @@ diff -ruN xv-3.10a/xvinfo.c xv-3.10a-bugfixes/xvinfo.c
"Copyright 1994, John Bradley - All Rights Reserved");
-@@ -139,8 +139,8 @@
+@@ -131,16 +131,16 @@
+ static void drawFieldName(fnum)
+ int fnum;
+ {
+- static char *fname[7] = { "Filename:", "Format:", "Resolution:", "Cropping:",
+- "Expansion:", "Selection:", "Colors:" };
++ static const char *fname[7] = { "Filename:", "Format:", "Resolution:",
++ "Cropping:", "Expansion:", "Selection:", "Colors:" };
+
+ XSetForeground(theDisp, theGC, infofg);
+ XSetBackground(theDisp, theGC, infobg);
if (infoMode == INF_NONE || infoMode == INF_STR) return;
if (infoMode == INF_PART && fnum>=3) return;
@@ -20674,7 +30238,7 @@ diff -ruN xv-3.10a/xvinfo.c xv-3.10a-bugfixes/xvinfo.c
XSetForeground(theDisp, theGC, infofg);
XDrawString(theDisp, infoW, theGC, STLEFT,
- TOPBASE + (st-ISTR_FILENAME)*LINEHIGH, istrs[st],
-+ TOPBASE + (st-ISTR_FILENAME)*LINEHIGH, istrs[st],
++ TOPBASE + (st-ISTR_FILENAME)*LINEHIGH, istrs[st],
(int) strlen(istrs[st]));
}
}
@@ -20707,7 +30271,12 @@ diff -ruN xv-3.10a/xvinfo.c xv-3.10a-bugfixes/xvinfo.c
drawStrings();
}
}
-@@ -237,9 +237,9 @@
+@@ -233,14 +233,14 @@
+
+ if (stnum>=0 && stnum < NISTR) {
+ fmt = va_arg(args, char *);
+- if (fmt) vsprintf(istrs[stnum], fmt, args);
++ if (fmt) vsnprintf(istrs[stnum], sizeof(istrs[stnum]), fmt, args);
else istrs[stnum][0] = '\0';
}
va_end(args);
@@ -20715,11 +30284,13 @@ diff -ruN xv-3.10a/xvinfo.c xv-3.10a-bugfixes/xvinfo.c
+
if (stnum == ISTR_COLOR) {
- sprintf(istrs[ISTR_INFO], "%s %s %s", formatStr,
-+ sprintf(istrs[ISTR_INFO], "%s %s %s", formatStr,
- (picType==PIC8) ? "8-bit mode." : "24-bit mode.",
+- (picType==PIC8) ? "8-bit mode." : "24-bit mode.",
++ snprintf(istrs[ISTR_INFO], sizeof(istrs[ISTR_INFO]), "%s %s %s",
++ formatStr, (picType==PIC8) ? "8-bit mode." : "24-bit mode.",
istrs[ISTR_COLOR]);
}
-@@ -250,19 +250,19 @@
+
+@@ -250,22 +250,22 @@
XFlush(theDisp);
}
@@ -20741,10 +30312,14 @@ diff -ruN xv-3.10a/xvinfo.c xv-3.10a-bugfixes/xvinfo.c
+ if (stnum == ISTR_WARNING && !ctrlUp && !infoUp && !anyBrowUp &&
strlen(istrs[stnum])) {
OpenAlert(istrs[stnum]);
- sleep(3);
-diff -ruN xv-3.10a/xviris.c xv-3.10a-bugfixes/xviris.c
+- sleep(3);
++ sleep(1); /* was 3, but _really_ slow for TIFFs with unknown tags... */
+ CloseAlert();
+ }
+ }
+diff -ru xv-3.10a/xviris.c xv-3.10a-enhancements/xviris.c
--- xv-3.10a/xviris.c 1994-12-22 14:34:47.000000000 -0800
-+++ xv-3.10a-bugfixes/xviris.c 2005-04-03 12:08:03.000000000 -0700
++++ xv-3.10a-enhancements/xviris.c 2007-05-13 17:49:50.000000000 -0700
@@ -14,7 +14,7 @@
*
* This code should work on machines with any byte order.
@@ -20763,6 +30338,26 @@ diff -ruN xv-3.10a/xviris.c xv-3.10a-bugfixes/xviris.c
char name[80];
u_long colormap;
+@@ -80,7 +80,7 @@
+ #define CHANOFFSET(z) (3-(z)) /* this is byte order dependent */
+
+
+-static int irisError PARM((char *, char *));
++static int irisError PARM((const char *, const char *));
+ static byte *getimagedata PARM((FILE *, IMAGE *));
+ static void interleaverow PARM((byte *, byte *, int, int));
+ static void expandrow PARM((byte *, byte *, int));
+@@ -97,8 +97,8 @@
+ static void putlong PARM((FILE *, u_long));
+
+
+-static char *loaderr;
+-static char *bname;
++static const char *loaderr;
++static const char *bname;
+
+ /*****************************************************/
+ int LoadIRIS(fname, pinfo)
@@ -112,7 +112,8 @@
IMAGE img;
byte *rawdata, *rptr;
@@ -20847,7 +30442,7 @@ diff -ruN xv-3.10a/xviris.c xv-3.10a-bugfixes/xviris.c
*bptr++ = rptr[3];
*bptr++ = rptr[2];
*bptr++ = rptr[1];
-@@ -220,7 +229,7 @@
+@@ -220,12 +229,12 @@
pinfo->comment = (char *) NULL;
return 1;
@@ -20856,7 +30451,13 @@ diff -ruN xv-3.10a/xviris.c xv-3.10a-bugfixes/xviris.c
/*******************************************/
-@@ -237,15 +246,15 @@
+ static int irisError(name, st)
+- char *name, *st;
++ const char *name, *st;
+ {
+ SetISTR(ISTR_WARNING,"%s: %s", name, st);
+ return 0;
+@@ -237,41 +246,53 @@
FILE *fp;
IMAGE *img;
{
@@ -20875,7 +30476,12 @@ diff -ruN xv-3.10a/xviris.c xv-3.10a-bugfixes/xviris.c
rle = ISRLE(img->type);
-@@ -257,21 +266,33 @@
+ bpp = BPP(img->type);
+- loaderr = (char *) NULL;
++ loaderr = (const char *) NULL;
+
+ if (bpp != 1) {
+ loaderr = "image must have 1 byte per pix chan";
return (byte *) NULL;
}
@@ -21098,10 +30704,37 @@ diff -ruN xv-3.10a/xviris.c xv-3.10a-bugfixes/xviris.c
*optr++ = 0;
return (optr - rlebuf);
}
-diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
+diff -ru xv-3.10a/xvjpeg.c xv-3.10a-enhancements/xvjpeg.c
--- xv-3.10a/xvjpeg.c 1995-01-05 00:17:13.000000000 -0800
-+++ xv-3.10a-bugfixes/xvjpeg.c 2005-03-27 16:23:06.000000000 -0800
-@@ -35,7 +35,7 @@
++++ xv-3.10a-enhancements/xvjpeg.c 2007-05-13 17:47:11.000000000 -0700
+@@ -12,13 +12,17 @@
+
+ #include <setjmp.h>
+
+-#include "jpeglib.h"
++#include "jpeglib.h" /* currently defines JPEG_APP0 but not JPEG_APP1 */
+ #include "jerror.h"
+
++#ifndef JPEG_APP1
++# define JPEG_APP1 (JPEG_APP0 + 1) /* EXIF marker */
++#endif
++
+ #define CREATOR_STR "CREATOR: "
+
+ #if BITS_IN_JSAMPLE != 8
+- Sorry, this code only copes with 8-bit JSAMPLEs. /* deliberate syntax err */
++ Sorry, this code copes only with 8-bit JSAMPLEs. /* deliberate syntax err */
+ #endif
+
+
+@@ -30,12 +34,12 @@
+ #define J_BCANC 1
+ #define BUTTH 24
+
+-/* minimum size compression when doing a 'quick' image load. (of course, if
+- the image *is* smaller than this, you'll get whatever size it actually is.
++/* Minimum size compression when doing a 'quick' image load. (Of course, if
++ the image *is* smaller than this, you'll get whatever size it actually is.)
This is currently hardcoded to be twice the size of a schnauzer icon, as
the schnauzer's the only thing that does a quick load... */
@@ -21110,7 +30743,42 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
#define QUICKHIGH 120
struct my_error_mgr {
-@@ -80,28 +80,26 @@
+@@ -51,19 +55,33 @@
+ static void clickJD PARM((int, int));
+ static void doCmd PARM((int));
+ static void writeJPEG PARM((void));
++#if JPEG_LIB_VERSION > 60
++METHODDEF(void) xv_error_exit PARM((j_common_ptr));
++METHODDEF(void) xv_error_output PARM((j_common_ptr));
++METHODDEF(void) xv_prog_meter PARM((j_common_ptr));
++#else
+ METHODDEF void xv_error_exit PARM((j_common_ptr));
+ METHODDEF void xv_error_output PARM((j_common_ptr));
+ METHODDEF void xv_prog_meter PARM((j_common_ptr));
++#endif
+ static unsigned int j_getc PARM((j_decompress_ptr));
++#if JPEG_LIB_VERSION > 60
++METHODDEF(boolean) xv_process_comment PARM((j_decompress_ptr));
++METHODDEF(boolean) xv_process_app1 PARM((j_decompress_ptr));
++#else
+ METHODDEF boolean xv_process_comment PARM((j_decompress_ptr));
++METHODDEF boolean xv_process_app1 PARM((j_decompress_ptr));
++#endif
+ static int writeJFIF PARM((FILE *, byte *, int,int,int));
+
+
+
+ /*** local variables ***/
+ static char *filename;
+-static char *fbasename;
++static const char *fbasename;
+ static char *comment;
++static byte *exifInfo;
++static int exifInfoSize; /* not a string => must track size explicitly */
+ static int colorType;
+
+ static DIAL qDial, smDial;
+@@ -80,28 +98,26 @@
/***************************************************/
void CreateJPEGW()
{
@@ -21124,12 +30792,12 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
-
- DCreate(&qDial, jpegW, 10, 10, 80, 100, 1, 100, 75, 5,
+
-+ DCreate(&qDial, jpegW, 10, 10, 80, 100, 1, 100, 75, 5,
++ DCreate(&qDial, jpegW, 10, 10, 80, 100, 1.0, 100.0, 75.0, 1.0, 5.0,
infofg, infobg, hicol, locol, "Quality", "%");
-
- DCreate(&smDial, jpegW, 120, 10, 80, 100, 0, 100, 0, 5,
+
-+ DCreate(&smDial, jpegW, 120, 10, 80, 100, 0, 100, 0, 5,
++ DCreate(&smDial, jpegW, 120, 10, 80, 100, 0.0, 100.0, 0.0, 1.0, 5.0,
infofg, infobg, hicol, locol, "Smoothing", "%");
-
- BTCreate(&jbut[J_BOK], jpegW, JWIDE-180-1, JHIGH-10-BUTTH-1, 80, BUTTH,
@@ -21150,7 +30818,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
/***************************************************/
void JPEGDialog(vis)
-@@ -122,32 +120,32 @@
+@@ -122,32 +138,32 @@
{
/* check event to see if it's for one of our subwindows. If it is,
deal accordingly, and return '1'. Otherwise, return '0' */
@@ -21191,7 +30859,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
if (e->button == Button1) {
if (e->window == jpegW) clickJD(x,y);
else if (e->window == qDial.win) DTrack(&qDial, x,y);
-@@ -156,18 +154,18 @@
+@@ -156,18 +172,18 @@
} /* button1 */
else rv = 0;
} /* button press */
@@ -21215,7 +30883,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
if (e->window == jpegW) {
if (stlen) {
if (buf[0] == '\r' || buf[0] == '\n') { /* enter */
-@@ -181,12 +179,12 @@
+@@ -181,12 +197,12 @@
else rv = 0;
}
else rv = 0;
@@ -21230,19 +30898,38 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
return rv;
}
-@@ -211,17 +209,17 @@
- char *title3 = "quality = bigger file.";
- char *title4 = "Use smoothing if saving";
- char *title5 = "an 8-bit image (eg, a GIF).";
--
-+
- char *qtitle1 = "Default = 75.";
- char *qtitle2 = "Useful range";
- char *qtitle3 = "is 5-95.";
- char *smtitle1 = "Default = 0 (none).";
- char *smtitle2 = "10-30 is enough";
- char *smtitle3 = "for typical GIFs.";
--
+@@ -205,23 +221,24 @@
+ static void drawJD(x,y,w,h)
+ int x,y,w,h;
+ {
+- char *title = "Save JPEG file...";
+- char *title1 = "Quality value determines";
+- char *title2 = "compression rate: higher";
+- char *title3 = "quality = bigger file.";
+- char *title4 = "Use smoothing if saving";
+- char *title5 = "an 8-bit image (eg, a GIF).";
+-
+- char *qtitle1 = "Default = 75.";
+- char *qtitle2 = "Useful range";
+- char *qtitle3 = "is 5-95.";
+- char *smtitle1 = "Default = 0 (none).";
+- char *smtitle2 = "10-30 is enough";
+- char *smtitle3 = "for typical GIFs.";
+-
++ const char *title = "Save JPEG file...";
++ const char *title1 = "Quality value determines";
++ const char *title2 = "compression rate: higher";
++ const char *title3 = "quality = bigger file.";
++ const char *title4 = "Use smoothing if saving";
++ const char *title5 = "an 8-bit image (eg, a GIF).";
++
++ const char *qtitle1 = "Default = 75.";
++ const char *qtitle2 = "Useful range";
++ const char *qtitle3 = "is 5-95.";
++
++ const char *smtitle1 = "Default = 0 (none).";
++ const char *smtitle2 = "10-30 is enough";
++ const char *smtitle3 = "for typical GIFs.";
+
int i;
XRectangle xr;
@@ -21251,7 +30938,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
xr.x = x; xr.y = y; xr.width = w; xr.height = h;
XSetClipRectangles(theDisp, theGC, 0,0, &xr, 1, Unsorted);
-@@ -240,11 +238,11 @@
+@@ -240,11 +257,11 @@
DrawString(jpegW, 15, 10+100+10+ASCENT, qtitle1);
DrawString(jpegW, 15, 10+100+10+ASCENT+LINEHIGH, qtitle2);
DrawString(jpegW, 15, 10+100+10+ASCENT+LINEHIGH*2, qtitle3);
@@ -21265,7 +30952,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
XSetClipMask(theDisp, theGC, None);
}
-@@ -255,14 +253,14 @@
+@@ -255,14 +272,14 @@
{
int i;
BUTT *bp;
@@ -21283,7 +30970,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
if (i<J_NBUTTS) { /* found one */
if (BTTrack(bp)) doCmd(i);
}
-@@ -281,7 +279,7 @@
+@@ -281,7 +298,7 @@
writeJPEG();
JPEGDialog(0);
@@ -21292,7 +30979,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
fullname = GetDirFullName();
if (!ISPIPE(fullname[0])) {
XVCreatedFile(fullname);
-@@ -304,7 +302,7 @@
+@@ -304,7 +321,7 @@
static void writeJPEG()
{
FILE *fp;
@@ -21301,7 +30988,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
register byte *ip, *ep;
byte *inpix, *rmap, *gmap, *bmap;
byte *image8, *image24;
-@@ -322,6 +320,14 @@
+@@ -322,6 +339,14 @@
WaitCursor();
inpix = GenSavePic(&ptype, &w, &h, &pfree, &nc, &rmap, &gmap, &bmap);
@@ -21316,7 +31003,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
image8 = image24 = (byte *) NULL;
-@@ -332,37 +338,46 @@
+@@ -332,37 +357,46 @@
if (i==nc) colorType = F_GREYSCALE; /* made it all the way through */
}
else { /* PIC24 */
@@ -21374,7 +31061,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
*ip++ = rmap[*ep];
*ip++ = gmap[*ep];
*ip++ = bmap[*ep];
-@@ -374,16 +389,16 @@
+@@ -374,16 +408,16 @@
}
}
@@ -21394,84 +31081,203 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
if (CloseOutFile(fp, filename, rv) == 0) DirBox(0);
SetCursors(-1);
}
-@@ -400,7 +415,7 @@
+@@ -400,7 +434,11 @@
/**************************************************/
-METHODDEF void xv_error_exit(cinfo)
-+METHODDEF void xv_error_exit(cinfo)
++#if JPEG_LIB_VERSION > 60
++METHODDEF(void) xv_error_exit(cinfo)
++#else
++METHODDEF void xv_error_exit(cinfo)
++#endif
j_common_ptr cinfo;
{
my_error_ptr myerr;
-@@ -412,7 +427,7 @@
+@@ -412,7 +450,11 @@
/**************************************************/
-METHODDEF void xv_error_output(cinfo)
-+METHODDEF void xv_error_output(cinfo)
++#if JPEG_LIB_VERSION > 60
++METHODDEF(void) xv_error_output(cinfo)
++#else
++METHODDEF void xv_error_output(cinfo)
++#endif
j_common_ptr cinfo;
{
my_error_ptr myerr;
-@@ -464,7 +479,7 @@
+@@ -426,7 +468,11 @@
+
+
+ /**************************************************/
+-METHODDEF void xv_prog_meter(cinfo)
++#if JPEG_LIB_VERSION > 60
++METHODDEF(void) xv_prog_meter(cinfo)
++#else
++METHODDEF void xv_prog_meter(cinfo)
++#endif
+ j_common_ptr cinfo;
+ {
+ struct jpeg_progress_mgr *prog;
+@@ -462,14 +508,16 @@
+ struct my_error_mgr jerr;
+ JSAMPROW rowptr[1];
FILE *fp;
- static byte *pic;
+- static byte *pic;
++ const char *colorspace_name = "Color";
++ byte *pic, *pic_end;
long filesize;
- int i,w,h,bperpix;
+ int i,w,h,bperpix,bperline,count;
fbasename = BaseName(fname);
-@@ -546,16 +561,16 @@
- if (cinfo.jpeg_color_space == JCS_GRAYSCALE) {
- cinfo.out_color_space = JCS_GRAYSCALE;
- cinfo.quantize_colors = FALSE;
--
+ pic = (byte *) NULL;
+ comment = (char *) NULL;
++ exifInfo = (byte *) NULL;
+
+ pinfo->type = PIC8;
+
+@@ -485,14 +533,22 @@
+ jerr.pub.output_message = xv_error_output;
+
+ if (setjmp(jerr.setjmp_buffer)) {
++L1:
+ /* if we're here, it blowed up... */
+ jpeg_destroy_decompress(&cinfo);
+ fclose(fp);
+- if (pic) free(pic);
+- if (comment) free(comment);
+-
+- pinfo->pic = (byte *) NULL;
+- pinfo->comment = (char *) NULL;
++ if (pic) free(pic);
++ if (comment) free(comment);
++ if (exifInfo) free(exifInfo);
+
- SetISTR(ISTR_INFO,"Loading %dx%d Greyscale JPEG (%ld bytes)...",
- w,h,filesize);
--
++ pinfo->pic = (byte *) NULL;
++ pinfo->comment = (char *) NULL;
++ pinfo->exifInfo = (byte *) NULL;
++ pinfo->exifInfoSize = 0;
+
- for (i=0; i<256; i++) pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i;
++ comment = (char *) NULL;
++ exifInfo = (byte *) NULL;
++ exifInfoSize = 0;
+
+ return 0;
}
- else {
- cinfo.out_color_space = JCS_RGB;
- cinfo.quantize_colors = FALSE; /* default: give 24-bit image to XV */
+@@ -500,6 +556,7 @@
+
+ jpeg_create_decompress(&cinfo);
+ jpeg_set_marker_processor(&cinfo, JPEG_COM, xv_process_comment);
++ jpeg_set_marker_processor(&cinfo, JPEG_APP1, xv_process_app1);
+
+ /* hook up progress meter */
+ prog.progress_monitor = xv_prog_meter;
+@@ -515,9 +572,8 @@
+
+
+ jpeg_calc_output_dimensions(&cinfo);
+- w = cinfo.output_width;
+- h = cinfo.output_height;
+- pinfo->normw = w; pinfo->normh = h;
++ pinfo->normw = w = cinfo.output_width;
++ pinfo->normh = h = cinfo.output_height;
+
+ if (quick) {
+ int wfac, hfac, fac;
+@@ -543,75 +599,120 @@
+ }
+
+
+- if (cinfo.jpeg_color_space == JCS_GRAYSCALE) {
+- cinfo.out_color_space = JCS_GRAYSCALE;
+- cinfo.quantize_colors = FALSE;
-
-+
- if (!quick && picType==PIC8 && conv24MB.flags[CONV24_LOCK] == 1) {
- /*
- * we're locked into 8-bit mode:
-@@ -563,23 +578,23 @@
- * if CONV24_SLOW, use JPEG's two-pass quantizer
- * if CONV24_BEST, or other, ask for 24-bit image and hand it to XV
- */
--
-+
- cinfo.desired_number_of_colors = 256;
--
-+
- if (conv24 == CONV24_FAST || conv24 == CONV24_SLOW) {
- cinfo.quantize_colors = TRUE;
- state824=1; /* image was converted from 24 to 8 bits */
+- SetISTR(ISTR_INFO,"Loading %dx%d Greyscale JPEG (%ld bytes)...",
+- w,h,filesize);
+-
+- for (i=0; i<256; i++) pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i;
+- }
+- else {
+- cinfo.out_color_space = JCS_RGB;
+- cinfo.quantize_colors = FALSE; /* default: give 24-bit image to XV */
+-
+- if (!quick && picType==PIC8 && conv24MB.flags[CONV24_LOCK] == 1) {
+- /*
+- * we're locked into 8-bit mode:
+- * if CONV24_FAST, use JPEG's one-pass quantizer
+- * if CONV24_SLOW, use JPEG's two-pass quantizer
+- * if CONV24_BEST, or other, ask for 24-bit image and hand it to XV
+- */
+-
+- cinfo.desired_number_of_colors = 256;
+-
+- if (conv24 == CONV24_FAST || conv24 == CONV24_SLOW) {
+- cinfo.quantize_colors = TRUE;
+- state824=1; /* image was converted from 24 to 8 bits */
-
-+
- cinfo.two_pass_quantize = (conv24 == CONV24_SLOW);
+- cinfo.two_pass_quantize = (conv24 == CONV24_SLOW);
++ cinfo.quantize_colors = FALSE; /* default: give 24-bit image to XV */
++ switch (cinfo.num_components) {
++ case 1:
++ cinfo.out_color_space = JCS_GRAYSCALE;
++ colorspace_name = "Greyscale";
++ for (i=0; i<256; i++) pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i;
++ break;
++
++ case 3:
++ cinfo.out_color_space = JCS_RGB;
++ goto L2;
++
++ case 4:
++ cinfo.out_color_space = JCS_CMYK;
++ colorspace_name = "4-Plane Color";
++L2:
++ if (!quick && picType == PIC8 && conv24MB.flags[CONV24_LOCK] == 1) {
++ /*
++ * we're locked into 8-bit mode:
++ * if CONV24_FAST, use JPEG's one-pass quantizer
++ * if CONV24_SLOW, use JPEG's two-pass quantizer
++ * if CONV24_BEST, or other, ask for 24-bit image and hand it to XV
++ */
++ cinfo.desired_number_of_colors = 256;
++
++ if (conv24 == CONV24_FAST || conv24 == CONV24_SLOW) {
++ cinfo.quantize_colors = TRUE;
++ state824 = 1; /* image was converted from 24 to 8 bits */
++ cinfo.two_pass_quantize = (conv24 == CONV24_SLOW);
++ }
}
- }
+- }
-
-+
- SetISTR(ISTR_INFO,"Loading %dx%d Color JPEG (%ld bytes)...",
- w,h,filesize);
- }
+- SetISTR(ISTR_INFO,"Loading %dx%d Color JPEG (%ld bytes)...",
+- w,h,filesize);
+- }
-
-+
- jpeg_calc_output_dimensions(&cinfo); /* note colorspace changes... */
+- jpeg_calc_output_dimensions(&cinfo); /* note colorspace changes... */
-
++ break;
+
+- if (cinfo.output_components != 1 && cinfo.output_components != 3) {
+- SetISTR(ISTR_WARNING, "%s: can't read %d-plane JPEG file!",
+- fbasename, cinfo.output_components);
+- jpeg_destroy_decompress(&cinfo);
+- fclose(fp);
+- if (comment) free(comment);
+- return 0;
++ default:
++ SetISTR(ISTR_WARNING, "%s: can't read %d-plane JPEG file!",
++ fbasename, cinfo.output_components);
++ goto L1;
+ }
++ SetISTR(ISTR_INFO, "Loading %dx%d %s JPEG (%ld bytes)...", w, h,
++ colorspace_name, filesize);
+
++ jpeg_calc_output_dimensions(&cinfo); /* note colorspace changes... */
+
- if (cinfo.output_components != 1 && cinfo.output_components != 3) {
- SetISTR(ISTR_WARNING, "%s: can't read %d-plane JPEG file!",
-@@ -594,7 +609,18 @@
bperpix = cinfo.output_components;
pinfo->type = (bperpix == 1) ? PIC8 : PIC24;
@@ -21481,21 +31287,21 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
+ if (w <= 0 || h <= 0 || bperline/w < bperpix || count/h < bperline) {
+ SetISTR(ISTR_WARNING, "%s: image dimensions too large (%dx%d)",
+ fbasename, w, h);
-+ jpeg_destroy_decompress(&cinfo);
-+ fclose(fp);
-+ if (comment) free(comment);
-+ return 0;
++ goto L1;
+ }
+
+ pic = (byte *) malloc((size_t) count);
if (!pic) {
SetISTR(ISTR_WARNING, "%s: can't read JPEG file - out of memory",
fbasename);
-@@ -603,15 +629,24 @@
- if (comment) free(comment);
- return 0;
+- jpeg_destroy_decompress(&cinfo);
+- fclose(fp);
+- if (comment) free(comment);
+- return 0;
++ goto L1;
}
-
++ pic_end = pic + count;
+
jpeg_start_decompress(&cinfo);
@@ -21503,11 +31309,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
+ if (cinfo.output_scanline < 0) { /* should never happen, but... */
+ SetISTR(ISTR_WARNING, "%s: invalid negative scanline (%d)",
+ fbasename, cinfo.output_scanline);
-+ jpeg_destroy_decompress(&cinfo);
-+ fclose(fp);
-+ if (comment) free(comment);
-+ free(pic);
-+ return 0;
++ goto L1;
+ }
rowptr[0] = (JSAMPROW) &pic[cinfo.output_scanline * w * bperpix];
(void) jpeg_read_scanlines(&cinfo, rowptr, (JDIMENSION) 1);
@@ -21515,34 +31317,113 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
-
+
++ /* Convert CMYK to RGB color space */
++
++ if (bperpix > 3) {
++ register byte *p = pic;
++
++ /* According to documentation accompanying the IJG JPEG Library, it appears
++ * that some versions of Adobe Systems' "Photoshop" write inverted CMYK
++ * data, where Byte 0 represents 100% ink coverage instead of 0% ink as
++ * you'd expect. The JPEG Library's implementors made a policy decision
++ * not to correct for this in the Library, but instead force applications
++ * to deal with it; so we try to do that here:
++ */
++ if (cinfo.saw_Adobe_marker) { /* assume inverted data */
++ register byte *q = pic;
++
++ do {
++ register int cmy, k = 255 - q[3];
++
++ if ((cmy = *q++ - k) < 0) cmy = 0; *p++ = cmy; /* R */
++ if ((cmy = *q++ - k) < 0) cmy = 0; *p++ = cmy; /* G */
++ if ((cmy = *q++ - k) < 0) cmy = 0; *p++ = cmy; /* B */
++ } while (++q <= pic_end);
++ }
++ else { /* assume normal data */
++ register byte *q = pic;
++
++ do {
++ register int cmy, k = 255 - q[3];
++
++ if ((cmy = k - *q++) < 0) cmy = 0; *p++ = cmy; /* R */
++ if ((cmy = k - *q++) < 0) cmy = 0; *p++ = cmy; /* G */
++ if ((cmy = k - *q++) < 0) cmy = 0; *p++ = cmy; /* B */
++ } while (++q <= pic_end);
++ }
++ pic = realloc(pic,p-pic); /* Release extra storage */
++ }
++
++
/* return 'PICINFO' structure to XV */
-@@ -623,7 +658,7 @@
+@@ -621,38 +722,59 @@
+ pinfo->frmType = F_JPEG;
+
if (cinfo.out_color_space == JCS_GRAYSCALE) {
- sprintf(pinfo->fullInfo, "Greyscale JPEG. (%ld bytes)", filesize);
+- sprintf(pinfo->fullInfo, "Greyscale JPEG. (%ld bytes)", filesize);
pinfo->colType = F_GREYSCALE;
-
+
for (i=0; i<256; i++) pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i;
}
else {
-@@ -638,10 +673,10 @@
+- sprintf(pinfo->fullInfo, "Color JPEG. (%ld bytes)", filesize);
+ pinfo->colType = F_FULLCOLOR;
+
+ if (cinfo.quantize_colors) {
+- for (i=0; i<cinfo.actual_number_of_colors; i++) {
+- pinfo->r[i] = cinfo.colormap[0][i];
+- pinfo->g[i] = cinfo.colormap[1][i];
+- pinfo->b[i] = cinfo.colormap[2][i];
++ switch (bperpix) {
++ case 3:
++ for (i = 0; i < cinfo.actual_number_of_colors; i++) {
++ pinfo->r[i] = cinfo.colormap[0][i];
++ pinfo->g[i] = cinfo.colormap[1][i];
++ pinfo->b[i] = cinfo.colormap[2][i];
++ }
++ break;
++
++ case 4:
++ for (i = 0; i < cinfo.actual_number_of_colors; i++) {
++ register int cmy, k = cinfo.colormap[3][i];
++
++ if ((cmy = 255 - cinfo.colormap[0][i] - k) < 0) cmy = 0;
++ pinfo->r[i] = cmy;
++ if ((cmy = 255 - cinfo.colormap[1][i] - k) < 0) cmy = 0;
++ pinfo->g[i] = cmy;
++ if ((cmy = 255 - cinfo.colormap[2][i] - k) < 0) cmy = 0;
++ pinfo->b[i] = cmy;
++ }
++ break;
}
}
}
-
- sprintf(pinfo->shrtInfo, "%dx%d %s JPEG. ", w,h,
-+
-+ sprintf(pinfo->shrtInfo, "%dx%d %s JPEG. ", w,h,
- (cinfo.out_color_space == JCS_GRAYSCALE) ? "Greyscale " : "Color ");
+- (cinfo.out_color_space == JCS_GRAYSCALE) ? "Greyscale " : "Color ");
-
+- pinfo->comment = comment;
++
++ sprintf(pinfo->fullInfo, "%s JPEG. (%ld bytes)", colorspace_name, filesize);
++ sprintf(pinfo->shrtInfo, "%dx%d %s JPEG. ", w, h, colorspace_name);
+
- pinfo->comment = comment;
++ pinfo->comment = comment;
++ pinfo->exifInfo = exifInfo;
++ pinfo->exifInfoSize = exifInfoSize;
jpeg_finish_decompress(&cinfo);
-@@ -651,8 +686,8 @@
- comment = (char *) NULL;
+ jpeg_destroy_decompress(&cinfo);
+ fclose(fp);
+
+- comment = (char *) NULL;
++ /* ownership transferred to pinfo */
++ comment = (char *) NULL;
++ exifInfo = (byte *) NULL;
++ exifInfoSize = 0;
++
return 1;
}
-
@@ -21552,7 +31433,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
/**************************************************/
-@@ -660,7 +695,7 @@
+@@ -660,7 +782,7 @@
j_decompress_ptr cinfo;
{
struct jpeg_source_mgr *datasrc = cinfo->src;
@@ -21561,7 +31442,20 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
if (datasrc->bytes_in_buffer == 0) {
if (! (*datasrc->fill_input_buffer) (cinfo))
ERREXIT(cinfo, JERR_CANT_SUSPEND);
-@@ -688,7 +723,7 @@
+@@ -671,7 +793,11 @@
+
+
+ /**************************************************/
+-METHODDEF boolean xv_process_comment(cinfo)
++#if JPEG_LIB_VERSION > 60
++METHODDEF(boolean) xv_process_comment(cinfo)
++#else
++METHODDEF boolean xv_process_comment(cinfo)
++#endif
+ j_decompress_ptr cinfo;
+ {
+ int length, hasnull;
+@@ -688,7 +814,7 @@
}
else comment = (char *) realloc(comment, strlen(comment) + length + 1);
if (!comment) FatalError("out of memory in xv_process_comment");
@@ -21570,11 +31464,66 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
oldsp = sp = comment + strlen(comment);
hasnull = 0;
-@@ -770,19 +805,19 @@
+@@ -705,6 +831,41 @@
+ }
+
+
++/**************************************************/
++#if JPEG_LIB_VERSION > 60
++METHODDEF(boolean) xv_process_app1(cinfo) /* Geoff H. Kuenning 20030331 */
++#else
++METHODDEF boolean xv_process_app1(cinfo)
++#endif
++ j_decompress_ptr cinfo;
++{
++ int length;
++ unsigned int ch;
++ byte *sp;
++
++ length = j_getc(cinfo) << 8;
++ length += j_getc(cinfo);
++ length -= 2; /* discount the length word itself */
++
++ if (!exifInfo) {
++ exifInfo = (byte *) malloc((size_t) length);
++ exifInfoSize = 0;
++ }
++ else exifInfo = (byte *) realloc(exifInfo, exifInfoSize + length);
++ if (!exifInfo) FatalError("out of memory in xv_process_app1 (EXIF info)");
++
++ sp = exifInfo + exifInfoSize;
++ exifInfoSize += length;
++
++ while (length-- > 0) {
++ ch = j_getc(cinfo);
++ *sp++ = (byte) ch;
++ }
++
++ return TRUE;
++}
++
++
+
+
+ /***************************************************************************/
+@@ -759,8 +920,8 @@
+
+
+ jpeg_set_defaults(&cinfo);
+- jpeg_set_quality(&cinfo, qDial.val, TRUE);
+- cinfo.smoothing_factor = smDial.val;
++ jpeg_set_quality(&cinfo, (int)qDial.val, TRUE);
++ cinfo.smoothing_factor = (int)smDial.val;
+
+
+ jpeg_start_compress(&cinfo, TRUE);
+@@ -769,20 +930,20 @@
+ /*** COMMENT HANDLING ***/
sprintf(xvcmt, "%sXV %s Quality = %d, Smoothing = %d\n",
- CREATOR_STR, REVDATE, qDial.val, smDial.val);
+- CREATOR_STR, REVDATE, qDial.val, smDial.val);
-
++ CREATOR_STR, REVDATE, (int)qDial.val, (int)smDial.val);
+
if (picComments) { /* append XV comment */
char *sp, *sp1; int done;
@@ -21594,7 +31543,7 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
sp = comment; done = 0;
while (!done && *sp) {
if (strncmp(sp, CREATOR_STR, strlen(CREATOR_STR)) == 0) {
-@@ -801,7 +836,7 @@
+@@ -801,7 +962,7 @@
}
}
@@ -21603,16 +31552,20 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
If none, add 2. If one, add 1. If two or more, add none. */
sp = comment + strlen(comment);
-@@ -814,15 +849,15 @@
+@@ -814,15 +975,18 @@
strcat(comment, xvcmt);
}
else comment = xvcmt;
-
-
+- jpeg_write_marker(&cinfo,JPEG_COM,(byte *) comment,(u_int) strlen(comment));
+-
+
+
- jpeg_write_marker(&cinfo,JPEG_COM,(byte *) comment,(u_int) strlen(comment));
--
++ jpeg_write_marker(&cinfo, JPEG_COM, (byte *)comment, (u_int)strlen(comment));
++
++ if (picExifInfo) jpeg_write_marker(&cinfo, JPEG_APP1, (byte *)picExifInfo,
++ (u_int)picExifInfoSize);
+
while (cinfo.next_scanline < cinfo.image_height) {
rowptr[0] = (JSAMPROW) &pic[cinfo.next_scanline * w * bperpix];
@@ -21623,10 +31576,46 @@ diff -ruN xv-3.10a/xvjpeg.c xv-3.10a-bugfixes/xvjpeg.c
jpeg_finish_compress(&cinfo);
jpeg_destroy_compress(&cinfo);
return 0;
-diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
+@@ -831,4 +995,27 @@
+
+
+
++
++/*******************************************/
++void
++VersionInfoJPEG() /* GRR 19980605, 19980607 */
++{
++ int major = JPEG_LIB_VERSION / 10;
++ int minor = JPEG_LIB_VERSION % 10;
++ char minoralpha[2];
++
++ if (minor) {
++ minoralpha[0] = (char)(minor - 1 + 'a');
++ minoralpha[1] = '\0';
++ } else
++ minoralpha[0] = '\0';
++
++/* fprintf(stderr, " Compiled with libjpeg %d.%d.\n", major, minor); */
++ fprintf(stderr, " Compiled with libjpeg %d%s.\n", major, minoralpha);
++}
++
++
++
++
++
+ #endif /* HAVE_JPEG */
+diff -ru xv-3.10a/xvmisc.c xv-3.10a-enhancements/xvmisc.c
--- xv-3.10a/xvmisc.c 1995-01-13 15:41:34.000000000 -0800
-+++ xv-3.10a-bugfixes/xvmisc.c 2005-03-20 22:47:06.000000000 -0800
-@@ -28,6 +28,8 @@
++++ xv-3.10a-enhancements/xvmisc.c 2007-05-13 17:32:59.000000000 -0700
+@@ -21,13 +21,15 @@
+ * void LoadFishCursors()
+ * void WaitCursor()
+ * void SetCursors(int)
+- * char *BaseName(char *)
++ * const char *BaseName(const char *)
+ * void DrawTempGauge(win, x,y,w,h, percent, fg,bg,hi,lo, str)
+ * void ProgressMeter(min, max, val, str);
+ * void xvbcopy(src, dst, length)
* int xvbcmp (s1, s2, length)
* void xvbzero(s, length)
* char *xv_strstr(s1, s2)
@@ -21646,7 +31635,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
#include "bits/fc_left"
#include "bits/fc_leftm"
#include "bits/fc_left1"
-@@ -61,12 +67,12 @@
+@@ -61,21 +67,24 @@
/* the following fakes 'XSetWMProtocols(theDisp, win, &atom_DELWIN, 1);' */
@@ -21661,7 +31650,22 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
PropModeReplace, (unsigned char *) &atom_DELWIN, 1);
}
-@@ -91,9 +97,9 @@
+
+ /***************************************************/
+ Window CreateWindow(name,clname,geom,defw,defh,fg,bg,usesize)
+-char *name, *clname, *geom;
+-int defw,defh,usesize;
+-unsigned long fg, bg;
++ const char *name;
++ const char *clname;
++ const char *geom;
++ int defw,defh;
++ unsigned long fg, bg;
++ int usesize;
+ {
+ Window win;
+ XSetWindowAttributes xswa;
+@@ -91,16 +100,24 @@
x = y = 1;
i = XParseGeometry(geom,&x,&y, (unsigned int *) &w, (unsigned int *) &h);
@@ -21673,7 +31677,25 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
if (!usesize || !(i&WidthValue)) w = defw;
if (!usesize || !(i&HeightValue)) h = defh;
-@@ -130,7 +136,7 @@
+- hints.flags |= USSize;
++ hints.flags |= USSize | PWinGravity;
+
+- if (i&XValue && i&XNegative) x = dispWIDE - w - abs(x);
+- if (i&YValue && i&YNegative) y = dispHIGH - h - abs(y);
++ hints.win_gravity = NorthWestGravity;
++ if (i&XValue && i&XNegative) {
++ hints.win_gravity = NorthEastGravity;
++ x = dispWIDE - (w + 2 * bwidth) - abs(x);
++ }
++ if (i&YValue && i&YNegative) {
++ hints.win_gravity = (hints.win_gravity == NorthWestGravity) ?
++ SouthWestGravity : SouthEastGravity;
++ y = dispHIGH - (h + 2 * bwidth) - abs(y);
++ }
+
+
+ #define VROOT_TRANS
+@@ -130,77 +147,76 @@
xswamask = CWBackPixel | CWBorderPixel | CWColormap;
if (!usesize) xswamask |= CWBitGravity;
@@ -21682,8 +31704,26 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
(u_int) bwidth, (int) dispDEEP, InputOutput,
theVisual, xswamask, &xswa);
if (!win) return(win); /* leave immediately if couldn't create */
-@@ -152,7 +158,7 @@
+
+- XSetStandardProperties(theDisp, win, name, name, None, NULL, 0, &hints);
+-
+ xwmh.input = True;
+ xwmh.flags = InputHint;
+ if (iconPix) { xwmh.icon_pixmap = iconPix; xwmh.flags |= IconPixmapHint; }
+- XSetWMHints(theDisp, win, &xwmh);
+
+ if (clname && strlen(clname)) {
+ classh.res_name = "xv";
+- classh.res_class = clname;
+- XSetClassHint(theDisp, win, &classh);
++ classh.res_class = (char *) clname;
+ StoreDeleteWindowProp(win);
+ }
+
++ XmbSetWMProperties(theDisp, win, name, name, NULL, 0, &hints, &xwmh,
++ clname ? &classh : NULL);
++
return(win);
}
-
@@ -21691,7 +31731,14 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
/**************************************************/
-@@ -164,7 +170,7 @@
+ void DrawString(win,x,y,str)
+- Window win;
+- int x,y;
+- char *str;
++ Window win;
++ int x,y;
++ const char *str;
+ {
XDrawString(theDisp, win, theGC, x, y, str, (int) strlen(str));
}
@@ -21699,8 +31746,13 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
+
/**************************************************/
void CenterString(win,x,y,str)
- Window win;
-@@ -174,7 +180,7 @@
+- Window win;
+- int x,y;
+- char *str;
++ Window win;
++ int x,y;
++ const char *str;
+ {
DrawString(win, CENTERX(mfinfo, x, str), CENTERY(mfinfo, y), str);
}
@@ -21708,9 +31760,12 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
+
/**************************************************/
void ULineString(win,x,y,str)
- Window win;
-@@ -182,11 +188,11 @@
- char *str;
+- Window win;
+- int x,y;
+- char *str;
++ Window win;
++ int x,y;
++ const char *str;
{
DrawString(win, x, y, str);
- XDrawLine(theDisp, win, theGC, x, y+DESCENT-1,
@@ -21722,8 +31777,9 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
+
/**************************************************/
int StringWidth(str)
- char *str;
-@@ -194,13 +200,13 @@
+- char *str;
++ const char *str;
+ {
return(XTextWidth(mfinfo, str, (int) strlen(str)));
}
@@ -21739,28 +31795,49 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
given keypress is a cursor key. More complex than you'd think, since
certain Sun Keyboards generate a variety of odd keycodes, and not all
keyboards *have* all these keys. Note that 'shifted' arrow keys
-@@ -225,16 +231,16 @@
+@@ -225,29 +241,29 @@
int i = CK_NONE;
- if (ks==XK_Up || ks==XK_KP_Up ||
+- ks==XK_KP_8 || ks==XK_F28) i=CK_UP;
+ if (ks==XK_Up || ks==XK_KP_Up ||
- ks==XK_KP_8 || ks==XK_F28) i=CK_UP;
++ ks==XK_F28) i=CK_UP;
- else if (ks==XK_Down || ks==XK_KP_Down ||
+- ks==XK_KP_2 || ks==XK_F34) i=CK_DOWN;
+ else if (ks==XK_Down || ks==XK_KP_Down ||
- ks==XK_KP_2 || ks==XK_F34) i=CK_DOWN;
++ ks==XK_F34) i=CK_DOWN;
- else if (ks==XK_Left || ks==XK_KP_Left ||
+- ks==XK_KP_4 || ks==XK_F30) i=CK_LEFT;
+ else if (ks==XK_Left || ks==XK_KP_Left ||
- ks==XK_KP_4 || ks==XK_F30) i=CK_LEFT;
++ ks==XK_F30) i=CK_LEFT;
- else if (ks==XK_Right || ks==XK_KP_Right ||
+- ks==XK_KP_6 || ks==XK_F32) i=CK_RIGHT;
+ else if (ks==XK_Right || ks==XK_KP_Right ||
- ks==XK_KP_6 || ks==XK_F32) i=CK_RIGHT;
++ ks==XK_F32) i=CK_RIGHT;
else if (ks==XK_Prior || ks==XK_KP_Prior ||
-@@ -257,7 +263,7 @@
+- ks==XK_KP_9 || ks==XK_F29) i=CK_PAGEUP;
++ ks==XK_F29) i=CK_PAGEUP;
+
+ else if (ks==XK_Next || ks==XK_KP_Next ||
+- ks==XK_KP_3 || ks==XK_F35) i=CK_PAGEDOWN;
++ ks==XK_F35) i=CK_PAGEDOWN;
+
+ else if (ks==XK_Home || ks==XK_KP_Home ||
+- ks==XK_KP_7 || ks==XK_F27) i=CK_HOME;
++ ks==XK_F27) i=CK_HOME;
+
+ else if (ks==XK_End || ks==XK_KP_End ||
+- ks==XK_KP_1 || ks==XK_F33) i=CK_END;
++ ks==XK_F33) i=CK_END;
+
+ else i = CK_NONE;
+
+@@ -257,7 +273,7 @@
else if (i==CK_UP) i=CK_PAGEUP;
else if (i==CK_DOWN) i=CK_PAGEDOWN;
}
@@ -21769,7 +31846,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
return i;
}
-@@ -334,9 +340,9 @@
+@@ -334,9 +350,9 @@
ev.window = win;
ev.x = x; ev.y = y; ev.width = w; ev.height = h;
ev.count = 0;
@@ -21781,7 +31858,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
/***********************************/
-@@ -381,7 +387,7 @@
+@@ -381,7 +397,7 @@
u_int w, h;
u_long bg;
{
@@ -21790,7 +31867,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
in the stipple pattern */
XSetFillStyle (theDisp, theGC, FillStippled);
-@@ -400,7 +406,7 @@
+@@ -400,7 +416,7 @@
unsigned int w,h;
unsigned long hi, lo, bg;
{
@@ -21799,7 +31876,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
x1 = x + (int) w;
y1 = y + (int) h;
-@@ -413,7 +419,7 @@
+@@ -413,7 +429,7 @@
XDrawLine(theDisp, win, theGC, x+i, y1-i, x+i, y+i);
XDrawLine(theDisp, win, theGC, x+i, y+i, x1-i, y+i);
}
@@ -21808,7 +31885,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
/* draw bot-right */
XSetForeground(theDisp, theGC, (inout==R3D_OUT) ? lo : hi);
-@@ -431,18 +437,18 @@
+@@ -431,18 +447,18 @@
}
}
}
@@ -21831,7 +31908,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
cWIDE, cHIGH, cXOFF, cYOFF);
else SetISTR(ISTR_CROP, "<none>");
}
-@@ -469,7 +475,7 @@
+@@ -469,7 +485,7 @@
char *st;
/* give 'em time to read message */
@@ -21840,7 +31917,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
else {
st = GetISTR(ISTR_INFO);
OpenAlert(st);
-@@ -477,7 +483,7 @@
+@@ -477,11 +493,11 @@
CloseAlert();
}
}
@@ -21849,7 +31926,12 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
/***********************************/
void FatalError (identifier)
-@@ -491,7 +497,7 @@
+- char *identifier;
++ const char *identifier;
+ {
+ fprintf(stderr, "%s: %s\n",cmd, identifier);
+ Quit(-1);
+@@ -491,12 +507,17 @@
/***********************************/
void Quit(i)
int i;
@@ -21858,9 +31940,48 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
/* called when the program exits. frees everything explictly created
EXCEPT allocated colors. This is used when 'useroot' is in operation,
as we have to keep the alloc'd colors around, but we don't want anything
-@@ -521,9 +527,9 @@
+ else to stay */
+
++#ifdef AUTO_EXPAND
++ chdir(initdir);
++ Vdsettle();
++#endif
++
+ if (!theDisp) exit(i); /* called before connection opened */
+
+ if (useroot && i==0) { /* save the root info */
+@@ -516,14 +537,38 @@
+ if (jpegW) XDestroyWindow(theDisp, jpegW);
#endif
++#ifdef HAVE_JP2K
++ if (jp2kW) XDestroyWindow(theDisp, jp2kW);
++#endif
++
+ #ifdef HAVE_TIFF
+ if (tiffW) XDestroyWindow(theDisp, tiffW);
+ #endif
+
++#ifdef HAVE_PNG
++ if (pngW) XDestroyWindow(theDisp, pngW);
++#endif
++
++#ifdef HAVE_PCD
++ if (pcdW) XDestroyWindow(theDisp, pcdW);
++#endif
++
++#ifdef HAVE_PIC2
++ if (pic2W) XDestroyWindow(theDisp, pic2W);
++#endif
++
++#ifdef HAVE_MGCSFX
++ if (mgcsfxW) XDestroyWindow(theDisp, mgcsfxW);
++#endif
++
++#ifdef HAVE_PNG
++ if (pngW) XDestroyWindow(theDisp, pngW);
++#endif
++
/* if NOT using stdcmap for images, free stdcmap */
- if (colorMapMode != CM_STDCMAP) {
+ if (colorMapMode != CM_STDCMAP) {
@@ -21870,7 +31991,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
xvFreeColors(theDisp, theCmap, &stdfreecols[j], 1, 0L);
}
-@@ -543,13 +549,13 @@
+@@ -543,13 +588,13 @@
if (origlist[j][0] != '/') { /* relative path, prepend 'initdir' */
sprintf(str,"%s/%s", initdir, origlist[j]);
if (unlink(str)) {
@@ -21886,7 +32007,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
cmd, origlist[j], ERRSTR(errno));
}
}
-@@ -567,7 +573,7 @@
+@@ -567,7 +612,7 @@
void LoadFishCursors()
{
#define fc_w 16
@@ -21895,7 +32016,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
Pixmap flpix,flmpix,fmpix,fmmpix,frpix,frmpix;
Pixmap fl1pix, fl1mpix, fr1pix, fr1mpix;
-@@ -592,7 +598,7 @@
+@@ -592,7 +637,7 @@
fr1pix = XCreatePixmapFromBitmapData(theDisp, ctrlW, (char *) fc_right1_bits,
fc_w, fc_h, 1L, 0L, 1);
@@ -21904,7 +32025,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
(char *) fc_right1m_bits,
fc_w, fc_h, 1L, 0L, 1);
-@@ -613,7 +619,7 @@
+@@ -613,7 +658,7 @@
fr1curs= XCreatePixmapCursor(theDisp, fr1pix,fr1mpix,&fg, &bg, 8,8);
frcurs = XCreatePixmapCursor(theDisp, frpix, frmpix, &fg, &bg, 8,8);
@@ -21913,7 +32034,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
{ flcurs = fmcurs = frcurs = (Cursor) NULL; }
}
-@@ -633,8 +639,8 @@
+@@ -633,8 +678,8 @@
time(&lastwaittime);
waiting=1;
xwmh.input = True;
@@ -21924,7 +32045,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
xwmh.flags = (InputHint | IconPixmapHint | IconMaskHint) ;
if (!useroot && mainW) XSetWMHints(theDisp, mainW, &xwmh);
if ( useroot && ctrlW) XSetWMHints(theDisp, ctrlW, &xwmh);
-@@ -665,8 +671,8 @@
+@@ -665,8 +710,8 @@
if (waiting) {
waiting=0;
xwmh.input = True;
@@ -21935,7 +32056,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
xwmh.flags = (InputHint | IconPixmapHint | IconMaskHint) ;
if (!useroot && mainW) XSetWMHints(theDisp, mainW, &xwmh);
if ( useroot && ctrlW) XSetWMHints(theDisp, ctrlW, &xwmh);
-@@ -694,11 +700,11 @@
+@@ -694,11 +739,11 @@
XFlush(theDisp);
}
@@ -21949,7 +32070,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
if (!useroot && mainW) XDefineCursor(theDisp, mainW, mainc);
if (infoW) XDefineCursor(theDisp, infoW, otherc);
if (ctrlW) XDefineCursor(theDisp, ctrlW, otherc);
-@@ -708,11 +714,11 @@
+@@ -708,42 +753,63 @@
SetBrowseCursor(otherc);
SetTextCursor(otherc);
@@ -21960,28 +32081,77 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
#endif
-
+
++#ifdef HAVE_JP2K
++ if (jp2kW) XDefineCursor(theDisp, jp2kW, otherc);
++#endif
++
#ifdef HAVE_TIFF
if (tiffW) XDefineCursor(theDisp, tiffW, otherc);
#endif
-@@ -725,7 +731,7 @@
++
++#ifdef HAVE_PNG
++ if (pngW) XDefineCursor(theDisp, pngW, otherc);
++#endif
++
++#ifdef HAVE_PNG
++ if (pngW) XDefineCursor(theDisp, pngW, otherc);
++#endif
++
++#ifdef HAVE_PCD
++ if (pcdW) XDefineCursor(theDisp, pcdW, otherc);
++#endif
++
++#ifdef HAVE_PIC2
++ if (pic2W) XDefineCursor(theDisp, pic2W, otherc);
++#endif
++
++#ifdef HAVE_MGCSFX
++ if (mgcsfxW) XDefineCursor(theDisp, mgcsfxW, otherc);
++#endif
+ }
+
+
+ /***************************************************/
+-char *BaseName(fname)
+- char *fname;
++const char *BaseName(fname)
++ const char *fname;
{
- char *basname;
+- char *basname;
++ const char *basname;
- /* given a complete path name ('/foo/bar/weenie.gif'), returns just the
+ /* given a complete path name ('/foo/bar/weenie.gif'), returns just the
'simple' name ('weenie.gif'). Note that it does not make a copy of
the name, so don't be modifying it... */
-@@ -736,7 +742,7 @@
- return basname;
+- basname = (char *) rindex(fname, '/');
+- if (!basname) basname = fname;
+- else basname++;
+-
+- return basname;
++ basname = (const char *) rindex(fname, '/');
++ return basname? basname+1 : fname;
}
-
+
/***************************************************/
void DrawTempGauge(win, x,y,w,h, ratio, fg,bg,hi,lo, str)
- Window win;
-@@ -773,14 +779,14 @@
+- Window win;
+- int x,y,w,h;
+- double ratio;
+- u_long fg,bg,hi,lo;
+- char *str;
++ Window win;
++ int x,y,w,h;
++ double ratio;
++ u_long fg,bg,hi,lo;
++ const char *str;
+ {
+ /* draws a 'temprature'-style horizontal progress meter in the specified
+ window, at the specified location */
+@@ -773,14 +839,14 @@
if (numchars) { /* do string */
if (barwide < maxwide) {
XSetForeground(theDisp, theGC, bg);
@@ -21999,7 +32169,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
CENTERY(mfinfo, (y+h/2)), str, numchars);
XSetFunction(theDisp, theGC, GXcopy);
-@@ -789,18 +795,18 @@
+@@ -789,18 +855,18 @@
else if (barwide < maxwide) {
XDrawLine(theDisp,win,theGC,x+3+barwide, y+h/2 + 0, x+w-3, y+h/2 + 0);
@@ -22024,7 +32194,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
(u_int) (maxwide-barwide),(u_int)((h-3) - (h/2+3)) + 1);
}
}
-@@ -815,35 +821,35 @@
+@@ -815,44 +881,44 @@
if (numchars) {
if (barwide < maxwide) {
XSetForeground(theDisp, theGC, bg);
@@ -22069,8 +32239,11 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
/***************************************************/
-@@ -852,7 +858,7 @@
- char *str;
+ void ProgressMeter(min, max, val, str)
+- int min, max, val;
+- char *str;
++ int min, max, val;
++ const char *str;
{
/* called during 'long' operations (algorithms, smoothing, etc.) to
- give some indication that the program will ever finish. Draws a
@@ -22078,7 +32251,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
temperature gauge in either mainW (if not useRoot), or ctrlW.
Tries to be clever: only draws gauge if it looks like the operation is
going to take more than a few seconds. Calling with val == max removes
-@@ -887,7 +893,7 @@
+@@ -887,7 +953,7 @@
if (!waiting) { /* not waiting (or not waiting any longer) */
if (nowTime == lastTime && val<max) return; /* max one draw per second */
lastTime = nowTime;
@@ -22087,7 +32260,26 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
infofg,infobg,hicol,locol,str);
if (val >= max) { /* remove temp gauge */
-@@ -945,7 +951,7 @@
+@@ -915,7 +981,7 @@
+ void XVCreatedFile(fullname)
+ char *fullname;
+ {
+- /* called whenever a file has been deleted. Updates browser & dir windows,
++ /* called whenever a file has been created. Updates browser & dir windows,
+ if necessary */
+
+ BRCreatedFile(fullname);
+@@ -925,7 +991,8 @@
+
+ /***************************************************/
+ void xvbcopy(src, dst, len)
+- char *src, *dst;
++ const char *src;
++ char *dst;
+ size_t len;
+ {
+ /* Modern OS's (Solaris, etc.) frown upon the use of bcopy(),
+@@ -945,7 +1012,7 @@
*/
if (src==dst || len<=0) return; /* nothin' to do */
@@ -22096,7 +32288,7 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
if (src<dst && src+len>dst) { /* do a backward copy */
src = src + len - 1;
dst = dst + len - 1;
-@@ -957,7 +963,7 @@
+@@ -957,11 +1024,11 @@
for ( ; len>0; len--, src++, dst++) *dst = *src;
}
}
@@ -22105,25 +32297,42 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
/***************************************************/
int xvbcmp (s1, s2, len)
-@@ -987,7 +993,7 @@
+- char *s1, *s2;
++ const char *s1, *s2;
+ size_t len;
{
- /* gets the current working directory. No trailing '/' */
+ for ( ; len>0; len--, s1++, s2++) {
+@@ -985,28 +1052,31 @@
+ char *buf;
+ size_t buflen;
+ {
+- /* gets the current working directory. No trailing '/' */
++ /* Gets the current working directory and puts it in buf. No trailing '/'. */
- char *rv;
-+ char *rv;
++ const char *rv;
#ifdef USE_GETCWD
- rv = (char *) getcwd(buf, buflen);
-@@ -996,7 +1002,7 @@
+- rv = (char *) getcwd(buf, buflen);
++ rv = (const char *) getcwd(buf, buflen);
+ #else
+- rv = (char *) getwd(buf);
++ rv = (const char *) getwd(buf);
#endif
if (!rv || strlen(rv)==0) {
- if (((rv=(char *) getenv("PWD"))==NULL) &&
-+ if (((rv=(char *) getenv("PWD"))==NULL) &&
- ((rv=(char *) getenv("cwd"))==NULL)) rv = "./";
+- ((rv=(char *) getenv("cwd"))==NULL)) rv = "./";
++ if (((rv=(const char *) getenv("PWD"))==NULL) &&
++ ((rv=(const char *) getenv("cwd"))==NULL)) rv = "./";
strcpy(buf, rv);
}
-@@ -1006,7 +1012,7 @@
++#ifdef AUTO_EXPAND
++ Vdtodir(buf);
++#endif
+ }
+
+
/***************************************************/
@@ -22132,14 +32341,57 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
* Source code for the "strstr" library routine.
*
* Copyright 1988 Regents of the University of California
-@@ -1066,6 +1072,22 @@
+@@ -1020,10 +1090,11 @@
+ */
+
+ char *xv_strstr(string, substring)
+- char *string; /* String to search. */
+- char *substring; /* Substring to try to find in string. */
++ const char *string; /* String to search. */
++ const char *substring; /* Substring to try to find in string. */
+ {
+- register char *a, *b;
++ const char *a;
++ const char *b;
+
+ /* First scan quickly through the two strings looking for a
+ * single-character match. When it's found, then compare the
+@@ -1031,14 +1102,14 @@
+ */
+
+ b = substring;
+- if (*b == 0) return string;
++ if (*b == 0) return (char *) string;
+
+ for ( ; *string != 0; string += 1) {
+ if (*string != *b) continue;
+
+ a = string;
+ while (1) {
+- if (*b == 0) return string;
++ if (*b == 0) return (char *) string;
+ if (*a++ != *b++) break;
+ }
+ b = substring;
+@@ -1052,7 +1123,8 @@
+
+ /***************************************************/
+ FILE *xv_fopen(fname, mode)
+- char *fname, *mode;
++ const char *fname;
++ const char *mode;
+ {
+ FILE *fp;
+
+@@ -1066,72 +1138,90 @@
}
+/***************************************************/
+/* GRR 20050320: added actual mk[s]temp() call... */
+void xv_mktemp(buf, fname)
-+ char *buf, *fname;
++ char *buf;
++ const char *fname;
+{
+#ifndef VMS
+ sprintf(buf, "%s/%s", tmpdir, fname);
@@ -22154,20 +32406,273 @@ diff -ruN xv-3.10a/xvmisc.c xv-3.10a-bugfixes/xvmisc.c
+}
- /*******/
-@@ -1124,7 +1146,7 @@
+-/*******/
++/***************************************************/
+ void Timer(msec) /* waits for 'n' milliseconds */
+- int msec;
+-/*******/
++ int msec;
+ {
+ long usec;
+
+ if (msec <= 0) return;
++
+ usec = (long) msec * 1000;
+
+
+-#ifdef VMS
++#ifdef USLEEP
++ usleep(usec);
++ /* return */
++#endif
++
++
++#if defined(VMS) && !defined(USLEEP)
+ {
+ float ftime;
+ ftime = msec / 1000.0;
+ lib$wait(&ftime);
+- return;
++ /* return */
+ }
+ #endif
+
+
+-#ifdef sgi
++#if defined(sgi) && !defined(USLEEP)
+ {
+ float ticks_per_msec;
+ long ticks;
+ ticks_per_msec = (float) CLK_TCK / 1000.0;
+ ticks = (long) ((float) msec * ticks_per_msec);
+ sginap(ticks);
+- return;
++ /* return */
+ }
+ #endif
+
+
+-#if defined(SVR4) || defined(sco)
++/* does SGI define SVR4? not sure... */
++#if (defined(SVR4) || defined(sco)) && !defined(sgi) && !defined(USLEEP)
+ {
+ struct pollfd dummy;
+ poll(&dummy, 0, msec);
+- return;
++ /* return */
+ }
+ #endif
+
+
+-#ifdef USLEEP
+- usleep(usec); return;
+-#endif
+-
+-
+-#ifdef NOTIMER
+- return;
+-#endif
+-
+-
+-#ifndef VMS
++#if !defined(USLEEP) && !defined(VMS) && !defined(sgi) && !defined(SVR4) && !defined(sco) && !defined(NOTIMER)
{
- /* default Timer() method now uses 'select()', which probably works
- on all systems *anyhow* (except for VMS...) */
+- /* default Timer() method now uses 'select()', which probably works
+- on all systems *anyhow* (except for VMS...) */
-
++ /* default/fall-through Timer() method now uses 'select()', which
++ * probably works on all systems *anyhow* (except for VMS...) */
+
struct timeval time;
time.tv_sec = usec / 1000000L;
-diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
+ time.tv_usec = usec % 1000000L;
+ select(0, XV_FDTYPE NULL, XV_FDTYPE NULL, XV_FDTYPE NULL, &time);
++ /* return */
+ }
+-#endif /* VMS */
+-}
++#endif
+
+
++ /* NOTIMER case, fallthroughs, etc. ... but we return void, so who cares */
++ /* return */
++}
++
+diff -ru xv-3.10a/xvpbm.c xv-3.10a-enhancements/xvpbm.c
--- xv-3.10a/xvpbm.c 1995-01-03 13:23:44.000000000 -0800
-+++ xv-3.10a-bugfixes/xvpbm.c 2005-04-03 14:25:28.000000000 -0700
-@@ -115,7 +115,7 @@
++++ xv-3.10a-enhancements/xvpbm.c 2007-05-13 17:44:03.000000000 -0700
+@@ -23,6 +23,15 @@
+ */
+
+
++typedef unsigned short ush;
++typedef unsigned char uch;
++
++#define alpha_composite(composite, fg, alpha, bg) { \
++ ush temp = ((ush)(fg)*(ush)(alpha) + \
++ (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
++ (composite) = (uch)((temp + (temp >> 8)) >> 8); \
++}
++
+ #define TRUNCSTR "File appears to be truncated."
+
+ static int garbage;
+@@ -31,17 +40,91 @@
+ static int loadpbm PARM((FILE *, PICINFO *, int));
+ static int loadpgm PARM((FILE *, PICINFO *, int, int));
+ static int loadppm PARM((FILE *, PICINFO *, int, int));
++static int loadpam PARM((FILE *, PICINFO *, int, int));
+ static int getint PARM((FILE *, PICINFO *));
+ static int getbit PARM((FILE *, PICINFO *));
+ static int getshort PARM((FILE *));
+-static int pbmError PARM((char *, char *));
++static int pbmError PARM((const char *, const char *));
++
++static const char *bname;
++
++
++#ifdef HAVE_MGCSFX
++/*
++ * When file read or file write is fail, probably it's caused by
++ * reading from pipe which has no data yet, or writing to pipe
++ * which is not ready yet.
++ * Then we can use system call select() on descriptor of pipe and wait.
++ * If you want, change 'undef' to 'define' in the following line.
++ * This feature is performance-killer.
++ */
++#undef FIX_PIPE_ERROR
++
++#ifdef __osf__
++# ifdef __alpha
++# define FIX_PIPE_ERROR
++# endif
++#endif
++
++#endif /* HAVE_MGCSFX */
++
++
++#ifdef FIX_PIPE_ERROR
++
++int pipefdr;
++
++struct timeval timeout;
++int width;
++fd_set fds;
++
++static void ready_read()
++{
++ if(pipefdr < 0) return; /* if file descriptor is not pipe, OK */
++ WaitCursor();
+
+-static char *bname;
++reselect:
++ /* setting of timeout */
++ timeout.tv_sec = 1; /* 1 sec */
++ timeout.tv_usec = 0; /* 0 usec */
++
++ FD_ZERO(&fds); /* clear bits */
++ FD_SET(pipefdr, &fds); /* set bit of fd in fds */
++
++ /* number of file descriptor to want check (0 $B!A(B width-1) */
++ width = pipefdr + 1;
++
++ /* select returns number of file descriptors */
++ if (select(width, &fds, NULL, NULL, &timeout) < 0){
++ if(DEBUG){
++ fprintf(stderr, "No file descriptors can't selected, waiting...\n");
++ }
++ goto reselect;
++ }
++
++ if (FD_ISSET(pipefdr, &fds)){
++ /* Now, descriptor of pipe is ready to read */
++ return;
++ }else{
++ if(DEBUG){
++ fprintf(stderr, "Can't read from pipe yet, waiting...\n");
++ }
++ goto reselect;
++ }
++
++}
++#endif /* FIX_PIPE_ERROR */
+
+ /*******************************************/
++#ifdef HAVE_MGCSFX
++int LoadPBM(fname, pinfo, fd)
++ char *fname;
++ PICINFO *pinfo;
++ int fd;
++#else
+ int LoadPBM(fname, pinfo)
+ char *fname;
+ PICINFO *pinfo;
++#endif /* HAVE_MGCSFX */
+ /*******************************************/
+ {
+ /* returns '1' on success */
+@@ -50,6 +133,10 @@
+ int c, c1;
+ int maxv, rv;
+
++#ifdef FIX_PIPE_ERROR
++ pipefdr = fd;
++#endif
++
+ garbage = maxv = rv = 0;
+ bname = BaseName(fname);
+
+@@ -57,6 +144,22 @@
+ pinfo->comment = (char *) NULL;
+
+
++#ifdef HAVE_MGCSFX
++ if(fd < 0){
++ /* open the file */
++ fp = xv_fopen(fname,"r");
++ if (!fp) return (pbmError(bname, "can't open file"));
++
++ /* compute file length */
++ fseek(fp, 0L, 2);
++ filesize = ftell(fp);
++ fseek(fp, 0L, 0);
++ }else{
++ fp = fdopen(fd, "r");
++ if (!fp) return (pbmError(bname, "can't open file"));
++ filesize = 0; /* dummy */
++ }
++#else
+ /* open the file */
+ fp = xv_fopen(fname,"r");
+ if (!fp) return (pbmError(bname, "can't open file"));
+@@ -65,6 +168,7 @@
+ fseek(fp, 0L, 2);
+ filesize = ftell(fp);
+ fseek(fp, 0L, 0);
++#endif /* HAVE_MGCSFX */
+
+
+ /* read the first two bytes of the file to determine which format
+@@ -73,7 +177,8 @@
+ "P6" = raw pixmap */
+
+ c = getc(fp); c1 = getc(fp);
+- if (c!='P' || c1<'1' || c1>'6') return(pbmError(bname, "unknown format"));
++ if (c!='P' || c1<'1' || (c1>'6' && c1!='8')) /* GRR alpha */
++ return(pbmError(bname, "unknown format"));
+
+ /* read in header information */
+ pinfo->w = getint(fp, pinfo); pinfo->h = getint(fp, pinfo);
+@@ -104,6 +209,7 @@
+ if (c1=='1' || c1=='4') rv = loadpbm(fp, pinfo, c1=='4' ? 1 : 0);
+ else if (c1=='2' || c1=='5') rv = loadpgm(fp, pinfo, c1=='5' ? 1 : 0, maxv);
+ else if (c1=='3' || c1=='6') rv = loadppm(fp, pinfo, c1=='6' ? 1 : 0, maxv);
++ else if (c1=='8') rv = loadpam(fp, pinfo, 1 , maxv);
+
+ fclose(fp);
+
+@@ -115,7 +221,7 @@
}
return rv;
@@ -22176,7 +32681,7 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
-@@ -127,15 +127,21 @@
+@@ -127,15 +233,21 @@
{
byte *pic8;
byte *pix;
@@ -22203,7 +32708,7 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
(raw) ? "raw" : "ascii", filesize);
sprintf(pinfo->shrtInfo, "%dx%d PBM.", w, h);
pinfo->colType = F_BWDITHER;
-@@ -153,7 +159,7 @@
+@@ -153,7 +265,7 @@
for (j=0; j<w; j++, pix++) *pix = getbit(fp, pinfo);
}
@@ -22212,7 +32717,7 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
if (garbage) {
return(pbmError(bname, "Garbage characters in image data."));
}
-@@ -192,17 +198,23 @@
+@@ -192,17 +304,23 @@
int raw, maxv;
{
byte *pix, *pic8;
@@ -22241,12 +32746,25 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
(raw) ? "raw" : "ascii", filesize);
sprintf(pinfo->shrtInfo, "%dx%d PGM.", pinfo->w, pinfo->h);
pinfo->colType = F_GREYSCALE;
-@@ -236,11 +248,11 @@
+@@ -236,11 +354,24 @@
}
}
else {
- numgot = fread(pic8, (size_t) 1, (size_t) w*h, fp); /* read raw data */
++#ifdef FIX_PIPE_ERROR
++ reread:
++ numgot += fread(pic8 + numgot, (size_t) 1, (size_t) w*h - numgot, fp); /* read raw data */
++ if(errno == EINTR){
++ if(DEBUG){
++ fprintf(stderr,
++ "Can't read all data from pipe, call select and waiting...\n");
++ }
++ ready_read();
++ goto reread;
++ }
++#else
+ numgot = fread(pic8, (size_t)1, (size_t)npixels, fp); /* read raw data */
++#endif
}
}
@@ -22255,7 +32773,7 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
if (garbage) {
return (pbmError(bname, "Garbage characters in image data."));
-@@ -256,18 +268,24 @@
+@@ -256,18 +387,24 @@
PICINFO *pinfo;
int raw, maxv;
{
@@ -22286,12 +32804,25 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
(raw) ? "raw" : "ascii", filesize);
sprintf(pinfo->shrtInfo, "%dx%d PPM.", w, h);
pinfo->colType = F_FULLCOLOR;
-@@ -297,20 +315,20 @@
+@@ -297,20 +434,149 @@
}
}
else {
- numgot = fread(pic24, (size_t) 1, (size_t) w*h*3, fp); /* read data */
++#ifdef FIX_PIPE_ERROR
++ reread:
++ numgot += fread(pic24 + numgot, (size_t) 1, (size_t) w*h*3 - numgot, fp); /* read data */
++ if(errno == EINTR){
++ if(DEBUG){
++ fprintf(stderr,
++ "Can't read all data from pipe, call select and waiting...\n");
++ }
++ ready_read();
++ goto reread;
++ }
++#else
+ numgot = fread(pic24, (size_t) 1, (size_t) bufsize, fp); /* read data */
++#endif
}
}
-
@@ -22310,10 +32841,126 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
- if (maxv<255) {
+ if (maxv<255) {
++ for (i=0; i<=maxv; i++) scale[i] = (i * 255) / maxv;
++
++ for (i=0, pix=pic24; i<h; i++) {
++ if ((i&0x3f)==0) WaitCursor();
++ for (j=0; j<w*3; j++, pix++) *pix = scale[*pix];
++ }
++ }
++
++ return 1;
++}
++
++
++/*******************************************/
++static int loadpam(fp, pinfo, raw, maxv) /* unofficial RGBA extension */
++ FILE *fp;
++ PICINFO *pinfo;
++ int raw, maxv;
++{
++ byte *p, *pix, *pic24, *linebuf, scale[256], bgR, bgG, bgB, r, g, b, a;
++ int i, j, bitshift, w, h, npixels, bufsize, linebufsize, holdmaxv;
++
++ w = pinfo->w;
++ h = pinfo->h;
++
++ npixels = w * h;
++ bufsize = 3*npixels;
++ linebufsize = 4*w;
++ if (w <= 0 || h <= 0 || npixels/w != h || bufsize/3 != npixels ||
++ linebufsize/4 != w)
++ return pbmError(bname, "image dimensions too large");
++
++ /* allocate 24-bit image */
++ pic24 = (byte *) calloc((size_t) bufsize, (size_t) 1);
++ if (!pic24) FatalError("couldn't malloc 'pic24' for PAM");
++
++ /* allocate line buffer for pre-composited RGBA data */
++ linebuf = (byte *) malloc((size_t) linebufsize);
++ if (!linebuf) {
++ free(pic24);
++ FatalError("couldn't malloc 'linebuf' for PAM");
++ }
++
++ pinfo->pic = pic24;
++ pinfo->type = PIC24;
++ sprintf(pinfo->fullInfo, "PAM, %s format. (%ld bytes)",
++ (raw) ? "raw" : "ascii", filesize);
++ sprintf(pinfo->shrtInfo, "%dx%d PAM.", w, h);
++ pinfo->colType = F_FULLCOLOR;
++
++
++ /* if maxv>255, keep dropping bits until it's reasonable */
++ holdmaxv = maxv;
++ bitshift = 0;
++ while (maxv>255) { maxv = maxv>>1; bitshift++; }
++
++
++ numgot = 0;
++
++ if (!raw) { /* GRR: not alpha-ready */
++ return pbmError(bname, "can't handle non-raw PAM image");
++/*
++ for (i=0, pix=pic24; i<h; i++) {
++ if ((i&0x3f)==0) WaitCursor();
++ for (j=0; j<w*3; j++, pix++)
++ *pix = (byte) (getint(fp, pinfo) >> bitshift);
++ }
++ */
++ }
++ else { /* raw */
++ if (holdmaxv>255) { /* GRR: not alpha-ready */
++ return pbmError(bname, "can't handle PAM image with maxval > 255");
++/*
++ for (i=0, pix=pic24; i<h; i++) {
++ if ((i&0x3f)==0) WaitCursor();
++ for (j=0; j<w*3; j++,pix++)
++ *pix = (byte) (getshort(fp) >> bitshift);
++ }
++ */
++ }
++ else {
++ if (have_imagebg) { /* GRR: alpha-ready */
++ bgR = (imagebgR >> 8);
++ bgG = (imagebgG >> 8);
++ bgB = (imagebgB >> 8);
++ } else {
++ bgR = bgG = bgB = 0;
++ }
++ for (i=0, pix=pic24; i<h; i++) {
++ numgot += fread(linebuf, (size_t) 1, (size_t) linebufsize, fp); /* read data */
++ if ((i&0x3f)==0) WaitCursor();
++ for (j=0, p=linebuf; j<w; j++) {
++ r = *p++;
++ g = *p++;
++ b = *p++;
++ a = *p++;
++ alpha_composite(*pix++, r, a, bgR)
++ alpha_composite(*pix++, g, a, bgG)
++ alpha_composite(*pix++, b, a, bgB)
++ }
++ }
++ }
++ }
++
++ free(linebuf);
++
++ /* in principle this could overflow, but not critical */
++ if (numgot != w*h*4) pbmError(bname, TRUNCSTR);
++
++ if (garbage)
++ return(pbmError(bname, "Garbage characters in image data."));
++
++
++ /* have to scale up all RGB values (Conv24to8 expects RGB values to
++ range from 0-255) */
++
++ if (maxv<255) {
for (i=0; i<=maxv; i++) scale[i] = (i * 255) / maxv;
for (i=0, pix=pic24; i<h; i++) {
-@@ -360,8 +378,8 @@
+@@ -360,8 +626,8 @@
pinfo->comment[0] = '\0';
}
else {
@@ -22324,7 +32971,26 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
if (!tmpptr) FatalError("realloc failure in xvpbm.c getint");
pinfo->comment = tmpptr;
}
-@@ -445,8 +463,8 @@
+@@ -409,7 +675,18 @@
+
+ numgot++;
+
++ /* Sometime after 1995, NetPBM's ppm(5) man page was changed to say, "Each
++ * sample is represented in pure binary by either 1 or 2 bytes. If the
++ * Maxval is less than 256, it is 1 byte. Otherwise, it is 2 bytes. The
++ * most significant byte is first." This change is incompatible with
++ * images created for viewing with all previous versions of XV, however,
++ * so both approaches are left available as a compile-time option. (Could
++ * make it runtime-selectable, too, but unclear whether anybody cares.) */
++#ifdef ASSUME_RAW_PPM_LSB_FIRST /* legacy approach */
+ return (c2 << 8) | c1;
++#else /* MSB first */
++ return (c1 << 8) | c2;
++#endif
+ }
+
+
+@@ -445,8 +722,8 @@
pinfo->comment[0] = '\0';
}
else {
@@ -22335,7 +33001,16 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
if (!tmpptr) FatalError("realloc failure in xvpbm.c getint");
pinfo->comment = tmpptr;
}
-@@ -490,7 +508,7 @@
+@@ -470,7 +747,7 @@
+
+ /*******************************************/
+ static int pbmError(fname, st)
+- char *fname, *st;
++ const char *fname, *st;
+ {
+ SetISTR(ISTR_WARNING,"%s: %s", fname, st);
+ return 0;
+@@ -490,7 +767,7 @@
char *comment;
{
/* writes a PBM/PGM/PPM file to the already open stream
@@ -22344,7 +33019,7 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
'colorstyle' single-handedly determines the type of file written
if colorstyle==0, (Full Color) a PPM file is written
if colorstyle==1, (Greyscale) a PGM file is written
-@@ -546,7 +564,7 @@
+@@ -546,7 +823,7 @@
}
}
else {
@@ -22353,7 +33028,7 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
fprintf(fp,"%3d %3d %3d ",rmap[*pix], gmap[*pix], bmap[*pix]);
else
fprintf(fp,"%3d %3d %3d ",pix[0], pix[1], pix[2]);
-@@ -554,7 +572,7 @@
+@@ -554,7 +831,7 @@
len+=12;
if (len>58) { fprintf(fp,"\n"); len=0; }
}
@@ -22362,7 +33037,16 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
pix += (ptype==PIC24) ? 3 : 1;
}
}
-@@ -626,10 +644,3 @@
+@@ -584,7 +861,7 @@
+
+ else if (colorstyle==2) { /* 1-bit B/W stipple */
+ int bit,k,flipbw;
+- char *str0, *str1;
++ const char *str0, *str1;
+
+ /* shouldn't happen */
+ if (ptype == PIC24) FatalError("PIC24 and B/W Stipple in WritePBM()\n");
+@@ -626,10 +903,3 @@
return 0;
}
@@ -22373,10 +33057,10 @@ diff -ruN xv-3.10a/xvpbm.c xv-3.10a-bugfixes/xvpbm.c
-
-
-
-diff -ruN xv-3.10a/xvpcx.c xv-3.10a-bugfixes/xvpcx.c
+diff -ru xv-3.10a/xvpcx.c xv-3.10a-enhancements/xvpcx.c
--- xv-3.10a/xvpcx.c 1995-01-10 15:06:37.000000000 -0800
-+++ xv-3.10a-bugfixes/xvpcx.c 2005-03-25 08:10:03.000000000 -0800
-@@ -29,7 +29,7 @@
++++ xv-3.10a-enhancements/xvpcx.c 2007-05-13 18:46:27.000000000 -0700
+@@ -29,17 +29,17 @@
#define PCX_YMAXH 11
/* hres (12,13) and vres (14,15) not used */
#define PCX_CMAP 16 /* start of 16*3 colormap data */
@@ -22385,17 +33069,31 @@ diff -ruN xv-3.10a/xvpcx.c xv-3.10a-bugfixes/xvpcx.c
#define PCX_BPRL 66
#define PCX_BPRH 67
-@@ -51,8 +51,8 @@
+ #define PCX_MAPSTART 0x0c /* Start of appended colormap */
+
+
+-static int pcxLoadImage8 PARM((char *, FILE *, PICINFO *, byte *));
+-static int pcxLoadImage24 PARM((char *, FILE *, PICINFO *, byte *));
++static int pcxLoadImage8 PARM((const char *, FILE *, PICINFO *, byte *));
++static int pcxLoadImage24 PARM((const char *, FILE *, PICINFO *, byte *));
+ static void pcxLoadRaster PARM((FILE *, byte *, int, byte *, int, int));
+-static int pcxError PARM((char *, char *));
++static int pcxError PARM((const char *, const char *));
+
+
+
+@@ -51,9 +51,9 @@
{
FILE *fp;
long filesize;
- char *bname, *errstr;
- byte hdr[128], *image;
-+ char *bname;
+ byte hdr[128];
int i, colors, gray, fullcolor;
++ const char *bname;
pinfo->type = PIC8;
+ pinfo->pic = (byte *) NULL;
@@ -64,7 +64,7 @@
/* open the stream */
fp = xv_fopen(fname,"r");
@@ -22444,7 +33142,14 @@ diff -ruN xv-3.10a/xvpcx.c xv-3.10a-bugfixes/xvpcx.c
hdr[PCX_PLANES], (hdr[PCX_PLANES]==1) ? "" : "s",
hdr[PCX_BPP], (hdr[PCX_BPP]==1) ? "" : "s",
filesize);
-@@ -218,15 +218,21 @@
+@@ -212,21 +212,27 @@
+
+ /*****************************/
+ static int pcxLoadImage8(fname, fp, pinfo, hdr)
+- char *fname;
++ const char *fname;
+ FILE *fp;
+ PICINFO *pinfo;
byte *hdr;
{
/* load an image with at most 8 bits per pixel */
@@ -22472,7 +33177,14 @@ diff -ruN xv-3.10a/xvpcx.c xv-3.10a-bugfixes/xvpcx.c
switch (hdr[PCX_BPP]) {
case 1: pcxLoadRaster(fp, image, 1, hdr, pinfo->w, pinfo->h); break;
case 8: pcxLoadRaster(fp, image, 8, hdr, pinfo->w, pinfo->h); break;
-@@ -249,25 +255,33 @@
+@@ -243,31 +249,39 @@
+
+ /*****************************/
+ static int pcxLoadImage24(fname, fp, pinfo, hdr)
+- char *fname;
++ const char *fname;
+ FILE *fp;
+ PICINFO *pinfo;
byte *hdr;
{
byte *pix, *pic24, scale[256];
@@ -22597,7 +33309,7 @@ diff -ruN xv-3.10a/xvpcx.c xv-3.10a-bugfixes/xvpcx.c
if (plane >= (int) hdr[PCX_PLANES]) { /* moved to next row */
plane = 0;
-@@ -367,13 +381,13 @@
+@@ -367,19 +381,19 @@
}
else { /* next plane, same row */
image = oldimage;
@@ -22613,9 +33325,16 @@ diff -ruN xv-3.10a/xvpcx.c xv-3.10a-bugfixes/xvpcx.c
-diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
+ /*******************************************/
+ static int pcxError(fname,st)
+- char *fname, *st;
++ const char *fname, *st;
+ {
+ SetISTR(ISTR_WARNING,"%s: %s", fname, st);
+ return 0;
+diff -ru xv-3.10a/xvpds.c xv-3.10a-enhancements/xvpds.c
--- xv-3.10a/xvpds.c 1995-01-03 13:25:52.000000000 -0800
-+++ xv-3.10a-bugfixes/xvpds.c 2005-04-03 11:31:30.000000000 -0700
++++ xv-3.10a-enhancements/xvpds.c 2007-05-12 14:08:47.000000000 -0700
@@ -22,23 +22,23 @@
Choice of algorithm for 16->8 bit conversion--linear or histogram stretch.
(adds CONV24_HIST item in "24/8 bit" pull-down menu.)
@@ -22665,7 +33384,17 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
* (301) 286-6695
* or call
* (301) 286-9000 (300,1200,2400 bps)
-@@ -91,10 +91,10 @@
+@@ -77,8 +77,7 @@
+ * Huffman-encoded, and the encoding histogram follows the ASCII headers.
+ * To decode these, we use a slightly modified version of "vdcomp.c" from the
+ * NASA Viking CD-ROMS. For xv to work, you need to have vdcomp compiled
+- * and in your search path. vdcomp.c should be included with this
+-distribution.
++ * and in your search path. vdcomp.c should be included with this distribution.
+ *
+ * I've heard that newer discs have FITS images on them. If they do, support
+ * for them will be added when I get one. Until then, you can use fitstopgm.
+@@ -91,10 +90,10 @@
* Copyright 1989, 1990 by Anthony A. Datri
*
* Permission to use, copy, and distribute for non-commercial purposes,
@@ -22678,18 +33407,65 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
* In exception to the above, permission to John Bradley is hereby granted to
* distribute this code as he sees fit within the context of his "xv" image
* viewer.
-@@ -132,8 +132,8 @@
+@@ -102,7 +101,7 @@
+ * This software is provided "as is" without any express or implied warranty.
+ */
+
+-
++#define NEEDSDIR /* for S_IRUSR|S_IWUSR */
+ #include "xv.h"
+
+ #ifdef HAVE_PDS
+@@ -129,27 +128,32 @@
+
+ /* This is arbitrary. Everything I've seen so far fits in 50 chars */
+ #define COMMENTSIZE 50
++#define INOTESIZE 1000
static int lastwasinote = FALSE;
-static char scanbuff [MAX_SIZE],
- rtbuff [RTBUFFSIZE],
-+static char scanbuff [MAX_SIZE],
-+ rtbuff [RTBUFFSIZE],
- inote [20*COMMENTSIZE],
- infobuff [COMMENTSIZE],
- spacecraft [COMMENTSIZE],
-@@ -203,10 +203,10 @@
+- inote [20*COMMENTSIZE],
+- infobuff [COMMENTSIZE],
+- spacecraft [COMMENTSIZE],
+- target [COMMENTSIZE],
+- filtname [COMMENTSIZE],
+- gainmode [COMMENTSIZE],
+- editmode [COMMENTSIZE],
+- scanmode [COMMENTSIZE],
+- exposure [COMMENTSIZE],
+- shuttermode [COMMENTSIZE],
+- mphase [COMMENTSIZE],
+- iname [COMMENTSIZE],
+- itime [COMMENTSIZE],
+- garbage [1020],
++static char scanbuff [MAX_SIZE+1],
++ rtbuff [RTBUFFSIZE+1],
++ inote [INOTESIZE+1],
++ infobuff [COMMENTSIZE+1],
++ spacecraft [COMMENTSIZE+1],
++ target [COMMENTSIZE+1],
++ filtname [COMMENTSIZE+1],
++ gainmode [COMMENTSIZE+1],
++ editmode [COMMENTSIZE+1],
++ scanmode [COMMENTSIZE+1],
++ exposure [COMMENTSIZE+1],
++ shuttermode [COMMENTSIZE+1],
++ mphase [COMMENTSIZE+1],
++ iname [COMMENTSIZE+1],
++ itime [COMMENTSIZE+1],
++ garbage [1024],
+ *tmptmp,
+ pdsuncompfname[FNAMESIZE];
++
++#define SSTR(l) "%" #l "s"
++#define S(l) SSTR(l)
++
+ byte *image;
+ static int elaphe;
+
+@@ -203,10 +207,10 @@
}
return(count);
@@ -22703,7 +33479,7 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
default: count++; *bp++ = c;
}
}
-@@ -242,7 +242,7 @@
+@@ -242,7 +246,7 @@
* disc seem to leave off the first two bytes. Sigh. This may sometimes be
* a distinction between the fixed and variable-record files.
*/
@@ -22712,21 +33488,27 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
/*******************************************/
int LoadPDS(fname, pinfo)
char *fname;
-@@ -250,11 +250,11 @@
+@@ -250,13 +254,16 @@
{
/* returns '1' on success, '0' on failure */
- int tempnum;
+ int tempnum, bytewidth, bufsize;
++#ifndef USE_MKSTEMP
++ int tmpfd;
++#endif
FILE *zf;
static int isfixed,teco,i,j,itype,vaxbyte,
recsize,hrecsize,irecsize,isimage,labelrecs,labelsofar,
- x,y,lpsize,lssize,samplesize,returnp,labelsize,yy;
+ w,h,lpsize,lssize,samplesize,returnp,labelsize,yy;
char *tmp;
- char *ftypstr;
+- char *ftypstr;
++ const char *ftypstr;
unsigned long filesize;
-@@ -265,7 +265,7 @@
+ char sampletype[64];
+
+@@ -265,7 +272,7 @@
returnp = isimage = FALSE;
itype = PDSTRASH;
@@ -22735,7 +33517,7 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
lpsize = lssize = samplesize = labelsize = labelsofar = 0;
(*pdsuncompfname) = (*iname) = (*target) = (*filtname) = (*garbage) = '\0';
-@@ -363,7 +363,7 @@
+@@ -363,7 +370,7 @@
* length indicator. If the length indicator is odd, then a pad byte
* is appended to the end of the record so that all records contain
* an even number of bytes." */
@@ -22744,7 +33526,7 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
i=getc(zf);
j=getc(zf);
if (j == EOF) {
-@@ -371,7 +371,7 @@
+@@ -371,7 +378,7 @@
fclose(zf);
return 0;
}
@@ -22753,7 +33535,7 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
teco = i + (j << 8);
if (teco % 2) teco++;
-@@ -380,7 +380,7 @@
+@@ -380,7 +387,7 @@
fclose(zf);
return 0;
}
@@ -22762,7 +33544,25 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
scanbuff[teco]='\0';
}
-@@ -429,11 +429,11 @@
+@@ -397,7 +404,7 @@
+
+ if (strcmp(scanbuff,"END") == 0) {
+ break;
+- } else if (sscanf(scanbuff," RECORD_TYPE = %s",rtbuff) == 1) {
++ } else if (sscanf(scanbuff, " RECORD_TYPE = " S(RTBUFFSIZE), rtbuff) == 1) {
+ if (strncmp(rtbuff,"VARIABLE_LENGTH", (size_t) 15) == 0) {
+ /* itype=PDSVARIABLE; */
+ } else if (strncmp(rtbuff,"FIXED_LENGTH", (size_t) 12) == 0) {
+@@ -416,7 +423,7 @@
+ if (irecsize == 0) irecsize=recsize;
+ lastwasinote=FALSE;
+ continue;
+- } else if (sscanf(scanbuff," FILE_TYPE = %s", rtbuff) != 0) {
++ } else if (sscanf(scanbuff, " FILE_TYPE = " S(RTBUFFSIZE), rtbuff) != 0) {
+ lastwasinote=FALSE;
+ if (strncmp(rtbuff,"IMAGE", (size_t) 5) == 0) {
+ isimage=TRUE;
+@@ -429,11 +436,11 @@
(sscanf(scanbuff," LABEL_RECORDS = %d", &labelrecs) == 1)) {
lastwasinote=FALSE;
continue;
@@ -22777,16 +33577,123 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
isimage=TRUE; lastwasinote=FALSE; continue;
} else if (sscanf(scanbuff," HEADER_RECORD_BYTES = %d",&hrecsize)==1) {
lastwasinote=FALSE; continue;
-@@ -472,7 +472,7 @@
+@@ -445,74 +452,74 @@
+ lastwasinote=FALSE; continue;
+ } else if (sscanf(scanbuff," SAMPLE_BITS = %d", &samplesize) == 1) {
+ lastwasinote=FALSE; continue;
+- } else if (sscanf(scanbuff," SAMPLE_TYPE = %s", sampletype) == 1) {
++ } else if (sscanf(scanbuff, " SAMPLE_TYPE = " S(64), sampletype) == 1) {
+ lastwasinote=FALSE; continue;
+- } else if (sscanf(scanbuff," SPACECRAFT_NAME = %s %s",
++ } else if (sscanf(scanbuff," SPACECRAFT_NAME = " S(COMMENTSIZE) " " S(1023),
+ spacecraft,garbage) == 2 ) {
+- strcat(spacecraft,xv_strstr(scanbuff, spacecraft)+strlen(spacecraft));
++ const char *tmp = xv_strstr(scanbuff, spacecraft) + strlen(spacecraft);
++ strncat(spacecraft, tmp, COMMENTSIZE - strlen(spacecraft));
+ lastwasinote=FALSE; continue;
+- } else if (sscanf(scanbuff," SPACECRAFT_NAME = %s", spacecraft) == 1) {
++ } else if (sscanf(scanbuff, " SPACECRAFT_NAME = " S(COMMENTSIZE), spacecraft) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," TARGET_NAME = %s", target) == 1) {
++ } else if (sscanf(scanbuff, " TARGET_NAME = " S(COMMENTSIZE), target) == 1) {
+ lastwasinote=FALSE; continue;
+- } else if (sscanf(scanbuff," TARGET_BODY = %s", target) == 1) {
++ } else if (sscanf(scanbuff, " TARGET_BODY = " S(COMMENTSIZE), target) == 1) {
+ lastwasinote=FALSE; continue;
- } else if (sscanf(scanbuff," INSTRUMENT_GAIN_STATE = %s",gainmode)==1) {
+- } else if (sscanf(scanbuff," MISSION_PHASE_NAME = %s", mphase) == 1) {
++ } else if (sscanf(scanbuff, " MISSION_PHASE_NAME = " S(COMMENTSIZE), mphase) == 1) {
+ lastwasinote=FALSE; continue;
+- } else if (sscanf(scanbuff," MISSION_PHASE = %s", mphase) == 1) {
++ } else if (sscanf(scanbuff, " MISSION_PHASE = " S(COMMENTSIZE), mphase) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," INSTRUMENT_NAME = %s", iname) == 1) {
++ } else if (sscanf(scanbuff, " INSTRUMENT_NAME = " S(COMMENTSIZE), iname) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," GAIN_MODE_ID = %s", gainmode) == 1) {
++ } else if (sscanf(scanbuff, " GAIN_MODE_ID = " S(COMMENTSIZE), gainmode) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," INSTRUMENT_GAIN_STATE = %s",gainmode)==1) {
++ } else if (sscanf(scanbuff, " INSTRUMENT_GAIN_STATE = " S(COMMENTSIZE), gainmode) ==1 ) {
lastwasinote=FALSE; continue;
-
+- } else if (sscanf(scanbuff," EDIT_MODE_ID = %s", editmode) == 1) {
+
- } else if (sscanf(scanbuff," EDIT_MODE_ID = %s", editmode) == 1) {
++ } else if (sscanf(scanbuff, " EDIT_MODE_ID = " S(COMMENTSIZE), editmode) == 1) {
lastwasinote=FALSE; continue;
-@@ -531,11 +531,11 @@
+- } else if (sscanf(scanbuff," INSTRUMENT_EDIT_MODE = %s", editmode)==1) {
++ } else if (sscanf(scanbuff, " INSTRUMENT_EDIT_MODE = " S(COMMENTSIZE), editmode) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," SCAN_MODE_ID = %s", scanmode) == 1) {
++ } else if (sscanf(scanbuff, " SCAN_MODE_ID = " S(COMMENTSIZE), scanmode) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," INSTRUMENT_SCAN_RATE = %s", scanmode)==1) {
++ } else if (sscanf(scanbuff, " INSTRUMENT_SCAN_RATE = " S(COMMENTSIZE), scanmode) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," SHUTTER_MODE_ID = %s", shuttermode) == 1) {
++ } else if (sscanf(scanbuff, " SHUTTER_MODE_ID = " S(COMMENTSIZE), shuttermode) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," INSTRUMENT_SHUTTER_MODE = %s",
+- shuttermode) == 1) {
++ } else if (sscanf(scanbuff, " INSTRUMENT_SHUTTER_MODE = " S(COMMENTSIZE), shuttermode) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," SCAN_MODE_ID = %s", scanmode) == 1) {
++ } else if (sscanf(scanbuff, " SCAN_MODE_ID = " S(COMMENTSIZE), scanmode) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," INSTRUMENT_SCAN_RATE = %s", scanmode)==1) {
++ } else if (sscanf(scanbuff, " INSTRUMENT_SCAN_RATE = " S(COMMENTSIZE), scanmode) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," SPACECRAFT_EVENT_TIME = %s", itime) == 1) {
++ } else if (sscanf(scanbuff, " SPACECRAFT_EVENT_TIME = " S(COMMENTSIZE), itime) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," IMAGE_TIME = %s", itime) == 1) {
++ } else if (sscanf(scanbuff, " IMAGE_TIME = " S(COMMENTSIZE), itime) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," FILTER_NAME = %s", filtname) == 1) {
++ } else if (sscanf(scanbuff, " FILTER_NAME = " S(COMMENTSIZE), filtname) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff," INSTRUMENT_FILTER_NAME = %s",filtname)==1) {
++ } else if (sscanf(scanbuff, " INSTRUMENT_FILTER_NAME = " S(COMMENTSIZE), filtname) == 1) {
+ lastwasinote=FALSE; continue;
+
+- } else if ((sscanf(scanbuff," EXPOSURE_DURATION = %s", exposure) == 1)
+- || (sscanf(scanbuff," INSTRUMENT_EXPOSURE_DURATION = %s",
+- exposure) == 1)) {
++ } else if ((sscanf(scanbuff, " EXPOSURE_DURATION = " S(COMMENTSIZE), exposure) == 1)
++ || (sscanf(scanbuff, " INSTRUMENT_EXPOSURE_DURATION = " S(COMMENTSIZE),
++ exposure)) == 1) {
+ tmptmp = (char *) index(scanbuff,'=');
+ tmptmp++;
+ while((*tmptmp) == ' ')
+@@ -520,10 +527,10 @@
+ strcpy(exposure,tmptmp);
+ lastwasinote=FALSE; continue;
+
+- } else if (sscanf(scanbuff, "NOTE = %s", inote) == 1) {
++ } else if (sscanf(scanbuff, "NOTE = " S(INOTESIZE), inote) == 1) {
+ tmptmp = (char *) index(scanbuff,'='); tmptmp++;
+ while (((*tmptmp) == ' ') || ((*tmptmp) == '"')) tmptmp++;
+- strcpy(inote,tmptmp);
++ strncpy(inote, tmptmp, INOTESIZE - 1);
+ strcat(inote," ");
+
+ /* evil and somewhat risky: A "note" (really, any textual
+@@ -531,11 +538,11 @@
* get my hands on the clown who designed this format...
* What we basically assume here
* is that a NOTE record that doesn't end with a " is
@@ -22800,7 +33707,16 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
* flag in each of the above record types for potential
* error recovery, although it really breaks up the beauty
* of the cascading sscanfs. Dykstra'd love me for this one */
-@@ -568,10 +568,10 @@
+@@ -548,7 +555,7 @@
+ } else if (lastwasinote) {
+ tmptmp=scanbuff;
+ while (((*tmptmp) == ' ') || ((*tmptmp) == '"')) tmptmp++;
+- strcat(inote,tmptmp);
++ strncat(inote, tmptmp, INOTESIZE - strlen(inote) - 1);
+ strcat(inote," ");
+ if (index(tmptmp,'"') != NULL)
+ lastwasinote=FALSE;
+@@ -568,10 +575,10 @@
fclose(zf);
return 0;
}
@@ -22813,7 +33729,7 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
} else if (itype == VICAR) {
/* we've got a VICAR file. Let's find out how big the puppy is */
ungetc(' ', zf);
-@@ -582,8 +582,8 @@
+@@ -582,8 +589,8 @@
SetISTR(ISTR_WARNING,"LoadPDS: bad NL in VICAR\n");
returnp=TRUE;
}
@@ -22824,7 +33740,7 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
SetISTR(ISTR_WARNING,"LoadPDS: bad scan NL in VICAR\n");
returnp=TRUE;
}
-@@ -593,7 +593,7 @@
+@@ -593,7 +600,7 @@
returnp=TRUE;
}
@@ -22833,7 +33749,7 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
SetISTR(ISTR_WARNING,"LoadPDS: bad scan NS in VICAR\n");
returnp=TRUE;
}
-@@ -625,6 +625,13 @@
+@@ -625,6 +632,13 @@
returnp=TRUE;
}
@@ -22847,12 +33763,51 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
if (returnp) {
fclose(zf);
return 0;
-@@ -689,11 +696,19 @@
+@@ -640,27 +654,27 @@
+
+ *infobuff='\0';
+ if (*spacecraft) {
+- strcat(infobuff,spacecraft);
++ strncat(infobuff, spacecraft, sizeof(infobuff) - 1);
+ }
+
+ if (*target) {
+- strcat(infobuff,", ");
+- strcat(infobuff,target);
++ strncat(infobuff, ", ", sizeof(infobuff) - strlen(infobuff) - 1);
++ strncat(infobuff, target, sizeof(infobuff) - strlen(infobuff) - 1);
+ }
+
+ if (*filtname) {
+- strcat(infobuff,", ");
+- strcat(infobuff,filtname);
++ strncat(infobuff, ", ", sizeof(infobuff) - strlen(infobuff) - 1);
++ strncat(infobuff, filtname, sizeof(infobuff) - strlen(infobuff) - 1);
+ }
+
+ if (*itime) {
+- strcat(infobuff,", ");
+- strcat(infobuff,itime);
++ strncat(infobuff, ", ", sizeof(infobuff) - strlen(infobuff) - 1);
++ strncat(infobuff, itime, sizeof(infobuff) - strlen(infobuff) - 1);
+ }
+
+- SetISTR(ISTR_WARNING,infobuff);
++ SetISTR(ISTR_WARNING, "%s", infobuff);
+
+- strcpy(pdsuncompfname,fname);
++ strncpy(pdsuncompfname,fname,sizeof(pdsuncompfname) - 1);
+ ftypstr = "";
+
+ switch (itype) {
+@@ -688,12 +702,26 @@
+ fclose(zf);
#ifndef VMS
- sprintf(pdsuncompfname,"%s/xvhuffXXXXXX", tmpdir);
+- sprintf(pdsuncompfname,"%s/xvhuffXXXXXX", tmpdir);
- mktemp(pdsuncompfname);
- sprintf(scanbuff,"%s %s - 4 >%s",PDSUNCOMP,fname,pdsuncompfname);
++ snprintf(pdsuncompfname, sizeof(pdsuncompfname) - 1, "%s/xvhuffXXXXXX", tmpdir);
#else
strcpy(pdsuncompfname,"sys$disk:[]xvhuffXXXXXX");
+#endif
@@ -22861,15 +33816,21 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
+ close(mkstemp(pdsuncompfname));
+#else
mktemp(pdsuncompfname);
++ tmpfd = open(pdsuncompfname,O_WRONLY|O_CREAT|O_EXCL,S_IRWUSR);
++ if (tmpfd < 0) {
++ SetISTR(ISTR_WARNING,"Unable to create temporary file.");
++ return 0;
++ }
++ close(tmpfd);
+#endif
+
+#ifndef VMS
-+ sprintf(scanbuff,"%s %s - 4 >%s",PDSUNCOMP,fname,pdsuncompfname);
++ sprintf(scanbuff,"%s '%s' - 4 > %s", PDSUNCOMP, fname, pdsuncompfname);
+#else
sprintf(scanbuff,"%s %s %s 4",PDSUNCOMP,fname,pdsuncompfname);
#endif
-@@ -727,63 +742,72 @@
+@@ -727,63 +755,72 @@
fread(scanbuff, (size_t) labelsize, (size_t) 1, zf);
}
@@ -22959,40 +33920,56 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
if (samplesize == 16)
if (Convert16BitImage(fname, pinfo,
-@@ -798,25 +822,25 @@
+@@ -798,27 +835,27 @@
if (pinfo->comment) {
char tmp[256];
*(pinfo->comment) = '\0';
-
-+
- sprintf(tmp, "Spacecraft: %-28sTarget: %-32s\n", spacecraft, target);
- strcat(pinfo->comment, tmp);
+- sprintf(tmp, "Spacecraft: %-28sTarget: %-32s\n", spacecraft, target);
+- strcat(pinfo->comment, tmp);
-
-+
- sprintf(tmp, "Filter: %-32sMission phase: %-24s\n", filtname, mphase);
- strcat(pinfo->comment, tmp);
+- sprintf(tmp, "Filter: %-32sMission phase: %-24s\n", filtname, mphase);
+- strcat(pinfo->comment, tmp);
-
-+
- sprintf(tmp, "Image time: %-28sGain mode: %-29s\n", itime, gainmode);
- strcat(pinfo->comment, tmp);
+- sprintf(tmp, "Image time: %-28sGain mode: %-29s\n", itime, gainmode);
+- strcat(pinfo->comment, tmp);
-
-+
- sprintf(tmp, "Edit mode: %-29sScan mode: %-29s\n", editmode, scanmode);
- strcat(pinfo->comment, tmp);
+- sprintf(tmp, "Edit mode: %-29sScan mode: %-29s\n", editmode, scanmode);
+- strcat(pinfo->comment, tmp);
-
-+
- sprintf(tmp, "Exposure: %-30sShutter mode: %-25s\n", exposure,shuttermode);
- strcat(pinfo->comment, tmp);
+- sprintf(tmp, "Exposure: %-30sShutter mode: %-25s\n", exposure,shuttermode);
+- strcat(pinfo->comment, tmp);
-
-+
- sprintf(tmp, "Instrument: %-28sImage time: %-28s\n", iname, itime);
- strcat(pinfo->comment, tmp);
+- sprintf(tmp, "Instrument: %-28sImage time: %-28s\n", iname, itime);
+- strcat(pinfo->comment, tmp);
-
+- sprintf(tmp, "Image Note: %-28s", inote);
+- strcat(pinfo->comment, tmp);
++
++ sprintf(tmp, "Spacecraft: %-28.28sTarget: %-32.32s\n", spacecraft, target);
++ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
++
++ sprintf(tmp, "Filter: %-32.32sMission phase: %-24.24s\n", filtname, mphase);
++ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
++
++ sprintf(tmp, "Image time: %-28.28sGain mode: %-29.29s\n", itime, gainmode);
++ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
++
++ sprintf(tmp, "Edit mode: %-29.29sScan mode: %-29.29s\n", editmode, scanmode);
++ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
++
++ sprintf(tmp, "Exposure: %-30.30sShutter mode: %-25.25s\n", exposure,shuttermode);
++ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
++
++ sprintf(tmp, "Instrument: %-28.28sImage time: %-28.28s\n", iname, itime);
++ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
+
- sprintf(tmp, "Image Note: %-28s", inote);
- strcat(pinfo->comment, tmp);
++ sprintf(tmp, "Image Note: %-28.28s", inote);
++ strncat(pinfo->comment, tmp, 2000 - strlen(pinfo->comment) - 1);
}
-@@ -868,23 +892,20 @@
+
+ if (LoadPDSPalette(fname, pinfo)) return 1;
+@@ -868,23 +905,20 @@
m = 65536 * sizeof(byte);
lut = (byte *) malloc(m);
if (lut == NULL) {
@@ -23019,7 +33996,7 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
(c = (char *) rindex(fname, ':')) ? c+1 : fname),
']');
#else
-@@ -947,14 +968,20 @@
+@@ -947,14 +981,20 @@
}
}
@@ -23043,7 +34020,7 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
}
/* convert the 16-bit image to 8-bit */
-@@ -979,16 +1006,16 @@
+@@ -979,16 +1019,16 @@
FILE *fp;
char name[1024], buf[256], *c;
int i, n, r, g, b;
@@ -23063,7 +34040,7 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
if ((fp = xv_fopen(name, "r")) == NULL)
return 0;
for (i = 0; i < 256; i++) {
-@@ -1014,7 +1041,3 @@
+@@ -1014,7 +1054,3 @@
#endif /* HAVE_PDS */
@@ -23071,9 +34048,9 @@ diff -ruN xv-3.10a/xvpds.c xv-3.10a-bugfixes/xvpds.c
-
-
-
-diff -ruN xv-3.10a/xvpictoppm.c xv-3.10a-bugfixes/xvpictoppm.c
+diff -ru xv-3.10a/xvpictoppm.c xv-3.10a-enhancements/xvpictoppm.c
--- xv-3.10a/xvpictoppm.c 1995-01-13 11:57:14.000000000 -0800
-+++ xv-3.10a-bugfixes/xvpictoppm.c 2005-04-10 09:36:04.000000000 -0700
++++ xv-3.10a-enhancements/xvpictoppm.c 2005-04-10 09:36:04.000000000 -0700
@@ -77,7 +77,7 @@
FILE *fp;
byte *icon8, *pic24, *ip, *pp;
@@ -23151,18 +34128,32 @@ diff -ruN xv-3.10a/xvpictoppm.c xv-3.10a-bugfixes/xvpictoppm.c
-
-
-
-diff -ruN xv-3.10a/xvpm.c xv-3.10a-bugfixes/xvpm.c
+diff -ru xv-3.10a/xvpm.c xv-3.10a-enhancements/xvpm.c
--- xv-3.10a/xvpm.c 1994-12-22 14:34:40.000000000 -0800
-+++ xv-3.10a-bugfixes/xvpm.c 2005-03-29 08:30:12.000000000 -0800
-@@ -60,7 +60,7 @@
++++ xv-3.10a-enhancements/xvpm.c 2007-05-13 17:34:04.000000000 -0700
+@@ -42,9 +42,9 @@
+ /***** end PM.H *****/
+
+
+-pmpic thePic;
++static pmpic thePic;
+
+-static int pmError PARM((char *, char *));
++static int pmError PARM((const char *, const char *));
+ static int flip4 PARM((int));
+ static int getint32 PARM((FILE *));
+ static void putint32 PARM((int, FILE *));
+@@ -60,8 +60,8 @@
FILE *fp;
byte *pic8;
- int isize,i,flipit,w,h;
+- char *bname;
+ int isize,i,flipit,w,h,npixels,nRGBbytes;
- char *bname;
++ const char *bname;
bname = BaseName(fname);
+ thePic.pm_image = (char *) NULL;
@@ -103,10 +103,11 @@
thePic.pm_cmtsize = flip4(thePic.pm_cmtsize);
}
@@ -23257,7 +34248,7 @@ diff -ruN xv-3.10a/xvpm.c xv-3.10a-bugfixes/xvpm.c
pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i; /* build mono cmap */
pinfo->pic = pic8;
-@@ -228,10 +236,10 @@
+@@ -228,13 +236,13 @@
pinfo->normw = pinfo->w; pinfo->normh = pinfo->h;
pinfo->frmType = F_PM;
@@ -23270,7 +34261,11 @@ diff -ruN xv-3.10a/xvpm.c xv-3.10a-bugfixes/xvpm.c
+ (thePic.pm_form==PM_I || thePic.pm_np>1)
? "24-bit color" : "8-bit greyscale",
thePic.pm_np, (thePic.pm_form==PM_I) ? "PM_I" : "PM_C",
- isize + PM_IOHDR_SIZE + thePic.pm_cmtsize);
+- isize + PM_IOHDR_SIZE + thePic.pm_cmtsize);
++ isize + (int)PM_IOHDR_SIZE + thePic.pm_cmtsize);
+
+ sprintf(pinfo->shrtInfo, "%dx%d PM.", w,h);
+ pinfo->comment = thePic.pm_cmt;
@@ -313,7 +321,7 @@
else if (colorstyle == 1) { /* GreyScale: 8 bits per pixel */
@@ -23280,9 +34275,18 @@ diff -ruN xv-3.10a/xvpm.c xv-3.10a-bugfixes/xvpm.c
if (ptype == PIC8) {
for (i=0; i<numcols; i++) rgb[i] = MONO(rmap[i],gmap[i],bmap[i]);
for (i=0, p=pic; i<w*h; i++, p++) {
-diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
+@@ -351,7 +359,7 @@
+
+ /*****************************/
+ static int pmError(fname, st)
+- char *fname, *st;
++ const char *fname, *st;
+ {
+ SetISTR(ISTR_WARNING,"%s: %s", fname, st);
+ if (thePic.pm_image != NULL) free(thePic.pm_image);
+diff -ru xv-3.10a/xvpopup.c xv-3.10a-enhancements/xvpopup.c
--- xv-3.10a/xvpopup.c 1995-01-19 10:09:31.000000000 -0800
-+++ xv-3.10a-bugfixes/xvpopup.c 2004-05-16 18:04:13.000000000 -0700
++++ xv-3.10a-enhancements/xvpopup.c 2007-04-15 15:02:32.000000000 -0700
@@ -1,5 +1,5 @@
-/*
- * xvpopup.c - popup "Are you sure? Yes/No/Maybe" sort of dialog box
@@ -23291,7 +34295,14 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
*
* callable functions:
*
-@@ -20,7 +20,8 @@
+@@ -13,16 +13,16 @@
+ * OpenAlert(str) - maps a button-less window
+ * CloseAlert() - closes a button-less window
+ * PUCheckEvent(event) - called by event handler
+- * TextRect() - draws semi-complex strings in a rectangle
+ */
+
+ #include "copyright.h"
#include "xv.h"
@@ -23299,31 +34310,156 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
+#define OMIT_ICON_BITS
+#include "bits/icon" /* icon_bits[] not used, but icon_width/height are */
- #define PUWIDE 400
+-#define PUWIDE 400
++#define PUWIDE 480
#define PUHIGH 170
-@@ -86,8 +87,8 @@
- static char *padMthdNames[] = { "Solid Fill", "Run 'bggen'", "Load Image" };
- static int padColDefLen = 9;
--static char *padColDefNames[] = { "black", "red", "yellow", "green",
-- "cyan", "blue", "magenta", "white",
-+static char *padColDefNames[] = { "black", "red", "yellow", "green",
-+ "cyan", "blue", "magenta", "white",
- "50% gray" };
+ #define PAD_PUWIDE 480
+@@ -30,8 +30,9 @@
+
+ #define BUTTH 24
+
+-static int doPopUp PARM((char *, char **, int, int, char *));
++static int doPopUp PARM((const char *, const char **, int, int, const char *));
+ static void attachPUD PARM((void));
++static void TextRect PARM((Window, const char *, int, int, int, int, u_long));
+ static void createPUD PARM((void));
+ static void drawPUD PARM((int, int, int, int));
+ static void drawPadOMStr PARM((void));
+@@ -41,8 +42,8 @@
+ static void changedGSBuf PARM((void));
+ static void drawGSBuf PARM((void));
+ static void buildPadLists PARM((void));
+-static void build1PadList PARM((char *, char **, char **, int *,
+- char **, char **, int));
++static void build1PadList PARM((const char *, const char **, const char **, int *,
++ const char **, const char **, int));
+
- static char *padColDefVals[] = { "black", "red", "yellow", "green",
-@@ -105,8 +106,8 @@
- "Red Balls",
- "Red+Yellow Diamonds" };
+ /* values 'popUp' can take */
+@@ -57,20 +58,21 @@
+ #define HIDESTR "Hide XV windows"
+ /* local variables */
+-Window popW;
+-int nbts, selected, popUp=0, firsttime=1;
+-int puwide = PUWIDE;
+-int puhigh = PUHIGH;
+-BUTT *bts;
+-char *text;
+-char accel[8];
+-
+-char *gsBuf, *gsFilter; /* stuff needed for GetStrPopUp() handling */
+-int gsBufLen, gsAllow, gsCurPos, gsStPos, gsEnPos;
+-int gsx, gsy, gsw, gsh;
++static Window popW;
++static int nbts, selected, popUp=0, firsttime=1;
++static int puwide = PUWIDE;
++static int puhigh = PUHIGH;
++static BUTT *bts;
++static const char *text;
++static char accel[8];
++
++static char *gsBuf; /* stuff needed for GetStrPopUp() handling */
++static const char *gsFilter;
++static int gsBufLen, gsAllow, gsCurPos, gsStPos, gsEnPos;
++static int gsx, gsy, gsw, gsh;
+
+ /* stuff for GrabPopUp */
+-CBUTT ahideCB;
++static CBUTT ahideCB;
+
+
+ /*** stuff for PadPopUp ***/
+@@ -82,48 +84,51 @@
+ static int padMode, padOMode;
+ static DIAL padWDial, padHDial, padODial;
+
+-static int padMthdLen=3;
+-static char *padMthdNames[] = { "Solid Fill", "Run 'bggen'", "Load Image" };
++static int padMthdLen=3;
++static const char *padMthdNames[] = { "Solid Fill", "Run 'bggen'", "Load Image" };
+
+-static int padColDefLen = 9;
+-static char *padColDefNames[] = { "black", "red", "yellow", "green",
+- "cyan", "blue", "magenta", "white",
+- "50% gray" };
+-
+-static char *padColDefVals[] = { "black", "red", "yellow", "green",
+- "cyan", "blue", "magenta", "white",
+- "gray50" };
+-
+-static int padBgDefLen = 8;
+-static char *padBgDefNames[] = {
+- "Black->White",
+- "Blue Gradient",
+- "RGB Rainbow",
+- "Full Rainbow",
+- "Color Assortment",
+- "Green Tiles",
+- "Red Balls",
+- "Red+Yellow Diamonds" };
+-
-static char *padBgDefVals[] = {
- "black white",
-+static char *padBgDefVals[] = {
-+ "black white",
- "100 100 255 50 50 150",
- "red green blue",
- "black red yellow green blue purple black",
-@@ -150,11 +151,11 @@
+- "100 100 255 50 50 150",
+- "red green blue",
+- "black red yellow green blue purple black",
+- "black white red black yellow white green black cyan white blue black magenta white red yellow green cyan blue magenta red",
+- "green black -r 30 -G 32x32",
+- "red black -r 45 -G 32x32",
+- "red yellow -r 45 -G 32x32" };
++static int padColDefLen = 9;
++static const char *padColDefNames[] = { "black", "red", "yellow", "green",
++ "cyan", "blue", "magenta", "white",
++ "50% gray" };
++
++static const char *padColDefVals[] = { "black", "red", "yellow", "green",
++ "cyan", "blue", "magenta", "white",
++ "gray50" };
++
++static int padBgDefLen = 8;
++static const char *padBgDefNames[] = { "Black->White",
++ "Blue Gradient",
++ "RGB Rainbow",
++ "Full Rainbow",
++ "Color Assortment",
++ "Green Tiles",
++ "Red Balls",
++ "Red+Yellow Diamonds" };
++
++static const char *padBgDefVals[] = { "black white",
++ "100 100 255 50 50 150",
++ "red green blue",
++ "black red yellow green blue purple black",
++ "black white red black yellow white green black cyan white blue black magenta white red yellow green cyan blue magenta red",
++ "green black -r 30 -G 32x32",
++ "red black -r 45 -G 32x32",
++ "red yellow -r 45 -G 32x32" };
+
+
+ /* this should match with PAD_O* defs in xv.h */
+-static char *padOMStr[] = { "RGB", "Int.", "Hue", "Sat." };
++static const char *padOMStr[] = { "RGB", "Int.", "Hue", "Sat." };
+
+ #define PAD_MAXDEFLEN 10
+-static int padColLen = 0, padBgLen = 0, padLoadLen = 0;
+-static char *padColNames [PAD_MAXDEFLEN], *padColVals [PAD_MAXDEFLEN];
+-static char *padBgNames [PAD_MAXDEFLEN], *padBgVals [PAD_MAXDEFLEN];
+-static char *padLoadNames[PAD_MAXDEFLEN], *padLoadVals[PAD_MAXDEFLEN];
++static int padColLen = 0;
++static const char *padColNames [PAD_MAXDEFLEN];
++static const char *padColVals [PAD_MAXDEFLEN];
++static int padBgLen = 0;
++static const char *padBgNames [PAD_MAXDEFLEN];
++static const char *padBgVals [PAD_MAXDEFLEN];
++static int padLoadLen = 0;
++static const char *padLoadNames[PAD_MAXDEFLEN];
++static const char *padLoadVals [PAD_MAXDEFLEN];
+
+
+ /***************************************************/
+@@ -150,11 +155,11 @@
if (wy + h > dispHIGH) wy = dispHIGH - h;
}
@@ -23337,7 +34473,32 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
else {
wx -= (ch_offx);
wy -= (ch_offy);
-@@ -197,7 +198,7 @@
+@@ -174,16 +179,20 @@
+
+ /***************************************************/
+ int PopUp(txt, labels, n)
+- char *txt, *labels[];
+- int n;
++ const char *txt;
++ const char *labels[];
++ int n;
+ {
+ return doPopUp(txt, labels, n, ISPOPUP, "xv confirm");
+ }
+
++
+ /***************************************************/
+ static int doPopUp(txt, labels, n, poptyp, wname)
+- char *txt, *labels[], *wname;
+- int n, poptyp;
++ const char *txt;
++ const char *labels[];
++ int n, poptyp;
++ const char *wname;
+ {
+ int i;
+ XEvent event;
+@@ -197,17 +206,17 @@
/* attach controls to popW, now that it exists */
if (poptyp==ISGRAB) ahideCB.win = popW;
else if (poptyp == ISPAD) {
@@ -23345,8 +34506,21 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
+
if (!padHaveDooDads) {
DCreate(&padWDial, popW, 16, puhigh-16-100-1,75,100,
- 1, 2048, pWIDE, 10,
-@@ -230,8 +231,8 @@
+- 1, 2048, pWIDE, 10,
++ 1.0, 2048.0, (double)pWIDE, 1.0, 10.0,
+ infofg, infobg, hicol, locol, "Width", NULL);
+ DCreate(&padHDial, popW, 16+1+75, puhigh-16-100-1,75,100,
+- 1, 2048, pHIGH, 10,
++ 1.0, 2048.0, (double)pHIGH, 1.0, 10.0,
+ infofg, infobg, hicol, locol, "Height", NULL);
+
+ DCreate(&padODial, popW, 16+1+75+75+9, puhigh-16-100-1,75,100,
+- 0, 100, 100, 10,
++ 0.0, 100.0, 100.0, 1.0, 10.0,
+ infofg, infobg, hicol, locol, "Opaque", NULL);
+
+ MBCreate(&padMthdMB, popW, 100-2+44, 10, 140, 19, NULL,
+@@ -230,8 +239,8 @@
XMapWindow(theDisp, padWDial.win);
XMapWindow(theDisp, padHDial.win);
XMapWindow(theDisp, padODial.win);
@@ -23357,19 +34531,22 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
XResizeWindow(theDisp, popW, (u_int) puwide, (u_int) puhigh);
XStoreName (theDisp, popW, wname);
-@@ -257,9 +258,9 @@
+@@ -257,10 +266,10 @@
}
else if (poptyp == ISPAD) {
BTSetActive(&bts[0], (int) strlen(gsBuf));
- i = pWIDE * 3; RANGE(i,2048,9999);
-+ i = pWIDE * 3; RANGE(i,2048,9999);
- DSetRange(&padWDial, 1, i, padWDial.val, 10);
+- DSetRange(&padWDial, 1, i, padWDial.val, 10);
- i = pHIGH * 3; RANGE(i,2048,9999);
+- DSetRange(&padHDial, 1, i, padHDial.val, 10);
++ i = pWIDE * 3; RANGE(i,2048,9999);
++ DSetRange(&padWDial, 1.0, (double)i, padWDial.val, 1.0, 10.0);
+ i = pHIGH * 3; RANGE(i,2048,9999);
- DSetRange(&padHDial, 1, i, padHDial.val, 10);
++ DSetRange(&padHDial, 1.0, (double)i, padHDial.val, 1.0, 10.0);
DSetActive(&padWDial, (padMode!=PAD_LOAD)); /* DSetRange activates dial */
-@@ -283,14 +284,14 @@
+ DSetActive(&padHDial, (padMode!=PAD_LOAD));
+@@ -283,18 +292,22 @@
}
}
@@ -23377,16 +34554,51 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
+ /* center first button in window around mouse position, with constraint that
window be fully on the screen */
- CenterMapWindow(popW, 40 + bts[0].x, BUTTH/2 + bts[0].y, puwide, puhigh);
+- CenterMapWindow(popW, 40 + bts[0].x, BUTTH/2 + bts[0].y, puwide, puhigh);
popUp = poptyp;
++ if (startGrab == 2)
++ startGrab = 4;
++ else {
++ CenterMapWindow(popW, 40 + bts[0].x, BUTTH/2 + bts[0].y, puwide, puhigh);
- /* MUST wait for VisibilityNotify event to come in, else we run the risk
+- /* MUST wait for VisibilityNotify event to come in, else we run the risk
- of UnMapping the window *before* the Map request completed. This
-+ of UnMapping the window *before* the Map request completed. This
- appears to be bad, (It leaves an empty window frame up.) though it
- generally only happens on slow servers. Better safe than screwed... */
+- appears to be bad, (It leaves an empty window frame up.) though it
+- generally only happens on slow servers. Better safe than screwed... */
++ /* MUST wait for VisibilityNotify event to come in, else we run the risk
++ of UnMapping the window *before* the Map request completed. This
++ appears to be bad, (It leaves an empty window frame up.) though it
++ generally only happens on slow servers. Better safe than screwed... */
+
+- XWindowEvent(theDisp, popW, VisibilityChangeMask, &event);
++ XWindowEvent(theDisp, popW, VisibilityChangeMask, &event);
++ }
+
+ /* block until this window gets closed */
+ while (popUp) {
+@@ -312,7 +325,8 @@
+
+ /***************************************************/
+ void ErrPopUp(txt, label)
+- char *txt, *label;
++ const char *txt;
++ const char *label;
+ {
+ /* simplified interface to PopUp. Takes a string and the label for the
+ (one) button */
+@@ -323,7 +337,10 @@
-@@ -338,10 +339,10 @@
+ /***************************************************/
+ int GetStrPopUp(txt, labels, n, buf, buflen, filstr, allow)
+- char *txt, *labels[], *buf, *filstr;
++ const char *txt;
++ const char *labels[];
++ char *buf;
++ const char *filstr;
+ int n, buflen, allow;
+ {
+ /* pops up a window with a prompt string, a 1-line editable
+@@ -338,10 +355,10 @@
button labels have 1-character accellerators at the front, same
as in PopUp(). Note that it would be suboptimal to make any
of the 1-character accellerators be the same character as one of
@@ -23399,7 +34611,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
(ie, interpreted as emacs-like commands) */
gsBuf = buf; gsBufLen = buflen;
-@@ -358,7 +359,7 @@
+@@ -358,7 +375,7 @@
gsy = PUHIGH - 10 - BUTTH - 10 - gsh - 20;
gsw = PUWIDE - gsx - 10;
@@ -23408,7 +34620,20 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
changedGSBuf(); /* careful! popW doesn't exist yet! */
return doPopUp(txt, labels, n, ISGETSTR, "xv prompt");
-@@ -390,7 +391,7 @@
+@@ -371,9 +388,9 @@
+ {
+ /* pops up Grab options dialog box */
+
+- int rv;
+- char delaybuf[32], grabTxt[1024];
+- static char *grabLabels[] = { "\nGrab", "aAutoGrab", "\033Cancel" };
++ int rv;
++ char delaybuf[32], grabTxt[1024];
++ static const char *grabLabels[] = { "\nGrab", "aAutoGrab", "\033Cancel" };
+
+ sprintf(delaybuf,"%d", *pDelay);
+ gsBuf = delaybuf; gsBufLen = 3;
+@@ -390,7 +407,7 @@
changedGSBuf(); /* careful! popW doesn't exist yet! */
/* window value gets filled in in doPopUp() */
@@ -23417,29 +34642,65 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
PUWIDE-10-18-StringWidth(HIDESTR),
gsy+2, HIDESTR, infofg, infobg, hicol, locol);
ahideCB.val = *pHide;
-@@ -464,8 +465,8 @@
+@@ -417,9 +434,9 @@
+ {
+ /* pops up 'Pad' options dialog box */
+
+- int rv, oldW, oldH, oldO;
+- static int firsttime=1;
+- static char *labels[] = { "\nOk", "\033Cancel" };
++ int rv, oldW, oldH, oldO;
++ static int firsttime=1;
++ static const char *labels[] = { "\nOk", "\033Cancel" };
+
+ if (firsttime) {
+ padSbuf[0] = '\0';
+@@ -464,10 +481,10 @@
changedGSBuf(); /* careful! popW doesn't exist yet! */
- if (padHaveDooDads) {
- oldW = padWDial.val;
+- oldH = padHDial.val;
+- oldO = padODial.val;
+ if (padHaveDooDads) {
-+ oldW = padWDial.val;
- oldH = padHDial.val;
- oldO = padODial.val;
++ oldW = (int)padWDial.val;
++ oldH = (int)padHDial.val;
++ oldO = (int)padODial.val;
+ }
+ else { oldW = pWIDE; oldH = pHIGH; oldO = 100; }
+
+@@ -486,9 +503,9 @@
+ }
+
+ if (rv == 1) { /* cancelled: restore normal values */
+- DSetVal(&padWDial, oldW);
+- DSetVal(&padHDial, oldH);
+- DSetVal(&padODial, oldO);
++ DSetVal(&padWDial, (double)oldW);
++ DSetVal(&padHDial, (double)oldH);
++ DSetVal(&padODial, (double)oldO);
}
-@@ -496,8 +497,8 @@
+
+ XUnmapWindow(theDisp, padWDial.win);
+@@ -496,11 +513,11 @@
XUnmapWindow(theDisp, padODial.win);
/* load up return values */
- *pMode = padMode;
- *pStr = padBuf;
+- *pWide = padWDial.val;
+- *pHigh = padHDial.val;
+- *pOpaque = padODial.val;
+ *pMode = padMode;
+ *pStr = padBuf;
- *pWide = padWDial.val;
- *pHigh = padHDial.val;
- *pOpaque = padODial.val;
-@@ -513,8 +514,6 @@
++ *pWide = (int)padWDial.val;
++ *pHigh = (int)padHDial.val;
++ *pOpaque = (int)padODial.val;
+ *pOmode = padOMode;
+
+ return rv;
+@@ -513,8 +530,6 @@
/* generates padCol* and padBg* lists used in 'Defaults' MBUTT. Grabs
all the X resources values it can, and adds appropriate defaults */
@@ -23448,9 +34709,12 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
rd_str_cl("foo", "", 1); /* rebuild database */
build1PadList("color", padColVals, padColNames, &padColLen,
-@@ -526,15 +525,15 @@
+@@ -524,49 +539,52 @@
+ padBgDefVals, padBgDefNames, padBgDefLen);
+
build1PadList("load", padLoadVals, padLoadNames, &padLoadLen,
- (char **) NULL, (char **) NULL, 0);
+- (char **) NULL, (char **) NULL, 0);
++ (const char **) NULL, (const char **) NULL, 0);
}
-
-
@@ -23458,43 +34722,90 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
+
/***************************************************/
static void build1PadList(typstr, vals, nams, lenp, dvals, dnams, dlen)
- char *typstr, **vals, **nams, **dvals, **dnams;
- int *lenp, dlen;
- {
- int i;
+- char *typstr, **vals, **nams, **dvals, **dnams;
+- int *lenp, dlen;
+-{
+- int i;
- char resname[128], name[256], value[256];
-+ char resname[128];
++ const char *typstr;
++ const char **vals, **nams;
++ const char **dvals, **dnams;
++ int *lenp, dlen;
++{
++ int i;
++ char resname[128];
++ char *copy;
for (i=0; i<*lenp; i++) { /* kill old lists */
- free(nams[i]);
-@@ -548,7 +547,7 @@
- vals[*lenp] = (char *) malloc(strlen(def_str)+1);
- if (!vals[*lenp]) continue;
- strcpy(vals[*lenp], def_str);
+- free(nams[i]);
+- free(vals[i]);
++ free((char *) nams[i]);
++ free((char *) vals[i]);
+ }
+ *lenp = 0;
+
+ for (i=0; i<10; i++) {
+ sprintf(resname, "pad.%s.val%d", typstr, i);
+ if (rd_str_cl(resname, "Dialog.Menu.Slot",0)) { /* got one! */
+- vals[*lenp] = (char *) malloc(strlen(def_str)+1);
+- if (!vals[*lenp]) continue;
+- strcpy(vals[*lenp], def_str);
-
++ copy = strdup(def_str);
++ if (!copy) continue;
++ vals[*lenp] = copy;
+
sprintf(resname, "pad.%s.name%d", typstr, i);
if (rd_str_cl(resname, "Dialog.Menu.Slot",0)) { /* and it has a name! */
- nams[*lenp] = (char *) malloc(strlen(def_str)+1);
-@@ -560,13 +559,14 @@
- nams[*lenp] = (char *) malloc((size_t) 32);
- if (!nams[*lenp]) { free(vals[*lenp]); continue; }
- strncpy(nams[*lenp], vals[*lenp], (size_t) 31);
-+ nams[*lenp][31] = '\0';
+- nams[*lenp] = (char *) malloc(strlen(def_str)+1);
+- if (!nams[*lenp]) { free(vals[*lenp]); continue; }
+- strcpy(nams[*lenp], def_str);
+-
++ copy = strdup(def_str);
++ if (!copy) { free((char *) vals[*lenp]); continue; }
+ }
+ else { /* it doesn't have a name. fabricate one */
+- nams[*lenp] = (char *) malloc((size_t) 32);
+- if (!nams[*lenp]) { free(vals[*lenp]); continue; }
+- strncpy(nams[*lenp], vals[*lenp], (size_t) 31);
++ copy = malloc((size_t) 32);
++ if (!copy) { free((char *) vals[*lenp]); continue; }
++ strncpy(copy, vals[*lenp], (size_t) 31);
++ copy[31] = '\0';
}
-
+- if (strlen(nams[*lenp]) > (size_t) 20) { /* fix long names */
+- char *sp = nams[*lenp] + 18;
++ if (strlen(copy) > (size_t) 20) { /* fix long names */
++ char *sp = copy + 18;
+
- if (strlen(nams[*lenp]) > (size_t) 20) { /* fix long names */
- char *sp = nams[*lenp] + 18;
*sp++ = '.'; *sp++ = '.'; *sp++ = '.'; *sp++ = '\0';
}
-
++ nams[*lenp] = copy;
+
*lenp = (*lenp) + 1;
}
}
-@@ -583,7 +583,7 @@
- strcpy(nams[*lenp], dnams[i]);
+@@ -574,16 +592,17 @@
+
+ /* add 'built-in' defaults to the lists */
+ for (i=0; i<dlen && *lenp<PAD_MAXDEFLEN; i++) {
+- vals[*lenp] = (char *) malloc(strlen(dvals[i])+1);
+- if (!vals[*lenp]) break;
+- strcpy(vals[*lenp], dvals[i]);
+-
+- nams[*lenp] = (char *) malloc(strlen(dnams[i])+1);
+- if (!nams[*lenp]) { free(vals[*lenp]); break; }
+- strcpy(nams[*lenp], dnams[i]);
++ copy = strdup(dvals[i]);
++ if (!copy) break;
++ vals[*lenp] = copy;
++
++ copy = strdup(dnams[i]);
++ if (!copy) { free((char *) vals[*lenp]); break; }
++ nams[*lenp] = copy;
++
*lenp = (*lenp) + 1;
}
-}
@@ -23502,16 +34813,19 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
-@@ -605,7 +605,7 @@
+@@ -603,9 +622,9 @@
+
+ /***************************************************/
void OpenAlert(txt)
- char *txt;
+- char *txt;
++ const char *txt;
{
- /* pops up a window with txt displayed in it (*no buttons*).
+ /* pops up a window with txt displayed in it (*no buttons*).
returns immediately. window is closed by 'CloseAlert()'.
No 'PopUp()' calls are allowed while an Alert is displayed. */
-@@ -624,14 +624,14 @@
+@@ -624,14 +643,14 @@
puwide = PUWIDE; puhigh = PUHIGH;
XResizeWindow(theDisp, popW, (u_int) puwide, (u_int) puhigh);
@@ -23528,7 +34842,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
appears to be bad, (It leaves an empty window frame up.) though it
generally only happens on slow servers. Better safe than screwed... */
-@@ -695,7 +695,7 @@
+@@ -695,7 +714,7 @@
XKeyEvent *e = (XKeyEvent *) xev;
char buf[128]; KeySym ks;
int stlen, i, shift, ck;
@@ -23537,7 +34851,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
stlen = XLookupString(e,buf,128,&ks,(XComposeStatus *) NULL);
shift = e->state & ShiftMask;
ck = CursorKey(ks, shift, 0);
-@@ -725,7 +725,7 @@
+@@ -725,7 +744,7 @@
rv = 1;
}
@@ -23546,8 +34860,31 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
if (e->window == popW) { doGetStrKey(buf[0]); rv = 1; }
}
}
-@@ -775,10 +775,10 @@
- int i, inbreak, lineno, top, hardcr, maxln, len[TR_MAXLN];
+@@ -765,26 +784,31 @@
+ #define TR_MAXLN 10
+
+ /***************************************************/
+-void TextRect(win, txt, x, y, w, h, fg)
+- Window win;
+- char *txt;
+- int x,y,w,h;
+- u_long fg;
+-{
+- char *sp, *ep, *oldep, *start[TR_MAXLN];
+- int i, inbreak, lineno, top, hardcr, maxln, len[TR_MAXLN];
++static void TextRect(win, txt, x, y, w, h, fg)
++ Window win;
++ const char *txt;
++ int x,y,w,h;
++ u_long fg;
++{
++ /* draws semi-complex strings in a rectangle */
++
++ const char *sp;
++ const char *ep;
++ const char *oldep;
++ const char *start[TR_MAXLN];
++ int i, inbreak, lineno, top, hardcr, maxln, len[TR_MAXLN];
XSetForeground(theDisp, theGC, fg);
-
@@ -23559,7 +34896,14 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
RANGE(maxln,0,TR_MAXLN);
while (*sp && lineno<maxln) {
-@@ -797,7 +797,7 @@
+ /* drop off any leading spaces (except on first line or after \n) */
+ if (sp!=txt && !hardcr) {
+- while(*sp==' ') sp++;
++ while (*sp==' ') sp++;
+ }
+
+ hardcr = 0; ep = sp;
+@@ -797,7 +821,7 @@
while (XTextWidth(mfinfo, sp, (int)(ep-sp))<= w && *ep && *ep!='\n') ep++;
if (*ep=='\n') { ep++; hardcr=1; } /* eat newline */
@@ -23568,7 +34912,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
(last char before a space or a '/') */
if (XTextWidth(mfinfo, sp, (int)(ep-sp)) > w) {
-@@ -812,7 +812,7 @@
+@@ -812,7 +836,7 @@
}
start[lineno] = sp; len[lineno] = ep-sp;
@@ -23577,7 +34921,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
/* make sure we don't print a trailing '\n' character! */
if (len[lineno] > 0) {
while (sp[len[lineno]-1] == '\n') len[lineno] = len[lineno] - 1;
-@@ -835,7 +835,7 @@
+@@ -835,7 +859,7 @@
/***************************************************/
static void createPUD()
{
@@ -23586,7 +34930,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
PUWIDE, PUHIGH, infofg, infobg, 0);
if (!popW) FatalError("can't create popup window!");
-@@ -847,7 +847,7 @@
+@@ -847,7 +871,7 @@
bts = (BUTT *) NULL;
nbts = selected = firsttime = 0;
}
@@ -23595,7 +34939,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
/***************************************************/
static void attachPUD()
-@@ -913,24 +913,24 @@
+@@ -913,24 +937,24 @@
XDrawLine(theDisp, popW, theGC, 16+1+75+75+5, puhigh-140 + 6+8,
16+1+75+75+5, puhigh-10-4);
}
@@ -23627,7 +34971,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
if (popUp == ISGETSTR) {
TextRect(popW, text, xt, yt, puwide-10-xt, gsy-20, infofg);
drawGSBuf();
-@@ -947,22 +947,22 @@
+@@ -947,23 +971,23 @@
/***************************************************/
static void drawPadOMStr()
{
@@ -23642,19 +34986,33 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
int x,y;
{
int i;
- BUTT *bp;
+- BUTT *bp;
-
++ BUTT *bp = NULL;
+
for (i=0; i<nbts; i++) {
bp = &bts[i];
if (PTINRECT(x, y, bp->x, bp->y, bp->w, bp->h)) break;
}
-
+- if (i<nbts && BTTrack(bp)) {
+
- if (i<nbts && BTTrack(bp)) {
++ if (i<nbts && bp && BTTrack(bp)) {
popUp = 0; selected = i; return;
}
-@@ -1017,11 +1017,11 @@
+
+@@ -972,8 +996,8 @@
+ else if (popUp == ISPAD) {
+ if (PTINRECT(x, y, padDButt.x, padDButt.y, padDButt.w, padDButt.h)) {
+ if (BTTrack(&padDButt)) {
+- DSetVal(&padWDial, pWIDE);
+- DSetVal(&padHDial, pHIGH);
++ DSetVal(&padWDial, (double)pWIDE);
++ DSetVal(&padHDial, (double)pHIGH);
+ }
+ }
+
+@@ -1017,11 +1041,11 @@
gsCurPos = strlen(gsBuf);
gsStPos = gsEnPos = 0;
changedGSBuf();
@@ -23669,7 +35027,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
(u_int)gsw-1, (u_int)gsh-1, False);
drawGSBuf();
-@@ -1032,7 +1032,7 @@
+@@ -1032,7 +1056,7 @@
DSetActive (&padWDial, (i!=PAD_LOAD));
DSetActive (&padHDial, (i!=PAD_LOAD));
@@ -23678,7 +35036,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
(u_int) puwide-10-184-10, 130-6 - BUTTH-10, True);
padMode = i;
-@@ -1049,11 +1049,11 @@
+@@ -1049,11 +1073,11 @@
gsCurPos = strlen(gsBuf);
gsStPos = gsEnPos = 0;
changedGSBuf();
@@ -23693,7 +35051,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
(u_int)gsw-1, (u_int)gsh-1, False);
drawGSBuf();
-@@ -1079,8 +1079,8 @@
+@@ -1079,8 +1103,8 @@
/* handle characters typed at GetStrPopUp window. Button accel. keys
have already been checked for elsewhere. Practical upshot is that
we don't have to do anything with ESC or Return (as these will normally
@@ -23704,7 +35062,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
Normally returns '0'. Returns '1' if character wasn't accepted, for
whatever reason. */
-@@ -1089,7 +1089,7 @@
+@@ -1089,7 +1113,7 @@
len = strlen(gsBuf);
if (gsFilter) flen = strlen(gsFilter);
else flen = 0;
@@ -23713,7 +35071,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
if (c>=' ' && c<'\177') { /* 'NORMAL' CHARACTERS */
if (flen) { /* check filter string */
-@@ -1097,7 +1097,7 @@
+@@ -1097,7 +1121,7 @@
if (!gsAllow && i< flen) return 1; /* found in 'disallow' filter */
if ( gsAllow && i==flen) return 1; /* not found in 'allow' filter */
}
@@ -23722,7 +35080,25 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
if (len >= gsBufLen-1) return 1; /* at max length */
xvbcopy(&gsBuf[gsCurPos], &gsBuf[gsCurPos+1], (size_t) len-gsCurPos+1);
-@@ -1147,7 +1147,7 @@
+@@ -1105,7 +1129,7 @@
+ }
+
+
+- else if (c=='\010' || c=='\177') { /* BS or DEL */
++ else if (c=='\010') { /* BS */
+ if (gsCurPos==0) return 1; /* at beginning of str */
+ xvbcopy(&gsBuf[gsCurPos], &gsBuf[gsCurPos-1], (size_t) len-gsCurPos+1);
+ gsCurPos--;
+@@ -1128,7 +1152,7 @@
+ gsCurPos = len;
+ }
+
+- else if (c=='\004') { /* ^D: delete character at gsCurPos */
++ else if (c=='\004' || c=='\177') { /* ^D or DEL: delete character at gsCurPos */
+ if (gsCurPos==len) return 1;
+ xvbcopy(&gsBuf[gsCurPos+1], &gsBuf[gsCurPos], (size_t) len-gsCurPos);
+ }
+@@ -1147,7 +1171,7 @@
changedGSBuf(); /* compute gsEnPos, gsStPos */
@@ -23731,7 +35107,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
XClearArea(theDisp, popW, gsx+3,gsy+3, (u_int)gsw-5, (u_int)gsh-5, False);
else
XClearArea(theDisp, popW, gsx+1,gsy+1, (u_int)gsw-1, (u_int)gsh-1, False);
-@@ -1175,7 +1175,7 @@
+@@ -1175,7 +1199,7 @@
/***************************************************/
static void changedGSBuf()
{
@@ -23740,7 +35116,7 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
portion of gsBuf */
int len;
-@@ -1212,7 +1212,7 @@
+@@ -1212,7 +1236,7 @@
XSetForeground(theDisp, theGC, infofg);
XDrawRectangle(theDisp, popW, theGC, gsx, gsy, (u_int) gsw, (u_int) gsh);
@@ -23749,9 +35125,9 @@ diff -ruN xv-3.10a/xvpopup.c xv-3.10a-bugfixes/xvpopup.c
R3D_IN, 2, hicol,locol,infobg);
XSetForeground(theDisp, theGC, infofg);
-diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
+diff -ru xv-3.10a/xvps.c xv-3.10a-enhancements/xvps.c
--- xv-3.10a/xvps.c 1994-12-22 14:34:42.000000000 -0800
-+++ xv-3.10a-bugfixes/xvps.c 2005-03-30 08:18:17.000000000 -0800
++++ xv-3.10a-enhancements/xvps.c 2007-05-12 15:25:59.000000000 -0700
@@ -1,4 +1,4 @@
-/*
+/*
@@ -23765,7 +35141,8 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
-static void epsPreview PARM((FILE *, byte *, int, int, int, int,
+static void epsPreview PARM((FILE *, byte *, int, int, int, int,
byte *, byte *, byte *, int));
- static int writeBWStip PARM((FILE *, byte *, char *, int, int, int));
+-static int writeBWStip PARM((FILE *, byte *, char *, int, int, int));
++static int writeBWStip PARM((FILE *, byte *, const char *, int, int, int));
+#ifdef GS_PATH
+static void buildCmdStr PARM((char *, char *, char *, int, int));
@@ -23787,10 +35164,10 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
CBCreate(&pscompCB, psW, 331, 7, "compress", infofg, infobg, hicol, locol);
- DCreate(&xsDial, psW, 240, 30, 80, 100, 10, 800, 100, 5,
-+ DCreate(&xsDial, psW, 240, 30, 80, 100, 10, 800, 100, 5,
++ DCreate(&xsDial, psW, 240, 30, 80, 100, 10.0, 800.0, 100.0, 0.5, 5.0,
infofg, infobg, hicol, locol, "Width", "%");
- DCreate(&ysDial, psW, 331, 30, 80, 100, 10, 800, 100, 5,
-+ DCreate(&ysDial, psW, 331, 30, 80, 100, 10, 800, 100, 5,
++ DCreate(&ysDial, psW, 331, 30, 80, 100, 10.0, 800.0, 100.0, 0.5, 5.0,
infofg, infobg, hicol, locol, "Height", "%");
xsDial.drawobj = changedScale;
ysDial.drawobj = changedScale;
@@ -23846,7 +35223,20 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
infofg, infobg, hicol, locol);
posxType = posyType = 0;
-@@ -246,7 +249,7 @@
+@@ -236,17 +239,17 @@
+
+ if (rd_int("psres")) { /* xv.psres: default paper resolution */
+ if (def_int >= 10 && def_int <= 720) {
+- int i = (int) ((PIX2INCH * 100) / def_int);
++ double v = (PIX2INCH * 100) / def_int;
+
+- DSetVal(&xsDial, i);
+- DSetVal(&ysDial, i);
++ DSetVal(&xsDial, v);
++ DSetVal(&ysDial, v);
+ }
+ }
+
XMapSubwindows(theDisp, psW);
}
@@ -23873,7 +35263,35 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
stlen = XLookupString(e,buf,128,&ks,(XComposeStatus *) NULL);
shift = e->state & ShiftMask;
ck = CursorKey(ks, shift, 0);
-@@ -497,7 +500,7 @@
+@@ -403,7 +406,7 @@
+ static void drawPSD(x,y,w,h)
+ int x,y,w,h;
+ {
+- char *title = "Save PostScript File...";
++ const char *title = "Save PostScript File...";
+ int i,cx;
+ XRectangle xr;
+
+@@ -463,12 +466,14 @@
+ /***************************************************/
+ static void drawPosStr()
+ {
+- int x,y;
+- double cmx, cmy, inx, iny;
+- char str[64], str1[64], *xst, *yst;
++ int x,y;
++ double cmx, cmy, inx, iny;
++ char str[64], str1[64];
++ const char *xst, *yst;
+
+ x = 256; y = 190 + 13;
+- inx = iny = 0; xst = yst = (char *) NULL;
++ inx = iny = 0;
++ xst = yst = (const char *) NULL;
+
+ switch (posxType) {
+ case 0: xst = "Left: "; inx = pos_inx; break;
+@@ -497,7 +502,7 @@
XSetFont(theDisp, theGC, mfont);
}
@@ -23882,7 +35300,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
/***************************************************/
static void drawSizeStr()
{
-@@ -522,7 +525,7 @@
+@@ -522,7 +527,7 @@
XSetFont(theDisp, theGC, mfont);
}
@@ -23891,7 +35309,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
/***************************************************/
static void drawResStr()
{
-@@ -540,9 +543,9 @@
+@@ -540,9 +545,9 @@
XSetFont(theDisp, theGC, mfont);
}
@@ -23904,7 +35322,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
/***************************************************/
static void drawPage()
{
-@@ -554,7 +557,7 @@
+@@ -554,7 +559,7 @@
XSetForeground(theDisp, theGC, infofg);
XDrawRectangle(theDisp, pageF, theGC, pageRect.x, pageRect.y,
(u_int) pageRect.width, (u_int) pageRect.height);
@@ -23913,7 +35331,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
drawIRect(1);
}
-@@ -611,7 +614,7 @@
+@@ -611,7 +616,7 @@
unsigned int mask;
double offx, offy, newx, newy;
@@ -23922,7 +35340,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
the top-left corner of the image */
offx = ((mx - pageRect.x) / in2pix) - pos_inx;
-@@ -642,7 +645,7 @@
+@@ -642,7 +647,7 @@
char *fullname;
switch (cmd) {
@@ -23931,7 +35349,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
PSDialog(0);
fullname = GetDirFullName();
if (!ISPIPE(fullname[0])) {
-@@ -721,15 +724,15 @@
+@@ -721,15 +726,15 @@
GetSaveSize(&w, &h);
@@ -23951,7 +35369,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
/* make sure 'center' of image is still on page */
hsx = sz_inx/2; hsy = sz_iny/2;
-@@ -783,20 +786,20 @@
+@@ -783,20 +788,20 @@
{
int x,y,w,h;
XRectangle xr;
@@ -23976,8 +35394,12 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
XSetClipRectangles(theDisp, theGC, 0,0, &xr, 1, Unsorted);
XDrawRectangle(theDisp, pageF, theGC, x, y, (u_int) w, (u_int) h);
XDrawLine(theDisp, pageF, theGC, x, y, x+w, y+h);
-@@ -839,15 +842,15 @@
- DSetVal(&xsDial, (int) ((100 * (sz_inx * PIX2INCH) / w) + .5));
+@@ -836,18 +841,18 @@
+ if (scx < scy) { sz_iny = h * scx; }
+ else { sz_inx = w * scy; }
+
+- DSetVal(&xsDial, (int) ((100 * (sz_inx * PIX2INCH) / w) + .5));
++ DSetVal(&xsDial, 100 * (sz_inx * PIX2INCH) / w);
DSetVal(&ysDial, xsDial.val);
- sz_inx = (double) w / PIX2INCH * (xsDial.val / 100.0);
@@ -23996,7 +35418,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
pos_inx = psizex/2 - sz_inx/2;
pos_iny = psizey/2 - sz_iny/2;
-@@ -888,7 +891,7 @@
+@@ -888,7 +893,7 @@
static void writePS()
{
FILE *fp;
@@ -24005,7 +35427,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
int iw, ih, ox, oy, slen, lwidth, bits, colorps, w, h, pfree;
double iwf, ihf;
byte *inpix, *rmap, *gmap, *bmap;
-@@ -900,13 +903,19 @@
+@@ -900,13 +905,19 @@
if (!fp) return;
WaitCursor();
@@ -24028,7 +35450,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
iwf = sz_inx * 72.0;
ihf = sz_iny * 72.0;
-@@ -923,12 +932,12 @@
+@@ -923,12 +934,12 @@
fprintf(fp,"%%%%Creator: XV %s - by John Bradley\n",REVDATE);
if (RBWhich(orientRB)==ORNT_LAND) /* Landscape mode */
@@ -24043,7 +35465,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
fprintf(fp,"%%%%BoundingBox: %d %d %d %d\n", ox, oy, ox+iw, oy+ih);
fprintf(fp,"%%%%Pages: 1\n");
-@@ -943,9 +952,9 @@
+@@ -943,9 +954,9 @@
case F_BWDITHER: slen = (w+7)/8; bits = 1; colorps = 0; break;
default: FatalError("unknown colorType in writePS()"); break;
}
@@ -24055,7 +35477,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
(RBWhich(orientRB)==ORNT_LAND) );
fprintf(fp,"%%%%EndProlog\n\n");
-@@ -978,7 +987,7 @@
+@@ -978,7 +989,7 @@
fprintf(fp,"%% print in landscape mode\n");
fprintf(fp,"90 rotate 0 %d translate\n\n",(int) (-psizey*72.0));
}
@@ -24064,7 +35486,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
if (RBWhich(paperRB) == PSZ_4BY5 ||
RBWhich(paperRB) == PSZ_35MM) {
fprintf(fp,"%% we're going to a 4x5 or a 35mm film recorder.\n");
-@@ -1083,12 +1092,12 @@
+@@ -1083,12 +1094,12 @@
gpix = inpix[1];
bpix = inpix[2];
}
@@ -24080,7 +35502,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
else { /* greyscale */
err = fprintf(fp,"%02x", MONO(rpix,gpix,bpix));
lwidth+=2;
-@@ -1106,7 +1115,7 @@
+@@ -1106,7 +1117,7 @@
fprintf(fp,"\n\n");
fprintf(fp,"%%\n");
fprintf(fp,"%% Compression made this file %.2f%% %s\n",
@@ -24089,7 +35511,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
((double) eWIDE * eHIGH * ((colorps) ? 3 : 1)),
"of the uncompressed size.");
fprintf(fp,"%%\n");
-@@ -1147,10 +1156,10 @@
+@@ -1147,10 +1158,10 @@
*
* returns length of the rleline vector
*/
@@ -24102,7 +35524,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
blocklen = isrun = rlen = 0;
for (i=0; i<wide; i++) {
-@@ -1186,7 +1195,7 @@
+@@ -1186,7 +1197,7 @@
}
}
}
@@ -24111,7 +35533,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
else { /* not a run */
if (pix == block[blocklen-1]) { /* case 3: non-run, prev==cur */
if (blocklen>1) { /* have a non-run block to flush */
-@@ -1215,7 +1224,7 @@
+@@ -1215,7 +1226,7 @@
else {
rleline[rlen++] = (blocklen-1) | 0x80;
@@ -24120,7 +35542,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
rleline[rlen++] = block[j];
}
-@@ -1231,15 +1240,15 @@
+@@ -1231,15 +1242,15 @@
else {
rleline[rlen++] = (blocklen-1) | 0x80;
@@ -24139,7 +35561,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
/**********************************************/
static void psColorImage(fp)
FILE *fp;
-@@ -1276,7 +1285,7 @@
+@@ -1276,7 +1287,7 @@
fprintf(fp," %% Utility procedure for colorimage operator.\n");
fprintf(fp," %% This procedure takes two procedures off the\n");
fprintf(fp," %% stack and merges them into a single procedure.\n\n");
@@ -24148,7 +35570,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
fprintf(fp," /mergeprocs { %% def\n");
fprintf(fp," dup length\n");
fprintf(fp," 3 -1 roll\n");
-@@ -1326,12 +1335,12 @@
+@@ -1326,12 +1337,12 @@
for (i=0; i<nc; i++) {
if (color) fprintf(fp,"%02x%02x%02x ", rmap[i],gmap[i],bmap[i]);
else fprintf(fp,"%02x ", MONO(rmap[i],gmap[i],bmap[i]));
@@ -24163,7 +35585,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
}
-@@ -1407,7 +1416,7 @@
+@@ -1407,7 +1418,7 @@
/**********************************************/
@@ -24172,7 +35594,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
landscape)
FILE *fp;
byte *pic;
-@@ -1420,21 +1429,37 @@
+@@ -1420,21 +1431,37 @@
if (landscape) { /* generate a rotated version of the pic */
@@ -24216,7 +35638,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
if (colorType != F_BWDITHER) { /* have to generate a preview */
prev = FSDither(pic, ptype, w, h, rmap,gmap,bmap, 0, 1);
-@@ -1451,8 +1476,8 @@
+@@ -1451,8 +1478,8 @@
flipbw = (MONO(rmap[0],gmap[0],bmap[0]) > MONO(rmap[1],gmap[1],bmap[1]));
}
@@ -24227,8 +35649,12 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
(w/(72*4) + 1) * h);
writeBWStip(fp, prev, "% ", w, h, !flipbw);
-@@ -1471,7 +1496,7 @@
- char *prompt;
+@@ -1468,10 +1495,10 @@
+ static int writeBWStip(fp, pic, prompt, w, h, flipbw)
+ FILE *fp;
+ byte *pic;
+- char *prompt;
++ const char *prompt;
int w, h, flipbw;
{
- /* write the given 'pic' (B/W stippled, 1 byte per pixel, 0=blk,1=wht)
@@ -24236,17 +35662,18 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
out as hexadecimal, max of 72 hex chars per line.
if 'flipbw', then 0=white, 1=black
-@@ -1535,25 +1560,32 @@
+@@ -1535,39 +1562,46 @@
document is multiple pages, a series of PNM files are created, and
the first one is loaded (but not deleted) */
-
- char tmp[512], tmp1[512], tmpname[64];
- int gsresult, nump, i, filetype;
+- char *rld;
+#ifdef GS_PATH
-+ char tmp[512], gscmd[512], cmdstr[512], tmpname[64];
++ #define CMDSIZE 1024
++ char tmp[512], gscmd[512], cmdstr[CMDSIZE], tmpname[64];
+ int gsresult, nump, i, filetype, doalert, epsf;
- char *rld;
+#endif
pinfo->pic = (byte *) NULL;
@@ -24269,12 +35696,14 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
+#else
mktemp(tmpname);
- if (tmpname[0] == '\0') { /* mktemp() blew up */
+- sprintf(str,"LoadPS: Unable to create temporary filename???");
+- ErrPopUp(str, "\nHow unlikely!");
+#endif
+ if (tmpname[0] == '\0') { /* mktemp() or mkstemp() blew up */
- sprintf(str,"LoadPS: Unable to create temporary filename???");
- ErrPopUp(str, "\nHow unlikely!");
++ sprintf(dummystr,"LoadPS: Unable to create temporary filename???");
++ ErrPopUp(dummystr, "\nHow unlikely!");
return 0;
-@@ -1561,13 +1593,13 @@
+ }
strcat(tmpname,".");
@@ -24283,7 +35712,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
#ifndef VMS /* VMS needs quotes around mixed case command lines */
- sprintf(tmp, "%s -sDEVICE=%s -r%d -q -dNOPAUSE -sOutputFile=%s%%d ",
-+ sprintf(gscmd, "%s -sDEVICE=%s -r%d -q -dNOPAUSE -sOutputFile=%s%%d ",
++ sprintf(gscmd, "%s -sDEVICE=%s -r%d -q -dSAFER -dNOPAUSE -sOutputFile=%s%%d ",
GS_PATH, gsDev, gsRes, tmpname);
#else
- sprintf(tmp,
@@ -24291,7 +35720,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
"%s \"-sDEVICE=%s\" -r%d -q \"-dNOPAUSE\" \"-sOutputFile=%s%%d\" ",
GS_PATH, gsDev, gsRes, tmpname);
#endif
-@@ -1575,74 +1607,60 @@
+@@ -1575,74 +1609,60 @@
#ifdef GS_LIB
# ifndef VMS
@@ -24403,7 +35832,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
WaitCursor();
-@@ -1664,7 +1682,7 @@
+@@ -1664,7 +1684,7 @@
return 0;
}
@@ -24412,7 +35841,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
GS_PATH, nump, (nump==1) ? "" : "s");
}
-@@ -1677,8 +1695,8 @@
+@@ -1677,8 +1697,8 @@
sprintf(tmp, "%s%d", tmpname, 1);
filetype = ReadFileType(tmp);
@@ -24423,7 +35852,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
filetype == RFT_COMPRESS) { /* shouldn't happen */
SetISTR(ISTR_WARNING, "Couldn't load first page '%s'", tmp);
KillPageFiles(tmpname, nump);
-@@ -1695,7 +1713,7 @@
+@@ -1695,7 +1715,7 @@
KillPageFiles(tmpname, nump);
SetCursors(-1);
return 0;
@@ -24432,7 +35861,7 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
/* SUCCESS! */
-@@ -1712,3 +1730,38 @@
+@@ -1712,3 +1732,54 @@
we don't have 'gs' package */
}
@@ -24440,52 +35869,79 @@ diff -ruN xv-3.10a/xvps.c xv-3.10a-bugfixes/xvps.c
+
+/******************************************************************/
+#ifdef GS_PATH
-+void buildCmdStr(str, gscmd, fname, quick, epsf)
-+ char *str, *gscmd, *fname;
++void buildCmdStr(str, gscmd, xname, quick, epsf)
++ char *str, *gscmd, *xname;
+ int quick, epsf;
+{
+ /* note 'epsf' set only on files that don't have a showpage cmd */
++ char *x, *y, *fname;
++
++ x = (char *) malloc((5 * strlen(xname))+3);
++ if (!x)
++ FatalError("malloc failure in xvps.c buildCmdStr");
++ fname = x;
++ *x++ = 0x27;
++
++ for (y = xname; *y; ++y) {
++ if (0x27 == *y) {
++ strcpy(x, "'\"'\"'");
++ x += strlen(x);
++ } else *x++ = *y;
++ }
++ strcpy (x, "'");
+
+#ifndef VMS
+
-+ if (epsf) sprintf(str, "echo '\n showpage ' | cat '%s' - | %s -",
++ if (epsf) snprintf(str, CMDSIZE, "echo '\n showpage ' | cat %s - | %s -",
+ fname, gscmd);
+
-+ else if (quick) sprintf(str, "echo '%s' | cat - '%s' | %s -",
++ else if (quick) snprintf(str, CMDSIZE, "echo %s | cat - %s | %s -",
+ "/showpage { showpage quit } bind def",
+ fname, gscmd);
+
-+ else sprintf(str, "%s -- %s", gscmd, fname);
++ else snprintf(str, CMDSIZE, "%s -- %s", gscmd, fname);
+
+#else /* VMS */
+ /* VMS doesn't have pipes or an 'echo' command and GS doesn't like
-+ Unix-style file names as input files in the VMS version */
++ Unix-style filenames as input files in the VMS version */
+ strcat(tmp, " -- ");
+ rld = strrchr(fname, '/'); /* Pointer to last '/' */
+ if (rld) rld++; /* Pointer to filename */
+ else rld = fname; /* No path - use original string */
+ strcat(tmp, rld);
+#endif /* VMS */
++ free(fname);
+}
+#endif /* GS_PATH */
+
+
+
-diff -ruN xv-3.10a/xvrle.c xv-3.10a-bugfixes/xvrle.c
+diff -ru xv-3.10a/xvrle.c xv-3.10a-enhancements/xvrle.c
--- xv-3.10a/xvrle.c 1995-01-19 09:27:47.000000000 -0800
-+++ xv-3.10a-bugfixes/xvrle.c 2005-03-29 23:29:14.000000000 -0800
-@@ -43,8 +43,8 @@
- byte bgcol[256];
++++ xv-3.10a-enhancements/xvrle.c 2007-05-13 17:49:34.000000000 -0700
+@@ -28,7 +28,7 @@
+ #define GETINT(fp) (c=getc(fp), c1=getc(fp), (c1<<8) + c )
+
+ static void read_rle PARM((FILE *, byte *, int, int, int, int));
+-static int rleError PARM((char *, char *));
++static int rleError PARM((const char *, const char *));
+
+
+
+@@ -44,9 +44,10 @@
byte maps[3][256];
int xpos, ypos, w, h, flags, ncolors, pixelbits, ncmap, cmaplen;
-- int cmtlen;
+ int cmtlen;
- byte *img, *pic8;
-+ int cmtlen, npixels, bufsize=0;
+ byte *img;
long filesize;
- char *bname, *errstr;
+- char *bname, *errstr;
++ const char *bname;
++ const char *errstr;
-@@ -57,7 +57,7 @@
+ pinfo->type = PIC8;
+ pinfo->pic = (byte *) NULL;
+@@ -57,7 +58,7 @@
/* open the stream */
fp = xv_fopen(fname,"r");
if (!fp) return (rleError(bname, "unable to open file"));
@@ -24494,7 +35950,7 @@ diff -ruN xv-3.10a/xvrle.c xv-3.10a-bugfixes/xvrle.c
/* figure out the file size */
fseek(fp, 0L, 2);
-@@ -85,7 +85,7 @@
+@@ -85,7 +86,7 @@
if (DEBUG) {
fprintf(stderr,"RLE: %dx%d image at %d,%d\n", w, h, xpos, ypos);
fprintf(stderr,"flags: 0x%02x (%s%s%s%s)\n",
@@ -24503,7 +35959,7 @@ diff -ruN xv-3.10a/xvrle.c xv-3.10a-bugfixes/xvrle.c
(flags & H_CLEARFIRST) ? "CLEARFIRST " : "",
(flags & H_NO_BACKGROUND) ? "NO_BG " : "",
(flags & H_ALPHA) ? "ALPHA " : "",
-@@ -93,7 +93,7 @@
+@@ -93,7 +94,7 @@
fprintf(stderr, "%d bands, %d pixelbits, %d cmap bands, %d cmap entries\n",
ncolors, pixelbits, ncmap, cmaplen);
@@ -24512,93 +35968,16 @@ diff -ruN xv-3.10a/xvrle.c xv-3.10a-bugfixes/xvrle.c
if (!(flags & H_NO_BACKGROUND)) {
if (DEBUG) fprintf(stderr, "background value: ");
-@@ -176,32 +176,44 @@
-
- errstr = NULL;
- if (ncolors == 0 || ncolors == 2)
-- errstr = "Unsupt. # of channels in RLE file.\n";
-+ errstr = "Unsupported number of channels in RLE file";
-
- if (pixelbits != 8)
-- errstr = "Only 8-bit pixels supported in RLE files.\n";
-+ errstr = "Only 8-bit pixels supported in RLE files";
-
- if (ncmap==0 || ncmap==1 || ncmap == 3 || ncmap == ncolors) { /* ok */ }
-- else errstr = "Invalid # of colormap channels in RLE file.\n";
-+ else errstr = "Invalid number of colormap channels in RLE file";
-
-- if (w<1 || h<1)
-- errstr = "Bogus size in RLE header.\n";
-+ npixels = w * h;
-+ if (w <= 0 || h <= 0 || npixels/w != h)
-+ errstr = "RLE image dimensions out of range";
-
-
- if (errstr) {
- fclose(fp);
-- if (pinfo->comment) free(pinfo->comment); pinfo->comment = (char *) NULL;
-+ if (pinfo->comment)
-+ free(pinfo->comment);
-+ pinfo->comment = (char *) NULL;
- return rleError(bname, errstr);
- }
-
-
- /* allocate image memory */
-- if (ncolors == 1) img = (byte *) calloc((size_t) w * h, (size_t) 1);
-- else img = (byte *) calloc((size_t) w * h * 3, (size_t) 1);
-+ if (ncolors == 1)
-+ img = (byte *) calloc((size_t) npixels, (size_t) 1);
-+ else {
-+ bufsize = 3*npixels;
-+ if (bufsize/3 != npixels)
-+ return rleError(bname, "RLE image dimensions out of range");
-+ img = (byte *) calloc((size_t) bufsize, (size_t) 1);
-+ }
-+
- if (!img) {
- fclose(fp);
-- if (pinfo->comment) free(pinfo->comment); pinfo->comment = (char *) NULL;
-- return rleError(bname, "unable to allocate image data.\n");
-+ if (pinfo->comment)
-+ free(pinfo->comment);
-+ pinfo->comment = (char *) NULL;
-+ return rleError(bname, "Unable to allocate RLE image data");
- }
-
-
-@@ -209,10 +221,10 @@
- if ((flags & H_CLEARFIRST) && !(flags & H_NO_BACKGROUND)) {
- byte *ip;
- if (ncolors == 1) {
-- for (i=0, ip=img; i<w*h; i++, ip++) *ip = bgcol[0];
-+ for (i=0, ip=img; i<npixels; i++, ip++) *ip = bgcol[0];
+@@ -212,7 +213,7 @@
+ for (i=0, ip=img; i<w*h; i++, ip++) *ip = bgcol[0];
}
else {
- for (i=0, ip=img; i<w*h; i++)
-+ for (i=0, ip=img; i<npixels; i++)
++ for (i=0, ip=img; i<w*h; i++)
for (j=0; j<3; j++, ip++) *ip = bgcol[j];
}
}
-@@ -230,7 +242,7 @@
- if (ncmap) {
- byte *ip;
- int imagelen, cmask;
-- imagelen = (ncolors==1) ? w*h : w*h*3;
-+ imagelen = (ncolors==1) ? npixels : bufsize;
- cmask = (cmaplen-1);
-
- if (ncmap == 1) { /* single gamma curve */
-@@ -238,7 +250,7 @@
- }
-
- else if (ncmap >= 3 && ncolors >=3) { /* one curve per band */
-- for (i=0, ip=img; i<w*h; i++) {
-+ for (i=0, ip=img; i<npixels; i++) {
- *ip = maps[0][*ip & cmask]; ip++;
- *ip = maps[1][*ip & cmask]; ip++;
- *ip = maps[2][*ip & cmask]; ip++;
-@@ -250,7 +262,7 @@
+@@ -250,7 +251,7 @@
/* finally, convert into XV internal format */
pinfo->pic = img;
@@ -24607,7 +35986,7 @@ diff -ruN xv-3.10a/xvrle.c xv-3.10a-bugfixes/xvrle.c
pinfo->h = h;
pinfo->normw = pinfo->w; pinfo->normh = pinfo->h;
pinfo->frmType = -1; /* no default format to save in */
-@@ -260,7 +272,7 @@
+@@ -260,7 +261,7 @@
if (ncmap == 0 || ncmap == 1) { /* grey, or grey with gamma curve */
pinfo->colType = F_GREYSCALE;
sprintf(pinfo->fullInfo, "Greyscale RLE. (%ld bytes)", filesize);
@@ -24616,7 +35995,7 @@ diff -ruN xv-3.10a/xvrle.c xv-3.10a-bugfixes/xvrle.c
pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i;
}
else {
-@@ -272,7 +284,7 @@
+@@ -272,7 +273,7 @@
pinfo->b[i] = maps[2][i];
}
}
@@ -24625,7 +36004,7 @@ diff -ruN xv-3.10a/xvrle.c xv-3.10a-bugfixes/xvrle.c
sprintf(pinfo->shrtInfo, "%dx%d RLE.",w, h);
}
-@@ -294,7 +306,7 @@
+@@ -294,7 +295,7 @@
int w, h, ncolors, ncmap;
{
int posx, posy, plane, bperpix, i, pixval, skipcalls;
@@ -24634,7 +36013,7 @@ diff -ruN xv-3.10a/xvrle.c xv-3.10a-bugfixes/xvrle.c
byte *ip;
posx = posy = plane = done = skipcalls = 0;
-@@ -324,7 +336,7 @@
+@@ -324,7 +325,7 @@
case RSkipPixelsOp:
if (opcode & LONG_OP) { getc(fp); operand = GETINT(fp); }
else operand = getc(fp);
@@ -24643,7 +36022,7 @@ diff -ruN xv-3.10a/xvrle.c xv-3.10a-bugfixes/xvrle.c
posx += operand;
break;
-@@ -340,7 +352,7 @@
+@@ -340,7 +341,7 @@
c = getc(fp);
if (plane<ncolors && posy<h && (posx+i < w)) *ip = c;
}
@@ -24652,7 +36031,7 @@ diff -ruN xv-3.10a/xvrle.c xv-3.10a-bugfixes/xvrle.c
if (operand & 1) getc(fp); /* word boundary */
posx += operand;
break;
-@@ -358,7 +370,7 @@
+@@ -358,7 +359,7 @@
for (i=0; i<operand; i++, ip+=bperpix) {
if (plane<ncolors && posy<h && (posx+i < w)) *ip = pixval;
}
@@ -24661,9 +36040,18 @@ diff -ruN xv-3.10a/xvrle.c xv-3.10a-bugfixes/xvrle.c
/* if (operand & 1) getc(fp); */ /* word boundary */
posx += operand;
break;
-diff -ruN xv-3.10a/xvroot.c xv-3.10a-bugfixes/xvroot.c
+@@ -373,7 +374,7 @@
+
+ /*******************************************/
+ static int rleError(fname,st)
+- char *fname, *st;
++ const char *fname, *st;
+ {
+ SetISTR(ISTR_WARNING,"%s: %s", fname, st);
+ return 0;
+diff -ru xv-3.10a/xvroot.c xv-3.10a-enhancements/xvroot.c
--- xv-3.10a/xvroot.c 1994-12-22 14:34:42.000000000 -0800
-+++ xv-3.10a-bugfixes/xvroot.c 2004-05-16 18:04:21.000000000 -0700
++++ xv-3.10a-enhancements/xvroot.c 2004-05-16 18:07:52.000000000 -0700
@@ -22,7 +22,7 @@
/***********************************/
void MakeRootPic()
@@ -24673,7 +36061,15 @@ diff -ruN xv-3.10a/xvroot.c xv-3.10a-bugfixes/xvroot.c
creates the XImage and the pixmap, sets the root to the new
pixmap, and refreshes the display */
-@@ -67,32 +67,32 @@
+@@ -44,6 +44,7 @@
+ case RM_MIRROR:
+ case RM_IMIRROR: rpixw = 2*eWIDE; rpixh = 2*eHIGH; break;
+ case RM_CSOLID:
++ case RM_UPLEFT:
+ case RM_CWARP:
+ case RM_CBRICK: rpixw = dispWIDE; rpixh = dispHIGH; break;
+
+@@ -67,32 +68,32 @@
if (rmode == RM_NORMAL || rmode == RM_TILE) {
@@ -24711,7 +36107,16 @@ diff -ruN xv-3.10a/xvroot.c xv-3.10a-bugfixes/xvroot.c
(u_int) eWIDE, (u_int) eHIGH);
FlipPic(epic, eWIDE, eHIGH, 1); /* flip vertically (back to orig) */
-@@ -122,15 +122,15 @@
+@@ -101,7 +102,7 @@
+
+
+ else if (rmode == RM_CENTER || rmode == RM_CENTILE || rmode == RM_CSOLID ||
+- rmode == RM_CWARP || rmode == RM_CBRICK) {
++ rmode == RM_CWARP || rmode == RM_CBRICK || rmode == RM_UPLEFT) {
+ /* do some stuff to set up the border around the picture */
+
+ if (rmode != RM_CENTILE) {
+@@ -122,15 +123,15 @@
for (i=ay; i < (int) eHIGH; i+=h) {
for (j=ax; j < (int) eWIDE; j+=w) {
/* if image goes off tmpPix, only draw subimage */
@@ -24730,8 +36135,16 @@ diff -ruN xv-3.10a/xvroot.c xv-3.10a-bugfixes/xvroot.c
x, y, (u_int) w1, (u_int) h1);
}
}
-@@ -140,7 +140,7 @@
+@@ -138,9 +139,15 @@
+ else if (rmode == RM_CSOLID) { }
+
++ else if (rmode == RM_UPLEFT) {
++
++ XPutImage(theDisp, tmpPix, theGC, theImage, 0,0, 0,0,
++ (u_int) eWIDE, (u_int) eHIGH);
++ }
++
else if (rmode == RM_CWARP) { /* warp effect */
XSetForeground(theDisp, theGC, rootfg);
- for (i=0; i<=dispWIDE; i+=8)
@@ -24739,7 +36152,7 @@ diff -ruN xv-3.10a/xvroot.c xv-3.10a-bugfixes/xvroot.c
XDrawLine(theDisp,tmpPix,theGC, i,0, (int) dispWIDE-i,(int) dispHIGH);
for (i=0; i<=dispHIGH; i+=8)
XDrawLine(theDisp,tmpPix,theGC, 0,i, (int) dispWIDE, (int) dispHIGH-i);
-@@ -150,16 +150,16 @@
+@@ -150,16 +157,16 @@
XSetForeground(theDisp, theGC, rootfg);
for (i=k=0; i<dispHIGH; i+=20,k++) {
XDrawLine(theDisp, tmpPix, theGC, 0, i, (int) dispWIDE, i);
@@ -24754,13 +36167,13 @@ diff -ruN xv-3.10a/xvroot.c xv-3.10a-bugfixes/xvroot.c
- if (rmode != RM_CENTILE)
- XPutImage(theDisp, tmpPix, theGC, theImage, 0,0,
- ((int) dispWIDE-eWIDE)/2, ((int) dispHIGH-eHIGH)/2,
-+ if (rmode != RM_CENTILE)
++ if ((rmode != RM_CENTILE) && (rmode != RM_UPLEFT))
+ XPutImage(theDisp, tmpPix, theGC, theImage, 0,0,
+ ((int) dispWIDE-eWIDE)/2, ((int) dispHIGH-eHIGH)/2,
(u_int) eWIDE, (u_int) eHIGH);
}
-@@ -172,7 +172,7 @@
+@@ -172,7 +179,7 @@
if (dispWIDE == eWIDE) {
/* horizontal center line */
int y, ay;
@@ -24769,7 +36182,7 @@ diff -ruN xv-3.10a/xvroot.c xv-3.10a-bugfixes/xvroot.c
y = eHIGH - ((dispHIGH/2)%eHIGH); /* Starting point in picture to copy */
ay = 0; /* Vertical anchor point */
while (ay < dispHIGH) {
-@@ -189,7 +189,7 @@
+@@ -189,7 +196,7 @@
else if (dispHIGH == eHIGH) {
/* vertical centerline */
int x, ax;
@@ -24778,7 +36191,7 @@ diff -ruN xv-3.10a/xvroot.c xv-3.10a-bugfixes/xvroot.c
x = eWIDE - ((dispWIDE/2)%eWIDE); /* Starting point in picture to copy */
ax = 0; /* Horizontal anchor point */
while (ax < dispWIDE) {
-@@ -206,10 +206,10 @@
+@@ -206,10 +213,10 @@
else {
/* vertical and horizontal centerlines */
int x,y, ax,ay;
@@ -24791,7 +36204,7 @@ diff -ruN xv-3.10a/xvroot.c xv-3.10a-bugfixes/xvroot.c
while (ay < dispHIGH) {
x = eWIDE - ((dispWIDE/2)%eWIDE);/* Starting point in picture to cpy */
ax = 0; /* Horizontal anchor point */
-@@ -276,8 +276,8 @@
+@@ -276,8 +283,8 @@
gc_init.foreground = BlackPixel(theDisp, theScreen);
gc_init.background = WhitePixel(theDisp, theScreen);
gc = XCreateGC(theDisp, vrootW, GCForeground|GCBackground, &gc_init);
@@ -24802,7 +36215,7 @@ diff -ruN xv-3.10a/xvroot.c xv-3.10a-bugfixes/xvroot.c
(unsigned int) DefaultDepth(theDisp, theScreen));
XCopyPlane(theDisp, bitmap, pix, gc, 0,0, root_weave_width,
-@@ -333,8 +333,8 @@
+@@ -333,8 +340,8 @@
prop = XInternAtom(theDisp, "_XSETROOT_ID", True);
if (prop == None) return; /* no old pixmap to kill */
@@ -24813,15 +36226,15 @@ diff -ruN xv-3.10a/xvroot.c xv-3.10a-bugfixes/xvroot.c
&after, &data) == Success) {
if (type==XA_PIXMAP && format==32 && length==1 && after==0 && data) {
-@@ -348,4 +348,4 @@
+@@ -348,4 +355,4 @@
-
+
-diff -ruN xv-3.10a/xvscrl.c xv-3.10a-bugfixes/xvscrl.c
+diff -ru xv-3.10a/xvscrl.c xv-3.10a-enhancements/xvscrl.c
--- xv-3.10a/xvscrl.c 1994-12-22 14:34:41.000000000 -0800
-+++ xv-3.10a-bugfixes/xvscrl.c 2004-05-16 18:04:25.000000000 -0700
++++ xv-3.10a-enhancements/xvscrl.c 2004-05-16 18:07:56.000000000 -0700
@@ -1,4 +1,4 @@
-/*
+/*
@@ -25048,9 +36461,9 @@ diff -ruN xv-3.10a/xvscrl.c xv-3.10a-bugfixes/xvscrl.c
}
}
-diff -ruN xv-3.10a/xvsmooth.c xv-3.10a-bugfixes/xvsmooth.c
+diff -ru xv-3.10a/xvsmooth.c xv-3.10a-enhancements/xvsmooth.c
--- xv-3.10a/xvsmooth.c 1994-12-22 14:34:42.000000000 -0800
-+++ xv-3.10a-bugfixes/xvsmooth.c 2004-05-16 18:04:28.000000000 -0700
++++ xv-3.10a-enhancements/xvsmooth.c 2004-05-16 18:07:59.000000000 -0700
@@ -4,11 +4,11 @@
* Contains:
* byte *SmoothResize(src8, swide, shigh, dwide, dhigh,
@@ -25102,7 +36515,7 @@ diff -ruN xv-3.10a/xvsmooth.c xv-3.10a-bugfixes/xvsmooth.c
/***************************************************/
-@@ -83,23 +83,23 @@
+@@ -83,29 +83,29 @@
bperpix = (is24) ? 3 : 1;
/* decide which smoothing routine to use based on type of expansion */
@@ -25131,19 +36544,35 @@ diff -ruN xv-3.10a/xvsmooth.c xv-3.10a-bugfixes/xvsmooth.c
0,0 = middle of pixel */
/* we can save a lot of time by precomputing cxtab[] and pxtab[], both
-@@ -115,10 +115,10 @@
+ dwide arrays of ints that contain values for the equations:
+ cx = (ex * swide) / dwide;
+- px = ((ex * swide * 100) / dwide) - (cx * 100) - 50; */
++ px = ((ex * swide * 128) / dwide) - (cx * 128) - 64; */
+
+ cxtab = (int *) malloc(dwide * sizeof(int));
+ if (!cxtab) { free(pic24); return NULL; }
+@@ -115,17 +115,17 @@
for (ex=0; ex<dwide; ex++) {
cxtab[ex] = (ex * swide) / dwide;
- pxtab[ex] = (((ex * swide)* 100) / dwide)
-+ pxtab[ex] = (((ex * swide)* 100) / dwide)
- - (cxtab[ex] * 100) - 50;
+- - (cxtab[ex] * 100) - 50;
++ pxtab[ex] = (((ex * swide)* 128) / dwide)
++ - (cxtab[ex] * 128) - 64;
}
-
+
for (ey=0; ey<dhigh; ey++) {
byte *pptr, rA, gA, bA, rB, gB, bB, rC, gC, bC, rD, gD, bD;
+ ProgressMeter(0, (dhigh)-1, ey, "Smooth");
+
+ cy = (ey * shigh) / dhigh;
+- py = (((ey * shigh) * 100) / dhigh) - (cy * 100) - 50;
++ py = (((ey * shigh) * 128) / dhigh) - (cy * 128) - 64;
+ if (py<0) { y1 = cy-1; if (y1<0) y1=0; }
+ else { y1 = cy+1; if (y1>shigh-1) y1=shigh-1; }
+
@@ -162,7 +162,7 @@
cC = pic824[cyOff + x1]; /* left/right center pixel */
cD = pic824[cyOff + cx]; /* center pixel */
@@ -25153,34 +36582,50 @@ diff -ruN xv-3.10a/xvsmooth.c xv-3.10a-bugfixes/xvsmooth.c
/* quick check */
if (!is24 && cA == cB && cB == cC && cC == cD) {
/* set this pixel to the same color as in pic8 */
-@@ -178,30 +178,30 @@
- pD = 100 - (pA + pB + pC);
+@@ -172,36 +172,36 @@
+ else {
+ /* compute weighting factors */
+ apx = abs(px); apy = abs(py);
+- pA = (apx * apy) / 100;
+- pB = (apy * (100 - apx)) / 100;
+- pC = (apx * (100 - apy)) / 100;
+- pD = 100 - (pA + pB + pC);
++ pA = (apx * apy) >> 7; /* div 128 */
++ pB = (apy * (128 - apx)) >> 7; /* div 128 */
++ pC = (apx * (128 - apy)) >> 7; /* div 128 */
++ pD = 128 - (pA + pB + pC);
if (is24) {
- *pp++ = ((int) (pA * rA))/100 + ((int) (pB * rB))/100 +
-+ *pp++ = ((int) (pA * rA))/100 + ((int) (pB * rB))/100 +
- ((int) (pC * rC))/100 + ((int) (pD * rD))/100;
+- ((int) (pC * rC))/100 + ((int) (pD * rD))/100;
++ *pp++ = (((int) (pA * rA))>>7) + (((int) (pB * rB))>>7) +
++ (((int) (pC * rC))>>7) + (((int) (pD * rD))>>7);
- *pp++ = ((int) (pA * gA))/100 + ((int) (pB * gB))/100 +
-+ *pp++ = ((int) (pA * gA))/100 + ((int) (pB * gB))/100 +
- ((int) (pC * gC))/100 + ((int) (pD * gD))/100;
+- ((int) (pC * gC))/100 + ((int) (pD * gD))/100;
++ *pp++ = (((int) (pA * gA))>>7) + (((int) (pB * gB))>>7) +
++ (((int) (pC * gC))>>7) + (((int) (pD * gD))>>7);
- *pp++ = ((int) (pA * bA))/100 + ((int) (pB * bB))/100 +
-+ *pp++ = ((int) (pA * bA))/100 + ((int) (pB * bB))/100 +
- ((int) (pC * bC))/100 + ((int) (pD * bD))/100;
+- ((int) (pC * bC))/100 + ((int) (pD * bD))/100;
++ *pp++ = (((int) (pA * bA))>>7) + (((int) (pB * bB))>>7) +
++ (((int) (pC * bC))>>7) + (((int) (pD * bD))>>7);
}
else { /* 8-bit pic */
- *pp++ = ((int) (pA * rmap[cA]))/100 + ((int)(pB * rmap[cB]))/100 +
-+ *pp++ = ((int) (pA * rmap[cA]))/100 + ((int)(pB * rmap[cB]))/100 +
- ((int) (pC * rmap[cC]))/100 + ((int)(pD * rmap[cD]))/100;
+- ((int) (pC * rmap[cC]))/100 + ((int)(pD * rmap[cD]))/100;
++ *pp++ = (((int)(pA * rmap[cA]))>>7) + (((int)(pB * rmap[cB]))>>7) +
++ (((int)(pC * rmap[cC]))>>7) + (((int)(pD * rmap[cD]))>>7);
- *pp++ = ((int) (pA * gmap[cA]))/100 + ((int)(pB * gmap[cB]))/100 +
-+ *pp++ = ((int) (pA * gmap[cA]))/100 + ((int)(pB * gmap[cB]))/100 +
- ((int) (pC * gmap[cC]))/100 + ((int)(pD * gmap[cD]))/100;
+- ((int) (pC * gmap[cC]))/100 + ((int)(pD * gmap[cD]))/100;
++ *pp++ = (((int)(pA * gmap[cA]))>>7) + (((int)(pB * gmap[cB]))>>7) +
++ (((int)(pC * gmap[cC]))>>7) + (((int)(pD * gmap[cD]))>>7);
- *pp++ = ((int)(pA * bmap[cA]))/100 + ((int)(pB * bmap[cB]))/100 +
-+ *pp++ = ((int)(pA * bmap[cA]))/100 + ((int)(pB * bmap[cB]))/100 +
- ((int)(pC * bmap[cC]))/100 + ((int)(pD * bmap[cD]))/100;
+- ((int)(pC * bmap[cC]))/100 + ((int)(pD * bmap[cD]))/100;
++ *pp++ = (((int)(pA * bmap[cA]))>>7) + (((int)(pB * bmap[cB]))>>7) +
++ (((int)(pC * bmap[cC]))>>7) + (((int)(pD * bmap[cD]))>>7);
}
}
}
@@ -25449,10 +36894,19 @@ diff -ruN xv-3.10a/xvsmooth.c xv-3.10a-bugfixes/xvsmooth.c
*np = rb | (gb>>3) | (bb>>6);
-diff -ruN xv-3.10a/xvsunras.c xv-3.10a-bugfixes/xvsunras.c
+diff -ru xv-3.10a/xvsunras.c xv-3.10a-enhancements/xvsunras.c
--- xv-3.10a/xvsunras.c 1994-12-22 14:34:42.000000000 -0800
-+++ xv-3.10a-bugfixes/xvsunras.c 2005-04-02 18:04:20.000000000 -0800
-@@ -54,8 +54,8 @@
++++ xv-3.10a-enhancements/xvsunras.c 2007-05-13 17:46:42.000000000 -0700
+@@ -39,7 +39,7 @@
+ #define RAS_RLE 0x80
+
+
+-static int sunRasError PARM((char *, char *));
++static int sunRasError PARM((const char *, const char *));
+ static int rle_read PARM((byte *, int, int, FILE *, int));
+ static void sunRas1to8 PARM((byte *, byte *, int));
+ static void sunRas8to1 PARM((byte *, byte *, int, int));
+@@ -54,10 +54,10 @@
PICINFO *pinfo;
{
FILE *fp;
@@ -25461,7 +36915,10 @@ diff -ruN xv-3.10a/xvsunras.c xv-3.10a-bugfixes/xvsunras.c
+ int linesize,lsize,csize,isize,i,w,h,d,npixels,nbytes;
+ byte *image, *line;
struct rasterfile sunheader;
- char *bname;
+- char *bname;
++ const char *bname;
+
+ bname = BaseName(fname);
@@ -85,7 +85,7 @@
sunheader.ras_depth != 8 &&
@@ -25586,6 +37043,15 @@ diff -ruN xv-3.10a/xvsunras.c xv-3.10a-bugfixes/xvsunras.c
pinfo->h = h;
pinfo->normw = pinfo->w; pinfo->normh = pinfo->h;
pinfo->frmType = F_SUNRAS;
+@@ -285,7 +318,7 @@
+
+ /*****************************/
+ static int sunRasError(fname, st)
+- char *fname, *st;
++ const char *fname, *st;
+ {
+ SetISTR(ISTR_WARNING,"%s: %s", fname, st);
+ return 0;
@@ -364,10 +397,15 @@
/* special case: if PIC24 and writing GREYSCALE, write 8-bit file */
@@ -25656,9 +37122,9 @@ diff -ruN xv-3.10a/xvsunras.c xv-3.10a-bugfixes/xvsunras.c
/* write the image */
-diff -ruN xv-3.10a/xvtarga.c xv-3.10a-bugfixes/xvtarga.c
+diff -ru xv-3.10a/xvtarga.c xv-3.10a-enhancements/xvtarga.c
--- xv-3.10a/xvtarga.c 1994-12-22 14:34:55.000000000 -0800
-+++ xv-3.10a-bugfixes/xvtarga.c 2005-03-31 07:33:07.000000000 -0800
++++ xv-3.10a-enhancements/xvtarga.c 2007-05-13 17:51:18.000000000 -0700
@@ -17,8 +17,8 @@
* 0:
* 1: colormap type
@@ -25679,6 +37145,15 @@ diff -ruN xv-3.10a/xvtarga.c xv-3.10a-bugfixes/xvtarga.c
*/
+@@ -36,7 +36,7 @@
+ #include "xv.h"
+
+ static long filesize;
+-static char *bname;
++static const char *bname;
+
+
+ /*******************************************/
@@ -48,7 +48,7 @@
/* returns '1' on success */
@@ -25735,9 +37210,9 @@ diff -ruN xv-3.10a/xvtarga.c xv-3.10a-bugfixes/xvtarga.c
putc(w&0xff, fp);
putc((w>>8)&0xff,fp);
putc(h&0xff, fp);
-diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
+diff -ru xv-3.10a/xvtext.c xv-3.10a-enhancements/xvtext.c
--- xv-3.10a/xvtext.c 1995-01-13 15:46:28.000000000 -0800
-+++ xv-3.10a-bugfixes/xvtext.c 2004-05-16 18:04:38.000000000 -0700
++++ xv-3.10a-enhancements/xvtext.c 2007-05-13 14:25:59.000000000 -0700
@@ -1,6 +1,6 @@
/*
* xvtext.c - text file display window routines
@@ -25746,19 +37221,247 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
* includes:
* void CreateTextWins(geom, cmtgeom);
* void OpenTextView(text, textlen, title, freeonclose);
-@@ -98,8 +98,7 @@
+@@ -19,9 +19,13 @@
+ #include "copyright.h"
+
+ #include "xv.h"
++#ifdef TV_MULTILINGUAL
++#include "xvml.h"
++#endif
+
+-
+-#define BUTTW 80
++#define BUTTW1 80
++#define BUTTW2 60
++#define BUTTW3 110
+ #define BUTTH 24
+
+ #define TOPMARGIN 30 /* from top of window to top of text window */
+@@ -36,19 +40,36 @@
+ #define TV_ASCII 0
+ #define TV_HEX 1
+ #define TV_CLOSE 2
+-#define TV_NBUTTS 3
+
++#define TV_E_NBUTTS 3
++
++#ifdef TV_L10N
++# define TV_RESCAN 3
++# define TV_USASCII 4
++# define TV_JIS 5
++# define TV_EUCJ 6
++# define TV_MSCODE 7
++
++# define TV_J_NBUTTS 8
++#endif
+
+ #define TITLELEN 128
+
++#ifdef TV_MULTILINGUAL
++struct coding_spec {
++ struct coding_system coding_system;
++ char *(*converter)PARM((char *, int, int *));
++};
++#endif
++
+ /* data needed per text window */
+ typedef struct { Window win, textW;
+ int vis, wasvis;
+- char *text; /* text to be displayed */
++ const char *text; /* text to be displayed */
+ int freeonclose; /* free text when closing win */
+ int textlen; /* length of text */
+ char title[TITLELEN]; /* name of file being displayed */
+- char **lines; /* ptr to array of line ptrs */
++ const char **lines; /* ptr to array of line ptrs */
+ int numlines; /* # of lines in text */
+ int hexlines; /* # of lines in HEX mode */
+ int maxwide; /* length of longest line (ascii) */
+@@ -57,16 +78,89 @@
+ int chwide, chhigh; /* size of textW, in chars */
+ int hexmode; /* true if disp Hex, else Ascii */
+ SCRL vscrl, hscrl;
+- BUTT but[TV_NBUTTS], nopBut;
++#ifdef TV_L10N
++ int code; /* current character code */
++ BUTT but[TV_J_NBUTTS], nopBut;
++#else
++ BUTT but[TV_E_NBUTTS], nopBut;
++#endif
++#ifdef TV_MULTILINGUAL
++/* int codeset; */
++ struct coding_spec ccs; /* current coding_spec */
++ BUTT csbut;
++ char *cv_text;
++ int cv_len;
++ struct context *ctx;
++ struct ml_text *txt;
++ struct csinfo_t *cs;
++#endif
+ } TVINFO;
+
+
+ static TVINFO tinfo[MAXTVWIN];
+ static int hasBeenSized = 0;
+ static int haveWindows = 0;
++static int nbutts; /* # of buttons */
+ static int mfwide, mfhigh, mfascent; /* size of chars in mono font */
+ static int *event_retP, *event_doneP; /* used in tvChkEvent() */
+-
++#ifdef TV_MULTILINGUAL
++# define TV_PLAIN 0
++# define TV_ISO_8859_1 1
++# define TV_ISO_2022_JP 2
++# define TV_EUC_JAPAN 3
++# define TV_ISO_2022_INT_1 4
++# define TV_ISO_2022_KR 5
++# define TV_EUC_KOREA 6
++# define TV_ISO_2022_SS2_8 7
++# define TV_ISO_2022_SS2_7 8
++# define TV_SHIFT_JIS 9
++# define TV_NCSS 10
++static char *codeSetNames[TV_NCSS] = {
++ "plain",
++ "iso-8859-1",
++ "iso-2022-jp",
++ "euc-japan",
++ "iso-2022-int-1",
++ "iso-2022-kr",
++ "euc-korea",
++ "iso-2022-ss2-8",
++ "iso-2022-ss2-7",
++ "Shift JIS",
++};
++static struct coding_spec coding_spec[TV_NCSS] = {
++ /* --- G0 --- --- G1 --- --- G2 --- --- G3 --- GL GR EOL SF LS */
++ /* plain */
++ {{{{ 1,94,'B'}, { 1,94,'B'}, { 1,94,'B'}, { 1,94,'B'}}, 0, 0, 0, 1, 1},
++ NULL},
++ /* iso-8859-1 */
++ {{{{ 1,94,'B'}, { 1,96,'A'}, {-1,94,'B'}, {-1,94,'B'}}, 0, 1, 0, 0, 0},
++ NULL},
++ /* iso-2022-jp */
++ {{{{ 1,94,'B'}, {-1,94,'B'}, {-1,94,'B'}, {-1,94,'B'}}, 0, 0, 0, 1, 0},
++ NULL},
++ /* euc-japan */
++ {{{{ 1,94,'B'}, { 2,94,'B'}, { 1,94,'J'}, { 2,94,'D'}}, 0, 1, 0, 1, 0},
++ NULL},
++ /* iso-2022-int-1 */
++ {{{{ 1,94,'B'}, { 2,94,'C'}, {-1,94,'B'}, {-1,94,'B'}}, 0, 1, 0, 1, 1},
++ NULL},
++ /* iso-2022-kr */
++ {{{{ 1,94,'B'}, { 2,94,'C'}, {-1,94,'B'}, {-1,94,'B'}}, 0, 1, 0, 0, 1},
++ NULL},
++ /* euc-korea */
++ {{{{ 1,94,'B'}, { 2,94,'C'}, {-1,94,'B'}, {-1,94,'B'}}, 0, 1, 0, 0, 0},
++ NULL},
++ /* iso-2022-ss2-8 */
++ {{{{ 1,94,'B'}, {-1,94,'C'}, { 0,94,'B'}, {-1,94,'B'}}, 0, 1, 0, 0, 0},
++ NULL},
++ /* iso-2022-ss2-7 */
++ {{{{ 1,94,'B'}, {-1,94,'C'}, { 0,94,'B'}, {-1,94,'B'}}, 0, 1, 0, 1, 0},
++ NULL},
++ /* shift jis */
++ {{{{ 1,94,'B'}, { 2,94,'B'}, { 1,94,'J'}, { 2,94,'D'}}, 0, 1, 1, 1, 0},
++ sjis_to_jis},
++};
++#endif
+
+ static void closeText PARM((TVINFO *));
+ static int tvChkEvent PARM((TVINFO *, XEvent *));
+@@ -82,7 +176,15 @@
+ static void textKey PARM((TVINFO *, int));
+ static void doHexAsciiCmd PARM((TVINFO *, int));
+ static void computeText PARM((TVINFO *));
+-
++#ifdef TV_L10N
++static int selectCodeset PARM((TVINFO *));
++#endif
++#ifdef TV_MULTILINGUAL
++static void setCodingSpec PARM((TVINFO *, struct coding_spec *));
++static void createCsWins PARM((char *));
++static void openCsWin PARM((TVINFO *));
++static void closeCsWin PARM((TVINFO *));
++#endif
+
+ /* HEXMODE output looks like this:
+ 0x00000000: 00 11 22 33 44 55 66 77 - 88 99 aa bb cc dd ee ff 0123456789abcdef
+@@ -92,19 +194,57 @@
+
+ /***************************************************************/
+ void CreateTextWins(geom, cmtgeom)
+- char *geom, *cmtgeom;
++ const char *geom, *cmtgeom;
+ {
+ int i, defwide, defhigh, cmthigh;
XSizeHints hints;
XSetWindowAttributes xswa;
TVINFO *tv;
- int gx,gy,gw,gh,gset,gx1,gy1;
-
++#ifdef TV_MULTILINGUAL
++ int default_codeset;
++#endif
++
++#ifdef TV_L10N
++ if (!xlocale) {
++#endif
++ mfwide = monofinfo->max_bounds.width;
++ mfhigh = monofinfo->ascent + monofinfo->descent;
++ mfascent = monofinfo->ascent;
+
++ nbutts = TV_E_NBUTTS; /* # of buttons */
++#ifdef TV_L10N
++ }
++ else {
++ mfwide = monofsetinfo->max_logical_extent.width / 2; /* shit! */
++ mfhigh = monofsetinfo->max_logical_extent.height + 1;
++ mfascent = mfhigh;
+
+- mfwide = monofinfo->max_bounds.width;
+- mfhigh = monofinfo->ascent + monofinfo->descent;
+- mfascent = monofinfo->ascent;
++ nbutts = TV_J_NBUTTS; /* # of buttons */
++ }
++#endif
- mfwide = monofinfo->max_bounds.width;
- mfhigh = monofinfo->ascent + monofinfo->descent;
-@@ -120,10 +119,10 @@
++#ifdef TV_MULTILINGUAL
++ {
++ char *dc = XGetDefault(theDisp, "xv", "codeSet");
++ if (dc == NULL)
++ default_codeset = TV_DEFAULT_CODESET;
++ else {
++ for (i = 0; i < TV_NCSS; i++) {
++ if (strcmp(dc, codeSetNames[i]) == 0)
++ break;
++ }
++ if (i >= TV_NCSS) {
++ if (strcmp(dc, "iso-2022") == 0)
++ default_codeset = TV_PLAIN;
++ else {
++ SetISTR(ISTR_WARNING, "%s: unknown codeset.", dc);
++ default_codeset = TV_PLAIN;
++ }
++ } else
++ default_codeset = i;
++ }
++ }
++#endif
+ /* compute default size of textview windows. should be big enough to
+ hold an 80x24 text window */
+
+@@ -119,11 +259,19 @@
+ for (i=0; i<MAXTVWIN; i++) {
tv = &tinfo[i];
++#ifdef TV_MULTILINGUAL
++ tv->ctx = ml_create_context(ScreenOfDisplay(theDisp, theScreen));
++ tv->txt = NULL;
++ tv->cv_text = NULL;
++ tv->cv_len = 0;
++ ml_set_charsets(tv->ctx, &coding_spec[TV_PLAIN].coding_system);
++#endif
++
tv->win = CreateWindow((i<CMTWIN) ? "xv text viewer" : "xv image comments",
- "XVtextview",
- (i<CMTWIN) ? geom : cmtgeom,
@@ -25771,7 +37474,7 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
infofg, infobg, 1);
if (!tv->win) FatalError("can't create textview window!");
-@@ -135,17 +134,17 @@
+@@ -135,17 +283,17 @@
/* note: everything is sized and positioned in resizeText() */
@@ -25793,16 +37496,67 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
hints.flags |= PMinSize;
else
hints.flags = PMinSize;
-@@ -162,7 +161,7 @@
+@@ -162,74 +310,115 @@
XSelectInput(theDisp, tv->textW, ExposureMask | ButtonPressMask);
-
+- BTCreate(&(tv->but[TV_ASCII]), tv->win, 0,0,BUTTW,BUTTH,
+
- BTCreate(&(tv->but[TV_ASCII]), tv->win, 0,0,BUTTW,BUTTH,
++ BTCreate(&(tv->but[TV_ASCII]), tv->win, 0,0,BUTTW1,BUTTH,
"Ascii",infofg,infobg,hicol,locol);
- BTCreate(&(tv->but[TV_HEX]), tv->win, 0,0,BUTTW,BUTTH,
-@@ -185,7 +184,7 @@
+- BTCreate(&(tv->but[TV_HEX]), tv->win, 0,0,BUTTW,BUTTH,
++ BTCreate(&(tv->but[TV_HEX]), tv->win, 0,0,BUTTW1,BUTTH,
+ "Hex",infofg,infobg,hicol,locol);
+- BTCreate(&(tv->but[TV_CLOSE]), tv->win, 0,0,BUTTW,BUTTH,
++ BTCreate(&(tv->but[TV_CLOSE]), tv->win, 0,0,BUTTW1,BUTTH,
+ "Close",infofg,infobg,hicol,locol);
+
++#ifdef TV_L10N
++ if (xlocale) {
++ BTCreate(&(tv->but[TV_RESCAN]), tv->win, 0,0,BUTTW2,BUTTH,
++ "RESCAN",infofg,infobg,hicol,locol);
++ BTCreate(&(tv->but[TV_USASCII]), tv->win, 0,0,BUTTW2,BUTTH,
++ "ASCII",infofg,infobg,hicol,locol);
++ BTCreate(&(tv->but[TV_JIS]), tv->win, 0,0,BUTTW2,BUTTH,
++ "JIS",infofg,infobg,hicol,locol);
++ BTCreate(&(tv->but[TV_EUCJ]), tv->win, 0,0,BUTTW2,BUTTH,
++ "EUC-j",infofg,infobg,hicol,locol);
++ BTCreate(&(tv->but[TV_MSCODE]), tv->win, 0,0,BUTTW2,BUTTH,
++ "MS Kanji",infofg,infobg,hicol,locol);
++ }
++#endif
++
+ BTCreate(&(tv->nopBut), tv->win, 0,0, (u_int) tv->vscrl.tsize+1,
+ (u_int) tv->vscrl.tsize+1, "", infofg, infobg, hicol, locol);
+ tv->nopBut.active = 0;
+
+ XMapSubwindows(theDisp, tv->win);
+
++#ifdef TV_MULTILINGUAL
++ BTCreate(&tv->csbut, tv->win, 0, 0, BUTTW1, BUTTH, "Code Sets",
++ infofg, infobg, hicol, locol);
++#endif
++
+ tv->text = (char *) NULL;
+ tv->textlen = 0;
+ tv->title[0] = '\0';
++#ifdef TV_L10N
++ tv->code = (xlocale ? LOCALE_DEFAULT : 0);
++#endif
++#ifdef TV_MULTILINGUAL
++ tv->ccs = coding_spec[default_codeset];
++#endif
+ }
+-
++#ifdef TV_MULTILINGUAL
++ get_monofont_size(&mfwide, &mfhigh);
++ /* recalculate sizes. */
++ defwide = 80 * mfwide + 2*LRMARGINS + 8 + 20; /* -ish */
++ defhigh = 24 * mfhigh + TOPMARGIN + BOTMARGIN + 8 + 20; /* ish */
++ cmthigh = 6 * mfhigh + TOPMARGIN + BOTMARGIN + 8 + 20; /* ish */
++#endif
+
for (i=0; i<MAXTVWIN; i++) {
resizeText(&tinfo[i], defwide, (i<CMTWIN) ? defhigh : cmthigh);
@@ -25811,34 +37565,106 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
KeyPressMask | StructureNotifyMask);
}
-@@ -200,7 +199,6 @@
+ hasBeenSized = 1; /* we can now start looking at textview events */
+
++#ifdef TV_MULTILINGUAL
++ createCsWins("+100+100");
++#endif
+ }
+
+
+ /***************************************************************/
+-void TextView(fname)
+- char *fname;
++int TextView(fname)
++ const char *fname;
{
/* given a filename, attempts to read in the file and open a textview win */
- int i;
++ int filetype;
long textlen;
char *text, buf[512], title[128], rfname[MAXPATHLEN+1];
char *basefname[128]; /* just current fname, no path */
-@@ -222,7 +220,7 @@
- if (!UncompressFile(basefname, rfname)) return;/* failed to uncompress */
+ FILE *fp;
++ char filename[MAXPATHLEN+1];
++
++ strncpy(filename, fname, sizeof(filename) - 1);
++#ifdef AUTO_EXPAND
++ Mkvdir(filename);
++ Dirtovd(filename);
++#endif
+
+ basefname[0] = '\0';
+- strcpy(rfname, fname);
++ strncpy(rfname, filename, sizeof(rfname) - 1);
+
+ /* see if this file is compressed. if it is, uncompress it, and view
+ the uncompressed version */
+
+- if (ReadFileType(fname) == RFT_COMPRESS) {
++ filetype = ReadFileType(filename);
++ if ((filetype == RFT_COMPRESS) || (filetype == RFT_BZIP2)) {
+ #ifndef VMS
+- if (!UncompressFile(fname, rfname)) return; /* failed to uncompress */
++ if (!UncompressFile(filename, rfname, filetype)) return FALSE;
+ #else
+ /* chop off trailing '.Z' from friendly displayed basefname, if any */
+- strcpy (basefname, fname);
++ strncpy (basefname, filename, 128 - 1);
+ *rindex (basefname, '.') = '\0';
+- if (!UncompressFile(basefname, rfname)) return;/* failed to uncompress */
++ if (!UncompressFile(basefname, rfname, filetype)) return FALSE;
#endif
}
-
-+
-
+-
fp = fopen(rfname, "r");
-@@ -246,7 +244,7 @@
+ if (!fp) {
+ sprintf(buf,"Couldn't open '%s': %s", rfname, ERRSTR(errno));
+ ErrPopUp(buf,"\nOh well");
+- return;
++ return FALSE;
+ }
+
- text = (char *) malloc((size_t) textlen);
+@@ -241,16 +430,16 @@
+ sprintf(buf, "File '%s' contains no data. (Zero length file.)", rfname);
+ ErrPopUp(buf, "\nOk");
+ fclose(fp);
+- return;
++ return FALSE;
+ }
+
+- text = (char *) malloc((size_t) textlen);
++ text = (char *) malloc((size_t) textlen + 1);
if (!text) {
- sprintf(buf, "Couldn't malloc %ld bytes to read file '%s'",
+ sprintf(buf, "Couldn't malloc %ld bytes to read file '%s'",
textlen, rfname);
ErrPopUp(buf, "\nSo what!");
fclose(fp);
-@@ -267,8 +265,8 @@
+- return;
++ return FALSE;
+ }
+
+ if (fread(text, (size_t) 1, (size_t) textlen, fp) != textlen) {
+@@ -258,6 +447,9 @@
+ rfname);
+ ErrPopUp(buf, "\nHmm...");
+ }
++#ifdef TV_MULTILINGUAL
++ text[textlen] = '\0';
++#endif
+
+ fclose(fp);
+
+@@ -265,27 +457,28 @@
+ OpenTextView(text, (int) textlen, title, 1);
+
/* note: text gets freed when window gets closed */
++ return TRUE;
}
-
@@ -25847,8 +37673,10 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
+
/***************************************************************/
void OpenTextView(text, len, title, freeonclose)
- char *text, *title;
-@@ -276,7 +274,6 @@
+- char *text, *title;
+- int len, freeonclose;
++ const char *text, *title;
++ int len, freeonclose;
{
/* opens up a textview window */
@@ -25856,7 +37684,20 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
TVINFO *tv;
tv = &tinfo[0];
-@@ -293,6 +290,7 @@
+
+ /* kill off old text info */
+- if (tv->freeonclose && tv->text) free(tv->text);
++ if (tv->freeonclose && tv->text) free((void *)tv->text);
+ if (tv->lines) free(tv->lines);
+- tv->text = (char *) NULL;
+- tv->lines = (char **) NULL;
++
++ tv->text = (const char *) NULL;
++ tv->lines = (const char **) NULL;
+ tv->numlines = tv->textlen = tv->hexmode = 0;
+
+
+@@ -293,6 +486,7 @@
tv->textlen = len;
tv->freeonclose = freeonclose;
strncpy(tv->title, title, (size_t) TITLELEN-1);
@@ -25864,7 +37705,7 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
computeText(tv); /* compute # lines and linestarts array */
-@@ -316,7 +314,6 @@
+@@ -316,7 +510,6 @@
{
/* opens up the reserved 'comment' textview window */
@@ -25872,7 +37713,7 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
TVINFO *tv;
tv = &tinfo[CMTWIN];
-@@ -351,9 +348,9 @@
+@@ -351,9 +544,9 @@
tv->textlen = (tv->text) ? strlen(tv->text) : 0;
tv->freeonclose = 0;
@@ -25884,16 +37725,27 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
sprintf(tv->title, "<no file loaded>");
computeText(tv); /* compute # lines and linestarts array */
-@@ -504,7 +501,7 @@
- if (tv->freeonclose && tv->text) free(tv->text);
+@@ -501,12 +694,16 @@
+ if (i==MAXTEXTWIN) anyTextUp = 0;
+
+ /* free all info for this textview window */
+- if (tv->freeonclose && tv->text) free(tv->text);
++ if (tv->freeonclose && tv->text) free((void *)tv->text);
if (tv->lines) free(tv->lines);
- tv->text = (char *) NULL;
-+ tv->text = (char *) NULL;
- tv->lines = (char **) NULL;
+- tv->lines = (char **) NULL;
++ tv->text = (const char *) NULL;
++ tv->lines = (const char **) NULL;
tv->numlines = tv->textlen = tv->hexmode = 0;
++
++#ifdef TV_MULTILINGUAL
++ closeCsWin(tv);
++#endif
}
-@@ -518,7 +515,7 @@
+
+
+@@ -518,7 +715,7 @@
/* checks event to see if it's a text-window related thing. If it
is, it eats the event and returns '1', otherwise '0'. */
@@ -25902,7 +37754,7 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
rv = 1;
-@@ -560,7 +557,7 @@
+@@ -560,7 +757,7 @@
count++;
} while (XCheckWindowEvent(theDisp, evt.xexpose.window,
ExposureMask, &evt));
@@ -25911,7 +37763,7 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
XClipBox(reg, &rect); /* bounding box of region */
XSetRegion(theDisp, theGC, reg);
-@@ -570,7 +567,7 @@
+@@ -570,7 +767,7 @@
fprintf(stderr,"grouped %d expose events into %d,%d %dx%d rect\n",
count, rect.x, rect.y, rect.width, rect.height);
}
@@ -25920,7 +37772,7 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
if (e->window == tv->win) drawTextView(tv);
else if (e->window == tv->textW) drawTextW(0, &(tv->vscrl));
-@@ -584,7 +581,7 @@
+@@ -584,7 +781,7 @@
else if (xev->type == ButtonPress) {
XButtonEvent *e = (XButtonEvent *) xev;
@@ -25929,7 +37781,48 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
x = e->x; y = e->y;
if (e->button == Button1) {
-@@ -615,7 +612,7 @@
+@@ -594,6 +791,40 @@
+ else if (e->window == tv->textW) { }
+ else rv = 0;
+ }
++ else if (e->button == Button4) { /* note min vs. max, + vs. - */
++ /* scroll regardless of where we are in the text window */
++ if (e->window == tv->win ||
++ e->window == tv->vscrl.win ||
++ e->window == tv->hscrl.win ||
++ e->window == tv->textW)
++ {
++ SCRL *sp=&(tv->vscrl);
++ int halfpage=sp->page/2;
++
++ if (sp->val > sp->min+halfpage)
++ SCSetVal(sp,sp->val-halfpage);
++ else
++ SCSetVal(sp,sp->min);
++ }
++ else rv = 0;
++ }
++ else if (e->button == Button5) { /* note max vs. min, - vs. + */
++ /* scroll regardless of where we are in the text window */
++ if (e->window == tv->win ||
++ e->window == tv->vscrl.win ||
++ e->window == tv->hscrl.win ||
++ e->window == tv->textW)
++ {
++ SCRL *sp=&(tv->vscrl);
++ int halfpage=sp->page/2;
++
++ if (sp->val < sp->max-halfpage)
++ SCSetVal(sp,sp->val+halfpage);
++ else
++ SCSetVal(sp,sp->max);
++ }
++ else rv = 0;
++ }
+ else rv = 0;
+ }
+
+@@ -615,7 +846,7 @@
if (tv->wide != e->width || tv->high != e->height) {
if (DEBUG) fprintf(stderr,"Forcing a redraw! (from configure)\n");
@@ -25938,7 +37831,7 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
(u_int) e->width, (u_int) e->height, True);
resizeText(tv, e->width, e->height);
}
-@@ -633,7 +630,7 @@
+@@ -633,10 +864,12 @@
TVINFO *tv;
int w,h;
{
@@ -25946,8 +37839,13 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
+ int i, maxw, maxh;
XSizeHints hints;
++#ifndef TV_MULTILINGUAL
if (tv->wide == w && tv->high == h) return; /* no change in size */
-@@ -657,7 +654,7 @@
++#endif
+
+ if (XGetNormalHints(theDisp, tv->win, &hints)) {
+ hints.width = w;
+@@ -657,13 +890,26 @@
tv->twWide = tv->chwide * mfwide + 6;
tv->twHigh = tv->chhigh * mfhigh + 6;
@@ -25955,8 +37853,29 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
+ XMoveResizeWindow(theDisp, tv->textW, LRMARGINS, TOPMARGIN,
(u_int) tv->twWide, (u_int) tv->twHigh);
- for (i=0; i<TV_NBUTTS; i++) {
-@@ -692,8 +689,8 @@
+- for (i=0; i<TV_NBUTTS; i++) {
+- tv->but[i].x = tv->wide - (TV_NBUTTS-i) * (BUTTW+5);
++ for (i=0; i<TV_E_NBUTTS; i++) {
++ tv->but[i].x = tv->wide - (TV_E_NBUTTS-i) * (BUTTW1+5);
+ tv->but[i].y = tv->high - BUTTH - 5;
+ }
++#ifdef TV_MULTILINGUAL
++ tv->csbut.x = 5;
++ tv->csbut.y = tv->high - BUTTH - 5;
++#endif
++
++#ifdef TV_L10N
++ if (xlocale) {
++ for (; i<TV_J_NBUTTS; i++) {
++ tv->but[i].x = 5 + (i-TV_E_NBUTTS) * (BUTTW2+5);
++ tv->but[i].y = tv->high - BUTTH - 5;
++ }
++ }
++#endif
+
+ computeScrlVals(tv);
+
+@@ -692,8 +938,8 @@
hpag = tv->chwide / 4;
vpag = tv->chhigh - 1;
@@ -25967,7 +37886,37 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
1, tv->twHigh, 0, vmax, tv->vscrl.val, vpag);
SCChange(&tv->hscrl, LRMARGINS, TOPMARGIN + tv->twHigh + 1,
-@@ -731,11 +728,11 @@
+@@ -714,6 +960,29 @@
+ case TV_CLOSE: if (tv == &tinfo[CMTWIN]) CloseCommentText();
+ else closeText(tv);
+ break;
++
++#ifdef TV_L10N
++ case TV_RESCAN:
++ tv->code = selectCodeset(tv);
++ drawTextW(0, &tv->vscrl);
++ break;
++ case TV_USASCII:
++ tv->code = LOCALE_USASCII;
++ drawTextW(0, &tv->vscrl);
++ break;
++ case TV_JIS:
++ tv->code = LOCALE_JIS;
++ drawTextW(0, &tv->vscrl);
++ break;
++ case TV_EUCJ:
++ tv->code = LOCALE_EUCJ;
++ drawTextW(0, &tv->vscrl);
++ break;
++ case TV_MSCODE:
++ tv->code = LOCALE_MSCODE;
++ drawTextW(0, &tv->vscrl);
++ break;
++#endif /* TV_L10N */
+ }
+ }
+
+@@ -731,11 +1000,11 @@
y = 5;
XSetForeground(theDisp, theGC, infobg);
@@ -25981,7 +37930,20 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
(u_int) StringWidth(tv->title)+7, (u_int) CHIGH+5);
Draw3dRect(tv->win, 5+1, y+1, (u_int) StringWidth(tv->title)+5,
-@@ -763,15 +760,15 @@
+@@ -748,8 +1017,10 @@
+ drawNumLines(tv);
+
+ /* draw the buttons */
+- for (i=0; i<TV_NBUTTS; i++) BTRedraw(&(tv->but[i]));
+-
++ for (i=0; i<nbutts; i++) BTRedraw(&(tv->but[i]));
++#ifdef TV_MULTILINGUAL
++ BTRedraw(&tv->csbut);
++#endif
+ BTRedraw(&tv->nopBut);
+ }
+
+@@ -763,15 +1034,15 @@
if (tv->hexmode) nl = tv->hexlines;
else {
@@ -26001,7 +37963,7 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
nl, (nl!=1) ? "s" : "");
w = StringWidth(tmpstr) + 7; /* width of frame */
-@@ -779,13 +776,13 @@
+@@ -779,13 +1050,13 @@
y = 6;
XSetForeground(theDisp, theGC, infobg);
@@ -26017,7 +37979,7 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
R3D_IN,2,hicol,locol,infobg);
XSetForeground(theDisp, theGC, infofg);
-@@ -800,10 +797,10 @@
+@@ -800,10 +1071,10 @@
int x, y, w, nl;
char tmpstr[64];
@@ -26031,8 +37993,24 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
nl, (nl>1) ? "s" : "");
w = StringWidth(tmpstr) + 7; /* width of frame */
-@@ -825,14 +822,14 @@
- u_char *sp, *ep, *lp;
+@@ -819,20 +1090,28 @@
+ int delta;
+ SCRL *sptr;
+ {
+- int i, j, lnum, hpos, cpos, extrach, lwide;
++ int i, j, lnum, hpos, vpos, cpos, lwide;
++#ifndef TV_MULTILINGUAL
++ int extrach;
++#endif
++#ifdef TV_L10N
++ int desig_stat; /* for ISO 2022-JP */
++ /* 0: ASCII, 1: JIS X 0208, 2: GL is JIS X 0201 kana */
++#endif
+ TVINFO *tv;
+ char linestr[512];
+- u_char *sp, *ep, *lp;
++ byte *lp;
++ const byte *sp, *ep;
/* figure out TVINFO pointer from SCRL pointer */
- for (i=0; i<MAXTVWIN && sptr != &tinfo[i].vscrl
@@ -26048,43 +38026,254 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
TextCheckEvent() */
if (!hasBeenSized) return;
-@@ -849,7 +846,7 @@
+@@ -842,14 +1121,40 @@
+ XSetFont(theDisp, theGC, monofont);
+
+ hpos = tv->hscrl.val;
++ vpos = tv->vscrl.val;
+ lwide = (tv->chwide < 500) ? tv->chwide : 500;
+
+ /* draw text */
+ if (!tv->hexmode) { /* ASCII mode */
++#ifdef TV_MULTILINGUAL
++ XClearArea(theDisp, tv->textW, 0, 0,
++ (u_int) tv->twWide, (u_int) tv->twHigh, False);
++ if(tv->txt == NULL)
++ return;
++ else {
++ int i;
++ int y;
++ struct ml_text *tp = tv->txt;
++ struct ml_line *lp2;
++
++ XSetFunction(theDisp, theGC, GXcopy);
++ XSetClipMask(theDisp, theGC, None);
++ y = 3;
++ for (lp2 = &tp->lines[vpos], i = tp->nlines - vpos;
++ i > 0; lp2++, i--) {
++ XDrawText16(theDisp, tv->textW, theGC,
++ -mfwide * hpos + 3, y + lp2->ascent,
++ lp2->items, lp2->nitems);
++ y += lp2->ascent + lp2->descent;
++ if (y > tv->twHigh)
++ break;
++ }
++ }
++#else
for (i=0; i<tv->chhigh; i++) { /* draw each line */
- lnum = i + tv->vscrl.val;
+- lnum = i + tv->vscrl.val;
++ lnum = i + vpos;
if (lnum < tv->numlines-1) {
-
+
/* find start of displayed portion of line. This is *wildly*
complicated by the ctrl-character and tab expansion... */
-@@ -902,7 +899,7 @@
+@@ -868,7 +1173,13 @@
+ cpos--; sp++;
+ }
+ else if (*sp < 32) extrach = 1;
++
++#ifdef TV_L10N
++ else if (!tv->code && *sp > 127) extrach = 3;
++#else
+ else if (*sp > 127) extrach = 3;
++#endif
++
+ else sp++;
+ }
+ else {
+@@ -884,6 +1195,10 @@
+
+ /* build up the linestr buffer, which is the current line, padded
+ with blanks to a width of exactly tv->chwide chars */
++#ifdef TV_L10N
++ desig_stat = 0; /* for ISO 2022-JP */
++ /* 0: ASCII, 1: JIS X 0208, 2: GL is JIS X 0201 kana */
++#endif
+ for (cpos=0, lp=(byte *) linestr; cpos<lwide; cpos++, lp++) {
+ if (sp>=ep) *lp = ' ';
+ else {
+@@ -897,13 +1212,117 @@
+ cpos--; lp--; sp++;
+ }
+
++#ifdef TV_L10N
++ else if (*sp < 32 && !(tv->code == LOCALE_JIS && *sp == 0x1b)) {
++#else
+ else if (*sp < 32) {
++#endif
+ if (!extrach) extrach = 2;
if (extrach == 2) *lp = '^';
else if (extrach == 1) *lp = *sp + 64;
}
-
+
++#ifdef TV_L10N
++ /* convert to EUC-Japan */
++ else if (tv->code == LOCALE_JIS) {
++ if (*sp == 0x1b) { /* ESC */
++ if (*(sp+1) == '$') {
++ if (*(sp+2) == 'B' || *(sp+2) == 'A' || *(sp+2) == '@') {
++ /* ESC $ B, ESC $ A, ESC $ @ */
++ desig_stat = 1;
++ sp += 3; cpos--; lp--;
++ }
++ else if (*(sp+2) == '(' && *(sp+3) == 'B') {
++ /* ESC $ ( B */
++ desig_stat = 1;
++ sp += 4; cpos--; lp--;
++ }
++ }
++ else if (*(sp+1) == '(') {
++ if (*(sp+2) == 'B' || *(sp+2) == 'J' || *(sp+2) == 'H') {
++ /* ESC ( B, ESC ( J, ESC ( H */
++ desig_stat = 0;
++ sp += 3; cpos--; lp--;
++ }
++ else if (*(sp+2) == 'I') {
++ /* ESC ( I */
++ desig_stat = 2;
++ sp += 3; cpos--; lp--;
++ }
++ }
++ else if (*(sp+1) == ')' && *(sp+2) == 'I') {
++ /* ESC ) I */
++ desig_stat = 2;
++ sp += 3; cpos--; lp--;
++ }
++ else { /* error */
++ *lp = ' '; sp++;
++ }
++ }
++
++ else {
++ switch (desig_stat) {
++ case 0: /* ASCII */
++ *lp = *sp++;
++ break;
++ case 1: /* JIS X 0208 */
++ *lp++ = *sp++ | 0x80;
++ *lp = *sp++ | 0x80;
++ cpos++;
++ break;
++ case 2: /* JIS X 0201 kana */
++#if defined(__osf__) && !defined(X_LOCALE)
++ *lp = '='; sp++;
++#else
++ *lp++ = 0x8e; /* ^N | 0x80 */
++ *lp = *sp++ | 0x80;
++#endif
++ break;
++ default: /* error */
++ *lp = *sp++;
++ break;
++ }
++ }
++ }
++
++ else if (tv->code == LOCALE_MSCODE) {
++ if ((*sp >= 0x81 && *sp <= 0x9f)
++ || (*sp >= 0xe0 && *sp <= 0xef)) {
++ static u_char c1, c2;
++
++/*fprintf(stderr, "(%x,%x)->", *sp, *(sp+1));*/
++ c1 = ((*sp - ((*sp>=0xe0) ? 0xb0 : 0x70)) << 1)
++ - ((*(sp+1)<=0x9e) ? 1 : 0);
++ c2 = *(sp+1);
++ if (c2 >= 0x9f) c2 -= 0x7e; /* 0x9F - 0xFC */
++ else if (c2 >= 0x80) c2 -= 0x20; /* 0x80 - 0x9E */
++ else c2 -= 0x1f; /* 0x40 - 0x7E */
++
++ *lp++ = c1 | 0x80;
++ *lp = c2 | 0x80;
++ sp += 2;
++/*fprintf(stderr, "(%x %x) ", c1 | 0x80, c2 | 0x80);*/
++ cpos++;
++ }
++
++ else if (*sp >= 0xa1 && *sp <= 0xdf) { /* JIS X 0201 kana */
++#if defined(__osf__) && !defined(X_LOCALE)
++ *lp = '='; sp++;
++#else
++ *lp++ = 0x8e; /* ^N | 0x80 */
++ *lp = *sp++;
++#endif
++ }
++
++ else *lp = *sp++;
++ }
++#endif /* TV_L10N */
++
++#ifdef TV_L10N
++ else if (!tv->code && *sp > 127) {
++#else
else if (*sp > 127) {
++#endif
if (!extrach) extrach = 4;
if (extrach == 4) *lp = '\\';
-@@ -926,7 +923,7 @@
+ else if (extrach == 3) *lp = ((u_char)(*sp & 0700) >> 6) + '0';
+@@ -919,6 +1338,9 @@
+ }
+ }
+ }
++#ifdef TV_L10N
++ *lp = '\0'; /* terminate linestr */
++#endif
+ }
+
+ else { /* below bottom of file. Just build a blank str */
+@@ -926,24 +1348,31 @@
}
/* draw the line */
- XDrawImageString(theDisp, tv->textW, theGC,
-+ XDrawImageString(theDisp, tv->textW, theGC,
- 3, i*mfhigh + 3 + mfascent, linestr, lwide);
+- 3, i*mfhigh + 3 + mfascent, linestr, lwide);
++#ifdef TV_L10N
++ if (xlocale)
++ XmbDrawImageString(theDisp, tv->textW, monofset, theGC,
++ 3, i*mfhigh + 1 + mfascent, linestr, strlen(linestr));
++ else
++#endif
++ XDrawImageString(theDisp, tv->textW, theGC,
++ 3, i*mfhigh + 3 + mfascent, linestr, lwide);
} /* for i ... */
++#endif /* TV_MULTILINGUAL */
} /* if hexmode */
-@@ -936,7 +933,7 @@
+
+
+ else { /* HEX MODE */
for (i=0; i<tv->chhigh; i++) { /* draw each line */
- lnum = i + tv->vscrl.val;
+- lnum = i + tv->vscrl.val;
++ lnum = i + vpos;
if (lnum < tv->hexlines) {
-
+
char hexstr[80], tmpstr[16];
/* generate hex for this line */
-@@ -972,7 +969,7 @@
+ sprintf(hexstr, "0x%08x: ", lnum * 0x10);
+
+- sp = (byte *) tv->text + lnum * 0x10;
+- ep = (byte *) tv->text + tv->textlen; /* ptr to end of buffer */
++ sp = (const byte *) tv->text + lnum * 0x10;
++ ep = (const byte *) tv->text + tv->textlen; /* ptr to end of buffer */
+
+ for (j=0; j<16; j++) {
+ if (sp+j < ep) sprintf(tmpstr,"%02x ", sp[j]);
+@@ -960,7 +1389,11 @@
+
+ for (j=0; j<16; j++) {
+ if (sp+j < ep) {
++#ifdef TV_L10N
++ if (sp[j] >= 32 && (sp[j] <= 127 || tv->code)) *lp++ = sp[j];
++#else
+ if (sp[j] >= 32 && sp[j] <= 127) *lp++ = sp[j];
++#endif
+ else *lp++ = '.';
+ }
+ else *lp++ = ' ';
+@@ -972,7 +1405,7 @@
now build 'linestr', which is going to have hexstr shifted
and/or padded with blanks (ie, the displayed portion or hexstr) */
@@ -26093,7 +38282,7 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
for (cpos=0, sp=(byte *) hexstr; cpos<hpos && *sp; cpos++, sp++);
for (cpos=0, lp=(byte *)linestr; cpos<lwide; cpos++, lp++) {
-@@ -985,16 +982,16 @@
+@@ -985,16 +1418,16 @@
}
/* draw the line */
@@ -26113,7 +38302,31 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
R3D_IN, 2, hicol, locol, infobg);
}
-@@ -1033,7 +1030,7 @@
+@@ -1008,14 +1441,21 @@
+ int i;
+ BUTT *bp;
+
+- for (i=0, bp=tv->but; i<TV_NBUTTS; i++, bp++) {
++ for (i=0, bp=tv->but; i<nbutts; i++, bp++) {
+ if (PTINRECT(x,y,bp->x,bp->y,bp->w,bp->h)) break;
+ }
+
+- if (i<TV_NBUTTS) {
++ if (i<nbutts) {
+ if (BTTrack(bp)) doCmd(tv, i);
+ return;
+ }
++
++#ifdef TV_MULTILINGUAL
++ if (PTINRECT(x, y, tv->csbut.x, tv->csbut.y, tv->csbut.w, tv->csbut.h)) {
++ if (BTTrack(&tv->csbut))
++ openCsWin(tv);
++ }
++#endif
+ }
+
+
+@@ -1033,7 +1473,7 @@
stlen = XLookupString(kevt, buf, 128, &ks, (XComposeStatus *) NULL);
shift = kevt->state & ShiftMask;
ck = CursorKey(ks, shift, 1);
@@ -26122,7 +38335,50 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
RemapKeyCheck(ks, buf, &stlen);
-@@ -1060,8 +1057,6 @@
+@@ -1045,13 +1485,38 @@
+
+ /* keyboard equivalents */
+ switch (buf[0]) {
+- case '\001': doCmd(tv, TV_ASCII); break; /* ^A = Ascii */
+- case '\010': doCmd(tv, TV_HEX); break; /* ^H = Hex */
+-
+- case '\033': doCmd(tv, TV_CLOSE); break; /* ESC = Close window */
++ case '\001': case 'a': case 'A':
++ doCmd(tv, TV_ASCII); break; /* ^A = Ascii */
++ case '\010': case 'h': case 'H':
++ doCmd(tv, TV_HEX); break; /* ^H = Hex */
++
++ case '\021': case 'q': case 'Q':
++ case '\003': case 'c': case 'C':
++ case '\033':
++ doCmd(tv, TV_CLOSE); break; /* ESC = Close window */
+
+ default: break;
+ }
++
++#ifdef TV_L10N
++ if (xlocale) {
++ switch (buf[0]) {
++ case '\022': case 'r': case 'R':
++ doCmd(tv, TV_RESCAN); break;
++ case '\012': case 'j': case 'J':
++ doCmd(tv, TV_JIS); break;
++ case '\005': case 'e': case 'E':
++ case '\025': case 'u': case 'U':
++ doCmd(tv, TV_EUCJ); break;
++ case '\015': case 'm': case 'M':
++ case '\023': case 's': case 'S':
++ doCmd(tv, TV_MSCODE); break;
++
++ default: break;
++ }
++ }
++#endif /* TV_L10N */
++
+ }
+
+
+@@ -1060,8 +1525,6 @@
TVINFO *tv;
int key;
{
@@ -26131,7 +38387,7 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
if (!tv->textlen) return;
/* an arrow key (or something like that) was pressed in icon window.
-@@ -1108,7 +1103,7 @@
+@@ -1108,13 +1571,26 @@
else { /* switch to ascii mode */
pos = oldvscrl * 16;
for (i=0; i<tv->numlines-1; i++) {
@@ -26140,20 +38396,74 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
tv->lines[i] - tv->text <= pos) break;
}
if (i<tv->numlines-1) SCSetVal(&tv->vscrl, i);
-@@ -1127,9 +1122,9 @@
+ }
+
++#ifdef TV_L10N
++ /* redraw text */
++ if (xlocale) {
++ XClearArea(theDisp, tv->textW, 0, 0,
++ (u_int) tv->twWide, (u_int) tv->twHigh, False);
++
++ drawTextW(0, &tv->vscrl);
++ }
++#endif
++#ifdef TV_MULTILINGUAL
++ XClearArea(theDisp, tv->textW, 0, 0,
++ (u_int) tv->twWide, (u_int) tv->twHigh, False);
+ drawTextW(0, &tv->vscrl);
++#endif
+ }
+
+
+@@ -1125,16 +1601,29 @@
+ /* compute # of lines and linestarts array for given text */
+
int i,j,wide,maxwide,space;
- byte *sp;
+- byte *sp;
++ const byte *sp;
- if (!tv->text) {
- tv->numlines = tv->hexlines = 0;
- tv->lines = (char **) NULL;
++#ifdef TV_L10N
++ /* select code-set */
++ if (xlocale)
++ tv->code = selectCodeset(tv);
++#endif /* TV_L10N */
++
+ if (!tv->text) {
+ tv->numlines = tv->hexlines = 0;
-+ tv->lines = (char **) NULL;
++ tv->lines = (const char **) NULL;
++#ifdef TV_MULTILINGUAL
++ if (tv->cv_text != NULL) {
++ free(tv->cv_text);
++ tv->cv_text = NULL;
++ }
++ tv->txt = NULL;
++#endif
return;
}
-@@ -1153,8 +1148,8 @@
+ /* count the # of newline characters in text */
+- for (i=0, sp=(byte *) tv->text, tv->numlines=0; i<tv->textlen; i++, sp++) {
++ for (i=0, sp=(const byte *) tv->text, tv->numlines=0; i<tv->textlen; i++, sp++) {
+ if (*sp == '\n') tv->numlines++;
+ }
+
+@@ -1142,19 +1631,19 @@
+ tv->numlines += 2;
+
+ /* build lines array */
+- tv->lines = (char **) malloc(tv->numlines * sizeof(char *));
++ tv->lines = (const char **) malloc(tv->numlines * sizeof(char *));
+ if (!tv->lines) FatalError("out of memory in computeText()");
+
+ j = 0;
+ tv->lines[j++] = tv->text;
+- for (i=0, sp=(byte *) tv->text; i<tv->textlen; i++, sp++) {
++ for (i=0, sp=(const byte *) tv->text; i<tv->textlen; i++, sp++) {
+ if (*sp == '\n') tv->lines[j++] = (char *) (sp + 1);
+ }
tv->lines[tv->numlines - 1] = tv->text + tv->textlen + 1;
@@ -26164,7 +38474,7 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
be printed by printing ((lines[n+1] - lines[n]) - 1) characters,
starting with lines[n].
-@@ -1164,13 +1159,13 @@
+@@ -1164,30 +1653,142 @@
/* compute length of longest line, when shown in 'ascii' mode. Takes
into account the fact that non-printing chars (<32 or >127) will be
@@ -26176,14 +38486,795 @@ diff -ruN xv-3.10a/xvtext.c xv-3.10a-bugfixes/xvtext.c
for (i=0; i<tv->numlines-1; i++) {
/* compute displayed width of line #i */
- for (sp=(byte *) tv->lines[i], wide=0; sp<(byte *) tv->lines[i+1]-1;
-+ for (sp=(byte *) tv->lines[i], wide=0; sp<(byte *) tv->lines[i+1]-1;
++ for (sp=(const byte *) tv->lines[i], wide=0; sp<(const byte *) tv->lines[i+1]-1;
sp++) {
if (*sp == '\011') { /* tab to next multiple of 8 */
space = ((wide+8) & (~7)) - wide;
-diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
+ wide += space;
+ }
+ else if (*sp < 32) wide += 2;
++#ifdef TV_L10N
++ else if (*sp > 127 && !tv->code) wide += 4;
++#else
+ else if (*sp > 127) wide += 4;
++#endif
+ else wide++;
+ }
+ if (wide > maxwide) maxwide = wide;
+ }
+ tv->maxwide = maxwide;
+
++#ifdef TV_MULTILINGUAL
++ ml_set_charsets(tv->ctx, &tv->ccs.coding_system);
++ if (tv->cv_text != NULL) {
++ free(tv->cv_text);
++ tv->cv_text = NULL;
++ }
++ if (tv->ccs.converter == NULL) {
++ tv->txt = ml_draw_text(tv->ctx, tv->text, tv->textlen);
++ } else {
++ tv->cv_text = (*tv->ccs.converter)(tv->text, tv->textlen, &tv->cv_len);
++ tv->txt = ml_draw_text(tv->ctx, tv->cv_text, tv->cv_len);
++ }
++ tv->maxwide = tv->txt->width / mfwide;
++ tv->numlines = tv->txt->height / mfhigh + 1;
++#endif
++
+ tv->hexlines = (tv->textlen + 15) / 16;
+ }
+
+
++/***************************************************/
++#ifdef TV_L10N
++static int selectCodeset(tv)
++ TVINFO *tv;
++{
++ const byte *sp;
++ int i, len;
++ int code = LOCALE_USASCII; /* == 0 */
++
++
++ len = tv->textlen;
++
++ /* select code-set */
++ if (xlocale) {
++ sp = (const byte *) tv->text; i = 0;
++ while (i < len - 1) {
++ if (*sp == 0x1b &&
++ (*(sp+1) == '$' || *(sp+1) == '(' || *(sp+1) == ')')) {
++ code = LOCALE_JIS;
++ break;
++ }
++
++ else if (*sp >= 0xa1 && *sp <= 0xdf) {
++ if (*(sp+1) >= 0xf0 && *(sp+1) <= 0xfe) {
++ code = LOCALE_EUCJ;
++ break;
++ }
++# if (LOCALE_DEFAULT == LOCALE_EUCJ)
++ else {
++ sp++; i++;
++ }
++# endif
++ }
++
++ else if ((*sp >= 0x81 && *sp <= 0x9f) || (*sp >= 0xe0 && *sp <= 0xef)) {
++ if ((*(sp+1) >= 0x40 && *(sp+1) <= 0x7e) || *(sp+1) == 0x80) {
++ code = LOCALE_MSCODE;
++ break;
++ }
++ else if (*(sp+1) == 0xfd || *(sp+1) == 0xfe) {
++ code = LOCALE_EUCJ;
++ break;
++ }
++ else {
++ sp++; i++;
++ }
++ }
++
++ else if (*sp >= 0xf0 && *sp <= 0xfe) {
++ code = LOCALE_EUCJ;
++ break;
++ }
++
++ sp++; i++;
++ }
++ if (!code) code = LOCALE_DEFAULT;
++ }
++
++ return code;
++}
++#endif /* TV_L10N */
++
++#ifdef TV_MULTILINGUAL
++static void setCodingSpec(tv, cs)
++ TVINFO *tv;
++ struct coding_spec *cs;
++{
++ if (xvbcmp((char *) &tv->ccs, (char *) cs, sizeof *cs) == 0)
++ return;
++
++ tv->ccs = *cs;
++#if 0
++ ml_set_charsets(tv->ctx, &tv->ccs.coding_system);
++ if (tv->cv_text != NULL) {
++ free(tv->cv_text);
++ tv->cv_text = NULL;
++ }
++ if (tv->ccs.converter == NULL) {
++ tv->txt = ml_draw_text(tv->ctx, tv->text, tv->textlen);
++ } else {
++ tv->cv_text = (*tv->ccs.converter)(tv->text, tv->textlen, &tv->cv_len);
++ tv->txt = ml_draw_text(tv->ctx, tv->cv_text, tv->cv_len);
++ }
++#else
++ computeText(tv);
++ computeScrlVals(tv);
++#endif
++ /* drawTextW(0, &tv->vscrl); */
++}
++#endif
++
++
+ /**********************************************************************/
+ /* BUILT-IN TEXT FILES ************************************************/
+ /**********************************************************************/
+@@ -1203,9 +1804,13 @@
+
+ /* build the license text */
+ #ifdef LC
+-#undef LC
++# undef LC
++#endif
++#ifdef __STDC__ /* since "x" is always a static string, this works: */
++# define LC(x) (strcat(license, x "\n"))
++#else
++# define LC(x) (strcat(license, x), strcat(license, "\n"))
+ #endif
+-#define LC(x) (strcat(license, x), strcat(license, "\n"))
+
+ LC("(Note: This has been changed, and hopefully clarified, from the 3.00");
+ LC("version of this info. Please read it.)");
+@@ -1220,7 +1825,12 @@
+ LC("the xv distribution. Do *not* send mail unless absolutely necessary");
+ LC("(ie, you don't have ftp capability).");
+ LC("");
+- LC("Note: The docs (xvdocs.ps) may be installed in '/usr/local/lib'.");
++ LC("Note: The documentation (README.jumbo, xvdocs.ps, and/or xvdocs.pdf)");
++#ifdef __STDC__
++ LC("may be installed in '" DOCDIR "'.");
++#else
++ LC("may be installed in '/usr/local/share/doc/xv'.");
++#endif
+ LC("");
+ LC("If you're viewing this information via the 'About XV' command, and");
+ LC("you'd like to print it out, a copy of this info can be found in the ");
+@@ -1230,7 +1840,7 @@
+ LC("");
+ LC("XV Licensing Information");
+ LC("------------------------");
+- LC("XV IS SHAREWARE FOR PERSONAL USE ONLY. ");
++ LC("XV IS SHAREWARE FOR PERSONAL USE ONLY.");
+ LC("");
+ LC("You may use XV for your own amusement, and if you find it nifty,");
+ LC("useful, generally cool, or of some value to you, your registration fee");
+@@ -1279,7 +1889,7 @@
+ LC("are not. All forms of payment must be payable in US Funds. Checks");
+ LC("must be payable through a US bank (or a US branch of a non-US bank).");
+ LC("Purchase orders for less than $50, while still accepted, are not");
+- LC("encouraged. ");
++ LC("encouraged.");
+ LC("");
+ LC("All payments should be payable to 'John Bradley', and mailed to:");
+ LC(" John Bradley");
+@@ -1382,7 +1992,11 @@
+ keyhelp[0] = '\0';
+
+ #undef LC
+-#define LC(x) (strcat(keyhelp, x), strcat(keyhelp, "\n"))
++#ifdef __STDC__ /* since "x" is always a static string, this works: */
++# define LC(x) (strcat(keyhelp, x "\n"))
++#else
++# define LC(x) (strcat(keyhelp, x), strcat(keyhelp, "\n"))
++#endif
+
+ LC("XV Mouse and Keyboard Usage");
+ LC("===========================");
+@@ -1415,16 +2029,16 @@
+ LC("");
+ LC("Part 2: Normal Keyboard Equivalents");
+ LC("------------------------------------");
+- LC("The following keys can be used in most xv windows, including the ");
+- LC("image, controls, and color editor windows, but *not* in the visual");
+- LC("schnauzer windows.");
++ LC("The following keys can be used in most xv windows, including the");
++ LC("image, controls, and color editor windows, but *not* in the Visual");
++ LC("Schnauzer windows.");
+ LC("");
+- LC(" Tab or ");
++ LC(" Tab or");
+ LC(" Space - 'Next' command");
+ LC("");
+ LC(" Return - reload currently displayed image file");
+ LC("");
+- LC(" Del or ");
++ LC(" Del or");
+ LC(" Backspace - 'Prev' command");
+ LC("");
+ LC(" ctrl+'l' - 'Load' command");
+@@ -1432,7 +2046,7 @@
+ LC(" ctrl+'p' - 'Print' command");
+ LC(" ctrl+'d' - 'Delete' command");
+ LC("");
+- LC(" 'q' or ");
++ LC(" 'q' or");
+ LC(" ctrl+'q' - 'Quit' command");
+ LC("");
+ LC(" meta+'x' - 'cut' command");
+@@ -1468,7 +2082,7 @@
+ LC(" 's' - smooth mode");
+ LC(" meta+'8' - toggle 8/24 bit mode");
+ LC("");
+- LC(" 'V' or ");
++ LC(" 'V' or");
+ LC(" ctrl+'v' - Visual Schnauzer");
+ LC(" 'e' - Color Editor");
+ LC(" 'i' - Image Info");
+@@ -1490,7 +2104,7 @@
+ LC(" meta+'S' - Spread algorithm");
+ LC("");
+ LC(" 'R' or");
+- LC(" meta+'r' or ");
++ LC(" meta+'r' or");
+ LC(" meta+'0' - 'Reset' command in color editor");
+ LC("");
+ LC(" meta+'1' - select preset 1 in color editor");
+@@ -1503,7 +2117,7 @@
+ LC("");
+ LC("Part 2a: Image Window Keys");
+ LC("---------------------------");
+- LC("The following keys can *only* be used inside the image window.");
++ LC("The following keys can be used *only* inside the image window.");
+ LC("");
+ LC(" ctrl + Up - crops 1 pixel off the bottom of the image");
+ LC(" ctrl + Down - crops 1 pixel off the top of the image");
+@@ -1514,11 +2128,11 @@
+ LC(" 'p' - opens a 'go to page #' dialog box");
+ LC("");
+ LC(" PageUp, or");
+- LC(" Prev, or ");
++ LC(" Prev, or");
+ LC(" shift+Up - previous page");
+ LC("");
+ LC(" PageDown, or");
+- LC(" Next, or ");
++ LC(" Next, or");
+ LC(" shift+Down - next page");
+ LC("");
+ LC("");
+@@ -1535,7 +2149,7 @@
+ LC("");
+ LC("Part 2b: Visual Schnauzer Keys");
+ LC("-------------------------------");
+- LC("The following keys can only be used in the visual schnauzer windows.");
++ LC("The following keys can be used only in the Visual Schnauzer windows.");
+ LC("");
+ LC(" ctrl+'d' - delete file(s)");
+ LC(" ctrl+'n' - create new directory");
+@@ -1560,8 +2174,509 @@
+ OpenTextView(keyhelp, (int) strlen(keyhelp), "XV Help", 0);
+ }
+
++#ifdef TV_MULTILINGUAL
+
++#define TV_ML_ACCEPT TV_NCSS
++#define TV_ML_CLOSE (TV_ML_ACCEPT + 1)
++#define TV_ML_NBUTTS (TV_ML_CLOSE + 1)
++
++#define TV_ML_RETCODE 0
++# define TV_ML_RET_LF 0
++# define TV_ML_RET_CRLF 1
++# define TV_ML_RET_CR 2
++# define TV_ML_RET_ANY 3
++#define TV_ML_GL 1
++#define TV_ML_GR 2
++#define TV_ML_CVTR 3
++#define TV_ML_NRBUTTS 4
++
++#define TV_ML_SHORT 0
++#define TV_ML_LOCK 1
++#define TV_ML_NCBUTTS 2
++
++#define TV_ML_NLISTS 4
++
++#define CSWIDE (BUTTW3 * 5 + 5 * 6)
++#define CSHIGH 450
++
++typedef struct csinfo_t {
++ TVINFO *tv;
++ RBUTT *rbt[TV_ML_NRBUTTS];
++ CBUTT cbt[TV_ML_NCBUTTS];
++ LIST ls[TV_ML_NLISTS];
++ BUTT bt[TV_ML_NBUTTS];
++ int up;
++ Window win;
++ struct coding_spec tcs; /* temporary coding_spec */
++} CSINFO;
++CSINFO csinfo[MAXTVWIN];
++static char **regs;
++static int nregs;
++
++static int csCheckEvent PARM((CSINFO *, XEvent *));
++static void csReflect PARM((CSINFO *));
++static void csRedraw PARM((CSINFO *));
++static void csListRedraw PARM((LIST *));
++static void csLsRedraw PARM((int, SCRL *));
++static void create_registry_list PARM((void));
++
++static char *(*cvtrtab[])PARM((char *, int, int *)) = {
++ NULL,
++ sjis_to_jis,
++};
+
++static void createCsWins(geom)
++ const char *geom;
++{
++ XSetWindowAttributes xswa;
++ int i, j;
++
++ create_registry_list();
++
++ xswa.backing_store = WhenMapped;
++ for (i = 0; i < MAXTVWIN; i++) {
++ char nam[8];
++ TVINFO *tv = &tinfo[i];
++ CSINFO *cs = &csinfo[i];
++ tv->cs = cs;
++ cs->tv = tv;
++ sprintf(nam, "XVcs%d", i);
++ cs->win = CreateWindow("xv codeset", nam, geom,
++ CSWIDE, CSHIGH, infofg, infobg, 0);
++ if (!cs->win) FatalError("couldn't create 'charset' window!");
++#ifdef BACKING_STORE
++ XChangeWindowAttributes(theDisp, cs->win, CWBackingStore, &xswa);
++#endif
++ XSelectInput(theDisp, cs->win, ExposureMask | ButtonPressMask);
++
++ DrawString(cs->win, 5, 5 + ASCENT, "Initial States");
++ for (i = 0; i < TV_ML_NLISTS; i++) {
++ int x, y;
++ char buf[80];
++
++ if (i / 2 == 0)
++ x = 15;
++ else
++ x = 280;
++ if (i % 2 == 0)
++ y = 5 + LINEHIGH * 1;
++ else
++ y = 5 + LINEHIGH * 7 + SPACING * 3;
++
++ sprintf(buf, "Designation for G%d:", i + 1);
++ DrawString(cs->win, x, y + ASCENT, buf);
++
++ LSCreate(&cs->ls[i], cs->win, x + 15, y + LINEHIGH,
++ 200, LINEHIGH * 5, 5,
++ regs, nregs + 2,
++ infofg, infobg, hicol, locol, csLsRedraw, 0, 0);
++ cs->ls[i].selected = 0;
++ }
+
++ for (i = 0; i < 2; i++) {
++ char *p;
++ int n;
++ int x, y;
++
++ if ((p = (char *) malloc(3 * 4)) == NULL)
++ FatalError("out of memory in createCsWins().");
++ strcpy(p, "G1 G2 G3 G4");
++ p[2] = p[5] = p[8] = '\0';
++ n = (i == 0 ? TV_ML_GL : TV_ML_GR);
++ x = (i == 0 ? 15 : 280);
++ y = 235;
++ DrawString(cs->win, x, y + ASCENT, "Assignment for GL:");
++ x += 15;
++ y += LINEHIGH;
++ cs->rbt[n] = RBCreate(NULL, cs->win,
++ x, y, p, infofg, infobg, hicol, locol);
++ for (j = 1; j < 4; j++) {
++ p += 3;
++ x += 50;
++ RBCreate(cs->rbt[n], cs->win,
++ x, y, p, infofg, infobg, hicol, locol);
++ }
++ }
++
++ DrawString(cs->win, 5, 280 + ASCENT, "Ret Code:");
++ cs->rbt[TV_ML_RETCODE] =
++ RBCreate(NULL, cs->win, 20, 300, "LF", infofg,infobg, hicol,locol);
++ RBCreate(cs->rbt[TV_ML_RETCODE], cs->win, 20, 300 + 20, "CR+LF",
++ infofg, infobg, hicol, locol);
++ RBCreate(cs->rbt[TV_ML_RETCODE], cs->win, 90, 300, "CR",
++ infofg, infobg, hicol, locol);
++ RBCreate(cs->rbt[TV_ML_RETCODE], cs->win, 90, 300 + 20, "Any",
++ infofg, infobg, hicol, locol);
++
++ DrawString(cs->win, 350, 280 + ASCENT, "Converter:");
++ cs->rbt[TV_ML_CVTR] =
++ RBCreate(NULL, cs->win, 365, 300, "Nothing",
++ infofg, infobg, hicol, locol);
++ RBCreate(cs->rbt[TV_ML_CVTR], cs->win, 365, 300 + 20, "Shift JIS",
++ infofg, infobg, hicol, locol);
++
++ CBCreate(&cs->cbt[TV_ML_SHORT], cs->win, 200, 300, "Short Form",
++ infofg, infobg, hicol, locol);
++ CBCreate(&cs->cbt[TV_ML_LOCK], cs->win, 200, 320, "Locking Shift",
++ infofg, infobg, hicol, locol);
++
++ for (j = 0; j < TV_NCSS; j++) {
++ BTCreate(&cs->bt[j], cs->win,
++ 5 + (BUTTW3 + 5) * (j % 5),
++ 350 + 5 + (BUTTH + 5) * (j / 5),
++ BUTTW3, BUTTH, codeSetNames[j],
++ infofg, infobg, hicol, locol);
++ }
++ BTCreate(&cs->bt[TV_ML_ACCEPT], cs->win,
++ CSWIDE - 10 - BUTTW3 * 2, CSHIGH - 5 - BUTTH, BUTTW3, BUTTH,
++ "Accept", infofg, infobg, hicol, locol);
++ BTCreate(&cs->bt[TV_ML_CLOSE], cs->win,
++ CSWIDE - 5 - BUTTW3, CSHIGH - 5 - BUTTH, BUTTW3, BUTTH,
++ "Close", infofg, infobg, hicol, locol);
++
++ XMapSubwindows(theDisp, cs->win);
++ cs->up = 0;
++ }
++}
+
++static void openCsWin(tv)
++ TVINFO *tv;
++{
++ CSINFO *cs = tv->cs;
++ if (cs->up)
++ return;
++
++ XMapRaised(theDisp, cs->win);
++ cs->up = 1;
++ cs->tcs = cs->tv->ccs;
++ csReflect(cs);
++}
++
++static void closeCsWin(tv)
++ TVINFO *tv;
++{
++ CSINFO *cs = tv->cs;
++ if (!cs->up)
++ return;
++ cs->up = 0;
++ XUnmapWindow(theDisp, cs->win);
++}
++
++int CharsetCheckEvent(xev)
++ XEvent *xev;
++{
++ int i;
++ CSINFO *cs;
++
++ for (cs = csinfo, i = 0; i < MAXTVWIN; cs++, i++) {
++ if (!cs->up)
++ continue;
++ if (csCheckEvent(cs, xev))
++ break;
++ }
++ if (i < MAXTVWIN)
++ return 1;
++ return 0;
++}
++
++static int csCheckEvent(cs, xev)
++ CSINFO *cs;
++ XEvent *xev;
++{
++ RBUTT **rbp;
++ CBUTT *cbp;
++ LIST *ls;
++ BUTT *bp;
++ int i, n;
++
++ if (xev->type == Expose) {
++ int x, y, w, h;
++ XExposeEvent *e = (XExposeEvent *) xev;
++ x = e->x; y = e->y; w = e->width; h = e->height;
++
++ if (cs->win == e->window){
++ csRedraw(cs);
++ return 1;
++ } else {
++ for (i = 0; i < TV_ML_NLISTS; i++) {
++ if (cs->ls[i].win == e->window) {
++ LSRedraw(&cs->ls[i], 0);
++ return 1;
++ }
++ }
++ for (i = 0; i < TV_ML_NLISTS; i++) {
++ if (cs->ls[i].scrl.win == e->window) {
++ SCRedraw(&cs->ls[i].scrl);
++ return 1;
++ }
++ }
++ }
++ } else if (xev->type == ButtonPress) {
++ int x, y;
++ XButtonEvent *e = (XButtonEvent *) xev;
++ x = e->x; y = e->y;
++ if (cs->win == e->window) {
++ for (bp = cs->bt, i = 0; i < TV_ML_NBUTTS; bp++, i++) {
++ if (PTINRECT(x, y, bp->x, bp->y, bp->w, bp->h))
++ break;
++ }
++ if (i < TV_ML_NBUTTS) {
++ if (BTTrack(bp)) {
++ if (i < TV_NCSS) {
++ cs->tcs = coding_spec[i];
++ csReflect(cs);
++ } else {
++ switch (i) {
++ case TV_ML_ACCEPT:
++ setCodingSpec(cs->tv, &cs->tcs);
++ break;
++ case TV_ML_CLOSE:
++ closeCsWin(cs->tv);
++ break;
++ }
++ }
++ }
++ return 1;
++ }
++ for (cbp = cs->cbt, i = 0; i < TV_ML_NCBUTTS; cbp++, i++) {
++ if (CBClick(cbp, x, y) && CBTrack(cbp))
++ break;
++ }
++ if (i < TV_ML_NCBUTTS) {
++ switch (i) {
++ case TV_ML_SHORT:
++ cs->tcs.coding_system.short_form = cbp->val;
++ break;
++ case TV_ML_LOCK:
++ cs->tcs.coding_system.lock_shift = cbp->val;
++ break;
++ }
++ return 1;
++ }
++ for (rbp = cs->rbt, i = 0; i < TV_ML_NRBUTTS; rbp++, i++) {
++ if ((n = RBClick(*rbp, x, y)) >= 0 && RBTrack(*rbp, n)) {
++ break;
++ }
++ }
++ if (i < TV_ML_NRBUTTS) {
++ switch (i) {
++ case TV_ML_RETCODE:
++ cs->tcs.coding_system.eol = n;
++ break;
++ case TV_ML_GL:
++ cs->tcs.coding_system.gl = n;
++ break;
++ case TV_ML_GR:
++ cs->tcs.coding_system.gr = n;
++ break;
++ case TV_ML_CVTR:
++ cs->tcs.converter = cvtrtab[n];
++ break;
++ }
++ return 1;
++ }
++ } else {
++ for (ls = cs->ls, i = 0; i < TV_ML_NLISTS; ls++, i++) {
++ if (ls->win == e->window) {
++ LSClick(ls, e);
++ n = ls->selected;
++ if (n < nregs) {
++ char r[32], *p = r;
++ int b7;
++ strcpy(r, regs[n]);
++ if ((p = strrchr(r, '/')) != NULL) {
++ *p = '\0';
++ b7 = (*(p + 1) == 'R' ? 1 : 0);
++ } else
++ b7 = 0; /* shouldn't occur */
++ cs->tcs.coding_system.design[i] = lookup_design(r, b7);
++ } else if (n == nregs) /* initially none is designed. */
++ cs->tcs.coding_system.design[i].bpc = 0;
++ else
++ cs->tcs.coding_system.design[i].bpc = -1;
++ return 1;
++ }
++ }
++ for (ls = cs->ls, i = 0; i < TV_ML_NLISTS; ls++, i++) {
++ if (ls->scrl.win == e->window) {
++ SCTrack(&ls->scrl, x, y);
++ return 1;
++ }
++ }
++ }
++ }
++ return 0;
++}
++
++static void csReflect(cs)
++ CSINFO *cs;
++{
++ int i;
++
++ RBSelect(cs->rbt[TV_ML_RETCODE], cs->tcs.coding_system.eol);
++ RBSelect(cs->rbt[TV_ML_GL], cs->tcs.coding_system.gl);
++ RBSelect(cs->rbt[TV_ML_GR], cs->tcs.coding_system.gr);
++ for (i = 0; i < sizeof cvtrtab / sizeof cvtrtab[0]; i++) {
++ if (cs->tcs.converter == cvtrtab[i])
++ break;
++ }
++ if (i >= sizeof cvtrtab / sizeof cvtrtab[0])
++ FatalError("program error in csReflect().");
++ RBSelect(cs->rbt[TV_ML_CVTR], i);
++
++ cs->cbt[TV_ML_SHORT].val = cs->tcs.coding_system.short_form;
++ cs->cbt[TV_ML_LOCK].val = cs->tcs.coding_system.lock_shift;
++ for (i = 0; i < TV_ML_NLISTS; i++) {
++ struct design design = cs->tcs.coding_system.design[i];
++ char *reg, r[32];
++ int b7;
++ int n = 0;
++ switch (design.bpc) {
++ case -1:
++ n = nregs + 1;
++ break;
++ case 0:
++ n = nregs;
++ break;
++ case 1:
++ case 2:
++ if ((reg = lookup_registry(design, &b7)) == NULL)
++ FatalError("internal error in csReflect.");
++ sprintf(r, "%s/%s", reg, b7 ? "Right" : "Left");
++ for (n = 0; n < nregs; n++) {
++ if (strcmp(regs[n], r) == 0)
++ break;
++ }
++ }
++ cs->ls[i].selected = n;
++ ScrollToCurrent(&cs->ls[i]);
++ }
++ csRedraw(cs);
++ for (i = 0; i < TV_ML_NLISTS; i++)
++ csListRedraw(&cs->ls[i]);
++}
++
++static void csRedraw(cs)
++ CSINFO *cs;
++{
++ int i;
++
++ XSetForeground(theDisp, theGC, infofg);
++ DrawString(cs->win, 5,5 + ASCENT, "Initial States");
++ for (i = 0; i < TV_ML_NLISTS; i++) {
++ int x, y;
++ char buf[80];
++
++ if (i / 2 == 0)
++ x = 15;
++ else
++ x = 280;
++ if (i % 2 == 0)
++ y = 5 + LINEHIGH * 1;
++ else
++ y = 5 + LINEHIGH * 7 + SPACING * 3;
++
++ sprintf(buf, "Designation for G%d:", i);
++ DrawString(cs->win, x, y + ASCENT, buf);
++ }
++
++ DrawString(cs->win, 15, 235 + ASCENT, "Invocation for GL:");
++ DrawString(cs->win, 280, 235 + ASCENT, "Invocation for GR:");
++ DrawString(cs->win, 5, 280 + ASCENT, "Ret Code:");
++ DrawString(cs->win, 350, 280 + ASCENT, "Converter:");
++
++ for (i = 0; i < TV_ML_NBUTTS; i++)
++ BTRedraw(&cs->bt[i]);
++ for (i = 0; i < TV_ML_NCBUTTS; i++)
++ CBRedraw(&cs->cbt[i]);
++ for (i = 0; i < TV_ML_NRBUTTS; i++)
++ RBRedraw(cs->rbt[i], -1);
++}
++
++static void csListRedraw(ls)
++ LIST *ls;
++{
++ int i;
++ for (i = 0; i < TV_ML_NLISTS; i++) {
++ LSRedraw(ls, 0);
++ SCRedraw(&ls->scrl);
++ }
++}
++
++static void csLsRedraw(delta, sptr)
++ int delta;
++ SCRL *sptr;
++{
++ int i, j;
++ for (i = 0; i < MAXTVWIN; i++) {
++ for (j = 0; j < TV_ML_NLISTS; j++) {
++ if (sptr == &csinfo[i].ls[j].scrl) {
++ LSRedraw(&csinfo[i].ls[j], delta);
++ return;
++ }
++ }
++ }
++}
++
++int CharsetDelWin(win)
++ Window win;
++{
++ CSINFO *cs;
++ int i;
++
++ for (cs = csinfo, i = 0; i < TV_NCSS; cs++, i++) {
++ if (cs->win == win) {
++ if (cs->up) {
++ XUnmapWindow(theDisp, cs->win);
++ cs->up = 0;
++ }
++ return 1;
++ }
++ }
++ return 0;
++}
++
++static int reg_comp PARM((const void *, const void *));
++static void create_registry_list()
++{
++ struct design d;
++ char *names, *p;
++ int i;
++
++ if ((p = names = (char *) malloc(32 * 0x80 * 2 * 2)) == NULL)
++ FatalError("out of memory in create_name_list#1.");
++ nregs = 0;
++ for (d.bpc = 1; d.bpc <=2; d.bpc++) {
++ for (d.noc = 94; d.noc <= 96; d.noc += 2) {
++ for (d.des = ' '; (unsigned char) d.des < 0x80; d.des++) {
++ int b7;
++ char *r;
++ if ((r = lookup_registry(d, &b7)) != NULL) {
++ sprintf(p, "%s/%s", r, b7 ? "Right" : "Left");
++ p += strlen(p) + 1;
++ nregs++;
++ }
++ }
++ }
++ }
++ if ((names = (char *) realloc(names, (size_t) (p - names))) == NULL)
++ FatalError("out of memory in create_name_list#2.");
++ if ((regs = (char **) malloc(sizeof(char *) * (nregs + 3))) == NULL)
++ FatalError("out of memory in create_name_list#3.");
++ p = names;
++ for (i = 0; i < nregs; i++) {
++ regs[i] = p;
++ p += strlen(p) + 1;
++ }
++ qsort(regs, (size_t) nregs, sizeof(char *), reg_comp);
++ regs[i++] = "nothing";
++ regs[i++] = "unused";
++ regs[i++] = NULL;
++}
++static int reg_comp(dst, src)
++ const void *dst, *src;
++{
++ return strcmp(*(char **) dst, *(char **) src);
++}
+
++#endif /* TV_MULTILINGUAL */
+diff -ru xv-3.10a/xvtiff.c xv-3.10a-enhancements/xvtiff.c
--- xv-3.10a/xvtiff.c 1995-01-13 11:53:34.000000000 -0800
-+++ xv-3.10a-bugfixes/xvtiff.c 2005-03-27 17:25:31.000000000 -0800
-@@ -1,7 +1,7 @@
++++ xv-3.10a-enhancements/xvtiff.c 2007-05-20 10:32:31.000000000 -0700
+@@ -1,11 +1,11 @@
/*
* xvtiff.c - load routine for 'TIFF' format pictures
*
@@ -26192,6 +39283,11 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
*/
#ifndef va_start
+-# define NEEDSARGS
++# define NEEDSARGS
+ #endif
+
+ #include "xv.h"
@@ -15,6 +15,35 @@
#include "tiffio.h" /* has to be after xv.h, as it needs varargs/stdarg */
@@ -26228,9 +39324,16 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
static byte *loadPalette PARM((TIFF *, uint32, uint32, int, int, PICINFO *));
static byte *loadColor PARM((TIFF *, uint32, uint32, int, int, PICINFO *));
static int loadImage PARM((TIFF *, uint32, uint32, byte *, int));
-@@ -28,19 +57,23 @@
+@@ -23,24 +52,29 @@
+
+ static long filesize;
+ static byte *rmap, *gmap, *bmap;
+-static char *filename;
++static const char *filename;
+
static int error_occurred;
++
/*******************************************/
-int LoadTIFF(fname, pinfo)
- char *fname;
@@ -26254,7 +39357,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
error_occurred = 0;
-@@ -60,6 +93,8 @@
+@@ -60,6 +94,8 @@
filesize = ftell(fp);
fclose(fp);
@@ -26263,7 +39366,16 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
rmap = pinfo->r; gmap = pinfo->g; bmap = pinfo->b;
/* a kludge: temporarily cd to the directory that the file is in (if
-@@ -80,10 +115,61 @@
+@@ -71,7 +107,7 @@
+ if (fname[0] == '/') {
+ xv_getwd(oldpath, sizeof(oldpath));
+ strcpy(tmppath, fname);
+- sp = BaseName(tmppath);
++ sp = (char *) BaseName(tmppath); /* intentionally losing constness */
+ if (sp != tmppath) {
+ sp[-1] = '\0'; /* truncate before last '/' char */
+ if (chdir(tmppath)) {
+@@ -80,10 +116,65 @@
else filename = BaseName(fname);
}
}
@@ -26278,9 +39390,9 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
+ /* see if there's more than 1 image in tiff file, to determine if we
+ should do multi-page thing... */
+
-+ tif = TIFFOpen(filename,"r");
++ tif = TIFFOpen(filename, "r");
+ if (!tif) return 0;
-+ while (TIFFReadDirectory(tif)) nump++;
++ while (TIFFReadDirectory(tif)) ++nump;
+ TIFFClose(tif);
+ if (DEBUG)
+ fprintf(stderr,"LoadTIFF: %d page%s found\n", nump, nump==1 ? "" : "s");
@@ -26289,20 +39401,23 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
+ /* if there are multiple images, copy them out to multiple tmp files,
+ and load the first one... */
+
-+ /* GRR 20050320: converted this fake mktemp() to use mktemp()/mkstemp()
-+ internally (formerly it simply prepended tmpdir to the string and
-+ returned immediately) */
-+ xv_mktemp(tmpname, "xvpgXXXXXX");
-+
-+ if (tmpname[0] == '\0') { /* mktemp() or mkstemp() blew up */
-+ sprintf(str,"LoadTIFF: Unable to create temporary filename???");
-+ ErrPopUp(str, "\nHow unlikely!");
-+ return 0;
-+ }
-+
+ if (nump>1) {
+ TIFF *in;
+
++ /* GRR 20050320: converted this fake mktemp() to use mktemp()/mkstemp()
++ internally (formerly it simply prepended tmpdir to the string and
++ returned immediately) */
++ xv_mktemp(tmpname, "xvpgXXXXXX");
++
++ if (tmpname[0] == '\0') { /* mktemp() or mkstemp() blew up */
++ sprintf(dummystr,"LoadTIFF: Unable to create temporary filename???");
++ ErrPopUp(dummystr, "\nHow unlikely!");
++ return 0;
++ }
++
++ /* GRR 20070506: could clean up unappended tmpname-file here (Linux
++ bug?), but "cleaner" (more general) to do so in KillPageFiles() */
++
+ in = TIFFOpen(filename, "r");
+ if (!in) return 0;
+ for (i=1; i<=nump; i++) {
@@ -26314,21 +39429,22 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
+
+ if (!TIFFReadDirectory(in)) break;
+ }
++ TIFFClose(in);
+ if (DEBUG)
+ fprintf(stderr,"LoadTIFF: %d page%s written\n",
+ i-1, (i-1)==1 ? "" : "s");
+
-+ sprintf(tmp, "%s%d", tmpname, 1); /* open page #1 */
++ sprintf(tmp, "%s%d", tmpname, 1); /* start with page #1 */
+ filename = tmp;
+ }
+ } /* if (!quick) ... */
+
+
-+ tif = TIFFOpen(filename,"r");
++ tif = TIFFOpen(filename, "r");
if (!tif) return 0;
/* flip orientation so that image comes in X order */
-@@ -107,6 +193,11 @@
+@@ -107,6 +198,11 @@
TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bps);
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photo);
TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &spp);
@@ -26340,7 +39456,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
if (spp == 1) {
pic8 = loadPalette(tif, w, h, photo, bps, pinfo);
-@@ -116,19 +207,19 @@
+@@ -116,19 +212,19 @@
/* try to get comments, if any */
pinfo->comment = (char *) NULL;
@@ -26363,7 +39479,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
TIFFClose(tif);
/* un-kludge */
-@@ -139,6 +230,8 @@
+@@ -139,6 +235,8 @@
if (pic8) free(pic8);
if (pinfo->comment) free(pinfo->comment);
pinfo->comment = (char *) NULL;
@@ -26372,7 +39488,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
return 0;
}
-@@ -148,15 +241,168 @@
+@@ -148,15 +246,178 @@
pinfo->normw = pinfo->w; pinfo->normh = pinfo->h;
pinfo->frmType = F_TIFF;
@@ -26417,7 +39533,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
+ TIFF *out;
+ short bitspersample, samplesperpixel, shortv, *shortav;
+ uint32 w, l;
-+ float floatv;
++ float floatv, *floatav;
+ char *stringv;
+ uint32 longv;
+ uint16 *red, *green, *blue, shortv2;
@@ -26426,44 +39542,54 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
+ out = TIFFOpen(fname, "w");
+ if (!out) return 0;
+
-+ CopyField (TIFFTAG_SUBFILETYPE, longv);
-+ CopyField (TIFFTAG_TILEWIDTH, w);
-+ CopyField (TIFFTAG_TILELENGTH, l);
-+ CopyField (TIFFTAG_IMAGEWIDTH, w);
-+ CopyField (TIFFTAG_IMAGELENGTH, l);
-+ CopyField (TIFFTAG_BITSPERSAMPLE, bitspersample);
-+ CopyField (TIFFTAG_COMPRESSION, shortv);
-+ CopyField (TIFFTAG_PREDICTOR, shortv);
-+ CopyField (TIFFTAG_PHOTOMETRIC, shortv);
-+ CopyField (TIFFTAG_THRESHHOLDING, shortv);
-+ CopyField (TIFFTAG_FILLORDER, shortv);
-+ CopyField (TIFFTAG_ORIENTATION, shortv);
-+ CopyField (TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
-+ CopyField (TIFFTAG_MINSAMPLEVALUE, shortv);
-+ CopyField (TIFFTAG_MAXSAMPLEVALUE, shortv);
-+ CopyField (TIFFTAG_XRESOLUTION, floatv);
-+ CopyField (TIFFTAG_YRESOLUTION, floatv);
-+ CopyField (TIFFTAG_GROUP3OPTIONS, longv);
-+ CopyField (TIFFTAG_GROUP4OPTIONS, longv);
-+ CopyField (TIFFTAG_RESOLUTIONUNIT, shortv);
-+ CopyField (TIFFTAG_PLANARCONFIG, shortv);
-+ CopyField (TIFFTAG_ROWSPERSTRIP, longv);
-+ CopyField (TIFFTAG_XPOSITION, floatv);
-+ CopyField (TIFFTAG_YPOSITION, floatv);
-+ CopyField (TIFFTAG_IMAGEDEPTH, longv);
-+ CopyField (TIFFTAG_TILEDEPTH, longv);
-+ CopyField2(TIFFTAG_EXTRASAMPLES, shortv, shortav);
-+ CopyField3(TIFFTAG_COLORMAP, red, green, blue);
-+ CopyField2(TIFFTAG_PAGENUMBER, shortv, shortv2);
-+ CopyField (TIFFTAG_ARTIST, stringv);
-+ CopyField (TIFFTAG_IMAGEDESCRIPTION,stringv);
-+ CopyField (TIFFTAG_MAKE, stringv);
-+ CopyField (TIFFTAG_MODEL, stringv);
-+ CopyField (TIFFTAG_SOFTWARE, stringv);
-+ CopyField (TIFFTAG_DATETIME, stringv);
-+ CopyField (TIFFTAG_HOSTCOMPUTER, stringv);
-+ CopyField (TIFFTAG_PAGENAME, stringv);
-+ CopyField (TIFFTAG_DOCUMENTNAME, stringv);
++ if (TIFFGetField(in, TIFFTAG_COMPRESSION, &shortv)){
++ /* Currently, the TIFF Library cannot correctly copy TIFF version 6.0 (or
++ * earlier) files that use "old" JPEG compression, so don't even try. */
++ if (shortv == COMPRESSION_OJPEG) return 0;
++ TIFFSetField(out, TIFFTAG_COMPRESSION, shortv);
++ }
++ CopyField (TIFFTAG_SUBFILETYPE, longv);
++ CopyField (TIFFTAG_TILEWIDTH, w);
++ CopyField (TIFFTAG_TILELENGTH, l);
++ CopyField (TIFFTAG_IMAGEWIDTH, w);
++ CopyField (TIFFTAG_IMAGELENGTH, l);
++ CopyField (TIFFTAG_BITSPERSAMPLE, bitspersample);
++ CopyField (TIFFTAG_PREDICTOR, shortv);
++ CopyField (TIFFTAG_PHOTOMETRIC, shortv);
++ CopyField (TIFFTAG_THRESHHOLDING, shortv);
++ CopyField (TIFFTAG_FILLORDER, shortv);
++ CopyField (TIFFTAG_ORIENTATION, shortv);
++ CopyField (TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
++ CopyField (TIFFTAG_MINSAMPLEVALUE, shortv);
++ CopyField (TIFFTAG_MAXSAMPLEVALUE, shortv);
++ CopyField (TIFFTAG_XRESOLUTION, floatv);
++ CopyField (TIFFTAG_YRESOLUTION, floatv);
++ CopyField (TIFFTAG_GROUP3OPTIONS, longv);
++ CopyField (TIFFTAG_GROUP4OPTIONS, longv);
++ CopyField (TIFFTAG_RESOLUTIONUNIT, shortv);
++ CopyField (TIFFTAG_PLANARCONFIG, shortv);
++ CopyField (TIFFTAG_ROWSPERSTRIP, longv);
++ CopyField (TIFFTAG_XPOSITION, floatv);
++ CopyField (TIFFTAG_YPOSITION, floatv);
++ CopyField (TIFFTAG_IMAGEDEPTH, longv);
++ CopyField (TIFFTAG_TILEDEPTH, longv);
++ CopyField2(TIFFTAG_EXTRASAMPLES, shortv, shortav);
++ CopyField3(TIFFTAG_COLORMAP, red, green, blue);
++ CopyField2(TIFFTAG_PAGENUMBER, shortv, shortv2);
++ CopyField (TIFFTAG_ARTIST, stringv);
++ CopyField (TIFFTAG_IMAGEDESCRIPTION, stringv);
++ CopyField (TIFFTAG_MAKE, stringv);
++ CopyField (TIFFTAG_MODEL, stringv);
++ CopyField (TIFFTAG_SOFTWARE, stringv);
++ CopyField (TIFFTAG_DATETIME, stringv);
++ CopyField (TIFFTAG_HOSTCOMPUTER, stringv);
++ CopyField (TIFFTAG_PAGENAME, stringv);
++ CopyField (TIFFTAG_DOCUMENTNAME, stringv);
++ CopyField2(TIFFTAG_JPEGTABLES, longv, stringv);
++ CopyField (TIFFTAG_YCBCRCOEFFICIENTS, floatav);
++ CopyField2(TIFFTAG_YCBCRSUBSAMPLING, shortv,shortv2);
++ CopyField (TIFFTAG_YCBCRPOSITIONING, shortv);
++ CopyField (TIFFTAG_REFERENCEBLACKWHITE, floatav);
+
+ if (TIFFIsTiled(in)) rv = cpTiles (in, out);
+ else rv = cpStrips(in, out);
@@ -26542,7 +39668,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
/*******************************************/
-@@ -167,6 +413,7 @@
+@@ -167,6 +428,7 @@
PICINFO *pinfo;
{
byte *pic8;
@@ -26550,7 +39676,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
switch (photo) {
case PHOTOMETRIC_PALETTE:
-@@ -178,7 +425,7 @@
+@@ -178,7 +440,7 @@
case PHOTOMETRIC_MINISWHITE:
case PHOTOMETRIC_MINISBLACK:
pinfo->colType = (bps==1) ? F_BWDITHER : F_GREYSCALE;
@@ -26559,7 +39685,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
bps,
photo == PHOTOMETRIC_MINISWHITE ? "min-is-white" :
"min-is-black",
-@@ -186,9 +433,16 @@
+@@ -186,9 +448,16 @@
break;
}
@@ -26578,7 +39704,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
if (!pic8) FatalError("loadPalette() - couldn't malloc 'pic8'");
if (loadImage(tif, w, h, pic8, 0)) return pic8;
-@@ -205,19 +459,28 @@
+@@ -205,19 +474,28 @@
PICINFO *pinfo;
{
byte *pic24, *pic8;
@@ -26610,11 +39736,33 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
if (!pic24) FatalError("loadColor() - couldn't malloc 'pic24'");
pic8 = (byte *) NULL;
-@@ -301,10 +564,10 @@
+@@ -249,7 +527,7 @@
+ vsprintf(cp, fmt, ap);
+ strcat(cp, ".");
+
+- SetISTR(ISTR_WARNING,buf);
++ SetISTR(ISTR_WARNING, "%s", buf);
+
+ error_occurred = 1;
+ }
+@@ -273,7 +551,7 @@
+ vsprintf(cp, fmt, ap);
+ strcat(cp, ".");
+
+- SetISTR(ISTR_WARNING,buf);
++ SetISTR(ISTR_WARNING, "%s", buf);
+ }
+
+
+@@ -301,10 +579,14 @@
static byte **BWmap;
static byte **PALmap;
-typedef void (*tileContigRoutine) PARM((byte*, u_char*, RGBvalue*,
++/* XXX Work around some collisions with the new library. */
++#define tileContigRoutine _tileContigRoutine
++#define tileSeparateRoutine _tileSeparateRoutine
++
+typedef void (*tileContigRoutine) PARM((byte*, u_char*, RGBvalue*,
uint32, uint32, int, int));
@@ -26623,7 +39771,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
RGBvalue*, uint32, uint32, int, int));
-@@ -312,13 +575,13 @@
+@@ -312,13 +594,13 @@
static int gt PARM((TIFF *, uint32, uint32, byte *));
static uint32 setorientation PARM((TIFF *, uint32));
@@ -26641,7 +39789,16 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
uint32, uint32, int));
static int makebwmap PARM((void));
-@@ -349,18 +612,18 @@
+@@ -340,7 +622,7 @@
+ uint32, uint32, int, int));
+ static void put4bitbwtile PARM((byte *, u_char *, RGBvalue *,
+ uint32, uint32, int, int));
+-static void put16bitbwtile PARM((byte *, u_char *, RGBvalue *,
++static void put16bitbwtile PARM((byte *, u_short *, RGBvalue *,
+ uint32, uint32, int, int));
+
+ static void putRGBcontig8bittile PARM((byte *, u_char *, RGBvalue *,
+@@ -349,22 +631,38 @@
static void putRGBcontig16bittile PARM((byte *, u_short *, RGBvalue *,
uint32, uint32, int, int));
@@ -26658,14 +39815,38 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
uint32, uint32, int, int));
- static void initYCbCrConversion PARM((void));
+-static void initYCbCrConversion PARM((void));
++static void initYCbCrConversion PARM((void));
-static void putRGBContigYCbCrClump PARM((byte *, u_char *, int, int,
-+static void putRGBContigYCbCrClump PARM((byte *, u_char *, int, int,
- uint32, int, int, int));
+- uint32, int, int, int));
++static void putRGBContigYCbCrClump PARM((byte *, u_char *, int, int,
++ uint32, int, int, int));
+
+-static void putcontig8bitYCbCrtile PARM((byte *, u_char *, RGBvalue *,
+- uint32, uint32, int, int));
++static void putRGBSeparateYCbCrClump PARM((byte *, u_char *, u_char *,
++ u_char *, int, int, uint32, int,
++ int, int));
++
++static void putRGBSeparate16bitYCbCrClump PARM((byte *, u_short *, u_short *,
++ u_short *, int, int, uint32,
++ int, int, int));
++
++static void putcontig8bitYCbCrtile PARM((byte *, u_char *, RGBvalue *,
++ uint32, uint32, int, int));
++
++static void putYCbCrseparate8bittile PARM((byte *, u_char *, u_char *,
++ u_char *, RGBvalue *,
++ uint32, uint32, int, int));
++
++static void putYCbCrseparate16bittile PARM((byte *, u_short *, u_short *,
++ u_short *, RGBvalue *,
++ uint32, uint32, int, int));
- static void putcontig8bitYCbCrtile PARM((byte *, u_char *, RGBvalue *,
-@@ -382,10 +645,10 @@
+ static tileContigRoutine pickTileContigCase PARM((RGBvalue *));
+ static tileSeparateRoutine pickTileSeparateCase PARM((RGBvalue *));
+@@ -382,28 +680,28 @@
TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample);
switch (bitspersample) {
@@ -26679,7 +39860,12 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
case 16: break;
default:
-@@ -397,8 +660,8 @@
+ TIFFError(TIFFFileName(tif),
+- "Sorry, can not handle %d-bit pictures", bitspersample);
++ "Sorry, cannot handle %d-bit pictures", bitspersample);
+ return (0);
+ }
+
TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
switch (samplesperpixel) {
@@ -26690,7 +39876,28 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
case 4: break;
default:
-@@ -470,7 +733,7 @@
+ TIFFError(TIFFFileName(tif),
+- "Sorry, can not handle %d-channel images", samplesperpixel);
++ "Sorry, cannot handle %d-channel images", samplesperpixel);
+ return (0);
+ }
+
+@@ -462,39 +760,81 @@
+ uint32 w, h;
+ byte *raster;
+ {
++#ifdef USE_LIBJPEG_FOR_TIFF_YCbCr_RGB_CONVERSION
++ u_short compression;
++#endif
+ u_short minsamplevalue, maxsamplevalue, planarconfig;
+ RGBvalue *Map;
+ int bpp = 1, e;
+ int x, range;
+
++#ifdef USE_LIBJPEG_FOR_TIFF_YCbCr_RGB_CONVERSION
++ TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression);
++#endif
++ TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &planarconfig);
TIFFGetFieldDefaulted(tif, TIFFTAG_MINSAMPLEVALUE, &minsamplevalue);
TIFFGetFieldDefaulted(tif, TIFFTAG_MAXSAMPLEVALUE, &maxsamplevalue);
Map = NULL;
@@ -26698,10 +39905,56 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
+
switch (photometric) {
case PHOTOMETRIC_YCBCR:
- TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRCOEFFICIENTS,
-@@ -481,12 +744,12 @@
- &refBlackWhite);
- initYCbCrConversion();
+- TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRCOEFFICIENTS,
+- &YCbCrCoeffs);
+- TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
+- &YCbCrHorizSampling, &YCbCrVertSampling);
+- TIFFGetFieldDefaulted(tif, TIFFTAG_REFERENCEBLACKWHITE,
+- &refBlackWhite);
+- initYCbCrConversion();
++#ifdef USE_LIBJPEG_FOR_TIFF_YCbCr_RGB_CONVERSION
++ if (compression == COMPRESSION_JPEG
++#ifdef LIBTIFF_HAS_OLDJPEG_SUPPORT
++ || compression == COMPRESSION_OJPEG
++#endif
++ ) {
++ /* FIXME: Remove the following test as soon as TIFF Library is fixed!
++ * (Currently [June 2002] this requires supporting patches in both
++ * tif_ojpeg.c and tif_jpeg.c in order to support subsampled YCbCr
++ * images having separated color planes.) */
++ if (planarconfig == PLANARCONFIG_CONTIG) {
++ /* can rely on libjpeg to convert to RGB (assuming newer libtiff,
++ * compiled with appropriate forms of JPEG support) */
++ TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
++ photometric = PHOTOMETRIC_RGB;
++ } else {
++ TIFFError(filename, "Cannot handle format");
++ return (0);
++ }
++ } else
++#endif // USE_LIBJPEG_FOR_TIFF_YCbCr_RGB_CONVERSION
++ {
++ TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRCOEFFICIENTS, &YCbCrCoeffs);
++ TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
++ &YCbCrHorizSampling, &YCbCrVertSampling);
++
++ /* According to the TIFF specification, if no "ReferenceBlackWhite"
++ * tag is present in the input file, "TIFFGetFieldDefaulted()" returns
++ * default reference black and white levels suitable for PHOTOMETRIC_RGB;
++ * namely: <0,255,0,255,0,255>. But for PHOTOMETRIC_YCBCR in JPEG
++ * images, the usual default (e.g., corresponding to the behavior of the
++ * IJG libjpeg) is: <0,255,128,255,128,255>. Since libtiff doesn't have
++ * a clean, standard interface for making this repair, the following
++ * slightly dirty code installs the default. --Scott Marovich,
++ * Hewlett-Packard Labs, 9/2001.
++ */
++ if (!TIFFGetField(tif, TIFFTAG_REFERENCEBLACKWHITE, &refBlackWhite)) {
++ TIFFGetFieldDefaulted(tif, TIFFTAG_REFERENCEBLACKWHITE, &refBlackWhite);
++ refBlackWhite[4] = refBlackWhite[2] = 1 << (bitspersample - 1);
++ }
++ TIFFGetFieldDefaulted(tif, TIFFTAG_REFERENCEBLACKWHITE, &refBlackWhite);
++ initYCbCrConversion();
++ }
/* fall thru... */
-
+
@@ -26714,7 +39967,16 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
/* fall thru... */
case PHOTOMETRIC_MINISBLACK:
case PHOTOMETRIC_MINISWHITE:
-@@ -509,7 +772,7 @@
+ range = maxsamplevalue - minsamplevalue;
+ Map = (RGBvalue *)malloc((range + 1) * sizeof (RGBvalue));
+ if (Map == NULL) {
+- TIFFError(filename,
+- "No space for photometric conversion table");
++ TIFFError(filename, "No space for photometric conversion table");
+ return (0);
+ }
+
+@@ -509,7 +849,7 @@
if (range<256) {
for (x=0; x<=range; x++) rmap[x] = gmap[x] = bmap[x] = Map[x];
} else {
@@ -26723,7 +39985,25 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
rmap[x] = gmap[x] = bmap[x] = Map[(range*x)/255];
}
-@@ -590,6 +853,8 @@
+@@ -529,8 +869,7 @@
+ case PHOTOMETRIC_PALETTE:
+ if (!TIFFGetField(tif, TIFFTAG_COLORMAP,
+ &redcmap, &greencmap, &bluecmap)) {
+- TIFFError(filename,
+- "Missing required \"Colormap\" tag");
++ TIFFError(filename, "Missing required \"Colormap\" tag");
+ return (0);
+ }
+
+@@ -571,7 +910,6 @@
+ return (0);
+ }
+
+- TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &planarconfig);
+ if (planarconfig == PLANARCONFIG_SEPARATE && samplesperpixel > 1) {
+ e = TIFFIsTiled(tif) ? gtTileSeparate (tif, raster, Map, h, w, bpp) :
+ gtStripSeparate(tif, raster, Map, h, w, bpp);
+@@ -590,6 +928,8 @@
TIFF *tif;
uint32 h;
{
@@ -26732,7 +40012,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
uint32 y;
TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &orientation);
-@@ -613,6 +878,11 @@
+@@ -613,6 +953,11 @@
orientation = ORIENTATION_TOPLEFT;
/* fall thru... */
case ORIENTATION_TOPLEFT:
@@ -26744,7 +40024,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
y = h-1;
break;
}
-@@ -623,11 +893,11 @@
+@@ -623,11 +968,11 @@
/*
@@ -26758,7 +40038,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
/*******************************************/
static int gtTileContig(tif, raster, Map, h, w, bpp)
TIFF *tif;
-@@ -642,11 +912,14 @@
+@@ -642,11 +987,14 @@
int fromskew, toskew;
u_int nrow;
tileContigRoutine put;
@@ -26774,7 +40054,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
if (buf == 0) {
TIFFError(filename, "No space for tile buffer");
return (0);
-@@ -655,12 +928,27 @@
+@@ -655,12 +1003,27 @@
TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
y = setorientation(tif, h);
@@ -26803,7 +40083,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
&& stoponerr) break;
if (col + tw > w) {
-@@ -670,14 +958,18 @@
+@@ -670,14 +1033,18 @@
*/
uint32 npix = w - col;
fromskew = tw - npix;
@@ -26825,7 +40105,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
}
free(buf);
return (1);
-@@ -687,11 +979,11 @@
+@@ -687,11 +1054,11 @@
/*
@@ -26839,7 +40119,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
/*******************************************/
static int gtTileSeparate(tif, raster, Map, h, w, bpp)
-@@ -701,20 +993,26 @@
+@@ -701,20 +1068,26 @@
uint32 h, w;
int bpp;
{
@@ -26870,7 +40150,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
if (buf == 0) {
TIFFError(filename, "No space for tile buffer");
return (0);
-@@ -751,10 +1049,10 @@
+@@ -751,10 +1124,10 @@
*/
uint32 npix = w - col;
fromskew = tw - npix;
@@ -26883,7 +40163,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
0, (int) (toskew*bpp));
}
y += (orientation == ORIENTATION_TOPLEFT ? -nrow : nrow);
-@@ -768,7 +1066,7 @@
+@@ -768,7 +1141,7 @@
* PlanarConfiguration contiguous if SamplesPerPixel > 1
* or
* SamplesPerPixel == 1
@@ -26892,7 +40172,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
/*******************************************/
static int gtStripContig(tif, raster, Map, h, w, bpp)
TIFF *tif;
-@@ -784,11 +1082,15 @@
+@@ -784,11 +1157,15 @@
uint32 imagewidth;
int scanline;
int fromskew, toskew;
@@ -26910,7 +40190,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
if (buf == 0) {
TIFFError(filename, "No space for strip buffer");
return (0);
-@@ -828,20 +1130,29 @@
+@@ -828,25 +1205,34 @@
uint32 h, w;
int bpp;
{
@@ -26946,7 +40226,13 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
g = r + stripsize;
b = g + stripsize;
put = pickTileSeparateCase(Map);
-@@ -861,7 +1172,7 @@
+ if (put == 0) {
+- TIFFError(filename, "Can not handle format");
++ TIFFError(filename, "Cannot handle format");
+ return (0);
+ }
+ y = setorientation(tif, h);
+@@ -861,7 +1247,7 @@
nrow = (row + rowsperstrip > h ? h - row : rowsperstrip);
band = 0;
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, (uint32) row, band),
@@ -26955,7 +40241,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
&& stoponerr) break;
band = 1;
-@@ -871,7 +1182,7 @@
+@@ -871,7 +1257,7 @@
band = 2;
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, (uint32) row, band),
@@ -26964,7 +40250,16 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
&& stoponerr) break;
(*put)(raster + y*w*bpp, r, g, b, Map, w, nrow, fromskew, toskew*bpp);
-@@ -895,7 +1206,7 @@
+@@ -886,7 +1272,7 @@
+ /*
+ * Greyscale images with less than 8 bits/sample are handled
+ * with a table to avoid lots of shifts and masks. The table
+- * is setup so that put*bwtile (below) can retrieve 8/bitspersample
++ * is set up so that put*bwtile (below) can retrieve 8/bitspersample
+ * pixel values simply by indexing into the table with one
+ * number.
+ */
+@@ -895,7 +1281,7 @@
register int i;
int nsamples = 8 / bitspersample;
register byte *p;
@@ -26973,7 +40268,23 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
BWmap = (byte **)malloc(
256*sizeof (byte *)+(256*nsamples*sizeof(byte)));
if (BWmap == NULL) {
-@@ -949,7 +1260,7 @@
+@@ -938,18 +1324,18 @@
+
+
+ /*
+- * Palette images with <= 8 bits/sample are handled
+- * with a table to avoid lots of shifts and masks. The table
+- * is setup so that put*cmaptile (below) can retrieve 8/bitspersample
+- * pixel values simply by indexing into the table with one
+- * number.
++ * Palette images with <= 8 bits/sample are handled with
++ * a table to avoid lots of shifts and masks. The table
++ * is set up so that put*cmaptile (below) can retrieve
++ * (8/bitspersample) pixel-values simply by indexing into
++ * the table with one number.
+ */
+ static int makecmap()
+ {
register int i;
int nsamples = 8 / bitspersample;
register byte *p;
@@ -26982,7 +40293,16 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
PALmap = (byte **)malloc(
256*sizeof (byte *)+(256*nsamples*sizeof(byte)));
if (PALmap == NULL) {
-@@ -1014,7 +1325,7 @@
+@@ -994,7 +1380,7 @@
+ /*
+ * The following routines move decoded data returned
+ * from the TIFF library into rasters filled with packed
+- * ABGR pixels (i.e. suitable for passing to lrecwrite.)
++ * ABGR pixels (i.e., suitable for passing to lrecwrite.)
+ *
+ * The routines have been created according to the most
+ * important cases and optimized. pickTileContigCase and
+@@ -1014,7 +1400,7 @@
#define CASE4(x,op) switch (x) { case 3: op; case 2: op; case 1: op; }
#define UNROLL8(w, op1, op2) { \
@@ -26991,7 +40311,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
for (x = w; x >= 8; x -= 8) { \
op1; \
REPEAT8(op2); \
-@@ -1026,7 +1337,7 @@
+@@ -1026,7 +1412,7 @@
}
#define UNROLL4(w, op1, op2) { \
@@ -27000,7 +40320,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
for (x = w; x >= 4; x -= 4) { \
op1; \
REPEAT4(op2); \
-@@ -1038,7 +1349,7 @@
+@@ -1038,7 +1424,7 @@
}
#define UNROLL2(w, op1, op2) { \
@@ -27009,7 +40329,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
for (x = w; x >= 2; x -= 2) { \
op1; \
REPEAT2(op2); \
-@@ -1048,7 +1359,7 @@
+@@ -1048,7 +1434,7 @@
op2; \
} \
}
@@ -27018,16 +40338,16 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
#define SKEW(r,g,b,skew) { r += skew; g += skew; b += skew; }
-@@ -1065,7 +1376,7 @@
+@@ -1065,7 +1451,7 @@
int fromskew, toskew;
{
while (h-- > 0) {
- UNROLL8(w,0, *cp++ = PALmap[*pp++][0]);
-+ UNROLL8(w, , *cp++ = PALmap[*pp++][0])
++ UNROLL8(w, , *cp++ = PALmap[*pp++][0]);
cp += toskew;
pp += fromskew;
}
-@@ -1082,7 +1393,7 @@
+@@ -1082,7 +1468,7 @@
int fromskew, toskew;
{
register byte *bw;
@@ -27036,7 +40356,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
fromskew /= 2;
while (h-- > 0) {
UNROLL2(w, bw = PALmap[*pp++], *cp++ = *bw++);
-@@ -1103,7 +1414,7 @@
+@@ -1103,7 +1489,7 @@
int fromskew, toskew;
{
register byte *bw;
@@ -27045,7 +40365,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
fromskew /= 4;
while (h-- > 0) {
UNROLL4(w, bw = PALmap[*pp++], *cp++ = *bw++);
-@@ -1123,10 +1434,10 @@
+@@ -1123,10 +1509,10 @@
int fromskew, toskew;
{
register byte *bw;
@@ -27058,7 +40378,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
cp += toskew;
pp += fromskew;
}
-@@ -1164,10 +1475,10 @@
+@@ -1164,10 +1550,10 @@
int fromskew, toskew;
{
register byte *bw;
@@ -27071,7 +40391,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
cp += toskew;
pp += fromskew;
}
-@@ -1184,7 +1495,7 @@
+@@ -1184,7 +1570,7 @@
int fromskew, toskew;
{
register byte *bw;
@@ -27080,7 +40400,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
fromskew /= 4;
while (h-- > 0) {
UNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++);
-@@ -1204,7 +1515,7 @@
+@@ -1204,7 +1590,7 @@
int fromskew, toskew;
{
register byte *bw;
@@ -27089,7 +40409,14 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
fromskew /= 2;
while (h-- > 0) {
UNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++);
-@@ -1224,7 +1535,7 @@
+@@ -1218,17 +1604,16 @@
+ */
+ static void put16bitbwtile(cp, pp, Map, w, h, fromskew, toskew)
+ byte *cp;
+- u_char *pp;
++ u_short *pp;
+ RGBvalue *Map;
+ uint32 w, h;
int fromskew, toskew;
{
register uint32 x;
@@ -27097,8 +40424,13 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
+
while (h-- > 0) {
for (x=w; x>0; x--) {
- *cp++ = Map[(pp[0] << 8) + pp[1]];
-@@ -1262,11 +1573,11 @@
+- *cp++ = Map[(pp[0] << 8) + pp[1]];
+- pp += 2;
++ *cp++ = Map[*pp++];
+ }
+ cp += toskew;
+ pp += fromskew;
+@@ -1262,7 +1647,7 @@
}
} else {
while (h-- > 0) {
@@ -27107,12 +40439,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
*cp++ = pp[0];
*cp++ = pp[1];
*cp++ = pp[2];
-- pp += samplesperpixel);
-+ pp += samplesperpixel)
- cp += toskew;
- pp += fromskew;
- }
-@@ -1284,7 +1595,7 @@
+@@ -1284,7 +1669,7 @@
int fromskew, toskew;
{
register u_int x;
@@ -27121,7 +40448,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
fromskew *= samplesperpixel;
if (Map) {
while (h-- > 0) {
-@@ -1320,7 +1631,7 @@
+@@ -1320,7 +1705,7 @@
RGBvalue *Map;
uint32 w, h;
int fromskew, toskew;
@@ -27130,7 +40457,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
{
if (Map) {
while (h-- > 0) {
-@@ -1335,11 +1646,11 @@
+@@ -1335,7 +1720,7 @@
}
} else {
while (h-- > 0) {
@@ -27139,12 +40466,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
*cp++ = *r++;
*cp++ = *g++;
*cp++ = *b++;
-- );
-+ )
- SKEW(r, g, b, fromskew);
- cp += toskew;
- }
-@@ -1357,7 +1668,7 @@
+@@ -1357,7 +1742,7 @@
int fromskew, toskew;
{
uint32 x;
@@ -27153,7 +40475,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
if (Map) {
while (h-- > 0) {
for (x = w; x > 0; x--) {
-@@ -1381,7 +1692,7 @@
+@@ -1381,7 +1766,7 @@
}
}
@@ -27162,12 +40484,13 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
#define CLAMP(f,min,max) \
(int)((f)+.5 < (min) ? (min) : (f)+.5 > (max) ? (max) : (f)+.5)
-@@ -1391,16 +1702,32 @@
+@@ -1390,17 +1775,32 @@
+ #define LumaGreen YCbCrCoeffs[1]
#define LumaBlue YCbCrCoeffs[2]
- static float D1, D2;
+-static float D1, D2;
-static float D3, D4, D5;
-+static float D3, D4 /*, D5 */;
++static float D1, D2, D3, D4 /*, D5 */;
static void initYCbCrConversion()
@@ -27198,7 +40521,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
}
static void putRGBContigYCbCrClump(cp, pp, cw, ch, w, n, fromskew, toskew)
-@@ -1412,7 +1739,7 @@
+@@ -1412,7 +1812,7 @@
{
float Cb, Cr;
int j, k;
@@ -27207,7 +40530,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
Cb = Code2V(pp[n], refBlackWhite[2], refBlackWhite[3], 127);
Cr = Code2V(pp[n+1], refBlackWhite[4], refBlackWhite[5], 127);
for (j = 0; j < ch; j++) {
-@@ -1421,8 +1748,24 @@
+@@ -1421,8 +1821,24 @@
Y = Code2V(*pp++,
refBlackWhite[0], refBlackWhite[1], 255);
R = Y + Cr*D1;
@@ -27233,7 +40556,70 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
cp[3*k+0] = CLAMP(R,0,255);
cp[3*k+1] = CLAMP(G,0,255);
cp[3*k+2] = CLAMP(B,0,255);
-@@ -1452,7 +1795,7 @@
+@@ -1432,6 +1848,62 @@
+ }
+ }
+
++static void putRGBSeparateYCbCrClump(cp, y, cb, cr, cw, ch, w, n, fromskew, toskew)
++ byte *cp;
++ u_char *y, *cb, *cr;
++ int cw, ch;
++ uint32 w;
++ int n, fromskew, toskew;
++{
++ float Cb, Cr;
++ int j, k;
++
++ Cb = Code2V(cb[0], refBlackWhite[2], refBlackWhite[3], 127);
++ Cr = Code2V(cr[0], refBlackWhite[4], refBlackWhite[5], 127);
++ for (j = 0; j < ch; j++) {
++ for (k = 0; k < cw; k++) {
++ float Y, R, G, B;
++ Y = Code2V(y[k], refBlackWhite[0], refBlackWhite[1], 255);
++ R = Y + Cr*D1;
++ G = Y - Cb*D4 - Cr*D2;
++ B = Y + Cb*D3;
++ cp[3*k+0] = CLAMP(R,0,255);
++ cp[3*k+1] = CLAMP(G,0,255);
++ cp[3*k+2] = CLAMP(B,0,255);
++ }
++ cp += w*3 + toskew;
++ y += w + ch*fromskew;
++ }
++}
++
++static void putRGBSeparate16bitYCbCrClump(cp, y, cb, cr, cw, ch, w, n, fromskew, toskew)
++ byte *cp;
++ u_short *y, *cb, *cr;
++ int cw, ch;
++ uint32 w;
++ int n, fromskew, toskew;
++{
++ float Cb, Cr;
++ int j, k;
++
++ Cb = Code2V(cb[0], refBlackWhite[2], refBlackWhite[3], 127);
++ Cr = Code2V(cr[0], refBlackWhite[4], refBlackWhite[5], 127);
++ for (j = 0; j < ch; j++) {
++ for (k = 0; k < cw; k++) {
++ float Y, R, G, B;
++ Y = Code2V(y[k], refBlackWhite[0], refBlackWhite[1], 255);
++ R = Y + Cr*D1;
++ G = Y - Cb*D4 - Cr*D2;
++ B = Y + Cb*D3;
++ cp[3*k+0] = CLAMP(R,0,255);
++ cp[3*k+1] = CLAMP(G,0,255);
++ cp[3*k+2] = CLAMP(B,0,255);
++ }
++ cp += w*3 + toskew;
++ y += w + ch*fromskew;
++ }
++}
++
+ #undef LumaBlue
+ #undef LumaGreen
+ #undef LumaRed
+@@ -1452,7 +1924,7 @@
u_int Coff = YCbCrVertSampling * YCbCrHorizSampling;
byte *tp;
uint32 x;
@@ -27242,7 +40628,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
/* XXX adjust fromskew */
while (h >= YCbCrVertSampling) {
tp = cp;
-@@ -1481,7 +1824,7 @@
+@@ -1481,19 +1953,122 @@
pp += Coff+2;
}
if (x > 0)
@@ -27251,7 +40637,114 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
(int)Coff, (int)(YCbCrHorizSampling-x),toskew);
}
}
-@@ -1493,7 +1836,7 @@
+
+ /*
++ * 8-bit unpacked YCbCr samples => RGB
++ */
++static void putYCbCrseparate8bittile(cp, y, cb, cr, Map, w, h, fromskew, toskew)
++ byte *cp;
++ u_char *y, *cb, *cr;
++ RGBvalue *Map;
++ uint32 w, h;
++ int fromskew, toskew;
++{
++ uint32 x;
++ int fromskew2 = fromskew/YCbCrHorizSampling;
++
++ while (h >= YCbCrVertSampling) {
++ for (x = w; x >= YCbCrHorizSampling; x -= YCbCrHorizSampling) {
++ putRGBSeparateYCbCrClump(cp, y, cb, cr, YCbCrHorizSampling,
++ YCbCrVertSampling, w, 0, 0, toskew);
++ cp += 3*YCbCrHorizSampling;
++ y += YCbCrHorizSampling;
++ ++cb;
++ ++cr;
++ }
++ if (x > 0) {
++ putRGBSeparateYCbCrClump(cp, y, cb, cr, (int) x, YCbCrVertSampling,
++ w, 0, (int)(YCbCrHorizSampling - x), toskew);
++ cp += x*3;
++ y += YCbCrHorizSampling;
++ ++cb;
++ ++cr;
++ }
++ cp += (YCbCrVertSampling - 1)*w*3 + YCbCrVertSampling*toskew;
++ y += (YCbCrVertSampling - 1)*w + YCbCrVertSampling*fromskew;
++ cb += fromskew2;
++ cr += fromskew2;
++ h -= YCbCrVertSampling;
++ }
++ if (h > 0) {
++ for (x = w; x >= YCbCrHorizSampling; x -= YCbCrHorizSampling) {
++ putRGBSeparateYCbCrClump(cp, y, cb, cr, YCbCrHorizSampling, (int) h,
++ w, 0, 0, toskew);
++ cp += 3*YCbCrHorizSampling;
++ y += YCbCrHorizSampling;
++ ++cb;
++ ++cr;
++ }
++ if (x > 0)
++ putRGBSeparateYCbCrClump(cp, y, cb, cr, (int) x, (int) h, w,
++ 0, (int)(YCbCrHorizSampling-x),toskew);
++ }
++}
++
++/*
++ * 16-bit unpacked YCbCr samples => RGB
++ */
++static void putYCbCrseparate16bittile(cp, y, cb, cr, Map, w, h, fromskew, toskew)
++ byte *cp;
++ u_short *y, *cb, *cr;
++ RGBvalue *Map;
++ uint32 w, h;
++ int fromskew, toskew;
++{
++ uint32 x;
++ int fromskew2 = fromskew/YCbCrHorizSampling;
++
++ while (h >= YCbCrVertSampling) {
++ for (x = w; x >= YCbCrHorizSampling; x -= YCbCrHorizSampling) {
++ putRGBSeparate16bitYCbCrClump(cp, y, cb, cr, YCbCrHorizSampling,
++ YCbCrVertSampling, w, 0, 0, toskew);
++ cp += 3*YCbCrHorizSampling;
++ y += YCbCrHorizSampling;
++ ++cb;
++ ++cr;
++ }
++ if (x > 0) {
++ putRGBSeparate16bitYCbCrClump(cp, y, cb, cr, (int) x, YCbCrVertSampling,
++ w, 0, (int)(YCbCrHorizSampling - x),
++ toskew);
++ cp += x*3;
++ y += YCbCrHorizSampling;
++ ++cb;
++ ++cr;
++ }
++ cp += (YCbCrVertSampling - 1)*w*3 + YCbCrVertSampling*toskew;
++ y += (YCbCrVertSampling - 1)*w + YCbCrVertSampling*fromskew;
++ cb += fromskew2;
++ cr += fromskew2;
++ h -= YCbCrVertSampling;
++ }
++ if (h > 0) {
++ for (x = w; x >= YCbCrHorizSampling; x -= YCbCrHorizSampling) {
++ putRGBSeparate16bitYCbCrClump(cp, y, cb, cr, YCbCrHorizSampling, (int) h,
++ w, 0, 0, toskew);
++ cp += 3*YCbCrHorizSampling;
++ y += YCbCrHorizSampling;
++ ++cb;
++ ++cr;
++ }
++ if (x > 0)
++ putRGBSeparate16bitYCbCrClump(cp, y, cb, cr, (int) x, (int) h, w,
++ 0, (int)(YCbCrHorizSampling-x),toskew);
++ }
++}
++
++/*
+ * Select the appropriate conversion routine for packed data.
+ */
+ static tileContigRoutine pickTileContigCase(Map)
RGBvalue* Map;
{
tileContigRoutine put = 0;
@@ -27260,7 +40753,7 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
switch (photometric) {
case PHOTOMETRIC_RGB:
switch (bitspersample) {
-@@ -1501,7 +1844,7 @@
+@@ -1501,7 +2076,7 @@
case 16: put = (tileContigRoutine) putRGBcontig16bittile; break;
}
break;
@@ -27269,7 +40762,34 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
case PHOTOMETRIC_PALETTE:
switch (bitspersample) {
case 8: put = put8bitcmaptile; break;
-@@ -1544,7 +1887,7 @@
+@@ -1514,7 +2089,7 @@
+ case PHOTOMETRIC_MINISWHITE:
+ case PHOTOMETRIC_MINISBLACK:
+ switch (bitspersample) {
+- case 16: put = put16bitbwtile; break;
++ case 16: put = (tileContigRoutine) put16bitbwtile; break;
+ case 8: put = putgreytile; break;
+ case 4: put = put4bitbwtile; break;
+ case 2: put = put2bitbwtile; break;
+@@ -1529,7 +2104,7 @@
+ break;
+ }
+
+- if (put==0) TIFFError(filename, "Can not handle format");
++ if (put==0) TIFFError(filename, "Cannot handle format");
+ return (put);
+ }
+
+@@ -1537,14 +2112,14 @@
+ /*
+ * Select the appropriate conversion routine for unpacked data.
+ *
+- * NB: we assume that unpacked single channel data is directed
+- * to the "packed routines.
++ * NB: we assume that unpacked single-channel data is directed
++ * to the "packed" routines.
+ */
+ static tileSeparateRoutine pickTileSeparateCase(Map)
RGBvalue* Map;
{
tileSeparateRoutine put = 0;
@@ -27278,9 +40798,52 @@ diff -ruN xv-3.10a/xvtiff.c xv-3.10a-bugfixes/xvtiff.c
switch (photometric) {
case PHOTOMETRIC_RGB:
switch (bitspersample) {
-diff -ruN xv-3.10a/xvtiffwr.c xv-3.10a-bugfixes/xvtiffwr.c
+@@ -1552,12 +2127,41 @@
+ case 16: put = (tileSeparateRoutine) putRGBseparate16bittile; break;
+ }
+ break;
++
++ case PHOTOMETRIC_YCBCR:
++ switch (bitspersample) {
++ case 8: put = (tileSeparateRoutine) putYCbCrseparate8bittile; break;
++ case 16: put = (tileSeparateRoutine) putYCbCrseparate16bittile; break;
++ }
++ break;
+ }
+
+- if (put==0) TIFFError(filename, "Can not handle format");
++ if (put==0) TIFFError(filename, "Cannot handle format");
+ return (put);
+ }
+
+
+
++/*******************************************/
++void
++VersionInfoTIFF() /* GRR 19980605 */
++{
++ char temp[1024], *p, *q;
++
++ strcpy(temp, TIFFGetVersion());
++ p = temp;
++ while (!isdigit(*p))
++ ++p;
++ if ((q = strchr(p, '\n')) != NULL)
++ *q = '\0';
++
++ fprintf(stderr, " Compiled with libtiff %s", p);
++#ifdef TIFFLIB_VERSION
++ fprintf(stderr, " of %d", TIFFLIB_VERSION); /* e.g., 19960307 */
++#endif
++ fprintf(stderr, ".\n");
++}
++
++
++
+ #endif /* HAVE_TIFF */
+diff -ru xv-3.10a/xvtiffwr.c xv-3.10a-enhancements/xvtiffwr.c
--- xv-3.10a/xvtiffwr.c 1995-01-03 13:28:13.000000000 -0800
-+++ xv-3.10a-bugfixes/xvtiffwr.c 2005-03-28 08:39:52.000000000 -0800
++++ xv-3.10a-enhancements/xvtiffwr.c 2007-05-12 14:07:58.000000000 -0700
@@ -9,15 +9,15 @@
#ifdef HAVE_TIFF
@@ -27340,7 +40903,16 @@ diff -ruN xv-3.10a/xvtiffwr.c xv-3.10a-bugfixes/xvtiffwr.c
WaitCursor();
-@@ -84,19 +92,27 @@
+@@ -78,25 +86,36 @@
+ TIFFSetField(tif, TIFFTAG_GROUP3OPTIONS,
+ GROUP3OPT_2DENCODING+GROUP3OPT_FILLBITS);
+
++ if (comp == COMPRESSION_LZW)
++ TIFFSetField(tif, TIFFTAG_PREDICTOR, 2);
++
+ TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+ TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
+ TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, h);
TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, (int)2);
@@ -27372,7 +40944,7 @@ diff -ruN xv-3.10a/xvtiffwr.c xv-3.10a-bugfixes/xvtiffwr.c
}
else { /* colorstyle == F_GREYSCALE */
-@@ -106,13 +122,13 @@
+@@ -106,13 +125,13 @@
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
@@ -27390,7 +40962,7 @@ diff -ruN xv-3.10a/xvtiffwr.c xv-3.10a-bugfixes/xvtiffwr.c
free(tpic);
}
-@@ -123,32 +139,42 @@
+@@ -123,32 +142,42 @@
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
setupColormap(tif, rmap, gmap, bmap);
@@ -27438,7 +41010,7 @@ diff -ruN xv-3.10a/xvtiffwr.c xv-3.10a-bugfixes/xvtiffwr.c
tp = tpic;
for (i=0, pix=pic; i<h; i++) {
if ((i&15)==0) WaitCursor();
-@@ -167,7 +193,7 @@
+@@ -167,7 +196,7 @@
*tp++ = (byte) (k & 0xff);
}
}
@@ -27447,7 +41019,7 @@ diff -ruN xv-3.10a/xvtiffwr.c xv-3.10a-bugfixes/xvtiffwr.c
free(tpic);
}
}
-@@ -209,16 +235,16 @@
+@@ -209,16 +238,16 @@
{
int y;
@@ -27467,7 +41039,7 @@ diff -ruN xv-3.10a/xvtiffwr.c xv-3.10a-bugfixes/xvtiffwr.c
"Cancel", infofg, infobg, hicol, locol);
y = 55;
-@@ -237,7 +263,7 @@
+@@ -237,7 +266,7 @@
XMapSubwindows(theDisp, tiffW);
}
@@ -27476,7 +41048,7 @@ diff -ruN xv-3.10a/xvtiffwr.c xv-3.10a-bugfixes/xvtiffwr.c
/***************************************************/
void TIFFDialog(vis)
-@@ -288,9 +314,9 @@
+@@ -288,9 +317,9 @@
else if (xev->type == KeyPress) {
XKeyEvent *e = (XKeyEvent *) xev;
@@ -27488,7 +41060,16 @@ diff -ruN xv-3.10a/xvtiffwr.c xv-3.10a-bugfixes/xvtiffwr.c
stlen = XLookupString(e,buf,128,&ks,&status);
buf[stlen] = '\0';
-@@ -381,7 +407,7 @@
+@@ -350,7 +379,7 @@
+ static void drawTD(x,y,w,h)
+ int x,y,w,h;
+ {
+- char *title = "Save TIFF file...";
++ const char *title = "Save TIFF file...";
+ int i;
+ XRectangle xr;
+
+@@ -381,7 +410,7 @@
/* check BUTTs */
/* check the RBUTTS first, since they don't DO anything */
@@ -27497,7 +41078,7 @@ diff -ruN xv-3.10a/xvtiffwr.c xv-3.10a-bugfixes/xvtiffwr.c
(void) RBTrack(compRB, i);
return;
}
-@@ -417,7 +443,7 @@
+@@ -417,7 +446,7 @@
}
}
break;
@@ -27506,17 +41087,29 @@ diff -ruN xv-3.10a/xvtiffwr.c xv-3.10a-bugfixes/xvtiffwr.c
case T_BCANC: TIFFDialog(0); break;
default: break;
-diff -ruN xv-3.10a/xvxbm.c xv-3.10a-bugfixes/xvxbm.c
+diff -ru xv-3.10a/xvxbm.c xv-3.10a-enhancements/xvxbm.c
--- xv-3.10a/xvxbm.c 1994-12-22 14:34:41.000000000 -0800
-+++ xv-3.10a-bugfixes/xvxbm.c 2005-03-28 22:06:50.000000000 -0800
-@@ -25,7 +25,7 @@
++++ xv-3.10a-enhancements/xvxbm.c 2007-05-13 17:45:48.000000000 -0700
+@@ -25,9 +25,9 @@
* move forward to next occurence of '0x'
* repeat
*/
-
+
+-static int xbmError PARM((char *, char *));
+
++static int xbmError PARM((const char *, const char *));
+
+
+ /*******************************************/
+@@ -44,7 +44,7 @@
+ long filesize;
+ char line[256], name[256];
+ byte hex[256];
+- char *bname;
++ const char *bname;
- static int xbmError PARM((char *, char *));
+ k = 0;
@@ -59,7 +59,7 @@
@@ -27563,7 +41156,13 @@ diff -ruN xv-3.10a/xvxbm.c xv-3.10a-bugfixes/xvxbm.c
pinfo->h = h;
pinfo->normw = pinfo->w; pinfo->normh = pinfo->h;
pinfo->type = PIC8;
-@@ -125,13 +125,13 @@
+@@ -120,18 +120,18 @@
+ /* read/convert the image data */
+
+ for (i=0, pix=pic8; i<h; i++)
+- for (j=0,bit=0; j<w; j++, pix++, bit = (++bit)&7) {
++ for (j=0,bit=0; j<w; j++, pix++, bit = (bit+1)&7) {
+
if (!bit) {
/* get next byte from file. we're already positioned at it */
c = getc(fp); c1 = getc(fp);
@@ -27580,7 +41179,7 @@ diff -ruN xv-3.10a/xvxbm.c xv-3.10a-bugfixes/xvxbm.c
if (hex[c] == 255) k = 0; /* no digits after the '0x' ... */
else k = hex[c];
}
-@@ -149,7 +149,7 @@
+@@ -149,13 +149,13 @@
fclose(fp);
return 1;
@@ -27589,6 +41188,13 @@ diff -ruN xv-3.10a/xvxbm.c xv-3.10a-bugfixes/xvxbm.c
+ /*******************************************/
+ static int xbmError(fname, st)
+- char *fname, *st;
++ const char *fname, *st;
+ {
+ SetISTR(ISTR_WARNING,"%s: %s", fname, st);
+ return 0;
@@ -172,7 +172,7 @@
{
/* pic is expected to be an array of w*h bytes, each of which is either
@@ -27598,7 +41204,14 @@ diff -ruN xv-3.10a/xvxbm.c xv-3.10a-bugfixes/xvxbm.c
considered black, and the other one, white.
Some sort of stippling algorithm should've
been called already to produce pic, otherwise the output won't be at all
-@@ -188,7 +188,7 @@
+@@ -182,13 +182,12 @@
+ byte *pix;
+ char name[256], *foo;
+
+- foo = BaseName(fname);
+- strcpy(name, foo);
++ strcpy(name, BaseName(fname));
+
foo = (char *) index(name,'.');
if (foo) *foo='\0'; /* truncated name at first '.' */
@@ -27607,9 +41220,9 @@ diff -ruN xv-3.10a/xvxbm.c xv-3.10a-bugfixes/xvxbm.c
fprintf(fp,"#define %s_height %d\n",name,h);
fprintf(fp,"static char %s_bits[] = {\n",name);
-diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
+diff -ru xv-3.10a/xvxpm.c xv-3.10a-enhancements/xvxpm.c
--- xv-3.10a/xvxpm.c 1994-12-22 14:34:42.000000000 -0800
-+++ xv-3.10a-bugfixes/xvxpm.c 2005-03-28 22:22:50.000000000 -0800
++++ xv-3.10a-enhancements/xvxpm.c 2007-05-13 17:52:21.000000000 -0700
@@ -10,7 +10,7 @@
* format images.
*
@@ -27619,7 +41232,18 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
*/
#define VALUES_LEN 80 /* Max length of values line */
-@@ -63,7 +63,7 @@
+@@ -48,8 +48,8 @@
+ /* a quoted string? */
+
+ /* Local Functions */
+-static int XpmLoadError PARM((char*, char*));
+-static int XpmGetc PARM((FILE*));
++static int XpmLoadError PARM((const char *, const char *));
++static int XpmGetc PARM((FILE *));
+ static int hash PARM((char *));
+ static int hash_init PARM((int));
+ static int hash_insert PARM((hentry *));
+@@ -63,110 +63,128 @@
PICINFO *pinfo;
{
/* returns '1' on success */
@@ -27628,7 +41252,10 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
FILE *fp;
hentry item;
int c;
-@@ -73,100 +73,110 @@
+- char *bname;
++ const char *bname;
+ char values[VALUES_LEN];
+ byte *pic;
byte *i_sptr; /* image search pointer */
long filesize;
int w, h, nc, cpp, line_pos;
@@ -27758,14 +41385,32 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
+
do {
char key[3];
- char color[40]; /* Need to figure a good size for this... */
+- char color[40]; /* Need to figure a good size for this... */
- short hd; /* Hex digits per R, G, or B */
-
++ char color[80]; /* Need to figure a good size for this... */
++
++/*
++ * Problem with spaces in color names
++ *
++ * X s Color Name m Other Name c Last Name
++ *
++ * ... this parser doesn't find `Any Name'
++ */
+
for (j=0; j<2 && (c != ' ') && (c != '\t') && (c != EOF); j++) {
key[j] = c;
c = XpmGetc(fp);
-@@ -185,14 +195,14 @@
+@@ -177,7 +195,7 @@
+ if (c == EOF) /* The failure condition of getc() */
+ return (XpmLoadError(bname, "Error parsing colormap line"));
+
+- for (j=0; j<39 && (c!=' ') && (c!='\t') && (c!='"') && c!=EOF; j++) {
++ for (j=0; j<79 && (c!=' ') && (c!='\t') && (c!='"') && c!=EOF; j++) {
+ color[j] = c;
+ c = XpmGetc(fp);
+ }
+@@ -185,14 +203,14 @@
while ((c == ' ') || (c == '\t'))
c = XpmGetc(fp);
@@ -27783,7 +41428,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
if (XParseColor(theDisp,theCmap,color,&col)) {
if (pinfo->type == PIC8) {
pinfo->r[i] = col.red >> 8;
-@@ -201,8 +211,8 @@
+@@ -201,8 +219,8 @@
c_sptr->cv_index = i;
/* Is there a better way to do this? */
@@ -27794,7 +41439,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
if (pinfo->r[i] == pinfo->g[i] &&
pinfo->g[i] == pinfo->b[i])
/* Still greyscale... */
-@@ -210,9 +220,9 @@
+@@ -210,9 +228,9 @@
else
/* It's color */
pinfo->colType = F_FULLCOLOR;
@@ -27806,7 +41451,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
if ((pinfo->r[i] == 0 || pinfo->r[i] == 0xff) &&
(pinfo->g[i] == 0 || pinfo->g[i] == 0xff) &&
(pinfo->b[i] == 0 || pinfo->b[i] == 0xff))
-@@ -221,10 +231,12 @@
+@@ -221,10 +239,12 @@
else
/* It's greyscale */
pinfo->colType = F_GREYSCALE;
@@ -27821,7 +41466,14 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
}
else { /* PIC24 */
c_sptr->cv_rgb[0] = col.red >> 8;
-@@ -242,7 +254,7 @@
+@@ -236,13 +256,13 @@
+ else { /* 'None' or unrecognized color spec */
+ int rgb;
+
+- if (strcmp(color, "None") == 0) rgb = 0xb2c0dc; /* infobg */
++ if (strcasecmp(color, "None") == 0) rgb = 0xb2c0dc; /* infobg */
+ else {
+ SetISTR(ISTR_INFO, "%s: unknown color spec '%s'", bname, color);
Timer(1000);
rgb = 0x808080;
}
@@ -27830,7 +41482,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
if (pinfo->type == PIC8) {
pinfo->r[i] = (rgb>>16) & 0xff;
pinfo->g[i] = (rgb>> 8) & 0xff;
-@@ -256,39 +268,39 @@
+@@ -256,39 +276,39 @@
}
}
@@ -27879,7 +41531,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
for (k = 0 ; k < cpp ; k++)
pixel[k] = XpmGetc(fp);
pixel[k] = '\0';
-@@ -300,7 +312,7 @@
+@@ -300,7 +320,7 @@
pixel);
return (XpmLoadError(bname, "Can't map resolve into colormap"));
}
@@ -27888,11 +41540,14 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
if (pinfo->type == PIC8)
*i_sptr++ = mapentry->cv_index;
else {
-@@ -310,27 +322,27 @@
+@@ -309,35 +329,36 @@
+ *i_sptr++ = mapentry->cv_rgb[2];
}
} /* for ( j < w ) */
- (void)XpmGetc(fp); /* Throw away the close " */
+- (void)XpmGetc(fp); /* Throw away the close " */
-
++ while (((c = XpmGetc(fp))!=EOF) && /* Throw away the close " and */
++ (c != '"')); /* erase all remaining pixels */
+
if (!(i%7)) WaitCursor();
} /* for ( i < h ) */
@@ -27922,7 +41577,15 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
return(1);
}
-@@ -349,17 +361,17 @@
+
+ /***************************************/
+ static int XpmLoadError(fname, st)
+- char *fname, *st;
++ const char *fname, *st;
+ {
+ SetISTR(ISTR_WARNING, "%s: %s", fname, st);
+ return 0;
+@@ -349,17 +370,17 @@
FILE *f;
{
int c, d, lastc;
@@ -27943,7 +41606,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
if (c == '"')
in_quote = !in_quote;
else if (!in_quote && c == '/') { /* might be a C-style comment */
-@@ -389,14 +401,14 @@
+@@ -389,14 +410,14 @@
/***************************************/
@@ -27960,7 +41623,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
sum = sum % hash_len;
return (sum);
}
-@@ -414,7 +426,7 @@
+@@ -414,7 +435,7 @@
*/
int i;
@@ -27969,7 +41632,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
hash_len = 257;
hashtab = (hentry **) malloc(sizeof(hentry *) * hash_len);
-@@ -425,7 +437,7 @@
+@@ -425,7 +446,7 @@
for (i = 0 ; i < hash_len ; i++)
hashtab[i] = NULL;
@@ -27978,7 +41641,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
return 1;
}
-@@ -436,22 +448,22 @@
+@@ -436,22 +457,22 @@
{
int key;
hentry *tmp;
@@ -28007,7 +41670,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
return 1;
}
-@@ -462,9 +474,9 @@
+@@ -462,9 +483,9 @@
{
int key;
hentry *tmp;
@@ -28019,7 +41682,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
tmp = hashtab[key];
while (tmp && strcmp(token, tmp->token)) {
tmp = tmp->next;
-@@ -479,7 +491,7 @@
+@@ -479,7 +500,7 @@
{
int i;
hentry *tmp;
@@ -28028,7 +41691,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
for (i=0; i<hash_len; i++) {
while (hashtab[i]) {
tmp = hashtab[i]->next;
-@@ -487,7 +499,7 @@
+@@ -487,7 +508,7 @@
hashtab[i] = tmp;
}
}
@@ -28037,7 +41700,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
free(hashtab);
return;
}
-@@ -508,10 +520,10 @@
+@@ -508,10 +529,10 @@
/* Note here, that tokenchars is assumed to contain 64 valid token */
/* characters. It's hardcoded to assume this for benefit of generating */
/* tokens, when there are more than 64^2 colors. */
@@ -28046,11 +41709,11 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
short i, imax, j; /* for() loop indices */
short cpp = 0;
- char *tokenchars =
-+ char *tokenchars =
++ const char *tokenchars =
".#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
char *tokens;
char image_name[256], *foo;
-@@ -523,20 +535,21 @@
+@@ -523,20 +544,20 @@
long li; /* for() loop index */
int numcol;
#endif
@@ -28064,10 +41727,11 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
else
printf("WriteXPM(): Write a colortype %d, PIC24 image.\n", col);
-
+- foo = BaseName(name);
+- strcpy(image_name, foo);
+ }
+
- foo = BaseName(name);
- strcpy(image_name, foo);
++ strcpy(image_name, BaseName(name));
foo = (char *)strchr(image_name, '.');
if (foo)
*foo = '\0'; /* Truncate name at first '.' */
@@ -28076,7 +41740,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
#ifdef USE_UNFINISHED_24BIT_WRITING_CODE
if (ptype == PIC24)
return -1;
-@@ -547,15 +560,15 @@
+@@ -547,15 +568,15 @@
/* 'packed'. Code in here to do that should be removed if */
/* Conv24to8 is "fixed" to do this... */
/* Chris P. Ross (cross@eng.umd.edu) 28-Sept-94 */
@@ -28095,7 +41759,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
"%s: Unable to convert to 8-bit image in WriteXPM()",
image_name);
return 1;
-@@ -594,7 +607,7 @@
+@@ -594,7 +615,7 @@
}
#endif
@@ -28104,7 +41768,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
#ifdef USE_UNFINISHED_24BIT_WRITING_CODE
if (ptype == PIC24) cpp = 4;
else if (numcol > 64) cpp = 2;
-@@ -609,7 +622,7 @@
+@@ -609,7 +630,7 @@
fprintf(fp, "/* width height num_colors chars_per_pixel */\n");
fprintf(fp, "\" %3d %3d %6d %1d\",\n", w, h, numcol, cpp);
fprintf(fp, "/* colors */\n");
@@ -28113,7 +41777,7 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
switch (cpp) {
case 1: /* <= 64 colors; index into tokenchars */
-@@ -681,12 +694,12 @@
+@@ -681,12 +702,12 @@
case 4:
/* Generate a colormap */
@@ -28128,9 +41792,9 @@ diff -ruN xv-3.10a/xvxpm.c xv-3.10a-bugfixes/xvxpm.c
if (fprintf(fp, "\"\n};\n") == EOF) {
return 1;
} else
-diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
+diff -ru xv-3.10a/xvxwd.c xv-3.10a-enhancements/xvxwd.c
--- xv-3.10a/xvxwd.c 1994-12-22 14:34:40.000000000 -0800
-+++ xv-3.10a-bugfixes/xvxwd.c 2005-03-28 22:37:07.000000000 -0800
++++ xv-3.10a-enhancements/xvxwd.c 2007-05-13 17:52:35.000000000 -0700
@@ -1,10 +1,10 @@
-/*
+/*
@@ -28144,18 +41808,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
** (e.g. DEC Alphas), 04/10/94
**
** Copyright (C) 1989, 1991 by Jef Poskanzer.
-@@ -19,47 +19,53 @@
- */
-
- #include "xv.h"
-+#include <limits.h> /* for CHAR_BIT */
-+
-+/* SJT: just in case ... */
-+#ifndef CHAR_BIT
-+# define CHAR_BIT 8
-+#endif
-
-
+@@ -24,42 +24,42 @@
/***************************** x11wd.h *****************************/
#define X11WD_FILE_VERSION 7
typedef struct {
@@ -28227,7 +41880,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
/*-------------------------------------------------------------------------*/
-@@ -67,7 +73,7 @@
+@@ -67,32 +67,35 @@
typedef byte pixel;
/* local functions */
@@ -28235,8 +41888,13 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
+static int getinit PARM((FILE *, int*, int*, int*, CARD32 *,
CARD32, PICINFO *));
static CARD32 getpixnum PARM((FILE *));
- static int xwdError PARM((char *));
-@@ -78,19 +84,27 @@
+-static int xwdError PARM((char *));
+-static void xwdWarning PARM((char *));
++static int xwdError PARM((const char *));
++static void xwdWarning PARM((const char *));
+ static int bs_short PARM((int));
+ static CARD32 bs_long PARM((CARD32));
+ static int readbigshort PARM((FILE *, CARD16 *));
static int readbiglong PARM((FILE *, CARD32 *));
static int readlittleshort PARM((FILE *, CARD16 *));
static int readlittlelong PARM((FILE *, CARD32 *));
@@ -28244,17 +41902,11 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
static int writebigshort PARM((FILE *, int));
static int writebiglong PARM((FILE *, CARD32));
+#endif
-+
-+static void getcolorshift PARM((CARD32, int *, int *)); /* SJT */
-+/* SJT: for 16bpp and 24bpp shifts */
-+static int red_shift_right, red_justify_left,
-+ grn_shift_right, grn_justify_left,
-+ blu_shift_right, blu_justify_left;
static byte *pic8, *pic24;
--static CARD32 red_mask, green_mask, blue_mask;
+ static CARD32 red_mask, green_mask, blue_mask;
-static int bits_per_item, bits_used, bit_shift, bits_per_pixel;
-+static CARD32 red_mask, grn_mask, blu_mask;
++static int red_shift, green_shift, blue_shift;
+static int bits_per_item, bits_used, bit_shift,
+ bits_per_pixel, bits_per_rgb;
static char buf[4];
@@ -28265,18 +41917,25 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
static int byte_swap, byte_order, bit_order, filesize;
-static byte bw[2] = {0, 0xff};
- static char *bname;
+-static char *bname;
++static const char *bname;
+
-@@ -105,7 +119,7 @@
+
+@@ -105,33 +108,38 @@
pixel *xP;
int col;
- int rows, cols, padright, row;
-+ int rows, cols, padright, row, npixels, bufsize;
- CARD32 maxval, visualclass;
+- CARD32 maxval, visualclass;
++ int rows=0, cols=0, padright=0, row, npixels, bufsize;
++ CARD32 maxval=0, visualclass=0;
FILE *ifp;
-@@ -116,22 +130,28 @@
+ bname = BaseName(fname);
+ pinfo->pic = (byte *) NULL;
+ pinfo->comment = (char *) NULL;
+- maxval = 0;
ifp = xv_fopen(fname, "r");
if (!ifp) return (xwdError("can't open file"));
@@ -28308,7 +41967,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
if (!pic8) {
xwdError("couldn't malloc 'pic'");
return 0;
-@@ -140,18 +160,18 @@
+@@ -140,18 +148,18 @@
for (row=0; row<rows; row++) {
for (col=0, xP=pic8+(row*cols); col<cols; col++, xP++)
*xP = getpixnum(ifp);
@@ -28330,7 +41989,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
if (!pic8) {
xwdError("couldn't malloc 'pic'");
return 0;
-@@ -162,15 +182,20 @@
+@@ -162,59 +170,70 @@
*xP = getpixnum(ifp);
for (col=0; col<padright; col++) getpixnum(ifp);
}
@@ -28354,14 +42013,14 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
if (!pic24) {
xwdError("couldn't malloc 'pic24'");
return 0;
-@@ -179,42 +204,44 @@
- for (row=0; row<rows; row++) {
- for (col=0, xP=pic24+(row*cols*3); col<cols; col++) {
- CARD32 ul;
+ }
+
+- for (row=0; row<rows; row++) {
+- for (col=0, xP=pic24+(row*cols*3); col<cols; col++) {
+- CARD32 ul;
-
-+
- ul = getpixnum(ifp);
- switch (bits_per_pixel) {
+- ul = getpixnum(ifp);
+- switch (bits_per_pixel) {
- case 16:
- *xP++ = ((ul & red_mask) >> 0);
- *xP++ = ((ul & green_mask) >> 5);
@@ -28375,29 +42034,44 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
- *xP++ = (ul>>16) & 0xff;
- break;
-
-+ case 16:
-+ case 24:
-+ case 32:
-+ /* SJT: shift all the way to the right and then shift left. The
-+ pairs of shifts could be combined. There will be two right and
-+ one left shift, but it's unknown which will be which. It seems
-+ easier to do the shifts (which might be 0) separately than to
-+ have a complex set of tests. I believe this is independent of
-+ byte order but I have no way to test.
-+ */
-+ *xP++ = ((ul & red_mask) >> red_shift_right) << red_justify_left;
-+ *xP++ = ((ul & grn_mask) >> grn_shift_right) << grn_justify_left;
-+ *xP++ = ((ul & blu_mask) >> blu_shift_right) << blu_justify_left;
-+ break;
-+
- default:
+- default:
- xwdError("True/Direct only supports 16, 24, and 32 bits");
-+ xwdError("True/Direct supports only 16, 24, and 32 bits");
- return 0;
- }
- }
+- return 0;
+- }
+- }
++ switch (bits_per_pixel) {
++ case 16:
++ case 24:
++ case 32:
++ ;
++ default:
++ xwdError("True/Direct supports only 16, 24, and 32 bits");
++ return 0;
++ }
- for (col=0; col<padright; col++) getpixnum(ifp);
+- for (col=0; col<padright; col++) getpixnum(ifp);
++ if (byte_order == MSBFirst) {
++ for (row=0; row<rows; row++) {
++ for (col=0, xP=pic24+(row*cols*3); col<cols; col++) {
++ register CARD32 ul = getpixnum(ifp);
++
++ *xP++ = ul >> red_shift & red_mask ;
++ *xP++ = ul >> green_shift & green_mask;
++ *xP++ = ul >> blue_shift & blue_mask ;
++ };
++ for (col=0; col<padright; col++) getpixnum(ifp);
++ }
++ } else {
++ for (row=0; row<rows; row++) {
++ for (col=0, xP=pic24+(row*cols*3); col<cols; col++) {
++ register CARD32 ul = getpixnum(ifp);
++
++ *xP++ = ul >> blue_shift & blue_mask ;
++ *xP++ = ul >> green_shift & green_mask;
++ *xP++ = ul >> red_shift & red_mask ;
++ };
++ for (col=0; col<padright; col++) getpixnum(ifp);
++ }
}
-
+
@@ -28417,7 +42091,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
((visualclass == StaticGray ) ? "StaticGray" :
(visualclass == GrayScale ) ? "GrayScale" :
(visualclass == StaticColor) ? "StaticColor" :
-@@ -258,10 +285,10 @@
+@@ -258,10 +277,10 @@
maxv = 255L;
h11P = (X11WDFileHeader*) header;
@@ -28430,7 +42104,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
if (h11P->file_version != X11WD_FILE_VERSION) {
byte_swap = 1;
h11P->header_size = bs_long(h11P->header_size);
-@@ -279,8 +306,8 @@
+@@ -279,8 +298,8 @@
h11P->bytes_per_line = bs_long(h11P->bytes_per_line);
h11P->visual_class = bs_long(h11P->visual_class);
h11P->red_mask = bs_long(h11P->red_mask);
@@ -28441,7 +42115,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
h11P->bits_per_rgb = bs_long(h11P->bits_per_rgb);
h11P->colormap_entries = bs_long(h11P->colormap_entries);
h11P->ncolors = bs_long(h11P->ncolors);
-@@ -294,7 +321,7 @@
+@@ -294,7 +313,7 @@
for (i=0; i<h11P->header_size - sizeof(*h11P); i++)
if (getc(file) == EOF)
return(xwdError("couldn't read rest of X11 XWD file header"));
@@ -28450,21 +42124,23 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
/* Check whether we can handle this dump. */
if (h11P->pixmap_depth > 24)
return(xwdError("can't handle X11 pixmap_depth > 24"));
-@@ -303,27 +330,31 @@
+@@ -303,27 +322,31 @@
return(xwdError("can't handle X11 bits_per_rgb > 24"));
if (h11P->pixmap_format != ZPixmap && h11P->pixmap_depth != 1) {
- sprintf(errstr, "can't handle X11 pixmap_format %d with depth != 1",
+- h11P->pixmap_format);
+ sprintf(errstr, "can't handle X11 pixmap_format %ld with depth != 1",
- h11P->pixmap_format);
++ (long)h11P->pixmap_format);
return(xwdError(errstr));
}
if (h11P->bitmap_unit != 8 && h11P->bitmap_unit != 16 &&
h11P->bitmap_unit != 32) {
- sprintf(errstr, "X11 bitmap_unit (%d) is non-standard - can't handle",
+- h11P->bitmap_unit);
+ sprintf(errstr, "X11 bitmap_unit (%ld) is non-standard - can't handle",
- h11P->bitmap_unit);
++ (long)h11P->bitmap_unit);
return(xwdError(errstr));
}
-
@@ -28489,7 +42165,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
if (word64) {
for (i = 0; i < h11P->ncolors; ++i) {
if (fread(&pad, sizeof(pad), (size_t) 1, file ) != 1)
-@@ -334,11 +365,11 @@
+@@ -334,11 +357,11 @@
}
}
else {
@@ -28503,20 +42179,20 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
for (i = 0; i < h11P->ncolors; ++i) {
if (byte_swap) {
x11colors[i].red = (CARD16) bs_short(x11colors[i].red);
-@@ -356,8 +387,11 @@
+@@ -356,8 +379,11 @@
grayscale = 0;
}
}
-
+
*visualclassP = h11P->visual_class;
-+ /* SJT: FIXME. If bits_per_pixel == 16 maxv could be either 31 or 63.
++ /* SJT: FIXME. If bits_per_pixel == 16, maxv could be either 31 or 63.
+ It doesn't matter, though, because maxv is never used beyond here.
+ */
if (*visualclassP == TrueColor || *visualclassP == DirectColor) {
if (h11P->bits_per_pixel == 16) maxv = 31;
else maxv = 255;
-@@ -389,24 +423,48 @@
+@@ -389,24 +415,58 @@
}
}
}
@@ -28551,7 +42227,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
+
+
+ /* which raises the question: how (can?) you ever have a 24 bits per pix,
-+ (ie, 3 bytes, no alpha/padding) */
++ (i.e., 3 bytes, no alpha/padding) */
+
+
+ bits_used = bits_per_item;
@@ -28559,65 +42235,30 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
if (bits_per_pixel == sizeof(pixel_mask) * 8) pixel_mask = (CARD32) -1;
else pixel_mask = (1 << bits_per_pixel) - 1;
-
-- red_mask = h11P->red_mask;
++
+ red_mask = h11P->red_mask;
- green_mask = h11P->green_mask;
- blue_mask = h11P->blue_mask;
++ green_mask = h11P->grn_mask;
++ blue_mask = h11P->blu_mask;
+
-+ red_mask = h11P->red_mask;
-+ grn_mask = h11P->grn_mask;
-+ blu_mask = h11P->blu_mask;
-+
-+ getcolorshift(red_mask, &red_shift_right, &red_justify_left);
-+ getcolorshift(grn_mask, &grn_shift_right, &grn_justify_left);
-+ getcolorshift(blu_mask, &blu_shift_right, &blu_justify_left);
-
- byteP = (char *) buf;
- shortP = (CARD16 *) buf;
-@@ -416,18 +474,57 @@
- }
-
-
-+/* SJT: figure out the proper shifts */
-+static void getcolorshift (CARD32 mask, int *rightshift, int *leftshift)
-+{
-+ int lshift, rshift;
-+ unsigned int uu;
-+
-+ if (mask == 0)
-+ {
-+ *rightshift = *leftshift = 0;
-+ return;
++ red_shift = blue_shift = green_shift = 0;
++ while (!(red_mask & 1)) {
++ red_mask >>= 1;
++ ++red_shift;
+ }
-+
-+ uu = mask;
-+ lshift = rshift = 0;
-+ while ((uu & 0xf) == 0)
-+ {
-+ rshift += 4;
-+ uu >>= 4;
++ while (!(blue_mask & 1)) {
++ blue_mask >>= 1;
++ ++blue_shift;
+ }
-+ while ((uu & 1) == 0)
-+ {
-+ rshift++;
-+ uu >>= 1;
++ while (!(green_mask & 1)) {
++ green_mask >>= 1;
++ ++green_shift;
+ }
-+
-+ while (uu != 0)
-+ {
-+ if (uu & 1)
-+ {
-+ lshift++;
-+ uu >>= 1;
-+ }
-+ }
-+ *rightshift = rshift;
-+ *leftshift = CHAR_BIT * sizeof(pixel) - lshift;
-+ return;
-+}
-+
-+
- /******************************/
- static CARD32 getpixnum(file)
+
+ byteP = (char *) buf;
+ shortP = (CARD16 *) buf;
+@@ -421,13 +481,13 @@
FILE* file;
{
int n;
@@ -28633,7 +42274,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
case 16:
if (byte_order == MSBFirst) {
if (readbigshort(file, shortP) == -1)
-@@ -438,7 +535,7 @@
+@@ -438,7 +498,7 @@
xwdWarning("unexpected EOF");
}
break;
@@ -28642,7 +42283,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
case 32:
if (byte_order == MSBFirst) {
if (readbiglong(file, longP) == -1)
-@@ -449,41 +546,41 @@
+@@ -449,48 +509,48 @@
xwdWarning("unexpected EOF");
}
break;
@@ -28692,7 +42333,24 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
return n;
}
-@@ -511,7 +608,7 @@
+
+ /***************************/
+ static int xwdError(st)
+- char *st;
++ const char *st;
+ {
+ if (pic8 != NULL) free(pic8);
+ if (pic24 != NULL) free(pic24);
+@@ -502,7 +562,7 @@
+
+ /***************************/
+ static void xwdWarning(st)
+- char *st;
++ const char *st;
+ {
+ SetISTR(ISTR_WARNING,"%s: %s", bname, st);
+ }
+@@ -511,7 +571,7 @@
@@ -28701,7 +42359,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
* Byte-swapping junk.
*/
-@@ -537,7 +634,7 @@
+@@ -537,7 +597,7 @@
{
union cheat u;
unsigned char t;
@@ -28710,7 +42368,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
u.l = l;
t = u.c[0]; u.c[0] = u.c[3]; u.c[3] = t;
t = u.c[1]; u.c[1] = u.c[2]; u.c[2] = t;
-@@ -549,7 +646,7 @@
+@@ -549,7 +609,7 @@
@@ -28719,7 +42377,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
* Endian I/O.
*/
-@@ -584,7 +681,7 @@
+@@ -584,7 +644,7 @@
{
*sP = getc(in) & 0xff;
*sP |= (getc(in) & 0xff) << 8;
@@ -28728,7 +42386,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
if (ferror(in)) return -1;
return 0;
}
-@@ -604,6 +701,7 @@
+@@ -604,6 +664,7 @@
}
@@ -28736,7 +42394,7 @@ diff -ruN xv-3.10a/xvxwd.c xv-3.10a-bugfixes/xvxwd.c
static int writebiglong(out, l)
FILE* out;
CARD32 l;
-@@ -624,3 +722,4 @@
+@@ -624,3 +685,4 @@
putc(s&0xff, out);
return 0;
}
diff --git a/source/xap/xv/xv.SlackBuild b/source/xap/xv/xv.SlackBuild
index 3ef40a7ba..95042cd8b 100755
--- a/source/xap/xv/xv.SlackBuild
+++ b/source/xap/xv/xv.SlackBuild
@@ -21,8 +21,17 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
VERSION=3.10a
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-5}
+BUILD=${BUILD:-6}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
CWD=$(pwd)
TMP=${TMP:-/tmp}
@@ -33,16 +42,18 @@ mkdir -p $TMP $PKG
cd $TMP
rm -rf xv-3.10
-tar xvf $CWD/xv-3.10.tar.gz || exit 1
+tar xvf $CWD/xv-3.10.tar.?z* || exit 1
cd xv-3.10 || exit 1
chown -R root:root .
-zcat $CWD/xv-3.10a.patch.gz | patch -p0 --verbose --backup --suffix=.orig || exit
-bzcat $CWD/xv-3.10a-jumbo-fix-patch-20050410.txt.bz2 | patch -p1 --verbose --backup --suffix=.orig || exit
-bzcat $CWD/xv-3.10a-jumbo-enh-patch-20050501.txt.bz2 | patch -p1 --verbose --backup --suffix=.orig || exit
-zcat $CWD/xv.prefix.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit
+zcat $CWD/xv-3.10a.patch.gz | patch -p0 --verbose --backup --suffix=.orig || exit 1
+bzcat $CWD/xv-3.10a-jumbo-fix-enh-patch-20070520.txt.bz2 | patch -p1 --verbose --backup --suffix=.orig || exit 1
+bzcat $CWD/xv-3.10a-jumbo-additions.diff.bz2 | patch -p1 --verbose --backup --suffix=.orig || exit 1
+bzcat $CWD/xv-3.10a-enhancements.20070520-20081216.diff.bz2 | patch -p1 --verbose --backup --suffix=.orig || exit 1
+zcat $CWD/xv.prefix.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
if [ "$ARCH" = "x86_64" ]; then
- zcat $CWD/xv.prefix_x86_64.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit
+ zcat $CWD/xv.prefix_x86_64.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
fi
+zcat $CWD/xv.jasper.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
make -f Makefile.std
strip --strip-unneeded bggen vdcomp xcmap xv xvpictoppm
mkdir -p $PKG/usr/bin
diff --git a/source/xap/xv/xv.jasper.diff b/source/xap/xv/xv.jasper.diff
new file mode 100644
index 000000000..8e933ee5a
--- /dev/null
+++ b/source/xap/xv/xv.jasper.diff
@@ -0,0 +1,20 @@
+--- ./Makefile.std.orig 2010-02-19 13:24:58.000000000 -0600
++++ ./Makefile.std 2010-02-19 13:27:20.000000000 -0600
+@@ -179,13 +179,13 @@
+ JP2K = -DDOJP2K
+ ###
+ #JP2KDIR = ../../jasper
+-JP2KDIR = /usr/local/lib
++JP2KDIR = /usr
+ ###
+ #JP2KINC = -I$(JP2KDIR)
+-JP2KINC = -I/usr/local/include
++JP2KINC = -I/usr/include
+ ###
+-#JP2KLIB = -L$(JP2KDIR) -ljasper
+-JP2KLIB = $(JP2KDIR)/libjasper.a
++JP2KLIB = -L$(JP2KDIR) -ljasper
++#JP2KLIB = $(JP2KDIR)/libjasper.a
+
+
+ ###
diff --git a/source/xap/xv/xv.prefix.diff b/source/xap/xv/xv.prefix.diff
index 0e6108333..7d57757a9 100644
--- a/source/xap/xv/xv.prefix.diff
+++ b/source/xap/xv/xv.prefix.diff
@@ -1,11 +1,11 @@
---- ./Makefile.std.orig 2005-07-12 15:15:19.000000000 -0700
-+++ ./Makefile.std 2005-07-12 15:16:08.000000000 -0700
-@@ -41,7 +41,7 @@
-
-
- ### Installation locations
+--- ./Makefile.std.orig 2010-02-19 13:12:10.000000000 -0600
++++ ./Makefile.std 2010-02-19 13:14:50.000000000 -0600
+@@ -56,7 +56,7 @@
+ ### NOTE: Users of old K&R compilers (i.e., any version not supporting C89
+ ### string concatenation, such as "fub" "ar" => "fubar") should update
+ ### xvtext.c:1831 (or thereabouts) if either PREFIX or DOCDIR changes:
-PREFIX = /usr/local
-+PREFIX = /usr/X11R6
++PREFIX = /usr
BINDIR = $(PREFIX)/bin
- MANDIR = $(PREFIX)/man/man1
+ MANDIR = $(PREFIX)/share/man/man1
MANSUF = 1
diff --git a/source/xap/xv/xv.prefix_x86_64.diff b/source/xap/xv/xv.prefix_x86_64.diff
index fd6803d50..8f629c344 100644
--- a/source/xap/xv/xv.prefix_x86_64.diff
+++ b/source/xap/xv/xv.prefix_x86_64.diff
@@ -1,20 +1,20 @@
---- xv-3.10/Makefile.std.orig 2008-11-06 22:16:03.000000000 +0000
-+++ xv-3.10/Makefile.std 2008-11-06 22:24:11.000000000 +0000
-@@ -46,7 +46,7 @@
- MANDIR = $(PREFIX)/man/man1
+--- ./Makefile.std.orig 2010-02-19 13:15:05.000000000 -0600
++++ ./Makefile.std 2010-02-19 13:16:10.000000000 -0600
+@@ -61,7 +61,7 @@
+ MANDIR = $(PREFIX)/share/man/man1
MANSUF = 1
- DOCDIR = $(PREFIX)/doc/xv-3.10a
+ DOCDIR = $(PREFIX)/share/doc/xv
-LIBDIR = $(PREFIX)/lib/xv
+LIBDIR = $(PREFIX)/lib64/xv
- SYSCONFDIR = $(PREFIX)/etc
+ SYSCONFDIR = /etc
DESTDIR =
-@@ -200,7 +200,7 @@
+@@ -236,7 +236,7 @@
- ### for LINUX, uncomment the following line
+ ### for Linux, uncomment one of the following lines:
-#MCHN = -DLINUX -L/usr/X11R6/lib
+MCHN = -DLINUX -L/usr/X11R6/lib64
+ #MCHN = -DLINUX -L/usr/X11R6/lib64
- # For SCO 1.1 (UNIX 3.2v2) machines, uncomment the following: