rpms/xloadimage/EL-5 01_libjpeg-support.dpatch, NONE, 1.1 02_png-support.dpatch, NONE, 1.1 03_security-strfoo.dpatch, NONE, 1.1 04_previous-image.dpatch, NONE, 1.1 05_idelay-manpage.dpatch, NONE, 1.1 06_-Wall-cleanup.dpatch, NONE, 1.1 07_SYSPATHFILE.dpatch, NONE, 1.1 08_manpage-config-path.dpatch, NONE, 1.1 09_xloadimagerc-path.dpatch, NONE, 1.1 10_config.c-HOME-fix.dpatch, NONE, 1.1 11_fork-implies-quiet.dpatch, NONE, 1.1 12_fix-tile.dpatch, NONE, 1.1 13_varargs-is-obsolete.dpatch, NONE, 1.1 14_errno-not-extern.dpatch, NONE, 1.1 15_CAN-2005-0638.dpatch, NONE, 1.1 16_CAN-2005-0639.dpatch, NONE, 1.1 17_security-sprintf.dpatch, NONE, 1.1 18_manpage_fixes.dpatch, NONE, 1.1 19_fix_root_c_resource_leak.dpatch, NONE, 1.1 xloadimage.spec, NONE, 1.1 sources, 1.1, 1.2

Tom Callaway spot at fedoraproject.org
Wed Dec 10 16:33:39 UTC 2008


Author: spot

Update of /cvs/pkgs/rpms/xloadimage/EL-5
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26242/EL-5

Modified Files:
	sources 
Added Files:
	01_libjpeg-support.dpatch 02_png-support.dpatch 
	03_security-strfoo.dpatch 04_previous-image.dpatch 
	05_idelay-manpage.dpatch 06_-Wall-cleanup.dpatch 
	07_SYSPATHFILE.dpatch 08_manpage-config-path.dpatch 
	09_xloadimagerc-path.dpatch 10_config.c-HOME-fix.dpatch 
	11_fork-implies-quiet.dpatch 12_fix-tile.dpatch 
	13_varargs-is-obsolete.dpatch 14_errno-not-extern.dpatch 
	15_CAN-2005-0638.dpatch 16_CAN-2005-0639.dpatch 
	17_security-sprintf.dpatch 18_manpage_fixes.dpatch 
	19_fix_root_c_resource_leak.dpatch xloadimage.spec 
Log Message:
initial branching


--- NEW FILE 01_libjpeg-support.dpatch ---
#! /bin/sh -e
## 01_libjpeg-support.dpatch by Yoshida Hiroshi <BXH04165 at nifty.ne.jp>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add support for libjpeg6b and other misc fixes.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0
				    
diff -urNad 01.xloadimage.tmp/Makefile.in 01.xloadimage/Makefile.in
--- 01.xloadimage.tmp/Makefile.in	1970-01-01 01:00:00.000000000 +0100
+++ 01.xloadimage/Makefile.in	2003-04-03 00:11:28.000000000 +0100
@@ -0,0 +1,51 @@
+#
+# Makefile for autoconf tutorial
+#
+
+CC = @CC@
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@
+XLIB = @X_LIBS@ @X_PRE_LIBS@ -lX11 @X_EXTRA_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+
+SRCS = bright.c clip.c cmuwmraster.c compress.c config.c \
+dither.c faces.c fbm.c fill.c gif.c halftone.c imagetypes.c img.c jpeg.c \
+mac.c mc_tables.c mcidas.c merge.c misc.c new.c niff.c options.c \
+pbm.c pcx.c pdsuncomp.c reduce.c rle.c rlelib.c root.c rotate.c \
+send.c smooth.c sunraster.c tiff.c undither.c value.c vff.c \
+vicar.c window.c xbitmap.c xloadimage.c xpixmap.c xwd.c zio.c zoom.c
+
+OBJS = $(SRCS:.c=.o)
+PROG = xloadimage
+
+all: $(PROG) uufilter
+
+$(PROG): $(OBJS)
+	./build-info
+	$(CC) $(CFLAGS) -c $(DEFS) build.c 
+	$(CC) -o $@ $(OBJS) build.o$(LDFLAGS) $(XLIB) $(LIBS)
+
+uufilter: uufilter.c
+	$(CC) $(CFLAGS) $(DEFS) uufilter.c -o $@
+
+.c.o: config.h image.h
+	$(CC) $(CFLAGS) -c $(DEFS) $<
+
+build.c:
+	./build-info
+clean:
+	rm -f $(PROG) uufilter build.c *.o
+
+distclean:
+	make clean
+	rm -f config.log config.cache config.status config.h Makefile
+
+config.h.in: configure.in
+	autoheader
+
+configure: configure.in
+	autoconf
+
+Makefile: Makefile.in
+	./configure
diff -urNad 01.xloadimage.tmp/config.h.in 01.xloadimage/config.h.in
--- 01.xloadimage.tmp/config.h.in	1970-01-01 01:00:00.000000000 +0100
+++ 01.xloadimage/config.h.in	2003-04-03 00:11:28.000000000 +0100
@@ -0,0 +1,40 @@
+/* config.h.in.  Generated automatically from configure.in by autoheader.  */
+
+/* Define as the return type of signal handlers (int or void).  */
+#undef RETSIGTYPE
+
+/* Define if you have the ANSI C header files.  */
+#undef STDC_HEADERS
+
+/* Define if the X Window System is missing or not being used.  */
+#undef X_DISPLAY_MISSING
+
+/* Define if you have the mkdir function.  */
+#undef HAVE_MKDIR
+
+/* Define if you have the select function.  */
+#undef HAVE_SELECT
+
+/* Define if you have the <malloc.h> header file.  */
+#undef HAVE_MALLOC_H
+
+/* Define if you have the <strings.h> header file.  */
+#undef HAVE_STRINGS_H
+
+/* Define if you have the <sys/time.h> header file.  */
+#undef HAVE_SYS_TIME_H
+
+/* Define if you have the <unistd.h> header file.  */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the jpeg library (-ljpeg).  */
+#undef HAVE_LIBJPEG
+
+/* Define if you have the m library (-lm).  */
+#undef HAVE_LIBM
+
+/* Define if you have the tiff library (-ltiff).  */
+#undef HAVE_LIBTIFF
+
+/* Define if you have the z library (-lz).  */
+#undef HAVE_LIBZ
diff -urNad 01.xloadimage.tmp/configure 01.xloadimage/configure
--- 01.xloadimage.tmp/configure	1970-01-01 01:00:00.000000000 +0100
+++ 01.xloadimage/configure	2003-04-03 00:11:28.000000000 +0100
@@ -0,0 +1,2357 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.12 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+  --with-x                use the X Window System"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+# 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"
+    ac_prev=
+    continue
+  fi
+
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case "$ac_option" in
+
[...3804 lines suppressed...]
 	for(j=0;j<total;j++)	
 	{
diff -urNad 01.xloadimage.tmp/sunraster.c 01.xloadimage/sunraster.c
--- 01.xloadimage.tmp/sunraster.c	1993-10-21 22:28:42.000000000 +0100
+++ 01.xloadimage/sunraster.c	2003-04-03 00:11:28.000000000 +0100
@@ -240,7 +240,8 @@
   case RTIFF: /* sorry, don't even know what these are */
   case RIFF:
   default:
-    fprintf(stderr, "%s: Unsupported Sun Rasterfile image type (sorry)\n");
+    fprintf(stderr, "%s: Unsupported Sun Rasterfile image type (sorry)\n",
+	    name);
     return(NULL);
   }
 
diff -urNad 01.xloadimage.tmp/tiff.c 01.xloadimage/tiff.c
--- 01.xloadimage.tmp/tiff.c	1993-11-08 15:15:42.000000000 +0000
+++ 01.xloadimage/tiff.c	2003-04-03 00:11:28.000000000 +0100
@@ -5,10 +5,10 @@
  * jim frost 09.05.93
  */
 
-#ifdef HAS_TIFF
-
 #include "image.h"
-#include "tiff/tiffio.h"
+#ifdef HAVE_LIBTIFF
+
+#include <tiffio.h>
 
 /* this structure contains all the information we care about WRT a TIFF
  * image.
@@ -217,7 +217,7 @@
 	   compressionName(info->compression));
   }
   if (info->title)
-    printf("Titled \"%s\"");
+    printf("Titled \"%s\"", info->title);
   printf("\n");
 }
 
@@ -227,14 +227,14 @@
   struct tiff_info info;
 
   tiff = is_tiff(fullname, name, &info);
-  babble(name, info);
   if (tiff == NULL)
     return(0);
+  babble(name, &info);
   if (tiff == (TIFF *)-1) /* is TIFF, but can't open it */
     return(1);
   TIFFClose(tiff);
 
-  babble(fullname, name, info);
+/*  babble(fullname, name, info); */
   return(1);
 }
 
@@ -404,6 +404,7 @@
     if (info.samplesperpixel != 3) {
       fprintf(stderr,
 	      "%s: Can't handle TIFF RGB images with %d samples per pixel, sorry\n",
+	      fullname,
 	      info.samplesperpixel);
       image = NULL;
       break;
@@ -624,6 +625,6 @@
   TIFFClose(out);
 }
 
-#else /* !HAS_TIFF */
+#else /* !HAVE_LIBTIFF */
 static int unused;
-#endif /* !HAS_TIFF */
+#endif /* !HAVE_LIBTIFF */
diff -urNad 01.xloadimage.tmp/uufilter.c 01.xloadimage/uufilter.c
--- 01.xloadimage.tmp/uufilter.c	1993-10-28 16:03:31.000000000 +0000
+++ 01.xloadimage/uufilter.c	2003-04-03 00:11:28.000000000 +0100
@@ -11,8 +11,9 @@
  */
 
 #include <stdio.h>
+#include <string.h>
 
-main(argc, argv)
+int main(argc, argv)
      int argc;
      char **argv;
 {
@@ -64,7 +65,7 @@
       fprintf(stderr, "Ignoring header line: %s\n", buf);
   }
   if (feof(inf)) {
-    fprintf(stderr, "No 'begin' line, sorry.\n", infilename);
+    fprintf(stderr, "%s: No 'begin' line, sorry.\n", infilename);
     exit(1);
   }
 
diff -urNad 01.xloadimage.tmp/vff.c 01.xloadimage/vff.c
--- 01.xloadimage.tmp/vff.c	1993-10-27 14:22:58.000000000 +0000
+++ 01.xloadimage/vff.c	2003-04-03 00:11:28.000000000 +0100
@@ -29,6 +29,7 @@
  */
 
 
+#include <ctype.h>
 #include "image.h"
 
 #define HEAD_BUF_SIZE	2048
diff -urNad 01.xloadimage.tmp/window.c 01.xloadimage/window.c
--- 01.xloadimage.tmp/window.c	1993-11-08 21:06:02.000000000 +0000
+++ 01.xloadimage/window.c	2003-04-03 00:11:28.000000000 +0100
@@ -15,7 +15,7 @@
 #include <X11/Xatom.h>
 #include <signal.h>
 #include <errno.h>
-#include <sys/types.h>
+#include <sys/time.h>
 #ifdef HAS_POLL
 #include <poll.h>
 #else /* !HAS_POLL */
@@ -616,13 +616,13 @@
     lastx= (winwidth || winheight); /* user set size flag */
     if (!winwidth) {
       winwidth= image->width;
-      if (winwidth > DisplayWidth(disp, scrn) * 0.9)
-	winwidth= DisplayWidth(disp, scrn) * 0.9;
+      if (winwidth > DisplayWidth(disp, scrn) * 0.98)
+	winwidth= DisplayWidth(disp, scrn) * 0.98;
     }
     if (!winheight) {
       winheight= image->height;
-      if (winheight > DisplayHeight(disp, scrn) * 0.9)
-	winheight= DisplayHeight(disp, scrn) * 0.9;
+      if (winheight > DisplayHeight(disp, scrn) * 0.95)
+	winheight= DisplayHeight(disp, scrn) * 0.95;
     }
   }
 
@@ -902,10 +902,25 @@
 
     switch (event.any.type) {
     case ButtonPress:
-      if (event.button.button == 1) {
+      switch (event.button.button) {
+      case 1:
 	lastx= event.button.x;
 	lasty= event.button.y;
 	break;
+      case 3:
+	if (delay)
+	  alarm(0);
+	{
+	   Cursor cursor;
+	   cursor= swa_view.cursor;
+	   swa_view.cursor= XCreateFontCursor(disp, XC_watch);
+	   XChangeWindowAttributes(disp, ViewportWin, CWCursor, &swa_view);
+	   XFreeCursor(disp, cursor);
+	   XFlush(disp);
+	   cleanUpImage(disp, scrn, swa_view.cursor, pixmap,
+			image, ximageinfo);
+	}
+	return(' ');
       }
       break;
 
diff -urNad 01.xloadimage.tmp/xbitmap.c 01.xloadimage/xbitmap.c
--- 01.xloadimage.tmp/xbitmap.c	1993-10-21 22:28:43.000000000 +0100
+++ 01.xloadimage/xbitmap.c	2003-04-03 00:11:28.000000000 +0100
@@ -132,7 +132,7 @@
   char          name_and_type[MAX_SIZE];
   char         *type;
   int           value;
-  int           v10p;
+  int           v10p = 0;
   unsigned int  linelen, dlinelen;
   unsigned int  x, y;
   unsigned int  w = 0, h = 0;
diff -urNad 01.xloadimage.tmp/xloadimage.c 01.xloadimage/xloadimage.c
--- 01.xloadimage.tmp/xloadimage.c	1993-11-05 14:11:46.000000000 +0000
+++ 01.xloadimage/xloadimage.c	2003-04-03 00:11:28.000000000 +0100
@@ -18,8 +18,6 @@
 #endif
 #include <signal.h>
 
-extern double atof();
-
 char *ProgramName= "xloadimage";
 
 /* if an image loader needs to have our display and screen, it will get
@@ -192,7 +190,9 @@
    */
 
   signal(SIGSEGV, internalError);
+#ifdef	SIGBUS
   signal(SIGBUS, internalError);
+#endif
   signal(SIGFPE, internalError);
   signal(SIGILL, internalError);
 #if defined(_AIX) && defined(_IBMR2)


--- NEW FILE 02_png-support.dpatch ---
#! /bin/sh -e
## 02_png-support.dpatch by Yoshida Hiroshi <BXH04165 at nifty.ne.jp>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add support for PNG images and other misc fixes.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

@DPATCH@
diff -urNad xloadimage-4.1~/Makefile.in xloadimage-4.1/Makefile.in
--- xloadimage-4.1~/Makefile.in	2005-12-06 02:59:07.000000000 +0000
+++ xloadimage-4.1/Makefile.in	2005-12-06 02:59:07.000000000 +0000
@@ -5,7 +5,7 @@
 CC = @CC@
 DEFS = @DEFS@
 CFLAGS = @CFLAGS@
-XLIB = @X_LIBS@ @X_PRE_LIBS@ -lX11 @X_EXTRA_LIBS@
+XLIB = @X_LIBS@ -lX11 @X_EXTRA_LIBS@
 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
 
@@ -14,7 +14,7 @@
 mac.c mc_tables.c mcidas.c merge.c misc.c new.c niff.c options.c \
 pbm.c pcx.c pdsuncomp.c reduce.c rle.c rlelib.c root.c rotate.c \
 send.c smooth.c sunraster.c tiff.c undither.c value.c vff.c \
-vicar.c window.c xbitmap.c xloadimage.c xpixmap.c xwd.c zio.c zoom.c
+vicar.c window.c xbitmap.c xloadimage.c xpixmap.c xwd.c zio.c zoom.c png.c
 
 OBJS = $(SRCS:.c=.o)
 PROG = xloadimage
@@ -24,7 +24,7 @@
 $(PROG): $(OBJS)
 	./build-info
 	$(CC) $(CFLAGS) -c $(DEFS) build.c 
-	$(CC) -o $@ $(OBJS) build.o$(LDFLAGS) $(XLIB) $(LIBS)
+	$(CC) -o $@ $(OBJS) build.o $(LDFLAGS) $(XLIB) $(LIBS)
 
 uufilter: uufilter.c
 	$(CC) $(CFLAGS) $(DEFS) uufilter.c -o $@
@@ -34,8 +34,13 @@
 
 build.c:
 	./build-info
+
 clean:
-	rm -f $(PROG) uufilter build.c *.o
+	rm -f autoconfig build.c err
+#	cd jpeg ; make clean
+#	cd tiff ; make clean
+	rm -f *.o *~ xloadimage uufilter autoconfig libconfig packtar \
+	  buildshar doshar shar.* *.tar *.tar.Z *.tc
 
 distclean:
 	make clean
diff -urNad xloadimage-4.1~/bright.c xloadimage-4.1/bright.c
--- xloadimage-4.1~/bright.c	2005-12-06 02:59:04.000000000 +0000
+++ xloadimage-4.1/bright.c	2005-12-06 02:59:07.000000000 +0000
@@ -73,9 +73,10 @@
      double disp_gam;
      unsigned int verbose;
 { int          a;
-  int gammamap[256];
-  unsigned int size;
+  static int gammamap[256];
   byte        *destptr;
+  const byte  *endptr, *srcptr;
+  static double old_gamma = -1.0;
 
   goodImage(image, "gammacorrect");
   if (BITMAPP(image)) /* we're AT&T */
@@ -86,7 +87,9 @@
     fflush(stdout);
   }
 
-  make_gamma(disp_gam,gammamap);
+  if( disp_gam != old_gamma)
+    make_gamma(disp_gam,gammamap);
+  old_gamma = disp_gam;
 
   switch (image->type) {
   case IRGB:
@@ -98,12 +101,13 @@
     break;
 
   case ITRUE:
-    size= image->width * image->height * 3;
-    destptr= image->data;
-    for (a= 0; a < size; a++) {
-      *destptr= gammamap[*destptr];
-      destptr++;
-    }
+    srcptr = destptr = image->data;
+    endptr = destptr + image->width * image->height * 3;
+    do {
+      *destptr++ = gammamap[*srcptr++];
+      *destptr++ = gammamap[*srcptr++];
+      *destptr++ = gammamap[*srcptr++];
+    } while (srcptr < endptr);
     break;
   }
 
diff -urNad xloadimage-4.1~/compress.c xloadimage-4.1/compress.c
--- xloadimage-4.1~/compress.c	2005-12-06 02:59:04.000000000 +0000
+++ xloadimage-4.1/compress.c	2005-12-06 02:59:07.000000000 +0000
@@ -30,7 +30,7 @@
 
 #define NIL_PIXEL 0xffffffff
 
-void compress(image, verbose)
+void compress_cmap(image, verbose)
      Image        *image;
      unsigned int  verbose;
 { Pixel         hash_table[32768];
diff -urNad xloadimage-4.1~/config.c xloadimage-4.1/config.c
--- xloadimage-4.1~/config.c	2005-12-06 02:59:04.000000000 +0000
+++ xloadimage-4.1/config.c	2005-12-06 02:59:07.000000000 +0000
@@ -17,7 +17,7 @@
 #include <pwd.h>
 #endif
 #include <errno.h>
-#ifndef IS_BSD
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
diff -urNad xloadimage-4.1~/config.h.in xloadimage-4.1/config.h.in
--- xloadimage-4.1~/config.h.in	2005-12-06 02:59:07.000000000 +0000
+++ xloadimage-4.1/config.h.in	2005-12-06 02:59:07.000000000 +0000
@@ -9,9 +9,6 @@
 /* Define if the X Window System is missing or not being used.  */
 #undef X_DISPLAY_MISSING
 
-/* Define if you have the mkdir function.  */
-#undef HAVE_MKDIR
-
 /* Define if you have the select function.  */
 #undef HAVE_SELECT
 
@@ -27,14 +24,17 @@
 /* Define if you have the <unistd.h> header file.  */
 #undef HAVE_UNISTD_H
 
-/* Define if you have the jpeg library (-ljpeg).  */
-#undef HAVE_LIBJPEG
-
 /* Define if you have the m library (-lm).  */
 #undef HAVE_LIBM
 
+/* Define if you have the jpeg library (-ljpeg).  */
+#undef HAVE_LIBJPEG
+
 /* Define if you have the tiff library (-ltiff).  */
 #undef HAVE_LIBTIFF
 
+/* Define if you have the png library (-lpng).  */
+#undef HAVE_LIBPNG
+
 /* Define if you have the z library (-lz).  */
 #undef HAVE_LIBZ
diff -urNad xloadimage-4.1~/configure xloadimage-4.1/configure
--- xloadimage-4.1~/configure	2005-12-06 02:59:07.000000000 +0000
+++ xloadimage-4.1/configure	2005-12-06 02:59:07.000000000 +0000
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12 
+# Generated automatically using autoconf version 2.13 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -51,6 +51,7 @@
 # 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
 
@@ -334,7 +335,7 @@
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.12"
+    echo "configure generated by autoconf version 2.13"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -504,9 +505,11 @@
 # 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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 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 at caip.rutgers.edu.
   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@@ -525,15 +528,16 @@
 # 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:529: checking for $ac_word" >&5
+echo "configure:532: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&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="${IFS}:"
-  for ac_dir in $PATH; do
+  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"
@@ -554,16 +558,17 @@
   # 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:558: checking for $ac_word" >&5
+echo "configure:562: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&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="${IFS}:"
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
   ac_prog_rejected=no
-  for ac_dir in $PATH; do
+  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
@@ -598,25 +603,61 @@
   echo "$ac_t""no" 1>&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:613: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&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"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+ ;;
+    esac
+  fi
   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:606: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:645: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 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
 
-cat > conftest.$ac_ext <<EOF
-#line 616 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 656 "configure"
 #include "confdefs.h"
+
 main(){return(0);}
 EOF
-if { (eval echo configure:620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:661: \"$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
@@ -630,18 +671,24 @@
   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 "$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; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:640: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:687: 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 $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:645: checking whether we are using GNU C" >&5
+echo "configure:692: 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
 else
@@ -650,7 +697,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:654: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:701: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -661,11 +708,15 @@
 
 if test $ac_cv_prog_gcc = yes; then
   GCC=yes
-  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:669: checking whether ${CC-cc} accepts -g" >&5
+else
+  GCC=
+fi
+
+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:720: 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
@@ -680,21 +731,25 @@
 fi
 
 echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-  if test "$ac_test_CFLAGS" = set; then
-    CFLAGS="$ac_save_CFLAGS"
-  elif test $ac_cv_prog_cc_g = yes; then
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
     CFLAGS="-g -O2"
   else
-    CFLAGS="-O2"
+    CFLAGS="-g"
   fi
 else
-  GCC=
-  test "${CFLAGS+set}" = set || CFLAGS="-g"
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
 fi
 
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:698: checking how to run the C preprocessor" >&5
+echo "configure:753: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -709,14 +764,14 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 713 "configure"
+#line 768 "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:719: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:774: \"$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
   :
 else
@@ -726,14 +781,31 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 730 "configure"
+#line 785 "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:736: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:791: \"$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
+  :
+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 802 "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:808: \"$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
   :
 else
@@ -746,6 +818,8 @@
 rm -f conftest*
 fi
 rm -f conftest*
+fi
+rm -f conftest*
   ac_cv_prog_CPP="$CPP"
 fi
   CPP="$ac_cv_prog_CPP"
@@ -759,7 +833,7 @@
 # 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:763: checking for X" >&5
+echo "configure:837: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -821,13 +895,13 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 825 "configure"
+#line 899 "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:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:904: \"$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*
   # We can compile using X headers with no special include directory.
@@ -895,14 +969,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 899 "configure"
+#line 973 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -1008,17 +1082,17 @@
     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:1012: checking whether -R must be followed by a space" >&5
+echo "configure:1086: 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 1015 "configure"
+#line 1089 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -1034,14 +1108,14 @@
       else
 	LIBS="$ac_xsave_LIBS -R $x_libraries"
 	cat > conftest.$ac_ext <<EOF
-#line 1038 "configure"
+#line 1112 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -1073,7 +1147,7 @@
     # libraries were built with DECnet support.  And karl at cs.umb.edu 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:1077: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:1151: 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
@@ -1081,7 +1155,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1085 "configure"
+#line 1159 "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
@@ -1092,7 +1166,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:1096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1170: \"$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
@@ -1114,7 +1188,7 @@
 
     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:1118: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:1192: 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
@@ -1122,7 +1196,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1126 "configure"
+#line 1200 "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
@@ -1133,7 +1207,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:1137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1211: \"$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
@@ -1162,12 +1236,12 @@
     # The nsl library prevents programs from opening the X display
     # on Irix 5.2, according to dickey at clark.net.
     echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:1166: checking for gethostbyname" >&5
+echo "configure:1240: 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 1171 "configure"
+#line 1245 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -1190,7 +1264,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1268: \"$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
@@ -1211,7 +1285,7 @@
 
     if test $ac_cv_func_gethostbyname = no; then
       echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:1215: checking for gethostbyname in -lnsl" >&5
+echo "configure:1289: 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
@@ -1219,7 +1293,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1223 "configure"
+#line 1297 "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
@@ -1230,7 +1304,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:1234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1308: \"$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
@@ -1260,12 +1334,12 @@
     # -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:1264: checking for connect" >&5
+echo "configure:1338: 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 1269 "configure"
+#line 1343 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -1288,7 +1362,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1366: \"$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
@@ -1309,7 +1383,7 @@
 
     if test $ac_cv_func_connect = no; then
       echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:1313: checking for connect in -lsocket" >&5
+echo "configure:1387: 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
@@ -1317,7 +1391,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1321 "configure"
+#line 1395 "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
@@ -1328,7 +1402,7 @@
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:1332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1406: \"$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
@@ -1352,12 +1426,12 @@
 
     # gomez at mi.uni-erlangen.de says -lposix is necessary on A/UX.
     echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:1356: checking for remove" >&5
+echo "configure:1430: 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 1361 "configure"
+#line 1435 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -1380,7 +1454,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1458: \"$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
@@ -1401,7 +1475,7 @@
 
     if test $ac_cv_func_remove = no; then
       echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:1405: checking for remove in -lposix" >&5
+echo "configure:1479: 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
@@ -1409,7 +1483,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lposix  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1413 "configure"
+#line 1487 "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
@@ -1420,7 +1494,7 @@
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:1424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1498: \"$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
@@ -1444,12 +1518,12 @@
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:1448: checking for shmat" >&5
+echo "configure:1522: 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 1453 "configure"
+#line 1527 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -1472,7 +1546,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1550: \"$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
@@ -1493,7 +1567,7 @@
 
     if test $ac_cv_func_shmat = no; then
       echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:1497: checking for shmat in -lipc" >&5
+echo "configure:1571: 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
@@ -1501,7 +1575,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lipc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1505 "configure"
+#line 1579 "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
@@ -1512,7 +1586,7 @@
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:1516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1590: \"$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
@@ -1545,15 +1619,15 @@
   # libraries we check for below, so use a different variable.
   #  --interran at uluru.Stanford.EDU, kb at cs.umb.edu.
   echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:1549: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:1623: 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
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lICE  $LIBS"
+LIBS="-lICE $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1557 "configure"
+#line 1631 "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
@@ -1564,7 +1638,7 @@
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:1568: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1642: \"$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
@@ -1589,12 +1663,12 @@
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1593: checking for ANSI C header files" >&5
+echo "configure:1667: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1598 "configure"
+#line 1672 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1602,8 +1676,8 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1680: \"$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*
   ac_cv_header_stdc=yes
@@ -1619,7 +1693,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1623 "configure"
+#line 1697 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1637,7 +1711,7 @@
 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 <<EOF
-#line 1641 "configure"
+#line 1715 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1658,7 +1732,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1662 "configure"
+#line 1736 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1669,7 +1743,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:1673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1696,18 +1770,18 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1700: checking for $ac_hdr" >&5
+echo "configure:1774: 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 1705 "configure"
+#line 1779 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1710: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1784: \"$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"
@@ -1734,7 +1808,7 @@
 
 
 echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
-echo "configure:1738: checking for main in -lm" >&5
+echo "configure:1812: checking for main in -lm" >&5
 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1742,14 +1816,14 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1746 "configure"
+#line 1820 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:1753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1827: \"$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
@@ -1777,7 +1851,7 @@
 fi
 
 echo $ac_n "checking for main in -lz""... $ac_c" 1>&6
-echo "configure:1781: checking for main in -lz" >&5
+echo "configure:1855: checking for main in -lz" >&5
 ac_lib_var=`echo z'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1785,14 +1859,14 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lz  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1789 "configure"
+#line 1863 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:1796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1870: \"$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
@@ -1819,8 +1893,51 @@
   echo "$ac_t""no" 1>&6
 fi
 
+echo $ac_n "checking for main in -lpng""... $ac_c" 1>&6
+echo "configure:1898: checking for main in -lpng" >&5
+ac_lib_var=`echo png'_'main | 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="-lpng  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1906 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:1913: \"$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
+    ac_tr_lib=HAVE_LIB`echo png | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lpng $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
 echo $ac_n "checking for main in -ljpeg""... $ac_c" 1>&6
-echo "configure:1824: checking for main in -ljpeg" >&5
+echo "configure:1941: checking for main in -ljpeg" >&5
 ac_lib_var=`echo jpeg'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1828,14 +1945,14 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ljpeg  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1832 "configure"
+#line 1949 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:1839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1956: \"$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
@@ -1863,7 +1980,7 @@
 fi
 
 echo $ac_n "checking for main in -ltiff""... $ac_c" 1>&6
-echo "configure:1867: checking for main in -ltiff" >&5
+echo "configure:1984: checking for main in -ltiff" >&5
 ac_lib_var=`echo tiff'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1871,14 +1988,14 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ltiff  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1875 "configure"
+#line 1992 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:1882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1999: \"$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
@@ -1909,12 +2026,12 @@
 
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1913: checking return type of signal handlers" >&5
+echo "configure:2030: 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 1918 "configure"
+#line 2035 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -1931,7 +2048,7 @@
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:1935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -1952,12 +2069,12 @@
 for ac_func in mkdir select
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1956: checking for $ac_func" >&5
+echo "configure:2073: 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 1961 "configure"
+#line 2078 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1980,7 +2097,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2101: \"$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
@@ -2028,7 +2145,7 @@
 # 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) 2>&1` in
+  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 \).
@@ -2095,7 +2212,7 @@
     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.12"
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -2114,9 +2231,11 @@
  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
diff -urNad xloadimage-4.1~/configure.in xloadimage-4.1/configure.in
--- xloadimage-4.1~/configure.in	2005-12-06 02:59:07.000000000 +0000
+++ xloadimage-4.1/configure.in	2005-12-06 02:59:07.000000000 +0000
@@ -15,6 +15,8 @@
 AC_CHECK_LIB(m, main)
 dnl Replace `main' with a function in -lz:
 AC_CHECK_LIB(z, main)
+dnl Replace `main' with a function in -lpng:
+AC_CHECK_LIB(png, main)
 dnl Replace `main' with a function in -ljpeg:
 AC_CHECK_LIB(jpeg, main)
 dnl Replace `main' with a function in -ltiff:
@@ -25,6 +27,6 @@
 
 dnl Checks for library functions.
 AC_TYPE_SIGNAL
-AC_CHECK_FUNCS(mkdir select)
+AC_CHECK_FUNCS(select)
 
 AC_OUTPUT(Makefile)
diff -urNad xloadimage-4.1~/image.h xloadimage-4.1/image.h
--- xloadimage-4.1~/image.h	2005-12-06 02:59:07.000000000 +0000
+++ xloadimage-4.1/image.h	2005-12-06 02:59:07.000000000 +0000
@@ -18,15 +18,12 @@
 
 /* ANSI-C stuff
  */
-#if defined(__STDC__)
-
+#ifdef STDC_HEADERS
 #if !defined(_ArgProto)
 #define _ArgProto(ARGS) ARGS
 #endif
-
 #include <stdlib.h>
-
-#else /* !__STDC__ */
+#else /* !STDC_HEADERS */
 
 #if !defined(const) /* "const" is an ANSI thing */
 #define const
@@ -35,26 +32,14 @@
 #define _ArgProto(ARGS) ()
 #endif
 
-#endif /* !__STDC__ */
+#endif /* !STDC_HEADERS */
 
 /* handle strings stuff that varies between BSD and ANSI/SYSV
  */
-#if defined(IS_BSD) && !defined(__STDC__)
-#include <strings.h>
-#if !defined(strchr) && !defined(index)
-#define strchr index
-#endif
-#if !defined(strrchr) && !defined(rindex)
-#define strrchr rindex
-#endif
-#if !defined(memcpy) && !defined(bcopy)
-#define memcpy(D,S,L) bcopy((char *)(S),(char *)(D),(L))
-#endif
-#if !defined(memset) && !defined(bzero)
-/* #define memset(D,V,L) bzero(D,L) */
-#endif
-#else /* !IS_BSD || __STDC__ */
 #include <string.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#else /* !HAVE_STRINGS_H */
 #if !defined(index) && !defined(strchr)
 #define index strchr
 #endif
@@ -67,7 +52,7 @@
 #if !defined(bzero) && !defined(memset)
 #define bzero(D,L) memset((void *)(D),0,(L))
 #endif
-#endif /* !IS_BSD || __STDC__ */
+#endif /* !HAVE_STRINGS_H */
 
 #ifdef VMS
 #define R_OK 4
@@ -234,7 +219,7 @@
 Image *normalize _ArgProto((Image *image, unsigned int verbose));
 
 /* compress.c */
-void compress _ArgProto((Image *image, unsigned int verbose));
+void compress_cmap _ArgProto((Image *image, unsigned int verbose));
 
 /* dither.c */
 Image *dither _ArgProto((Image *image, unsigned int verbose));
diff -urNad xloadimage-4.1~/imagetypes.h xloadimage-4.1/imagetypes.h
--- xloadimage-4.1~/imagetypes.h	2005-12-06 02:59:07.000000000 +0000
+++ xloadimage-4.1/imagetypes.h	2005-12-06 02:59:07.000000000 +0000
@@ -34,6 +34,9 @@
 #ifdef HAVE_LIBTIFF
 Image *tiffLoad();
 #endif
+#ifdef HAVE_LIBPNG
+Image *pngLoad();
+#endif
 
 int niffIdent();
 int facesIdent();
@@ -62,6 +65,9 @@
 #ifdef HAVE_LIBTIFF
 int tiffIdent();
 #endif
+#ifdef HAVE_LIBPNG
+int pngIdent();
+#endif
 
 void niffDump();
 #ifdef HAVE_LIBJPEG
@@ -91,6 +97,9 @@
 #ifdef HAVE_LIBTIFF
   tiffIdent,      tiffLoad,      tiffDump,    "tiff",      "TIFF image",
 #endif
+#ifdef HAVE_LIBPNG
+  pngIdent,       pngLoad,       NULL,        "png",       "PNG image",
+#endif
   fbmIdent,       fbmLoad,       NULL,        "fbm",       "FBM Image",
   cmuwmIdent,     cmuwmLoad,     NULL,        "cmuraster", "CMU WM Raster",
   pbmIdent,       pbmLoad,       pbmDump,     "pbm",       "Portable Bit Map (PBM, PGM, PPM)",
diff -urNad xloadimage-4.1~/new.c xloadimage-4.1/new.c
--- xloadimage-4.1~/new.c	2005-12-06 02:59:04.000000000 +0000
+++ xloadimage-4.1/new.c	2005-12-06 02:59:07.000000000 +0000
@@ -10,6 +10,9 @@
 
 #include "copyright.h"
 #include "image.h"
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
 
 extern int _Xdebug;
 
diff -urNad xloadimage-4.1~/niff.c xloadimage-4.1/niff.c
--- xloadimage-4.1~/niff.c	2005-12-06 02:59:07.000000000 +0000
+++ xloadimage-4.1/niff.c	2005-12-06 02:59:07.000000000 +0000
@@ -8,8 +8,10 @@
  * this is in the public domain.
  */
 
-#include <unistd.h>
 #include "image.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 #include "niff.h"
 
 static void babble(name, header, title)
diff -urNad xloadimage-4.1~/options.c xloadimage-4.1/options.c
--- xloadimage-4.1~/options.c	2005-12-06 02:59:04.000000000 +0000
+++ xloadimage-4.1/options.c	2005-12-06 02:59:07.000000000 +0000
@@ -731,6 +731,11 @@
       if (++a >= argc)
 	optionUsage(GAMMA);
       newopt->info.gamma= getFloat(GAMMA, argv[a]);
+      if (newopt->info.gamma < 0.0) {
+	fprintf(stderr, "Argument to %s must be over 0.0 (ignored)\n",
+		optionName(GAMMA));
+	newopt->type= OPT_IGNORE;
+      }
       break;
 
     case GOTO:
diff -urNad xloadimage-4.1~/png.c xloadimage-4.1/png.c
--- xloadimage-4.1~/png.c	1970-01-01 00:00:00.000000000 +0000
+++ xloadimage-4.1/png.c	2005-12-06 02:59:07.000000000 +0000
@@ -0,0 +1,350 @@
+/*
+ * PNG - Portable Network Graphics
+ *
+ * Alpha channle is linear.
+ * Color   \   Bit Depth      1   2   4   8  16  palette  bKGD
+ * PNG_COLOR_TYPE_PALETTE     O   O   O   O      must      8 bit
+ * PNG_COLOR_TYPE_GRAY        O   O   O   O   O           16
+ * PNG_COLOR_TYPE_GRAY_ALPHA              O   O           16
+ * PNG_COLOR_TYPE_RGB                     O   O  possible 16 * 3
+ * PNG_COLOR_TYPE_RGB_ALPHA               O   O  possible 16 * 3
+ * 
+ * This code is based on jpeg.c and sample code from the libpng-1.0.5.
+ * 2000/01/10: YOSHIDA Hiroshi
+ *
+ * TODO:
+ * pngLoad(): Alpha channel, Transparency palette.
+ * pngDump(): Dump.
+ * 
+ */
+
+
+#include "image.h"	/* xloadimage declarations */
+#ifdef HAVE_LIBPNG
+#include "options.h"
+#include <png.h>
+#include <setjmp.h>
+
+#undef  DEBUG
+/* #define  DEBUG */
+#undef  debug
+
+#ifdef DEBUG
+# define debug(xx)	fprintf(stderr,xx)
+#else
+# define debug(xx)
+#endif
+
+#define PNG_BYTES_TO_CHECK 4
+
+static Image *image;    /* xloadimage image being returned */
+static ZFILE *zinput_file;
+static char *filename;
+
+int pngIdent(char *fullname, char *name);
+Image *pngLoad(char *fullname, char *name, unsigned int verbose);
+/* void pngDump(Image *image, char *options, char *file, int verbose); */
+
+
+/*
+ * png read handler
+ */
+static void png_read_data(png_structp png_ptr,
+			  png_bytep data, png_size_t length)
+{
+  if (zread(zinput_file, data, length) != length)
+    png_error(png_ptr, "Read Error");
+}
+
+
+/*
+ * png warn handler
+ */
+static void output_warn(png_structp png_ptr, png_const_charp str)
+{
+  debug(" #warn ");
+  fprintf(stderr, " PNG file: %s - %s\n", filename, str);
+  fflush(stderr);
+}
+
+
+/*
+ * png error handler
+ */
+static void output_error(png_structp png_ptr, png_const_charp str)
+{
+  debug(" #error ");
+  output_warn( png_ptr, str);
+  longjmp(png_ptr->jmpbuf, 1);	/* return control to outer routine */
+}
+
+
+static const char *pngColor(int color_type)
+{
+  const char *str;
+
+  switch (color_type) {
+  case PNG_COLOR_TYPE_GRAY:
+    str = "GRAY";
+    break;
+  case PNG_COLOR_TYPE_GRAY_ALPHA:
+    str = "GRAY_ALPHA";
+    break;
+  case PNG_COLOR_TYPE_PALETTE:
+    str = "PALETTE";
+    break;
+  case PNG_COLOR_TYPE_RGB:
+    str = "RGB";
+    break;
+  case PNG_COLOR_TYPE_RGB_ALPHA:
+    str = "RGB_ALPHA";
+    break;
+  default:
+    str = "UNKNOWN_COLOR_TYPE";
+  }
+  return str;
+}
+
+
+static const char *pngInterlace(int interlace_type)
+{
+  const char *str;
+
+  switch (interlace_type) {
+  case PNG_INTERLACE_NONE:
+    str = "NONE";
+    break;
+  case PNG_INTERLACE_ADAM7:
+    str = "ADAM7";
+    break;
+  default:
+    str = "UNKNOWN_TYPE";
+  }
+  return str;
+}
+
+
+/*
+ * Output PNG file infomation.
+ */
+static void pngInfo( png_uint_32 width, png_uint_32 height,
+		     int bit_depth, int color_type, int interlace_type,
+		     double file_gamma)
+{
+  printf("%s is %ldx%ld PNG image, color type %s, %d bit",
+	 filename, width, height, pngColor(color_type), bit_depth);
+  if( interlace_type != PNG_INTERLACE_NONE)
+    printf(", interlace %s", pngInterlace(interlace_type));
+  if( file_gamma >= 0.0)
+    printf(", file gamma %.4f", file_gamma);
+  putchar('\n');
+}
+
+
+/*
+ * pngIdent(), pngLoad()
+ * Read PNG header & allocate png's struct:
+ * return 1: success
+ */
+static int pngHeader(png_structpp png_pp,
+		     png_infopp info_pp, png_infopp end_pp)
+{
+  *info_pp = *end_pp = NULL;
+  *png_pp = png_create_read_struct(PNG_LIBPNG_VER_STRING,
+				   NULL, output_error, output_warn);
+  if (!*png_pp)
+    return 0;
+  *info_pp = png_create_info_struct(*png_pp);
+  if (!*info_pp) {
+    png_destroy_read_struct(png_pp, info_pp, end_pp);
+    return 0;
+  }
+  *end_pp = png_create_info_struct(*png_pp);
+  if (!*end_pp) {
+    png_destroy_read_struct(png_pp, info_pp, end_pp);
+    return 0;
+  }
+  if (setjmp((*png_pp)->jmpbuf)) {
+    /* On error */
+    png_destroy_read_struct(png_pp, info_pp, end_pp);
+    return 0;
+  }
+  png_set_sig_bytes(*png_pp, PNG_BYTES_TO_CHECK);
+  png_set_read_fn(*png_pp, NULL, png_read_data);
+  png_read_info(*png_pp, *info_pp);
+
+  return 1;
+}
+
+
+/*
+ * return !0: It is a PNG.
+ */
+static int is_png(ZFILE *zf)
+{
+  byte png_read_buff[PNG_BYTES_TO_CHECK];
+
+  /* Read in some of the signature bytes */
+  if (zread(zf, png_read_buff,PNG_BYTES_TO_CHECK) != PNG_BYTES_TO_CHECK)
+    return 0;
+  return !png_sig_cmp(png_read_buff, (png_size_t)0, PNG_BYTES_TO_CHECK);
+}
+
+
+/*
+ * Main control routine for identifying PNG without loading
+ * return 1: PNG file.
+ */
+int pngIdent(char *fullname, char *name)
+{
+  png_structp png_ptr;
+  png_infop info_ptr, end_info;
+  png_uint_32 width, height;
+  int color_type, bit_depth, interlace_type;
+  double file_gamma;
+
+  zinput_file = zopen(fullname);
+  if (zinput_file == NULL) {
+    zclose(zinput_file);
+    return 0;
+  }
+  /* check at early timing */
+  if (is_png(zinput_file) == 0) {
+    zclose(zinput_file);
+    return 0;
+  }
+  filename = name;
+
+  /* read infomation header */
+  if (!pngHeader(&png_ptr, &info_ptr, &end_info)) {
+    zclose(zinput_file);
+    return 0;
+  }
+  if (setjmp(png_ptr->jmpbuf)) {
+    /* On error */
+    freeImage(image);
+    png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+    zclose(zinput_file);
+    return 0;
+  }
+  png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
+	       &color_type, &interlace_type, NULL, NULL);
+  if(!png_get_gAMA( png_ptr, info_ptr, &file_gamma))
+    file_gamma = -1.0;
+  /* print out PNG infomation */
+  pngInfo( width, height, bit_depth, color_type, interlace_type, file_gamma);
+
+  znocache(zinput_file);
+  png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+  zclose(zinput_file);
+  return 1;
+}
+
+
+/*
+ * Main control routine for loading
+ */
+Image *pngLoad(char *fullname, char *name, unsigned int verbose)
+{
+  png_structp png_ptr;
+  png_infop info_ptr, end_info;
+  png_colorp palette;
+  png_color_16p background;
+  png_bytep bufp, *row_pointers;
+  png_uint_32 width, height;
+  int i, row_stride, color_type, bit_depth, num_palette, interlace_type;
+  double file_gamma;
+
+  zinput_file = zopen(fullname);
+  if (zinput_file == NULL) {
+    zclose(zinput_file);
+    return NULL;
+  }
+  /* check at early timing */
+  if (is_png(zinput_file) == 0) {
+    zclose(zinput_file);
+    return NULL;
+  }
+  filename = name;
+
+  /* read infomation header */
+  if (!pngHeader(&png_ptr, &info_ptr, &end_info)) {
+    zclose(zinput_file);
+    return NULL;
+  }
+  png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
+	       &color_type, &interlace_type, NULL, NULL);
+  if(!png_get_gAMA( png_ptr, info_ptr, &file_gamma))
+    file_gamma = -1.0;
+  /* print out PNG infomation */
+  if (verbose)
+    pngInfo( width, height, bit_depth, color_type, interlace_type, file_gamma);
+  znocache(zinput_file);
+  image = NULL;
+
+  if (file_gamma <= 0.0)
+    file_gamma = 1.0;
+  png_set_gamma(png_ptr, 1.0, file_gamma);
+  if (bit_depth > 8)
+    png_set_strip_16(png_ptr);      /* 16 bit -> 8 bit */
+  /*  if (color_type & PNG_COLOR_MASK_ALPHA) */
+  png_set_strip_alpha(png_ptr);
+  if (png_get_bKGD(png_ptr, info_ptr, &background))
+    png_set_background(png_ptr, background, file_gamma, 1, 1.0);
+  switch (color_type) {
+  case PNG_COLOR_TYPE_PALETTE:
+    if (bit_depth < 8)
+      png_set_packing(png_ptr);     /* 1 pixlel 1 byte */
+    image = newRGBImage(width, height, 8);
+    png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
+    image->rgb.used = num_palette;
+    for (i = 0; i < num_palette; i++) {
+      *(image->rgb.red + i) = palette->red << 8;
+      *(image->rgb.green + i) = palette->green << 8;
+      *(image->rgb.blue + i) = palette->blue << 8;
+      palette++;
+    }
+    break;
+  case PNG_COLOR_TYPE_GRAY_ALPHA:
+  case PNG_COLOR_TYPE_GRAY:
+    if (bit_depth < 8)
+      png_set_gray_1_2_4_to_8(png_ptr);  /* 1 pixlel 1 byte */
+    image = newRGBImage(width, height, 8);
+    image->rgb.used = 256;
+    for (i = 0; i < 256; i++) {
+      *(image->rgb.red + i) = 
+	*(image->rgb.green + i) = 
+	*(image->rgb.blue + i) = i << 8;
+    }
+    break;
+  case PNG_COLOR_TYPE_RGB_ALPHA:
+  case PNG_COLOR_TYPE_RGB:
+    image = newTrueImage(width, height);
+    break;
+  default:
+    fprintf(stderr, "Unknown color type PNG.");
+    png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+    zclose(zinput_file);
+    return NULL;
+  }
+  image->title = dupString(filename);
+
+  bufp = image->data;
+  png_read_update_info(png_ptr, info_ptr);
+  row_stride = png_get_rowbytes(png_ptr, info_ptr);
+  row_pointers = (png_bytep *)lmalloc(sizeof(png_bytep) * height);
+  for (i = 0; i < height; i++) {
+    *(row_pointers + i) = bufp;
+    bufp += row_stride;
+  }
+  png_read_image(png_ptr, row_pointers);
+  lfree((byte *)row_pointers);
+  png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+  zclose(zinput_file);
+
+  return image;
+}
+
+#else /* !HAVE_LIBPNG */
+static int unused;
+#endif /* !HAVE_LIBPNG */
diff -urNad xloadimage-4.1~/send.c xloadimage-4.1/send.c
--- xloadimage-4.1~/send.c	2005-12-06 02:59:04.000000000 +0000
+++ xloadimage-4.1/send.c	2005-12-06 02:59:07.000000000 +0000
@@ -255,7 +255,7 @@
 
   default:
   retry: /* this tag is used when retrying because we couldn't get a fit */
-    compress(image, verbose);
+    compress_cmap(image, verbose);
 
     index= (Pixel *)lmalloc(sizeof(Pixel) * image->rgb.used);
 
diff -urNad xloadimage-4.1~/vff.c xloadimage-4.1/vff.c
--- xloadimage-4.1~/vff.c	2005-12-06 02:59:07.000000000 +0000
+++ xloadimage-4.1/vff.c	2005-12-06 02:59:07.000000000 +0000
@@ -150,7 +150,7 @@
 	  op = image->data;
 	  skip = bands - 3;
 	  linewidth = bands * width;
-	  buf = (unsigned char *)malloc((unsigned)linewidth);
+	  buf = (unsigned char *)lmalloc((unsigned)linewidth);
 	  if (buf == NULL) {
 	       memoryExhausted();    
 	  }
@@ -337,7 +337,7 @@
 		    return(0);
 	       }
 
-	       if ((header[lines] = (char *)malloc((unsigned)count+1)) == NULL) {
+	       if ((header[lines] = (char *)lmalloc((unsigned)count+1)) == NULL) {
 		    memoryExhausted();    
 	       }
 	       bcopy(buf, header[lines], count);
diff -urNad xloadimage-4.1~/vicar.c xloadimage-4.1/vicar.c
--- xloadimage-4.1~/vicar.c	2005-12-06 02:59:04.000000000 +0000
+++ xloadimage-4.1/vicar.c	2005-12-06 02:59:07.000000000 +0000
@@ -12,7 +12,6 @@
 #define SAMPLES   label[6]
  
 #include <stdio.h>
-#include <malloc.h>
 #include "image.h"
 #include <sys/types.h>
 
diff -urNad xloadimage-4.1~/window.c xloadimage-4.1/window.c
--- xloadimage-4.1~/window.c	2005-12-06 02:59:07.000000000 +0000
+++ xloadimage-4.1/window.c	2005-12-06 02:59:07.000000000 +0000
@@ -15,23 +15,21 @@
 #include <X11/Xatom.h>
 #include <signal.h>
 #include <errno.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
+#ifdef HAVE_SELECT
+#define ENABLE_TIMEOUT
+#include <sys/select.h>
+#else /* !HAVE_SELECT */
 #ifdef HAS_POLL
 #include <poll.h>
-#else /* !HAS_POLL */
-#ifdef HAS_SELECT_INCLUDE
-#include <sys/select.h>
-#endif /* HAS_SELECT_INCLUDE */
-#endif /* !HAS_POLL */
-
-/* we can use timeouts if either select() or poll() are available.
- */
-#if IS_BSD
 #define ENABLE_TIMEOUT
-#endif
-#if defined(HAS_SELECT_INCLUDE) || defined(HAS_POLL)
-#define ENABLE_TIMEOUT
-#endif
+#endif /* !HAS_POLL */
+#endif /* !HAVE_SELECT */
 
 /* SUPPRESS 560 */
 
diff -urNad xloadimage-4.1~/xloadimage.c xloadimage-4.1/xloadimage.c
--- xloadimage-4.1~/xloadimage.c	2005-12-06 02:59:07.000000000 +0000
+++ xloadimage-4.1/xloadimage.c	2005-12-06 02:59:07.000000000 +0000
@@ -16,6 +16,9 @@
 #else
 #include "patchlevel"
 #endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 #include <signal.h>
 
 char *ProgramName= "xloadimage";
diff -urNad xloadimage-4.1~/xloadimagerc xloadimage-4.1/xloadimagerc
--- xloadimage-4.1~/xloadimagerc	2005-12-06 02:59:04.000000000 +0000
+++ xloadimage-4.1/xloadimagerc	2005-12-06 03:11:46.000000000 +0000
@@ -14,6 +14,7 @@
             .pbm .pgm .ppm    # PBMPLUS
             .img              # GEM IMG
             .pcx              # PCX image
+            .png              # PNG image
 
 # add uufilter for automatic uudecoding of files ending in .uu or .uue
 filter = "uufilter -s" .uu .uue


--- NEW FILE 03_security-strfoo.dpatch ---
#! /bin/sh -e
## 03_newpatch.dpatch by James Troup <james at nocrew.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix unsafe str{cat,cpy} usage.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

diff -urNad 03.xloadimage.tmp/config.c 03.xloadimage/config.c
--- 03.xloadimage.tmp/config.c	2003-04-02 19:16:50.000000000 +0100
+++ 03.xloadimage/config.c	2003-04-02 19:16:44.000000000 +0100
@@ -256,7 +256,8 @@
       }
       break;
     case parse_filter_name: /* name of filter program */
-      strcpy(filter_name, buf);
+      strncpy(filter_name, buf, BUFSIZ - 1);
+      filter_name[BUFSIZ - 1] = '\0';
       state= parse_filter_extension;
       break;
     case parse_filter_extension:
@@ -454,7 +455,8 @@
 #endif
     else if(*p == '~') {
       buf1[b1] = '\0';
-      strcat(buf1, getenv("HOME"));
+      strncat(buf1, getenv("HOME"), BUFSIZ - strlen(buf1) - 1);
+      buf1[BUFSIZ - 1] = '\0';
       b1 = strlen(buf1);
       var = 0;
     }
@@ -462,7 +464,8 @@
       if(var) {
 	buf1[b1] = '\0';
 	buf2[b2] = '\0';
-	strcat(buf1, getenv(buf2));
+	strncat(buf1, getenv(buf2), BUFSIZ - strlen (buf1) - 1);
+	buf1[BUFSIZ - 1] = '\0';
 	b1 = strlen(buf1);
 	buf2[0] = '\0';
 	b2 = 0;
diff -urNad 03.xloadimage.tmp/faces.c 03.xloadimage/faces.c
--- 03.xloadimage.tmp/faces.c	1993-10-21 22:28:37.000000000 +0100
+++ 03.xloadimage/faces.c	2003-04-02 19:16:44.000000000 +0100
@@ -108,9 +108,15 @@
     if (! strcmp(buf, "\n"))
       break;
     if (!strncmp(buf, "FirstName:", 10))
-      strcpy(fname, buf + 11);
+      {
+	strncpy(fname, buf + 11, BUFSIZ - 1);
+	fname[BUFSIZ - 1] = '\0';
+      }
     else if (!strncmp(buf, "LastName:", 9))
-      strcpy(lname, buf + 10);
+      {
+	strncpy(lname, buf + 10, BUFSIZ - 1);
+	lname[BUFSIZ - 1] = '\0';
+      }
     else if (!strncmp(buf, "Image:", 6)) {
       if (sscanf(buf + 7, "%d%d%d", &iw, &ih, &id) != 3) {
 	printf("%s: Bad Faces Project image\n", fullname);
@@ -136,7 +142,7 @@
 
   image= newRGBImage(w, h, d);
   fname[strlen(fname) - 1]= ' ';
-  strcat(fname, lname);
+  strncat(fname, lname, BUFSIZ - strlen(fname) -1);
   fname[strlen(fname) - 1]= '\0';
   image->title= dupString(fname);
 
diff -urNad 03.xloadimage.tmp/imagetypes.c 03.xloadimage/imagetypes.c
--- 03.xloadimage.tmp/imagetypes.c	2003-04-02 19:16:50.000000000 +0100
+++ 03.xloadimage/imagetypes.c	2003-04-02 19:16:44.000000000 +0100
@@ -146,7 +146,10 @@
     optptr++; /* skip comma */
   }
   else
-    strcpy(typename, type);
+    {
+      strncpy(typename, type, 31);
+      typename[31] = '\0';
+    }
 
   for (a= 0; ImageTypes[a].loader; a++)
     if (!strncmp(ImageTypes[a].type, typename, strlen(typename))) {
diff -urNad 03.xloadimage.tmp/options.c 03.xloadimage/options.c
--- 03.xloadimage.tmp/options.c	2003-04-02 19:16:50.000000000 +0100
+++ 03.xloadimage/options.c	2003-04-02 19:16:44.000000000 +0100
@@ -13,6 +13,9 @@
 #include "image.h"
 #include "options.h"
 
+#undef  MIN
+#define MIN(a, b)  (((a) < (b)) ? (a) : (b))
+
 extern char *ProgramName;
 /* options array and definitions.  If you add something to this you also
  * need to add its OptionId in options.h.
@@ -883,12 +886,13 @@
    */
   p = index(*opt_string, ',');
   if (p != NULL) {
-    strncpy(option_name, *opt_string, p - *opt_string);
-    option_name[p - *opt_string] = '\0';
+    strncpy(option_name, *opt_string, MIN(BUFSIZ - 1, p - *opt_string));
+    option_name[MIN(BUFSIZ - 1, p - *opt_string)] = '\0';
     *opt_string = p + 1; /* increment to next option */
   }
   else {
-    strcpy(option_name, *opt_string);
+    strncpy(option_name, *opt_string, BUFSIZ -1);
+    option_name[BUFSIZ - 1] = '\0';
     *opt_string += strlen(*opt_string); /* increment to end of string */
   }
   *name = option_name;
@@ -897,7 +901,8 @@
    */
   p = index(option_name, '=');
   if (p != NULL) {
-    strcpy(option_value, p + 1);
+    strncpy(option_value, p + 1, BUFSIZ - 1);
+    option_value[BUFSIZ - 1] = '\0';
     *p = '\0'; /* stomp equals sign */
     *value = option_value;
   }
diff -urNad 03.xloadimage.tmp/packtar.c 03.xloadimage/packtar.c
--- 03.xloadimage.tmp/packtar.c	1993-11-09 21:18:14.000000000 +0000
+++ 03.xloadimage/packtar.c	2003-04-02 19:16:44.000000000 +0100
@@ -48,9 +48,12 @@
   char new_file[1024];
   char *p;
 
-  strcpy(new_file, dir); /* target directory */
-  strcat(new_file, "/");
-  strcat(new_file, old_file);
+  strncpy(new_file, dir, 1023); /* target directory */
+  new_file[1023] = '\0';
+  strncat(new_file, "/", 1023 - strlen(new_file));
+  new_file[1023] = '\0';
+  strncat(new_file, old_file, 1023 - strlen(new_file));
+  new_file[1023] = '\0';
 
   for (p = new_file; p = strchr(p, '/'); p++) {
     *p = '\0'; /* stomp directory separator */


--- NEW FILE 04_previous-image.dpatch ---
#! /bin/sh -e
## 04_previous-image.dpatch by Juan Cespedes <cespedes at debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix 'p' (previous image) key.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

diff -urNad 04.xloadimage.tmp/xloadimage.c 04.xloadimage/xloadimage.c
--- 04.xloadimage.tmp/xloadimage.c	2003-04-02 19:28:25.000000000 +0100
+++ 04.xloadimage/xloadimage.c	2003-04-02 19:27:44.000000000 +0100
@@ -493,6 +493,8 @@
       if (!tmpset)
 	goto redisplay_in_window; /* ick */
       optset= tmpset;
+      freeImage(dispimage);
+      dispimage= NULL;
       goto get_another_image; /* ick */
     case '<':
       if ((opt = getOption(optset,ZOOM)) == NULL) {


--- NEW FILE 05_idelay-manpage.dpatch ---
#! /bin/sh -e
## 05_idelay-manpage.dpatch by James Troup <james at nocrew.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Update manpage for how -idelay/-delay actually work.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

diff -urNad 05.xloadimage.tmp/xloadimage.man 05.xloadimage/xloadimage.man
--- 05.xloadimage.tmp/xloadimage.man	1993-10-21 22:29:05.000000000 +0100
+++ 05.xloadimage/xloadimage.man	2003-04-02 19:33:28.000000000 +0100
@@ -84,9 +84,6 @@
 debugging.  If an X error is seen while in this mode, a core will be
 dumped.
 .TP
--delay \fIsecs\fR
-Automatically advance to the next image after \fIsecs\fR seconds.
-.TP
 -display \fIdisplay_name\fR
 X11 display name to send the image(s) to.
 .TP
@@ -237,6 +234,11 @@
 Specify the maximum number of colors to use in the image.  This is a
 way to forcibly reduce the depth of an image.
 .TP
+-delay \fIsecs\fR
+Automatically advance to the next image after \fIsecs\fR seconds.  You
+may want to use the \fI-global\fR switch with this command to create a
+slideshow with multiple images.
+.TP
 -dither
 Dither a color image to monochrome using a Floyd-Steinberg dithering
 algorithm.  This happens by default when viewing color images on a
@@ -273,10 +275,8 @@
 but will take longer to process and will be less accurate.
 .TP
 -idelay \fIsecs\fR
-Set the delay to be used for this image to \fIsecs\fR seconds (see
-\fI-delay\fR).  If \fI-delay\fR was specified, this overrides it.  If
-it was not specified, this sets the automatic advance delay for this
-image while others will wait for the user to advance them.
+This option is no longer supported due to the addition of
+\fI-global\fR.  The same functionality can be had with \fI-delay\fR.
 .TP
 -invert
 Inverts a monochrome image.  This is shorthand for \fI-foreground


--- NEW FILE 06_-Wall-cleanup.dpatch ---
#! /bin/sh -e
## 06_-Wall-cleanup.dpatch by James Troup <james at nocrew.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Make the code -Wall clean.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

diff -urNad 06.xloadimage.tmp/bright.c 06.xloadimage/bright.c
--- 06.xloadimage.tmp/bright.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/bright.c	2003-04-02 23:27:50.000000000 +0100
@@ -10,6 +10,7 @@
 
 #include "copyright.h"
 #include "image.h"
+#include "rlelib.h"
 
 /* alter an image's brightness by a given percentage
  */
@@ -150,6 +151,8 @@
   byte         *srcptr, *destptr;
   byte          array[256];
 
+  newimage = NULL;
+
   goodImage(image, "normalize");
   if (BITMAPP(image))
     return(image);
@@ -194,11 +197,11 @@
       for (x= 0; x < image->width; x++) {
 	pixval= memToVal(srcptr, image->pixlen);
 	*destptr= array[image->rgb.red[pixval] >> 8];
-	*destptr++;
+	destptr++;
 	*destptr= array[image->rgb.green[pixval] >> 8];
-	*destptr++;
+	destptr++;
 	*destptr= array[image->rgb.blue[pixval] >> 8];
-	*destptr++;
+	destptr++;
 	srcptr += image->pixlen;
       }
     break;
diff -urNad 06.xloadimage.tmp/cmuwmraster.c 06.xloadimage/cmuwmraster.c
--- 06.xloadimage.tmp/cmuwmraster.c	1993-10-21 22:28:36.000000000 +0100
+++ 06.xloadimage/cmuwmraster.c	2003-04-02 23:27:50.000000000 +0100
@@ -16,11 +16,11 @@
 
 /* SUPPRESS 558 */
 
-int babble(name, headerp)
+void babble(name, headerp)
 char *name;
 struct cmuwm_header *headerp;
 {
-    printf("%s is a %dx%d %d plane CMU WM raster\n",
+    printf("%s is a %ldx%ld %ld plane CMU WM raster\n",
 	   name,
 	   memToVal(headerp->width, sizeof(long)),
 	   memToVal(headerp->height, sizeof(long)),
@@ -108,7 +108,7 @@
       {
 	  fprintf(stderr,"CMU WM raster %s is of depth %d, must be 1",
 		  name,
-		  header.depth);
+		  (int) header.depth);
 	  return(NULL);
       }
 
diff -urNad 06.xloadimage.tmp/compress.c 06.xloadimage/compress.c
--- 06.xloadimage.tmp/compress.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/compress.c	2003-04-02 23:27:50.000000000 +0100
@@ -136,12 +136,13 @@
   lfree((byte *)pixel_table);
   lfree((byte *)pixel_map);
 
-  if (badcount)
+  if (badcount) {
     if (verbose)
       printf("%d out-of-range pixels, ", badcount);
     else
       fprintf(stderr, "Warning: %d out-of-range pixels were seen\n",
 	      badcount);
+  }
   if (verbose) {
     if ((rgb.used == image->rgb.used) && !badcount)
       printf("no improvment\n");
diff -urNad 06.xloadimage.tmp/copyright.h 06.xloadimage/copyright.h
--- 06.xloadimage.tmp/copyright.h	1993-10-21 22:28:36.000000000 +0100
+++ 06.xloadimage/copyright.h	2003-04-02 23:27:50.000000000 +0100
@@ -20,7 +20,9 @@
  */
 
 #ifndef __SABER__
+#ifndef LINT
 static char *Copyright= "Copyright 1989, 1993 Jim Frost";
+#endif /* LINT */
 #endif
 #define _JIM_COPYRIGHT_
 #endif
diff -urNad 06.xloadimage.tmp/faces.c 06.xloadimage/faces.c
--- 06.xloadimage.tmp/faces.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/faces.c	2003-04-02 23:27:50.000000000 +0100
@@ -178,7 +178,7 @@
      char *fullname, *name;
 { Image *image;
 
-  if (image= facesLoad(fullname, name, 1)) {
+  if ((image= facesLoad(fullname, name, 1))) {
     freeImage(image);
     return(1);
   }
diff -urNad 06.xloadimage.tmp/fbm.c 06.xloadimage/fbm.c
--- 06.xloadimage.tmp/fbm.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/fbm.c	2003-04-02 23:27:50.000000000 +0100
@@ -204,7 +204,6 @@
   register int    x, y, j, k, rowlen, plnlen;
   unsigned char *pixptr, *cm;
   unsigned int map_size;
-  extern int Scrn;
   unsigned char *r, *g, *b;
 
   if (! (zf= zopen(fullname)))
diff -urNad 06.xloadimage.tmp/gif.c 06.xloadimage/gif.c
--- 06.xloadimage.tmp/gif.c	1993-10-21 22:28:37.000000000 +0100
+++ 06.xloadimage/gif.c	2003-04-02 23:27:50.000000000 +0100
@@ -468,7 +468,7 @@
  * add a new string to the string table
  */
 
-static gifin_add_string(p, e)
+static void gifin_add_string(p, e)
      int p;
      int e;
 {
@@ -488,7 +488,7 @@
  * semi-graceful fatal error mechanism
  */
 
-static gifin_fatal(msg)
+static void gifin_fatal(msg)
      char *msg;
 {
   printf("Error reading GIF file: %s\n", msg);
diff -urNad 06.xloadimage.tmp/gif.h 06.xloadimage/gif.h
--- 06.xloadimage.tmp/gif.h	1993-10-21 22:28:37.000000000 +0100
+++ 06.xloadimage/gif.h	2003-04-02 23:27:50.000000000 +0100
@@ -50,8 +50,8 @@
 static int gifin_skip_extension();
 static int gifin_read_data_block();
 static int gifin_push_string();
-static int gifin_add_string();
-static int gifin_fatal();
+static void gifin_add_string();
+static void gifin_fatal();
 
 /* #defines, typedefs, and such
  */
diff -urNad 06.xloadimage.tmp/halftone.c 06.xloadimage/halftone.c
--- 06.xloadimage.tmp/halftone.c	1993-10-21 22:28:37.000000000 +0100
+++ 06.xloadimage/halftone.c	2003-04-02 23:27:50.000000000 +0100
@@ -130,23 +130,23 @@
 #define GRAYSTEP ((unsigned long)(65536 / GRAYS))
 
 static byte DitherBits[GRAYS][4] = {
-  0xf, 0xf, 0xf, 0xf,
-  0xe, 0xf, 0xf, 0xf,
-  0xe, 0xf, 0xb, 0xf,
-  0xa, 0xf, 0xb, 0xf,
-  0xa, 0xf, 0xa, 0xf,
-  0xa, 0xd, 0xa, 0xf,
-  0xa, 0xd, 0xa, 0x7,
-  0xa, 0x5, 0xa, 0x7,
-  0xa, 0x5, 0xa, 0x5,
-  0x8, 0x5, 0xa, 0x5,
-  0x8, 0x5, 0x2, 0x5,
-  0x0, 0x5, 0x2, 0x5,
-  0x0, 0x5, 0x0, 0x5,
-  0x0, 0x4, 0x0, 0x5,
-  0x0, 0x4, 0x0, 0x1,
-  0x0, 0x0, 0x0, 0x1,
-  0x0, 0x0, 0x0, 0x0
+  {0xf, 0xf, 0xf, 0xf},
+  {0xe, 0xf, 0xf, 0xf},
+  {0xe, 0xf, 0xb, 0xf},
+  {0xa, 0xf, 0xb, 0xf},
+  {0xa, 0xf, 0xa, 0xf},
+  {0xa, 0xd, 0xa, 0xf},
+  {0xa, 0xd, 0xa, 0x7},
+  {0xa, 0x5, 0xa, 0x7},
+  {0xa, 0x5, 0xa, 0x5},
+  {0x8, 0x5, 0xa, 0x5},
+  {0x8, 0x5, 0x2, 0x5},
+  {0x0, 0x5, 0x2, 0x5},
+  {0x0, 0x5, 0x0, 0x5},
+  {0x0, 0x4, 0x0, 0x5},
+  {0x0, 0x4, 0x0, 0x1},
+  {0x0, 0x0, 0x0, 0x1},
+  {0x0, 0x0, 0x0, 0x0}
 };
 
 /* simple dithering algorithm, really optimized for the 4x4 array
diff -urNad 06.xloadimage.tmp/image.h 06.xloadimage/image.h
--- 06.xloadimage.tmp/image.h	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/image.h	2003-04-02 23:27:50.000000000 +0100
@@ -8,6 +8,9 @@
  * copyright information.
  */
 
+#ifndef __IMAGE_H__
+#define __IMAGE_H__
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -320,3 +323,5 @@
 #else /* !DEBUG */
 #define debug(ARGS)
 #endif /* !DEBUG */
+
+#endif /* __IMAGE_H__ */
diff -urNad 06.xloadimage.tmp/imagetypes.c 06.xloadimage/imagetypes.c
--- 06.xloadimage.tmp/imagetypes.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/imagetypes.c	2003-04-02 23:27:50.000000000 +0100
@@ -47,7 +47,7 @@
   if (opt) {
     for (a= 0; ImageTypes[a].loader; a++)
       if (!strncmp(ImageTypes[a].type, opt->info.type, strlen(opt->info.type))) {
-	if (image= ImageTypes[a].loader(fullname, name, verbose)) {
+	if ((image= ImageTypes[a].loader(fullname, name, verbose))) {
 	  zreset(NULL);
 
 	  /* this converts a 1-bit RGB image to a bitmap prior to blitting
@@ -80,7 +80,7 @@
    */
   for (a= 0; ImageTypes[a].loader; a++) {
     debug(("Checking %s against loader for %s\n", fullname, ImageTypes[a].name));
-    if (image= ImageTypes[a].loader(fullname, name, verbose)) {
+    if ((image= ImageTypes[a].loader(fullname, name, verbose))) {
       zreset(NULL);
 
       /* this does the 1-bit conversion as above.
diff -urNad 06.xloadimage.tmp/imagetypes.h 06.xloadimage/imagetypes.h
--- 06.xloadimage.tmp/imagetypes.h	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/imagetypes.h	2003-04-02 23:27:50.000000000 +0100
@@ -7,6 +7,9 @@
  * jim frost 10.15.89
  */
 
+#ifndef __IMAGETYPES_H__
+#define __IMAGETYPES_H__
+
 Image *niffLoad();
 Image *facesLoad();
 Image *pbmLoad();
@@ -88,35 +91,39 @@
   char  *type;            /* image type name */
   char  *name;            /* name of this image format */
 } ImageTypes[] = {
-  niffIdent,      niffLoad,      niffDump,    "niff",      "Native Image File Format (NIFF)",
-  sunRasterIdent, sunRasterLoad, NULL,        "sunraster", "Sun Rasterfile",
-  gifIdent,       gifLoad,       NULL,        "gif",       "GIF Image",
+  {niffIdent,      niffLoad,      niffDump,    "niff",      "Native Image File Format (NIFF)"},
+  {sunRasterIdent, sunRasterLoad, NULL,        "sunraster", "Sun Rasterfile"},
+  {gifIdent,       gifLoad,       NULL,        "gif",       "GIF Image"},
 #ifdef HAVE_LIBJPEG
-  jpegIdent,      jpegLoad,      jpegDump,    "jpeg",      "JFIF-style JPEG Image",
+  {jpegIdent,      jpegLoad,      jpegDump,    "jpeg",      "JFIF-style JPEG Image"},
 #endif
 #ifdef HAVE_LIBTIFF
-  tiffIdent,      tiffLoad,      tiffDump,    "tiff",      "TIFF image",
+  {tiffIdent,      tiffLoad,      tiffDump,    "tiff",      "TIFF image"},
 #endif
 #ifdef HAVE_LIBPNG
-  pngIdent,       pngLoad,       NULL,        "png",       "PNG image",
+  {pngIdent,       pngLoad,       NULL,        "png",       "PNG image"},
 #endif
-  fbmIdent,       fbmLoad,       NULL,        "fbm",       "FBM Image",
-  cmuwmIdent,     cmuwmLoad,     NULL,        "cmuraster", "CMU WM Raster",
-  pbmIdent,       pbmLoad,       pbmDump,     "pbm",       "Portable Bit Map (PBM, PGM, PPM)",
-  facesIdent,     facesLoad,     NULL,        "faces",     "Faces Project",
-  rleIdent,       rleLoad,       NULL,        "rle",       "Utah RLE Image",
-  xwdIdent,       xwdLoad,       NULL,        "xwd",       "X Window Dump",
-  vffIdent,       vffLoad,       NULL,        "vff",       "Sun Visualization File Format",
-  mcidasIdent,    mcidasLoad,    NULL,        "mcidas",    "McIDAS areafile",
+  {fbmIdent,       fbmLoad,       NULL,        "fbm",       "FBM Image"},
+  {cmuwmIdent,     cmuwmLoad,     NULL,        "cmuraster", "CMU WM Raster"},
+  {pbmIdent,       pbmLoad,       pbmDump,     "pbm",       "Portable Bit Map (PBM, PGM, PPM)"},
+  {facesIdent,     facesLoad,     NULL,        "faces",     "Faces Project"},
+  {rleIdent,       rleLoad,       NULL,        "rle",       "Utah RLE Image"},
+  {xwdIdent,       xwdLoad,       NULL,        "xwd",       "X Window Dump"},
+  {vffIdent,       vffLoad,       NULL,        "vff",       "Sun Visualization File Format"},
+  {mcidasIdent,    mcidasLoad,    NULL,        "mcidas",    "McIDAS areafile"},
 #if 0
-  pdsIdent,       pdsLoad,       NULL,        "pds",       "PDS/VICAR Image",
+  {pdsIdent,       pdsLoad,       NULL,        "pds",       "PDS/VICAR Image"},
 #else
-  vicarIdent,     vicarLoad,     NULL,        "vicar",     "VICAR Image",
+  {vicarIdent,     vicarLoad,     NULL,        "vicar",     "VICAR Image"},
 #endif
-  pcxIdent,       pcxLoad,       NULL,        "pcx",       "PC Paintbrush Image",
-  imgIdent,       imgLoad,       NULL,        "gem",       "GEM Bit Image",
-  macIdent,       macLoad,       NULL,        "macpaint",  "MacPaint Image",
-  xpixmapIdent,   xpixmapLoad,   NULL,        "xpm",       "X Pixmap",
-  xbitmapIdent,   xbitmapLoad,   NULL,        "xbm",       "X Bitmap",
-  NULL,           NULL,          NULL,         NULL,        NULL
+  {pcxIdent,       pcxLoad,       NULL,        "pcx",       "PC Paintbrush Image"},
+  {imgIdent,       imgLoad,       NULL,        "gem",       "GEM Bit Image"},
+  {macIdent,       macLoad,       NULL,        "macpaint",  "MacPaint Image"},
+  {xpixmapIdent,   xpixmapLoad,   NULL,        "xpm",       "X Pixmap"},
+  {xbitmapIdent,   xbitmapLoad,   NULL,        "xbm",       "X Bitmap"},
+  {NULL,           NULL,          NULL,         NULL,        NULL}
 };
+
+void dumpImage (Image *image, char *type, char *filename, int verbose);
+
+#endif /* __IMAGETYPES_H__ */
diff -urNad 06.xloadimage.tmp/img.c 06.xloadimage/img.c
--- 06.xloadimage.tmp/img.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/img.c	2003-04-02 23:27:50.000000000 +0100
@@ -71,11 +71,15 @@
 void (*transf)    ();
 
 static int vdi2pli();
+#ifdef UNUSED_FUNCTIONS
 static int pli2vdi();
+#endif /* UNUSED_FUNCTIONS */
 
 static void   transf0    ();
 static void   transf1    ();
+#ifdef UNUSED_FUNCTIONS
 static void   transf2    ();
+#endif /* UNUSED_FUNCTIONS */
 static void   transf3    ();
 static void   xread_img  ();
 static void   xread_line ();
@@ -89,8 +93,9 @@
 unsigned int            ScanByteBreite, max_planes,
                         pattern_len, plane, x, y, ByteNr, height;
 unsigned char           *ptr, Muster[ALL_PLANES][BUFSIZ], tmp[BUFSIZ];
+#ifdef UNUSED_FUNCTIONS
 static unsigned char    *bitplane[ALL_PLANES], *lastbitplane;
-
+#endif /* UNUSED_FUNCTIONS */
 
 
 static void transf0(bitimage, plane, value, planes)
@@ -128,7 +133,7 @@
 }
 
 
-
+#ifdef UNUSED_FUNCTIONS
 static void transf2(bitimage, plane, value, planes)
      unsigned char *bitimage;
      unsigned int   plane;
@@ -146,6 +151,7 @@
   bitplane[plane][x] = value;
   x++;
 }
+#endif /* UNUSED_FUNCTIONS */
 
 static void transf3(bitimage, plane, value, planes)
      unsigned char *bitimage;
@@ -367,9 +373,10 @@
   ZFILE   *file;
   long    size = 0;
   int     w, h, nplanes;
-  char    extention[5];
 
 #if 0
+  char    extention[5];
+
   strncpy (extention, name+strlen(name)-4, 4);
   extention[4] = '\0';
   if (strcmp(extention, ".IMG") != 0 && strcmp(extention, ".img") != 0)
@@ -402,7 +409,7 @@
     printf("%s is a %dx%d monochrome IMG-file\n",name , w, h);
   else
     if (nplanes != 24)
-      printf("%s is a %dx%d IMG-file with %ld colors\n",name , w, h,
+      printf("%s is a %dx%d IMG-file with %d colors\n",name , w, h,
 	     (1 << nplanes));
     else
       printf("%s is a %dx%d %d-bit IMG-file\n",name , w, h, nplanes);
@@ -564,7 +571,6 @@
   ZFILE  *file;
   long    size = 0;
   int     w, h, nplanes;
-  char    extention[5];
 
   if ((file = zopen(name)) == NULL)
   {
@@ -593,7 +599,7 @@
 
   printf("%s\n  is a %dx%d ",name, w, h);
   if (nplanes != 24)
-    printf("RGB XIMG-file with %ld colors\n", 1<<nplanes);
+    printf("RGB XIMG-file with %d colors\n", 1<<nplanes);
   else
     printf("24-bit XIMG-file\n");
   return (1);
@@ -602,8 +608,6 @@
 static int vdi2pli(vdi, plimax)
      int vdi, plimax;
 {
-  extern unsigned char indexToCode[];
-  extern int           work_ext[];
   static char          vdi2pli[] = {0, 15, 1, 2, 4, 6, 3, 5, 7, 8, 9, 10, 12, 14, 11, 13 };
   
   if (vdi == 1)
@@ -614,7 +618,7 @@
 }
 
 
-
+#ifdef UNUSED_FUNCTIONS
 static int pli2vdi(pli, plimax)
      int pli, plimax;
 {
@@ -626,6 +630,7 @@
     return(pli);
   return(pli2vdi[pli]);
 }
+#endif /* UNUSED_FUNCTIONS */
 
 static Image *load_ximg(name)
      char *name;
diff -urNad 06.xloadimage.tmp/kljcpyrght.h 06.xloadimage/kljcpyrght.h
--- 06.xloadimage.tmp/kljcpyrght.h	1993-10-21 22:28:38.000000000 +0100
+++ 06.xloadimage/kljcpyrght.h	2003-04-02 23:27:50.000000000 +0100
@@ -22,7 +22,9 @@
 ****/
 
 #ifndef __SABER__
+#ifndef LINT
 static char *KLJCopyright = "Copyright 1989, 1990 Kirk L. Johnson";
+#endif /* LINT */
 #endif
 #define _KLJ_COPYRIGHT_
 #endif
diff -urNad 06.xloadimage.tmp/mcidas.c 06.xloadimage/mcidas.c
--- 06.xloadimage.tmp/mcidas.c	1993-10-21 22:28:39.000000000 +0100
+++ 06.xloadimage/mcidas.c	2003-04-02 23:27:50.000000000 +0100
@@ -94,7 +94,7 @@
      char *name;
      struct area_dir *dir;
 {
-  printf("%s is a %dx%d McIDAS areafile from %s at %s (%d, %d) (%d, %d)\n",
+  printf("%s is a %ldx%ld McIDAS areafile from %s at %s (%ld, %ld) (%ld, %ld)\n",
 	 name,
 	 dir->esiz, dir->lsiz,
 	 mc_sensor(dir->satid),
@@ -163,7 +163,6 @@
   struct navigation  nav;
   Image          *image;
   unsigned int    y;
-  int doswap = 0 ;
 
   if (! (zf= zopen(fullname))) {
     perror("mcidasLoad");
@@ -218,7 +217,7 @@
    */
   zread(zf, image->data, dir.esiz * dir.lsiz * dir.zsiz) ;
   if (dir.bands > 1)
-      printf("Warning: Only showing first of %d bands\n", dir.bands);
+      printf("Warning: Only showing first of %ld bands\n", dir.bands);
 
   zclose(zf);
   image->title= dupString(name);
diff -urNad 06.xloadimage.tmp/misc.c 06.xloadimage/misc.c
--- 06.xloadimage.tmp/misc.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/misc.c	2003-04-02 23:27:50.000000000 +0100
@@ -10,6 +10,7 @@
 
 #include "copyright.h"
 #include "xloadimage.h"
+#include "misc.h"
 #ifdef VMS
 #include "patchlevel."
 #else
@@ -151,7 +152,7 @@
 { char errortext[BUFSIZ];
 
   XGetErrorText(disp, error->error_code, errortext, BUFSIZ);
-  fprintf(stderr, "xloadimage: X Error: %s on 0x%x\n",
+  fprintf(stderr, "xloadimage: X Error: %s on 0x%lx\n",
 	  errortext, error->resourceid);
   if (_Xdebug) /* if -debug mode is enabled, dump a core when we hit this */
     abort();
diff -urNad 06.xloadimage.tmp/misc.h 06.xloadimage/misc.h
--- 06.xloadimage.tmp/misc.h	1970-01-01 01:00:00.000000000 +0100
+++ 06.xloadimage/misc.h	2003-04-02 23:27:50.000000000 +0100
@@ -0,0 +1 @@
+void usageHelp() __attribute__ ((noreturn));
diff -urNad 06.xloadimage.tmp/mit.cpyrght 06.xloadimage/mit.cpyrght
--- 06.xloadimage.tmp/mit.cpyrght	1993-10-21 22:29:06.000000000 +0100
+++ 06.xloadimage/mit.cpyrght	2003-04-02 23:27:50.000000000 +0100
@@ -21,8 +21,10 @@
  */
 
 #ifndef __SABER__
+#ifndef LINT
 static char *MitCopyright=
   "Copyright 1989 Massachusetts Institute of Technology";
+#endif /* LINT */
 #endif
 #define _MIT_COPYRIGHT_
 #endif
diff -urNad 06.xloadimage.tmp/new.c 06.xloadimage/new.c
--- 06.xloadimage.tmp/new.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/new.c	2003-04-02 23:27:50.000000000 +0100
@@ -51,8 +51,8 @@
   /* 28 */ 268435456,
   /* 29 */ 536870912,
   /* 30 */ 1073741824,
-  /* 31 */ 2147483648,
-  /* 32 */ 2147483648 /* bigger than unsigned int; this is good enough */
+  /* 31 */ 2147483648UL,
+  /* 32 */ 2147483648UL /* bigger than unsigned int; this is good enough */
 };
 
 unsigned long colorsToDepth(ncolors)
diff -urNad 06.xloadimage.tmp/niff.c 06.xloadimage/niff.c
--- 06.xloadimage.tmp/niff.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/niff.c	2003-04-02 23:27:50.000000000 +0100
@@ -15,25 +15,26 @@
 #include "niff.h"
 
 static void babble(name, header, title)
+     char *name;
      struct niff_header *header;
      char *title;
 {
-  printf("%s is a %dx%d ", name,
+  printf("%s is a %ldx%ld ", name,
 	 memToVal(header->width, 4),
 	 memToVal(header->height, 4));
   if (memToVal(header->version, 4) != NIFF_VERSION)
-    printf("version %d ", memToVal(header->version, 4));
+    printf("version %ld ", memToVal(header->version, 4));
   printf("NIFF ");
   switch (header->type) {
   case NIFF_BITMAP:
     printf("bitmap image");
     break;
   case NIFF_RGB:
-    printf("%d-bit RGB image with %d colors",
+    printf("%ld-bit RGB image with %ld colors",
 	   memToVal(header->depth, 4), memToVal(header->cmap_size, 4));
     break;
   case NIFF_TRUE:
-    printf("%d-bit true color image", memToVal(header->depth, 4));
+    printf("%ld-bit true color image", memToVal(header->depth, 4));
     break;
   default:
     printf("image with an unknown type");
diff -urNad 06.xloadimage.tmp/options.c 06.xloadimage/options.c
--- 06.xloadimage.tmp/options.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/options.c	2003-04-02 23:27:50.000000000 +0100
@@ -12,6 +12,8 @@
 #include <stdio.h>
 #include "image.h"
 #include "options.h"
+#include "misc.h"
+#include "xloadimage.h"
 
 #undef  MIN
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
diff -urNad 06.xloadimage.tmp/options.h 06.xloadimage/options.h
--- 06.xloadimage.tmp/options.h	1993-10-28 17:01:00.000000000 +0000
+++ 06.xloadimage/options.h	2003-04-02 23:27:50.000000000 +0100
@@ -8,6 +8,9 @@
  * copyright information.
  */
 
+#ifndef __OPTIONS_H__
+#define __OPTIONS_H__
+
 /* enum with the options in it.  If you add one to this you also have to
  * add its information to Options[] in options.c before it becomes available.
  */
@@ -98,3 +101,8 @@
 Image *loadImage _ArgProto((OptionSet *globalopts, OptionSet *options,
 			    char *name, unsigned int verbose));
 void   identifyImage _ArgProto((char *name));
+
+void processOptions (int argc, char *argv[], OptionSet **rglobal, OptionSet **rimage);
+void addOption (OptionSet *optset, Option *newopt);
+
+#endif /* __OPTIONS_H__ */
diff -urNad 06.xloadimage.tmp/pcx.c 06.xloadimage/pcx.c
--- 06.xloadimage.tmp/pcx.c	1993-10-28 16:22:12.000000000 +0000
+++ 06.xloadimage/pcx.c	2003-04-02 23:27:50.000000000 +0100
@@ -259,7 +259,6 @@
 	ZFILE *zf;
 	Image *image;
 {
-	int pl;
 	switch (PCXH->Zbpp) {	/* What kind of plane do we have ?	*/
 	    case 1 :			/* Bit planes			*/
 		if (PCXH->Znplanes == 1)	/* Only one : Read it	*/
@@ -298,7 +297,7 @@
 	unsigned int verbose;
 {
 	ZFILE *zf;
-	unsigned int i, ret;
+	unsigned int i;
 	int xmin;
 	int xmax;
 	int ymin;
diff -urNad 06.xloadimage.tmp/pdsuncomp.c 06.xloadimage/pdsuncomp.c
--- 06.xloadimage.tmp/pdsuncomp.c	1993-10-28 16:20:18.000000000 +0000
+++ 06.xloadimage/pdsuncomp.c	2003-04-02 23:27:50.000000000 +0100
@@ -78,7 +78,6 @@
   register NODE **np;           /* Node list pointer */
 
   register long int num_freq;   /* Number non-zero frequencies in histogram */
-  long int sum;                 /* Sum of all frequencies */
 
   register short int num_nodes; /* Counter for DN initialization */
   register short int cnt;       /* Miscellaneous counter */
@@ -114,6 +113,7 @@
     unsigned char *cp = (unsigned char *) hist++;
     unsigned long int j;
     short int i;
+    j = 0;
     for (i=4 ; --i >= 0 ; j = (j << 8) | *(cp+i))
       ;
 
@@ -242,6 +242,7 @@
  * 16-AUG-89 Kris Becker   USGS, Flagstaff Original Version
  */
 
+#ifdef UNUSED_FUNCTIONS
 static void free_tree(nfreed)
      long int   *nfreed;  /* Return of total count of nodes freed. */
 {
@@ -253,6 +254,7 @@
   *nfreed = free_node(tree,total_free);
   return;
 }
+#endif /* UNUSED_FUNCTIONS */
 
 /* free_node - deallocates an allocated NODE pointer
  *
@@ -351,7 +353,6 @@
      char  *ibuf;
 {
   int   length,result,nlen;
-  unsigned int value;
   unsigned char buf[2];
 
   length = 0;
@@ -361,7 +362,7 @@
   return(length);
 }
 
-skip_record(zf)
+void skip_record(zf)
      ZFILE *zf;
 {
   unsigned int value;
@@ -384,9 +385,6 @@
      int type;
 {
   if (type == PDSVARIABLE) {
-    char buf[2];
-    int len;
-    char *dummy;
 
     Decompressing= 1; /* flag pdsRead() to do decompressions */
 
diff -urNad 06.xloadimage.tmp/reduce.c 06.xloadimage/reduce.c
--- 06.xloadimage.tmp/reduce.c	1993-10-21 22:28:40.000000000 +0100
+++ 06.xloadimage/reduce.c	2003-04-02 23:27:50.000000000 +0100
@@ -88,7 +88,7 @@
 /* predicate functions for qsort
  */
 
-static sortRGB(p1, p2)
+static int sortRGB(p1, p2)
      unsigned short *p1, *p2;
 { unsigned int red1, green1, blue1, red2, green2, blue2;
 
@@ -115,7 +115,7 @@
     return(1);
 }
 
-static sortRBG(p1, p2)
+static int sortRBG(p1, p2)
      unsigned short *p1, *p2;
 { unsigned int red1, green1, blue1, red2, green2, blue2;
 
@@ -142,7 +142,7 @@
     return(1);
 }
 
-static sortGRB(p1, p2)
+static int sortGRB(p1, p2)
      unsigned short *p1, *p2;
 { unsigned int red1, green1, blue1, red2, green2, blue2;
 
@@ -169,7 +169,7 @@
     return(1);
 }
 
-static sortGBR(p1, p2)
+static int sortGBR(p1, p2)
      unsigned short *p1, *p2;
 { unsigned int red1, green1, blue1, red2, green2, blue2;
 
@@ -196,7 +196,7 @@
     return(1);
 }
 
-static sortBRG(p1, p2)
+static int sortBRG(p1, p2)
      unsigned short *p1, *p2;
 { unsigned int red1, green1, blue1, red2, green2, blue2;
 
@@ -223,7 +223,7 @@
     return(1);
 }
 
-static sortBGR(p1, p2)
+static int sortBGR(p1, p2)
      unsigned short *p1, *p2;
 { unsigned int red1, green1, blue1, red2, green2, blue2;
 
@@ -254,7 +254,7 @@
  * the color area in the list of color areas.
  */
 
-static insertColorArea(pixel_counts, rlargest, rsmallest, area)
+static void insertColorArea(pixel_counts, rlargest, rsmallest, area)
      unsigned long *pixel_counts;
      struct color_area **rlargest, **rsmallest, *area;
 { int a;
@@ -368,7 +368,7 @@
 { unsigned long pixel_counts[32768]; /* pixel occurrance histogram */
   unsigned short pixel_array[32768];
   unsigned long count, midpoint;
-  int x, y, num_pixels, allocated, depth, ncolors;
+  int x, y, num_pixels, allocated, depth;
   byte *pixel, *dpixel;
   struct color_area *areas, *largest_area, *smallest_area;
   struct color_area *new_area, *old_area;
diff -urNad 06.xloadimage.tmp/rle.c 06.xloadimage/rle.c
--- 06.xloadimage.tmp/rle.c	1993-11-08 21:04:56.000000000 +0000
+++ 06.xloadimage/rle.c	2003-04-02 23:27:50.000000000 +0100
@@ -14,6 +14,7 @@
 #include <stdio.h>
 #include "image.h"
 #include "rle.h"
+#include "rlelib.h"
 
 #undef  DEBUG
 #undef  debug
@@ -394,7 +395,7 @@
 #define DMAP(v,x,y)	(modN[v]>magic[x][y] ? divN[v] + 1 : divN[v])
 
 /* run the black and white through its map */
-bw_m_line(dp,number)
+void bw_m_line(dp,number)
      int number;
      register unsigned char *dp;
 {
@@ -408,7 +409,7 @@
 }
 
 /* convert a colour line with map to 8 bits per pixel */
-c_m_line(dp,number,line)
+void c_m_line(dp,number,line)
      int number,line;
      register unsigned char *dp;
 {
diff -urNad 06.xloadimage.tmp/rle.h 06.xloadimage/rle.h
--- 06.xloadimage.tmp/rle.h	1993-10-21 22:28:40.000000000 +0100
+++ 06.xloadimage/rle.h	2003-04-02 23:27:50.000000000 +0100
@@ -29,6 +29,9 @@
  * 88/07/13 Graeme W. Gill
  */
 
+#ifndef __RLE_H__
+#define __RLE_H__
+
 enum sv_dispatch {
     RUN_DISPATCH
 };
@@ -182,3 +185,7 @@
 extern int dith_np2;	/* set non-zero to use non-power_of_2 matrix size */
 extern int dith_size;	/* effective size of the dither matrix chosen */
 
+void bw_m_line (unsigned char *dp, int number);
+void c_m_line(unsigned char *dp, int number, int line);
+
+#endif /* __RLE_H__ */
diff -urNad 06.xloadimage.tmp/rlelib.c 06.xloadimage/rlelib.c
--- 06.xloadimage.tmp/rlelib.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/rlelib.c	2003-04-02 23:27:50.000000000 +0100
@@ -17,6 +17,7 @@
 
 #include "image.h"		/* need ZFILE definition */
 #include "rle.h"
+#include "rlelib.h"
 
 /* SUPPRESS 530 */
 /* SUPPRESS 558 */
@@ -710,11 +711,12 @@
 {
     for ( ; *n != '\0' && *n != '=' && *n == *v; n++, v++ )
 	;
-    if (*n == '\0' || *n == '=')
+    if (*n == '\0' || *n == '=') {
 	if ( *v == '\0' )
 	    return v;
 	else if ( *v == '=' )
 	    return ++v;
+    }
 
     return NULL;
 }
@@ -820,7 +822,7 @@
  * Algorithm:
  * 	Read in the setup info and fill in sv_globals.
  */
-rle_get_setup( globals )
+int rle_get_setup( globals )
 struct sv_globals * globals;
 {
     struct XtndRsetup setup;
@@ -1100,7 +1102,7 @@
  *	decoding the instructions into scanline data.
  */
 
-rle_getrow( globals, scanline )
+int rle_getrow( globals, scanline )
 struct sv_globals * globals;
 rle_pixel *scanline[];
 {
@@ -1230,7 +1232,7 @@
 
 	    scanc += nc;
 	    scan_x += nc;
-	    if ( debug_f )
+	    if ( debug_f ) {
 		if ( SV_BIT( *globals, channel ) )
 		{
 		    rle_pixel * cp = scanc - nc;
@@ -1241,6 +1243,7 @@
 		}
 	    else
 		fprintf( stderr, "Pixel data %d (to %d)\n", nc, scan_x );
+	    }
 	    break;
 
 	case RRunDataOp:
@@ -1586,7 +1589,7 @@
  * Algorithm:
  * 	Chose sub cell of 16 by 16 magic square
      */
-make_magic( size, magic )
+void make_magic( size, magic )
 int size;
 int magic[16][16];
 {
@@ -1630,7 +1633,7 @@
  * Outputs:
  *  Changes gamma array entries.
  */
-make_gamma( gamma, gammamap )
+void make_gamma( gamma, gammamap )
 double gamma;
 int gammamap[256];
 {
@@ -1667,7 +1670,7 @@
  * Algorithm:
  * 	see "Note:" in dithermap comment.
  */
-dithergb( x, y, r, g, b, levels, divN, modN, magic )
+int dithergb( x, y, r, g, b, levels, divN, modN, magic )
 int divN[256];
 int modN[256];
 int magic[16][16];
@@ -1697,7 +1700,7 @@
  * Algorithm:
  * 	see "Note:" in bwdithermap comment.
  */
-ditherbw( x, y, val, divN, modN, magic )
+int ditherbw( x, y, val, divN, modN, magic )
 int divN[256];
 int modN[256];
 int magic[16][16];
diff -urNad 06.xloadimage.tmp/rlelib.h 06.xloadimage/rlelib.h
--- 06.xloadimage.tmp/rlelib.h	1970-01-01 01:00:00.000000000 +0100
+++ 06.xloadimage/rlelib.h	2003-04-02 23:27:50.000000000 +0100
@@ -0,0 +1,6 @@
+#include "rle.h"
+
+int rle_get_setup (struct sv_globals *globals);
+int rle_getrow (struct sv_globals *globals, rle_pixel *scanline[]);
+void make_gamma (double gamma, int gammamap[256]);
+void make_magic (int size, int magic[16][16]);
diff -urNad 06.xloadimage.tmp/root.c 06.xloadimage/root.c
--- 06.xloadimage.tmp/root.c	1993-11-08 21:05:20.000000000 +0000
+++ 06.xloadimage/root.c	2003-04-02 23:27:50.000000000 +0100
@@ -78,7 +78,7 @@
   if ((XGetWindowProperty(dpy, w, atom, 0, 1, 1/*delete*/,
 			  AnyPropertyType, &actual_type, &format, (unsigned long *)&nitems,
 			  (unsigned long *)&bytes_after, (unsigned char **)&pm) == Success) &&
-      nitems == 1) 
+      nitems == 1) {
     if ((actual_type == XA_PIXMAP) && (format == 32) &&
 	(nitems == 1) && (bytes_after == 0)) {
       /* blast it away */
@@ -90,6 +90,7 @@
 	      "%s: warning: invalid format encountered for property %s\n",
 	      RETAIN_PROP_NAME, "xloadimage");
     }
+  }
 }
 
 #if FIND_DEC_ROOTWINDOW
@@ -151,9 +152,11 @@
   Window        root, rootReturn, parentReturn, *children;
   unsigned int  numChildren;
   int           i;
+#ifdef FIND_DEC_ROOTWINDOW
   char         *s;
+#endif /* FIND_DEC_ROOTWINDOW */
 
-  if (opt= getOption(options, WINDOWID))
+  if ((opt= getOption(options, WINDOWID)))
     root= opt->info.windowid;
   else {
     root = RootWindow(disp, scrn);
diff -urNad 06.xloadimage.tmp/rotate.c 06.xloadimage/rotate.c
--- 06.xloadimage.tmp/rotate.c	1993-10-21 22:28:41.000000000 +0100
+++ 06.xloadimage/rotate.c	2003-04-02 23:27:50.000000000 +0100
@@ -52,7 +52,6 @@
   int       bit[8];			/* Array of hex values         */
   int         x, y;
   int         i, b;
-  int   newx, newy;
   int   newi, newb;
   byte      **yptr;
 
@@ -74,6 +73,7 @@
   sprintf(buf, "%s (rotated by %d degrees)", simage->title, degrees);
 
   image1 = simage;
+  image2 = NULL;
   do {
     degrees -= 90;
     switch (image1->type) {
diff -urNad 06.xloadimage.tmp/send.c 06.xloadimage/send.c
--- 06.xloadimage.tmp/send.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/send.c	2003-04-02 23:27:50.000000000 +0100
@@ -21,7 +21,7 @@
     char buf[MAXERRORLEN+1];
     GotError = 1;
     XGetErrorText(disp, pErrorEvent->error_code, buf, MAXERRORLEN);
-    printf("serial #%d (request code %d) Got Error %s\n",
+    printf("serial #%ld (request code %d) Got Error %s\n",
 	pErrorEvent->serial,
 	pErrorEvent->request_code,
 	buf);
@@ -166,6 +166,8 @@
       unsigned int redbottom, greenbottom, bluebottom;
       unsigned int redtop, greentop, bluetop;
 
+      redtop = greentop = bluetop = 0;
+
       redvalue= (Pixel *)lmalloc(sizeof(Pixel) * 256);
       greenvalue= (Pixel *)lmalloc(sizeof(Pixel) * 256);
       bluevalue= (Pixel *)lmalloc(sizeof(Pixel) * 256);
@@ -300,7 +302,7 @@
 	xcolor.red= *(image->rgb.red + a);
 	xcolor.green= *(image->rgb.green + a);
 	xcolor.blue= *(image->rgb.blue + a);
-	if (! XAllocColor(disp, ximageinfo->cmap, &xcolor))
+	if (! XAllocColor(disp, ximageinfo->cmap, &xcolor)) {
 	  if ((visual->class == StaticColor) ||
 	      (visual->class == StaticGray) ||
 	      (visual->class == TrueColor) ||
@@ -319,6 +321,7 @@
 	    newmap= 1;
 	    break;
 	  }
+	}
 	*(index + a)= xcolor.pixel;
       }
     }
@@ -602,8 +605,6 @@
      int          src_x, src_y, dst_x, dst_y;
      unsigned int w, h;
 { XGCValues gcv;
-  int a, orig_depth;
-  char *orig_data;
 
   /* build and cache the GC
    */
diff -urNad 06.xloadimage.tmp/sunraster.c 06.xloadimage/sunraster.c
--- 06.xloadimage.tmp/sunraster.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/sunraster.c	2003-04-02 23:27:50.000000000 +0100
@@ -42,7 +42,7 @@
   default:
     printf(" unknown-type");
   }
-  printf(" %dx%d", memToVal(header->width, 4), memToVal(header->height, 4));
+  printf(" %ldx%ld", memToVal(header->width, 4), memToVal(header->height, 4));
 
   switch (memToVal(header->depth, 4)) {
   case 1:
@@ -256,7 +256,7 @@
   /*
    *  Handle color...
    */
-  if (mapsize= memToVal(header.maplen, 4)) {
+  if ((mapsize= memToVal(header.maplen, 4))) {
     map= lmalloc(mapsize);
     if (zread(zf, map, mapsize) < mapsize) {
       printf("sunRasterLoad: Bad read on colormap\n");
diff -urNad 06.xloadimage.tmp/tgncpyrght.h 06.xloadimage/tgncpyrght.h
--- 06.xloadimage.tmp/tgncpyrght.h	1993-10-21 22:28:42.000000000 +0100
+++ 06.xloadimage/tgncpyrght.h	2003-04-02 23:27:50.000000000 +0100
@@ -22,7 +22,9 @@
 ****/
 
 #ifndef __SABER__
+#ifndef LINT
 static char *TGNCopyright = "Copyright (C) 1991 Tim Northrup";
+#endif /* LINT */
 #endif
 #define _TGN_COPYRIGHT_
 #endif
diff -urNad 06.xloadimage.tmp/tiff.c 06.xloadimage/tiff.c
--- 06.xloadimage.tmp/tiff.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/tiff.c	2003-04-02 23:27:50.000000000 +0100
@@ -6,6 +6,7 @@
  */
 
 #include "image.h"
+#include "options.h"
 #ifdef HAVE_LIBTIFF
 
 #include <tiffio.h>
diff -urNad 06.xloadimage.tmp/uufilter.c 06.xloadimage/uufilter.c
--- 06.xloadimage.tmp/uufilter.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/uufilter.c	2003-04-02 23:27:50.000000000 +0100
@@ -163,6 +163,7 @@
      */
     bp = &buf[1];
     phase = 0;
+    outchar = 0;
     while (len > 0) {
       unsigned char c;
 
diff -urNad 06.xloadimage.tmp/vff.c 06.xloadimage/vff.c
--- 06.xloadimage.tmp/vff.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/vff.c	2003-04-02 23:27:50.000000000 +0100
@@ -361,7 +361,7 @@
      return(0); /* so that we try and see what was wrong */
 }
 
-vffIdent(fullname, name)
+int vffIdent(fullname, name)
 char *fullname, *name;
 {
 
diff -urNad 06.xloadimage.tmp/vicar.c 06.xloadimage/vicar.c
--- 06.xloadimage.tmp/vicar.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/vicar.c	2003-04-02 23:27:51.000000000 +0100
@@ -107,14 +107,12 @@
      char *fullname, *name;
      unsigned int verbose;
 {
-  char         c;
-  int          i,j;
+  int          i;
   unsigned int mapsize, size;
   Image        *image;
   byte         *lineptr;
   byte         *map;
   byte         *mapred,*mapgreen,*mapblue;
-  byte         *buf;
   ZFILE        *zf;
  
   if ( vicarIdent(fullname,name,verbose) == 0 )
diff -urNad 06.xloadimage.tmp/window.c 06.xloadimage/window.c
--- 06.xloadimage.tmp/window.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/window.c	2003-04-02 23:27:51.000000000 +0100
@@ -227,7 +227,7 @@
      int scrn;
      Visual *visual;
 { XSetWindowAttributes swa;
-  static cmap_atom= None;
+  static Atom cmap_atom= None;
   Window cmap_windows[2];
 
   if (cmap_atom == None)
@@ -278,7 +278,7 @@
    * want to change this.
    */
 
-  if (t= rindex(buf, '/')) {
+  if ((t= rindex(buf, '/'))) {
     for (s= buf, t++; *t; s++, t++)
       *s= *t;
     *s= '\0';
@@ -296,14 +296,14 @@
   int   class; /* numerical value of class */
   char *name;  /* actual name of class */
 } VisualClassName[] = {
-  TrueColor,   "TrueColor",
-  DirectColor, "DirectColor",
-  PseudoColor, "PseudoColor",
-  StaticColor, "StaticColor",
-  GrayScale,   "GrayScale",
-  StaticGray,  "StaticGray",
-  StaticGray,  "StaticGrey",
-  -1,          NULL
+  {TrueColor,   "TrueColor"},
+  {DirectColor, "DirectColor"},
+  {PseudoColor, "PseudoColor"},
+  {StaticColor, "StaticColor"},
+  {GrayScale,   "GrayScale"},
+  {StaticGray,  "StaticGray"},
+  {StaticGray,  "StaticGrey"},
+  {-1,          NULL}
 };
 
 int visualClassFromName(name)
@@ -393,6 +393,7 @@
    * have no visuals that support that depth.  seems silly to me....
    */
 
+  visual = NULL;
   depth= 0;
   screen= ScreenOfDisplay(disp, scrn);
   for (a= 0; a < screen->ndepths; a++) {
@@ -575,19 +576,21 @@
   unsigned int          private_cmap;
   int                   visual_class;
 
+  oldcmap = 0;
+  lastx = 0;
   /* get values from options that we'll use a lot
    */
   fit= (getOption(global_options, FIT) != NULL);
   fullscreen= (getOption(global_options, FULLSCREEN) != NULL);
   install= (getOption(global_options, INSTALL) != NULL);
   private_cmap= (getOption(global_options, PRIVATE) != NULL);
-  if (opt= getOption(image_options, DELAY))
+  if ((opt= getOption(image_options, DELAY)))
     delay= opt->info.delay;
-  else if (opt= getOption(global_options, DELAY))
+  else if ((opt= getOption(global_options, DELAY)))
     delay= opt->info.delay;
   else
     delay= 0;
-  if (opt= getOption(image_options, VISUAL))
+  if ((opt= getOption(image_options, VISUAL)))
     visual_class= opt->info.visual;
   else
     visual_class= -1;
diff -urNad 06.xloadimage.tmp/xbitmap.c 06.xloadimage/xbitmap.c
--- 06.xloadimage.tmp/xbitmap.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/xbitmap.c	2003-04-02 23:27:51.000000000 +0100
@@ -247,7 +247,7 @@
      char         *fullname, *name;
 { Image *image;
 
-  if (image= xbitmapLoad(fullname, name, (unsigned int)1)) {
+  if ((image= xbitmapLoad(fullname, name, (unsigned int)1))) {
     freeImage(image);
     return(1);
   }
diff -urNad 06.xloadimage.tmp/xloadimage.c 06.xloadimage/xloadimage.c
--- 06.xloadimage.tmp/xloadimage.c	2003-04-02 23:28:23.000000000 +0100
+++ 06.xloadimage/xloadimage.c	2003-04-02 23:27:51.000000000 +0100
@@ -10,6 +10,8 @@
 
 #include "copyright.h"
 #include "xloadimage.h"
+#include "options.h"
+#include "misc.h"
 #ifdef VMS
 #include "patchlevel."
 #define NO_FORK
@@ -121,6 +123,10 @@
   case ZOOM:
     retimage= zoom(image, option->info.zoom.x, option->info.zoom.y, verbose);
     break;
+
+  default:
+    /* Nothing to do */
+    break;
   }
   return(retimage);
 }
@@ -167,7 +173,7 @@
 /* the real thing
  */
 
-main(argc, argv)
+int main(argc, argv)
      int argc;
      char *argv[];
 { Option *opt;
@@ -233,7 +239,7 @@
 
   if (getOption(global_options, IDENTIFY)) {
     for (optset= image_options; optset; optset= optset->next) {
-      if (opt= getOption(optset, NAME))
+      if ((opt= getOption(optset, NAME)))
 	identifyImage(opt->info.name);
     }
     exit(0);
@@ -272,7 +278,7 @@
   onroot= (getOption(global_options, ONROOT) != NULL);
   fullscreen= (getOption(global_options, FULLSCREEN) != NULL);
   shrinktofit= (getOption(global_options, SHRINKTOFIT) != NULL);
-  if (opt= getOption(global_options, GEOMETRY)) {
+  if ((opt= getOption(global_options, GEOMETRY))) {
     winwidth= opt->info.geometry.w;
     winheight= opt->info.geometry.h;
   }
@@ -354,7 +360,7 @@
 
     /* retitle the image if we were asked to
      */
-    if (opt= getOption(optset, TITLE)) {
+    if ((opt= getOption(optset, TITLE))) {
       if (newimage->title)
 	lfree((byte *)newimage->title);
       newimage->title= dupString(opt->info.title);
@@ -428,7 +434,7 @@
 
       /* handle -at
        */
-      if (opt= getOption(optset, AT))
+      if ((opt= getOption(optset, AT)))
 	tmpimage= merge(dispimage, newimage,
 			opt->info.at.x, opt->info.at.y, verbose);
       else
@@ -470,7 +476,7 @@
       exit(0);
     case ' ':
     case 'n':  /* next image */
-      if (opt= getOption(optset->next, GOTO)) {
+      if ((opt= getOption(optset->next, GOTO))) {
 	char *tag= opt->info.go_to;
 
 	for (tmpset= image_options; tmpset; tmpset= tmpset->next) {
@@ -539,7 +545,7 @@
     for (optset= image_options; optset && optset->next; optset= optset->next)
       /* EMPTY */
       ;
-    if (opt= getOption(optset, NAME)) {
+    if ((opt= getOption(optset, NAME))) {
       if (dispimage->title)
 	lfree((byte *)dispimage->title);
       dispimage->title= dupString(opt->info.title);
diff -urNad 06.xloadimage.tmp/xloadimage.h 06.xloadimage/xloadimage.h
--- 06.xloadimage.tmp/xloadimage.h	1993-10-28 16:26:55.000000000 +0000
+++ 06.xloadimage/xloadimage.h	2003-04-02 23:27:51.000000000 +0100
@@ -38,6 +38,7 @@
  */
 
 void supportedImageTypes(); /* imagetypes.c */
+void dumpImage();
 
 char *tail(); /* misc.c */
 void memoryExhausted();
@@ -47,6 +48,9 @@
 void goodImage();
 int errorHandler();
 
+void showConfiguration(); /* config.c */
+void listImages();
+
 char *expandPath(); /* path.c */
 int findImage();
 void listImages();
diff -urNad 06.xloadimage.tmp/xpixmap.c 06.xloadimage/xpixmap.c
--- 06.xloadimage.tmp/xpixmap.c	1993-10-21 22:28:44.000000000 +0100
+++ 06.xloadimage/xpixmap.c	2003-04-02 23:27:51.000000000 +0100
@@ -54,6 +54,8 @@
   int            c;
   byte          *dptr;
 
+  cpp = 0;
+
   if (! (zf= zopen(fullname)))
     return(NULL);
 
@@ -112,7 +114,7 @@
     return(NULL);
   }
 
-  if (p= rindex(what, '_')) {     /* get the name in the image if there is */
+  if ((p= rindex(what, '_'))) {     /* get the name in the image if there is */
     *p= '\0';                     /* one */
     imagetitle= dupString(what);
   }
@@ -190,7 +192,7 @@
       break;
   }
 
-  if (p= rindex(what, '_'))
+  if ((p= rindex(what, '_')))
     p++;
   else
     p= what;
@@ -234,7 +236,7 @@
      char *fullname, *name;
 { Image *image;
 
-  if (image= xpixmapLoad(fullname, name, (unsigned int)1)) {
+  if ((image= xpixmapLoad(fullname, name, (unsigned int)1))) {
     freeImage(image);
     return(1);
   }
diff -urNad 06.xloadimage.tmp/xwd.c 06.xloadimage/xwd.c
--- 06.xloadimage.tmp/xwd.c	1993-10-21 22:28:44.000000000 +0100
+++ 06.xloadimage/xwd.c	2003-04-02 23:27:51.000000000 +0100
@@ -418,6 +418,8 @@
   Image     *image;
   int        a;
 
+  image = NULL;
+
   if (! (zf= zopen(fullname)))
     return(NULL);
   if (! isXWD(name, zf, &header, verbose)) {
diff -urNad 06.xloadimage.tmp/zoom.c 06.xloadimage/zoom.c
--- 06.xloadimage.tmp/zoom.c	1993-10-21 22:28:44.000000000 +0100
+++ 06.xloadimage/zoom.c	2003-04-02 23:27:51.000000000 +0100
@@ -53,6 +53,8 @@
   byte          srcmask, destmask, bit;
   Pixel         value;
 
+  image = NULL;
+
   goodImage(oimage, "zoom");
 
   if (!xzoom && !yzoom) /* stupid user */


--- NEW FILE 07_SYSPATHFILE.dpatch ---
#! /bin/sh -e
## 07_SYSPATHFILE.dpatch by James Troup <james at nocrew.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Define SYSPATHFILE during build.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

diff -urNad 07.xloadimage.tmp/Makefile.in 07.xloadimage/Makefile.in
--- 07.xloadimage.tmp/Makefile.in	2003-04-02 23:40:49.000000000 +0100
+++ 07.xloadimage/Makefile.in	2003-04-02 23:40:15.000000000 +0100
@@ -3,7 +3,7 @@
 #
 
 CC = @CC@
-DEFS = @DEFS@
+DEFS = @DEFS@ -DSYSPATHFILE=\"/etc/X11/Xloadimage\"
 CFLAGS = @CFLAGS@
 XLIB = @X_LIBS@ -lX11 @X_EXTRA_LIBS@
 LDFLAGS = @LDFLAGS@


--- NEW FILE 08_manpage-config-path.dpatch ---
#! /bin/sh -e
## 08_manpage-config-path.dpatch by Austin Donnelly <and1000 at debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Correct path for system-wide configuration file in manpage.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

diff -urNad 08.xloadimage.tmp/xloadimage.man 08.xloadimage/xloadimage.man
--- 08.xloadimage.tmp/xloadimage.man	2003-04-02 23:43:14.000000000 +0100
+++ 08.xloadimage/xloadimage.man	2003-04-02 23:42:26.000000000 +0100
@@ -633,7 +633,7 @@
 xloadimage              - the image loader and viewer
 xsetbg                  - pseudonym which quietly sets the background
 xview                   - pseudonym which views in a window
-/usr/lib/X11/Xloadimage - default system-wide configuration file
+/etc/X11/Xloadimage     - default system-wide configuration file
 ~/.xloadimagerc         - user's personal configuration file
 .in -5
 .fi


--- NEW FILE 09_xloadimagerc-path.dpatch ---
#! /bin/sh -e
## 09_xloadimagerc-path.dpatch by Austin Donnelly <and1000 at debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Include ~images in path for system-wide configuration file.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

diff -urNad 09.xloadimage.tmp/xloadimagerc 09.xloadimage/xloadimagerc
--- 09.xloadimage.tmp/xloadimagerc	1993-10-21 22:30:32.000000000 +0100
+++ 09.xloadimage/xloadimagerc	2003-04-02 23:44:16.000000000 +0100
@@ -1,6 +1,9 @@
 # Sample .xloadimagerc file
 
-path = /usr/local/images
+# Directories to search for images
+path = ~/images /usr/local/images
+
+# Default extensions to try tacking onto the end of a filename, in order
 extension = .niff             # NIFF image
             .jpg .jpeg        # JPEG image
             .gif              # CompuServe GIF image


--- NEW FILE 10_config.c-HOME-fix.dpatch ---
#! /bin/sh -e
## 10_config.c-HOME-fix.dpatch by Austin Donnelly <and1000 at debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Gracefully handle lack of HOME env. variable.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

diff -urNad 10.xloadimage.tmp/config.c 10.xloadimage/config.c
--- 10.xloadimage.tmp/config.c	2003-04-02 23:48:30.000000000 +0100
+++ 10.xloadimage/config.c	2003-04-02 23:46:22.000000000 +0100
@@ -15,11 +15,13 @@
 #include <sys/stat.h>
 #ifndef VMS
 #include <pwd.h>
+#include <sys/types.h>
 #endif
 #include <errno.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#include <stdlib.h>
 
 /* SUPPRESS 530 */
 /* SUPPRESS 560 */
@@ -434,14 +436,29 @@
     printf("No filters\n");
 }
 
+/* Work out where this user's home directory is, or default to '/' */
+/* XXX needs a VMS guru to supply something plausable for VMS */
+static char *homedir()
+{ char *p;
+  struct passwd *pw;
+
+  p = getenv("HOME");
+  if (p) return p;
+
+  /* try for a password file lookup instead */
+  pw = getpwuid(getuid());
+  if (!pw)
+    return "/"; /* XXX maybe print message? */
+  else
+    return pw->pw_dir;
+}
+
 char *expandPath(p)
      char *p;
 { char buf1[BUFSIZ], buf2[BUFSIZ];
   int b1, b2, var;
   char *ptr;
 
-  char *getenv();
-
   buf1[0] = '\0';
   buf2[0] = '\0';
   b1 = 0;
@@ -455,7 +472,7 @@
 #endif
     else if(*p == '~') {
       buf1[b1] = '\0';
-      strncat(buf1, getenv("HOME"), BUFSIZ - strlen(buf1) - 1);
+      strncat(buf1, homedir(), BUFSIZ - strlen(buf1) - 1);
       buf1[BUFSIZ - 1] = '\0';
       b1 = strlen(buf1);
       var = 0;


--- NEW FILE 11_fork-implies-quiet.dpatch ---
#! /bin/sh -e
## 11_fork-implies-quiet.dpatch by Jens Peter Secher <jpsecher at diku.dk>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Make -fork imply -quiet as documented.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

diff -urNad 11.xloadimage.tmp/options.c 11.xloadimage/options.c
--- 11.xloadimage.tmp/options.c	2003-04-05 14:13:53.000000000 +0100
+++ 11.xloadimage/options.c	2003-04-05 14:13:30.000000000 +0100
@@ -551,6 +551,7 @@
 	      optionName(FORK));
       continue;
 #else
+      killOption(global_options, VERBOSE);
       global_opt= 1;
       break;
 #endif


--- NEW FILE 12_fix-tile.dpatch ---
#! /bin/sh -e
## 12_fix-tile.dpatch by Rémi Guyomarch <rguyom at pobox.com> (via FreeBSD & OpenBSD)
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix -tile for images smaller than the screen.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

diff -urNad 12.xloadimage.tmp/merge.c 12.xloadimage/merge.c
--- 12.xloadimage.tmp/merge.c	1993-10-21 22:28:39.000000000 +0100
+++ 12.xloadimage/merge.c	2003-04-05 15:04:06.000000000 +0100
@@ -244,6 +244,7 @@
      int x, y;
      unsigned int width, height, verbose;
 { Image *base, *tmp;
+  int nx, ny;
 
   if (verbose) {
     printf("  Tiling...");
@@ -259,16 +260,14 @@
   else
     base = newTrueImage(width, height);
 
-  while (x < base->width) {
-    while(y < base->height) {
-      tmp = merge(base, image, x, y, 0);
+  for (nx = x; nx < base->width; nx += image->width) {
+    for(ny = y; ny < base->height; ny += image->height) {
+      tmp = merge(base, image, nx, ny, 0);
       if (tmp != base) {
 	freeImage(base);
 	base = tmp;
       }
-      y += image->width;
     }
-    x += image->width;
   }
   printf("done.\n");
   return(base);


--- NEW FILE 13_varargs-is-obsolete.dpatch ---
#!/bin/sh -e
## 13_varargs-is-obsolete.dpatch by James Troup <james at nocrew.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: <varargs.h> is obsolete and no longer supported by gcc-3.3.
## DP: ... and more to the point rlelib.c doesn't actually need it.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"

case "$1" in
       -patch) patch $patch_opts -p1 < $0;;
       -unpatch) patch $patch_opts -p1 -R < $0;;
        *)
                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
                exit 1;;
esac

exit 0

@DPATCH@
diff -urNad /home/james/debian/packages/xloadimage/xloadimage-4.1/rlelib.c xloadimage-4.1/rlelib.c
--- /home/james/debian/packages/xloadimage/xloadimage-4.1/rlelib.c	2003-06-06 03:32:44.000000000 +0100
+++ xloadimage-4.1/rlelib.c	2003-06-06 03:33:00.000000000 +0100
@@ -12,7 +12,6 @@
 
 #include <stdio.h>
 #include <math.h>
-#include <varargs.h>
 #include <ctype.h>
 
 #include "image.h"		/* need ZFILE definition */


--- NEW FILE 14_errno-not-extern.dpatch ---
#!/bin/sh -e
## 14_errno-not-extern.dpatch by James Troup <james at nocrew.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Remove 'extern int errno' which breaks with new glibc (>=
## DP: 2.3.2-ds1-8) and add #include <errno.h> where needed.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"

case "$1" in
       -patch) patch $patch_opts -p1 < $0;;
       -unpatch) patch $patch_opts -p1 -R < $0;;
        *)
                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
                exit 1;;
esac

exit 0

@DPATCH@
diff -urNad /home/james/debian/packages/xloadimage/xloadimage-4.1/config.c xloadimage-4.1/config.c
--- /home/james/debian/packages/xloadimage/xloadimage-4.1/config.c	2003-10-31 01:50:29.000000000 +0000
+++ xloadimage-4.1/config.c	2003-10-31 01:50:29.000000000 +0000
@@ -26,8 +26,6 @@
 /* SUPPRESS 530 */
 /* SUPPRESS 560 */
 
-extern int errno;
-
 struct filter *Filters = (struct filter *)NULL;
 
 static unsigned int  NumPaths= 0;
diff -urNad /home/james/debian/packages/xloadimage/xloadimage-4.1/imagetypes.c xloadimage-4.1/imagetypes.c
--- /home/james/debian/packages/xloadimage/xloadimage-4.1/imagetypes.c	2003-10-31 01:50:29.000000000 +0000
+++ xloadimage-4.1/imagetypes.c	2003-10-31 01:50:29.000000000 +0000
@@ -16,7 +16,6 @@
 
 /* SUPPRESS 560 */
 
-extern int errno;
 extern int findImage(char *name, char *fullname);
 
 /* load a named image
diff -urNad /home/james/debian/packages/xloadimage/xloadimage-4.1/img.c xloadimage-4.1/img.c
--- /home/james/debian/packages/xloadimage/xloadimage-4.1/img.c	2003-10-31 01:50:29.000000000 +0000
+++ xloadimage-4.1/img.c	2003-10-31 01:50:43.000000000 +0000
@@ -14,10 +14,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <errno.h>
 #include "image.h"
 
-extern int errno;
-
 #define TRUE  1
 #define FALSE 0
 
diff -urNad /home/james/debian/packages/xloadimage/xloadimage-4.1/packtar.c xloadimage-4.1/packtar.c
--- /home/james/debian/packages/xloadimage/xloadimage-4.1/packtar.c	2003-10-31 01:50:29.000000000 +0000
+++ xloadimage-4.1/packtar.c	2003-10-31 01:50:29.000000000 +0000
@@ -11,8 +11,6 @@
 #include <stdio.h>
 #include <errno.h>
 
-extern int errno;
-
 /* poor-man's varargs.  good enough for now.
  */
 int run(a0, a1, a2, a3, a4, a5, a6, a7, a8)
diff -urNad /home/james/debian/packages/xloadimage/xloadimage-4.1/window.c xloadimage-4.1/window.c
--- /home/james/debian/packages/xloadimage/xloadimage-4.1/window.c	2003-10-31 01:50:29.000000000 +0000
+++ xloadimage-4.1/window.c	2003-10-31 01:50:29.000000000 +0000
@@ -33,8 +33,6 @@
 
 /* SUPPRESS 560 */
 
-extern int errno; /* not defined in errno.h on some systems */
-
 static Window    ImageWindow= 0;
 static Window    ViewportWin= 0;
 static Colormap  ImageColormap;


--- NEW FILE 15_CAN-2005-0638.dpatch ---
#! /bin/sh -e
## 15_CAN-2005-0638.dpatch
##
## DP: Description: Fix shell metacharacters vulnerability with compressed
## DP:              images (#298926).
## DP: Author: xli upstream via Gentoo
## DP: Upstream status: Not submitted
## DP: Date: 2005-03-10

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

@DPATCH@
diff -urNad --exclude=CVS --exclude=.svn ./zio.c /tmp/dpep-work.7hAKRd/xloadimage-4.1/zio.c
--- ./zio.c	1993-10-28 17:10:02.000000000 +0000
+++ /tmp/dpep-work.7hAKRd/xloadimage-4.1/zio.c	2005-10-08 04:12:08.000000000 +0100
@@ -210,9 +210,30 @@
     if ((strlen(name) > strlen(filter->extension)) &&
 	!strcmp(filter->extension,
 		name + (strlen(name) - strlen(filter->extension)))) {
-      debug(("Filtering image through '%s'\n", filter->filter));
-      zf->type= ZPIPE;
-      sprintf(buf, "%s %s", filter->filter, name);
+            char *fname, *t, *s;
+            
+            /* meta-char protection from xli.
+             *
+             * protect in single quotes, replacing single quotes
+             * with '"'"', so worst-case expansion is 5x
+             */
+            
+            s = fname = (char *) lmalloc(1 + (5 * strlen(name)) + 1 + 1);
+			*s++ = '\'';
+            for (t = name; *t; ++t) {
+                if ('\'' == *t) {
+					/* 'foo'bar' -> 'foo'"'"'bar' */
+                    strcpy(s, "'\"'\"'");
+					s += strlen(s);
+                } else {
+                    *s++ = *t;
+                }
+            }
+            strcpy (s, "'");
+            debug(("Filtering image through '%s'\n", filter->filter));
+            zf->type= ZPIPE;
+            sprintf(buf, "%s %s", filter->filter, fname);
+            lfree (fname);
       if (! (zf->stream= popen(buf, "r"))) {
 	lfree((byte *)zf->filename);
 	zf->filename= NULL;


--- NEW FILE 16_CAN-2005-0639.dpatch ---
#! /bin/sh -e
## 16_CAN-2005-0639.dpatch
##
## DP: Description: Fix integer overflows in new.c.
## DP: Author: Debian security team
## DP: Upstream status: Not submitted
## DP: Date: 2005-03-18

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

@DPATCH@
diff -urNad --exclude=CVS --exclude=.svn ./new.c /tmp/dpep-work.Yefw4q/xloadimage-4.1/new.c
--- ./new.c	1993-10-28 17:24:14.000000000 +0000
+++ /tmp/dpep-work.Yefw4q/xloadimage-4.1/new.c	2005-10-08 04:12:37.000000000 +0100
@@ -63,6 +63,18 @@
 }
 
 
+static unsigned int ovmul(unsigned int a, unsigned int b)
+{
+  unsigned int r;
+
+  r = a * b;
+  if (r / a != b) {
+    memoryExhausted();
+  }
+
+  return r;
+}
+
 void goodImage(image, func)
      Image *image;
      char  *func;
@@ -128,7 +140,7 @@
   image->height= height;
   image->depth= 1;
   linelen= (width / 8) + (width % 8 ? 1 : 0); /* thanx johnh at amcc.com */
-  image->data= (unsigned char *)lcalloc(linelen * height);
+  image->data= (unsigned char *)lcalloc(ovmul(linelen, height));
   return(image);
 }
 
@@ -149,7 +161,7 @@
   image->height= height;
   image->depth= depth;
   image->pixlen= pixlen;
-  image->data= (unsigned char *)lmalloc(width * height * pixlen);
+  image->data= (unsigned char *)lmalloc(ovmul(ovmul(width, height), pixlen));
   return(image);
 }
 
@@ -165,6 +177,7 @@
   image->height= height;
   image->depth= 24;
   image->pixlen= 3;
+  image->data= (unsigned char *)lmalloc(ovmul(ovmul(width, height), 3));
   image->data= (unsigned char *)lmalloc(width * height * 3);
   return(image);
 }


--- NEW FILE 17_security-sprintf.dpatch ---
#! /bin/sh -e
## 17_security-sprintf.dpatch
##
## DP: Description: Fix unsafe sprintf usage.  (#332524)
## DP: Author: James Troup <james at nocrew.org>
## DP: Upstream status: Not submitted
## DP: URL: http://msgs.securepoint.com/cgi-bin/get/bugtraq0510/57.html
## DP: Date: 2005-10-07

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

@DPATCH@
diff -urNad --exclude=CVS --exclude=.svn ./mcidas.c /tmp/dpep-work.5qsW5w/xloadimage-4.1/mcidas.c
--- ./mcidas.c	2005-10-08 04:15:18.000000000 +0100
+++ /tmp/dpep-work.5qsW5w/xloadimage-4.1/mcidas.c	2005-10-08 04:15:19.000000000 +0100
@@ -63,7 +63,7 @@
   minute = (time % 10000) / 100;
   second = (time % 100);
 
-  sprintf(buf, "%d:%2.2d:%2.2d %s %d, %d (day %d)",
+  snprintf(buf, 29, "%d:%2.2d:%2.2d %s %d, %d (day %d)",
 	  hour, minute, second, month_info[month].name, day, year,
 	  (date % 1000));
   return(buf);
diff -urNad --exclude=CVS --exclude=.svn ./reduce.c /tmp/dpep-work.5qsW5w/xloadimage-4.1/reduce.c
--- ./reduce.c	2005-10-08 04:15:18.000000000 +0100
+++ /tmp/dpep-work.5qsW5w/xloadimage-4.1/reduce.c	2005-10-08 04:15:19.000000000 +0100
@@ -501,7 +501,7 @@
 
   depth= colorsToDepth(n);
   new_image= newRGBImage(image->width, image->height, depth);
-  sprintf(buf, "%s (%d colors)", image->title, n);
+  snprintf(buf, BUFSIZ - 1, "%s (%d colors)", image->title, n);
   new_image->title= dupString(buf);
 
   /* calculate RGB table from each color area.  this should really calculate
diff -urNad --exclude=CVS --exclude=.svn ./rotate.c /tmp/dpep-work.5qsW5w/xloadimage-4.1/rotate.c
--- ./rotate.c	2005-10-08 04:15:18.000000000 +0100
+++ /tmp/dpep-work.5qsW5w/xloadimage-4.1/rotate.c	2005-10-08 04:15:19.000000000 +0100
@@ -70,7 +70,7 @@
     { printf("  Rotating image by %d degrees...", degrees);
       fflush(stdout);
     }
-  sprintf(buf, "%s (rotated by %d degrees)", simage->title, degrees);
+  snprintf(buf, BUFSIZ - 1, "%s (rotated by %d degrees)", simage->title, degrees);
 
   image1 = simage;
   image2 = NULL;
diff -urNad --exclude=CVS --exclude=.svn ./tiff.c /tmp/dpep-work.5qsW5w/xloadimage-4.1/tiff.c
--- ./tiff.c	2005-10-08 04:15:18.000000000 +0100
+++ /tmp/dpep-work.5qsW5w/xloadimage-4.1/tiff.c	2005-10-08 04:15:19.000000000 +0100
@@ -125,14 +125,14 @@
   switch (info->photometric) {
   case PHOTOMETRIC_MINISBLACK:
     if (info->bitspersample > 1) {
-      sprintf(buf, "%d-bit greyscale ", info->bitspersample);
+      snprintf(buf, 31, "%d-bit greyscale ", info->bitspersample);
       return(buf);
     }
     else
       return "white-on-black ";
   case PHOTOMETRIC_MINISWHITE:
     if (info->bitspersample > 1) {
-      sprintf(buf, "%d-bit greyscale ", info->bitspersample);
+      snprintf(buf, 31, "%d-bit greyscale ", info->bitspersample);
       return(buf);
     }
     else
diff -urNad --exclude=CVS --exclude=.svn ./window.c /tmp/dpep-work.5qsW5w/xloadimage-4.1/window.c
--- ./window.c	2005-10-08 04:15:18.000000000 +0100
+++ /tmp/dpep-work.5qsW5w/xloadimage-4.1/window.c	2005-10-08 04:15:19.000000000 +0100
@@ -602,7 +602,7 @@
   else {
     char def_geom[30];
 
-    sprintf(def_geom, "%ux%u+0+0", image->width, image->height);
+    snprintf(def_geom, 29, "%ux%u+0+0", image->width, image->height);
     XGeometry(disp, scrn, opt->info.geometry.string, def_geom, 0, 1, 1, 0, 0,
 	      (int *)&winx, (int *)&winy, (int *)&winwidth, (int *)&winheight);
   }
diff -urNad --exclude=CVS --exclude=.svn ./zio.c /tmp/dpep-work.5qsW5w/xloadimage-4.1/zio.c
--- ./zio.c	2005-10-08 04:15:18.000000000 +0100
+++ /tmp/dpep-work.5qsW5w/xloadimage-4.1/zio.c	2005-10-08 04:15:28.000000000 +0100
@@ -232,7 +232,7 @@
             strcpy (s, "'");
             debug(("Filtering image through '%s'\n", filter->filter));
             zf->type= ZPIPE;
-            sprintf(buf, "%s %s", filter->filter, fname);
+            snprintf(buf, BUFSIZ - 1, "%s %s", filter->filter, fname);
             lfree (fname);
       if (! (zf->stream= popen(buf, "r"))) {
 	lfree((byte *)zf->filename);
diff -urNad --exclude=CVS --exclude=.svn ./zoom.c /tmp/dpep-work.5qsW5w/xloadimage-4.1/zoom.c
--- ./zoom.c	2005-10-08 04:15:18.000000000 +0100
+++ /tmp/dpep-work.5qsW5w/xloadimage-4.1/zoom.c	2005-10-08 04:15:19.000000000 +0100
@@ -63,23 +63,23 @@
   if (!xzoom) {
     if (verbose)
       printf("  Zooming image Y axis by %d%%...", yzoom);
-      sprintf(buf, "%s (Y zoom %d%%)", oimage->title, yzoom);
+      snprintf(buf, BUFSIZ - 1, "%s (Y zoom %d%%)", oimage->title, yzoom);
   }
   else if (!yzoom) {
     if (verbose)
       printf("  Zooming image X axis by %d%%...", xzoom);
-    sprintf(buf, "%s (X zoom %d%%)", oimage->title, xzoom);
+    snprintf(buf, BUFSIZ - 1, "%s (X zoom %d%%)", oimage->title, xzoom);
   }
   else if (xzoom == yzoom) {
     if (verbose)
       printf("  Zooming image by %d%%...", xzoom);
-    sprintf(buf, "%s (%d%% zoom)", oimage->title, xzoom);
+    snprintf(buf, BUFSIZ - 1, "%s (%d%% zoom)", oimage->title, xzoom);
   }
   else {
     if (verbose)
       printf("  Zooming image X axis by %d%% and Y axis by %d%%...",
 	     xzoom, yzoom);
-    sprintf(buf, "%s (X zoom %d%% Y zoom %d%%)", oimage->title,
+    snprintf(buf, BUFSIZ - 1, "%s (X zoom %d%% Y zoom %d%%)", oimage->title,
 	    xzoom, yzoom);
   }
   if (verbose)


--- NEW FILE 18_manpage_fixes.dpatch ---
#! /bin/sh -e
## 18_manpage_fixes.dpatch
##
## DP: Various typo fixes and correction of .TH section.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

@DPATCH@
diff -urNad xloadimage-4.1~/uufilter.man xloadimage-4.1/uufilter.man
--- xloadimage-4.1~/uufilter.man	1993-11-04 15:47:26.000000000 +0000
+++ xloadimage-4.1/uufilter.man	2005-12-06 02:47:57.000000000 +0000
@@ -1,4 +1,4 @@
-.TH UUFILTER 1 "21 October 1993"
+.TH UUFILTER 1x "21 October 1993"
 .SH NAME
 uufilter - decode uuencoded files to stdout
 .SH SYNOPSIS
@@ -12,7 +12,7 @@
 \fIUufilter\fR automatically ignores lines that do not appear to be
 part of the uuencoded file.  This is particularly useful in uudecoding
 files that have been concatenated from several email or news postings
-without stripping off the headers or otherwise editting extraneous
+without stripping off the headers or otherwise editing extraneous
 content.
 .SH OPTIONS
 .TP 8
diff -urNad xloadimage-4.1~/xloadimage.man xloadimage-4.1/xloadimage.man
--- xloadimage-4.1~/xloadimage.man	2005-12-06 02:45:45.000000000 +0000
+++ xloadimage-4.1/xloadimage.man	2005-12-06 02:52:04.000000000 +0000
@@ -1,4 +1,4 @@
-.TH XLOADIMAGE 1 "8 May 1991"
+.TH XLOADIMAGE 1x "8 May 1991"
 .SH NAME
 xloadimage, xsetbg, xview \- load images into an X11 window or onto
 the root window
@@ -174,7 +174,7 @@
 -type \fItype_name\fR
 Forces \fIxloadimage\fR to try to load the image as a particular file
 type rather than trying to guess.  This often improves load
-performance noticably.
+performance noticeably.
 .TP
 -verbose
 Causes \fIxloadimage\fR to be talkative, telling you what kind of
@@ -198,13 +198,13 @@
 .TP
 -windowid \fIhex_window_id\fR
 Sets the background pixmap of a particular window ID.  The argument
-must be in hexadecimal and must be preceeded by "0x" (\fIeg\fR
+must be in hexadecimal and must be preceded by "0x" (\fIeg\fR
 -windowid 0x40000b.  This is intended for setting the background
 pixmap of some servers which use untagged virtual roots
 (\fIeg\fR HP-VUE), but can have other interesting applications.
 .SH IMAGE OPTIONS
-The following options may preceed each image.  These options are
-local to the image they preceed. 
+The following options may precede each image.  These options are
+local to the image they precede. 
 .TP
 -at \fIX\fR,\fIY\fR
 Indicates coordinates to load the image at on the base image.  If
@@ -285,7 +285,7 @@
 -merge
 Merge this image onto the base image after local processing.  The base
 image is considered to be the first image specified or the last image
-that was not preceeded by \fI-merge\fR.  If used in conjunction with
+that was not preceded by \fI-merge\fR.  If used in conjunction with
 \fI-at\fR and \fI-clip\fR, very complex images can be built up.  This
 option is on by default for all images if the \fI-onroot\fR or
 \fI-windowid\fR options are specified.
@@ -408,7 +408,7 @@
 When zooming color images up you can reduce blockiness with
 \fI-smooth\fR.  For zooms of 300% or more, I recommend two smoothing
 passes (although this can take awhile to do on slow machines).  There
-will be a noticable improvement in the image.
+will be a noticeable improvement in the image.
 .PP
 You can perform image processing on a small portion of an image by
 loading the image more than once and using the \fI-merge\fR, \fI-at\fR
@@ -547,7 +547,7 @@
   filter = "uufilter -s" .uu .uue
 .fi
 The filter will be automatically invoked on any file with a .uu or
-.uue extension.
+\&.uue extension.
 .PP
 For a list of filters automatically recognized by xloadimage use the
 \fI-configuration\fR option.
@@ -640,9 +640,9 @@
 .SH COPYRIGHT
 Copyright (c) 1989, 1993 Jim Frost and others.
 .PP
-\fIXloadimage\fR is copywritten material with a very loose copyright
+\fIXloadimage\fR is copyrighted material with a very loose copyright
 allowing unlimited modification and distribution if the copyright
-notices are left intact.  Various portions are copywritten by various
+notices are left intact.  Various portions are copyrighted by various
 people, but all use a modification of the MIT copyright notice.
 Please check the source for complete copyright information.  The
 intent is to keep the source free, not to stifle its distribution, so


--- NEW FILE 19_fix_root_c_resource_leak.dpatch ---
#! /bin/sh -e
## 19_fix_root_c_resource_leak.dpatch
##
## DP: Fix leaking xresources when using onroot option. See #325689.
## DP: Patch by Alex Perry, reformatted by Tim Connors 

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

@DPATCH@
diff -urNad xloadimage-4.1~/root.c xloadimage-4.1/root.c
--- xloadimage-4.1~/root.c	2008-11-22 19:52:01.000000000 +0100
+++ xloadimage-4.1/root.c	2008-11-22 19:52:02.000000000 +0100
@@ -16,24 +16,6 @@
 
 #define RETAIN_PROP_NAME	"_XSETROOT_ID"
 
-void updateProperty(dpy, w, name, type, format, data, nelem)
-     Display	*dpy;
-     Window	w;
-     char	*name;
-     Atom	type;
-     int	format;
-     int	data;
-     int	nelem;
-{
-  /* intern the property name */
-  Atom	atom = XInternAtom(dpy, name, 0);
-
-  /* create or replace the property */
-  XChangeProperty(dpy, w, atom, type, format, PropModeReplace, 
-		  (unsigned char *)&data, nelem);
-}
-
-
 /* Sets the close-down mode of the client to 'RetainPermanent'
  * so all client resources will be preserved after the client
  * exits.  Puts a property on the default root window containing
@@ -47,9 +29,15 @@
 {
   /* create dummy resource */
   Pixmap pm= XCreatePixmap(dpy, w, 1, 1, 1);
+  unsigned char *data = (unsigned char *) ±
 	
-  /* create/replace the property */
-  updateProperty(dpy, w, RETAIN_PROP_NAME, XA_PIXMAP, 32, (int)pm, 1);
+  /* intern the property name */
+  char *name = RETAIN_PROP_NAME;
+  Atom atom = XInternAtom(dpy, name, 0);
+
+  /* create or replace the property */
+  XChangeProperty(dpy, w, atom, XA_PIXMAP, 32, PropModeReplace,
+                 data, sizeof(Pixmap)/4);
 	
   /* retain all client resources until explicitly killed */
   XSetCloseDownMode(dpy, RetainPermanent);
@@ -61,36 +49,64 @@
  */
 
 static void
-freePrevious(dpy, w)
+freePrevious(dpy, w, verbose)
      Display	*dpy;
      Window	w;
+     unsigned int  verbose;
 {
-  Pixmap *pm;			
-  Atom	actual_type;		/* NOTUSED */
+  Pixmap *pm;
+  unsigned char *charpm;
+  Atom actual_type;
   int	format;
-  int	nitems;
-  int	bytes_after;
+  unsigned long        nitems;
+  unsigned long        bytes_after;
+  int   returncode;
 
   /* intern the property name */
   Atom atom = XInternAtom(dpy, RETAIN_PROP_NAME, 0);
 
   /* look for existing resource allocation */
-  if ((XGetWindowProperty(dpy, w, atom, 0, 1, 1/*delete*/,
-			  AnyPropertyType, &actual_type, &format, (unsigned long *)&nitems,
-			  (unsigned long *)&bytes_after, (unsigned char **)&pm) == Success) &&
-      nitems == 1) {
-    if ((actual_type == XA_PIXMAP) && (format == 32) &&
-	(nitems == 1) && (bytes_after == 0)) {
-      /* blast it away */
-      XKillClient(dpy, (XID) *pm);
-      XFree((char *)pm);
-    }
-    else if (actual_type != None) {
-      fprintf(stderr,
-	      "%s: warning: invalid format encountered for property %s\n",
-	      RETAIN_PROP_NAME, "xloadimage");
-    }
+  nitems = sizeof(Pixmap)/4;
+  returncode = XGetWindowProperty(dpy, w, atom,
+                 0, nitems, 1/*delete*/,
+                XA_PIXMAP, &actual_type,
+                &format, &nitems,
+                &bytes_after, &charpm);
+  if (returncode != Success) {
+    if (verbose)
+      fprintf(stderr, "failed to look for %s with return code %i.\n",
+              RETAIN_PROP_NAME, returncode);
+    return;
+  }
+
+  /* Check if the property was found */
+  if (actual_type == None) {
+    if (verbose)
+      fprintf(stderr, "didn't find evidence of prior run.\n");
+    return;
+  }
+
+  /* Make sure the dummy value is still present */
+  if (actual_type != XA_PIXMAP) {
+    if (verbose)
+      fprintf(stderr, "found wrong data type - skipped.\n");
+    return;
+  }
+
+  /* Check size, in case we're a different architecture */
+  if ((nitems != sizeof(Pixmap)/4) ||
+      (format != 32) ||
+      (bytes_after != 0)) {
+    if (verbose)
+      fprintf(stderr, "saw wrong %li / word size %i / architecture %li.\n",
+              bytes_after, format, nitems);
+    return;
   }
+
+  /* blast it away */
+  pm = (Pixmap*) charpm;
+  XKillClient(dpy, (XID) *pm);
+  XFree(charpm);
 }
 
 #if FIND_DEC_ROOTWINDOW
@@ -185,20 +201,21 @@
     for(i = 0; i < numChildren; i++) {
       Atom actual_type;
       int actual_format;
-      long nitems, bytesafter;
-      Window *newRoot = NULL;
-      
-      if (XGetWindowProperty (disp, children[i], __SWM_VROOT,0,1,
-			      False, XA_WINDOW, &actual_type, &actual_format,
-			      (unsigned long *)&nitems, (unsigned long *)&bytesafter,
-			      (unsigned char **) &newRoot) ==
-	  Success && newRoot) {
-	root = *newRoot;
+      unsigned long nitems, bytesafter;
+      unsigned char *newRoot = 0;
+
+      if ((XGetWindowProperty (disp, children[i], __SWM_VROOT,0,1,
+                             False, XA_WINDOW,
+                             &actual_type, &actual_format,
+                             &nitems, &bytesafter, &newRoot)
+          == Success) &&
+         newRoot) {
+        root = *((Window*) newRoot);
 	break;
       }
     }
   }
-  freePrevious(disp, root);
+  freePrevious(disp, root, verbose);
 
   if (! (ximageinfo= imageToXImage(disp, scrn,
 				   DefaultVisual(disp, scrn),


--- NEW FILE xloadimage.spec ---
Name:		xloadimage
Summary: 	Image viewer and processor
Version:	4.1
Release:	2%{?dist}
License:	MIT
Group:		User Interface/X
Source0:	ftp://ftp.x.org/R5contrib/%{name}.%{version}.tar.gz
# All of these patches come from Debian 4.1-16.1
# Many thanks to all those who have done work on this package over the years
Patch0:		01_libjpeg-support.dpatch
Patch1:		02_png-support.dpatch
Patch2:		03_security-strfoo.dpatch
Patch3:		04_previous-image.dpatch
Patch4:		05_idelay-manpage.dpatch
Patch5:		06_-Wall-cleanup.dpatch
Patch6:		07_SYSPATHFILE.dpatch
Patch7:		08_manpage-config-path.dpatch
Patch8:		09_xloadimagerc-path.dpatch
Patch9:		10_config.c-HOME-fix.dpatch
Patch10:	11_fork-implies-quiet.dpatch
Patch11:	12_fix-tile.dpatch
Patch12:	13_varargs-is-obsolete.dpatch
Patch13:	14_errno-not-extern.dpatch
Patch14:	15_CAN-2005-0638.dpatch
Patch15:	16_CAN-2005-0639.dpatch
Patch16:	17_security-sprintf.dpatch
Patch17:	18_manpage_fixes.dpatch
Patch18:	19_fix_root_c_resource_leak.dpatch

URL:		http://www.frostbytes.com/~jimf/xloadimage.html
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:	libX11-devel, libtiff-devel, libpng-devel, libjpeg-devel
BuildRequires:	libICE-devel

%description
Xloadimage is a utility which will view many different types of images 
under X11, load images onto the root window, or dump processed images 
into one of several image file formats. The current version can read 
many different image file types.

A variety of options are available to modify images prior to viewing. 
These options include clipping, dithering, depth reduction, zoom (either 
X or Y axis independently or both at once), brightening or darkening, 
and image merging. When applicable, these options are done automatically 
(eg a color image to be displayed on a monochrome screen will be 
dithered automatically). 

%prep
%setup -q -n %{name}.%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
chmod +x configure

%build
%configure
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
# First, the binaries:
mkdir -p %{buildroot}%{_bindir}
install -m 0755 uufilter %{buildroot}%{_bindir}
install -m 0755 xloadimage %{buildroot}%{_bindir}
# Next, the symlinks
pushd %{buildroot}%{_bindir}
ln -s xloadimage xsetbg
ln -s xloadimage xview
popd
# The configuration file
mkdir -p %{buildroot}%{_sysconfdir}/X11/
install -m 0644 xloadimagerc %{buildroot}%{_sysconfdir}/X11/Xloadimage
# Now, the man pages
mkdir -p %{buildroot}%{_mandir}/man1/
install -m 0644 xloadimage.man %{buildroot}%{_mandir}/man1/xloadimage.1x
install	-m 0644 uufilter.man %{buildroot}%{_mandir}/man1/uufilter.1x
# And some copies for the symlinks (we can't really make symlinks here because of how rpm 
# compresses man pages)
cp -a %{buildroot}%{_mandir}/man1/xloadimage.1x %{buildroot}%{_mandir}/man1/xsetbg.1x
cp -a %{buildroot}%{_mandir}/man1/xloadimage.1x %{buildroot}%{_mandir}/man1/xview.1x

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc README mit.cpyrght
%{_bindir}/uufilter
%{_bindir}/xloadimage
%{_bindir}/xsetbg
%{_bindir}/xview
%config(noreplace) %{_sysconfdir}/X11/Xloadimage
%{_mandir}/man1/*

%changelog
* Wed Dec 10 2008 Tom "spot" Callaway <tcallawa at redhat.com> 4.1-2
- drop unnecessary BR: zlib-devel (dragged in by libpng-devel)

* Thu Dec 4 2008 Tom "spot" Callaway <tcallawa at redhat.com> 4.1-1
- Initial package for Fedora


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/xloadimage/EL-5/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	10 Dec 2008 15:59:24 -0000	1.1
+++ sources	10 Dec 2008 16:33:08 -0000	1.2
@@ -0,0 +1 @@
+7331850fc04056ab8ae6b5725d1fb3d2  xloadimage.4.1.tar.gz




More information about the fedora-extras-commits mailing list