Imported from libpng-1.0.5h.tar
diff --git a/contrib/gregbook/makefile.w32 b/contrib/gregbook/makefile.w32
index dbcec3b..e520ae7 100644
--- a/contrib/gregbook/makefile.w32
+++ b/contrib/gregbook/makefile.w32
@@ -17,7 +17,7 @@
 # "c:\windows\command.com /e:4096" as the program command line and set the
 # working directory to this directory.  Then double-click to open the new
 # DOS-prompt window with a bigger environment and retry the commands above.
-# 
+#
 # This makefile assumes libpng and zlib have already been built or downloaded
 # and are in subdirectories at the same level as the current subdirectory
 # (as indicated by the PNGPATH and ZPATH macros below).  Edit as appropriate.
diff --git a/contrib/gregbook/makevms.com b/contrib/gregbook/makevms.com
index 5f7a9c6..2ee2eb6 100644
--- a/contrib/gregbook/makevms.com
+++ b/contrib/gregbook/makevms.com
@@ -45,20 +45,20 @@
 $   write sys$output "Building rpng-x..."
 $   CALL MAKE rpng-x.OBJ "cc ''CCOPT' rpng-x" -
 	rpng-x.c readpng.h
-$   call make rpng-x.exe - 
-	"LINK rpng-x,readpng,lib.opt/opt,x11.opt/opt" - 
+$   call make rpng-x.exe -
+	"LINK rpng-x,readpng,lib.opt/opt,x11.opt/opt" -
 	rpng-x.obj readpng.obj
 $   write sys$output "Building rpng2-x..."
 $   CALL MAKE rpng2-x.OBJ "cc ''CCOPT' rpng2-x" -
 	rpng2-x.c readpng2.h
-$   call make rpng2-x.exe - 
-	"LINK rpng2-x,readpng2,lib.opt/opt,x11.opt/opt" - 
+$   call make rpng2-x.exe -
+	"LINK rpng2-x,readpng2,lib.opt/opt,x11.opt/opt" -
 	rpng2-x.obj readpng2.obj
 $   write sys$output "Building wpng..."
 $   CALL MAKE wpng.OBJ "cc ''CCOPT' wpng" -
 	wpng.c writepng.h
-$   call make wpng.exe - 
-	"LINK wpng,writepng,lib.opt/opt" - 
+$   call make wpng.exe -
+	"LINK wpng,writepng,lib.opt/opt" -
 	wpng.obj writepng.obj
 $ exit
 $!
diff --git a/contrib/gregbook/readpng.c b/contrib/gregbook/readpng.c
index 2d584fd..6dd720f 100644
--- a/contrib/gregbook/readpng.c
+++ b/contrib/gregbook/readpng.c
@@ -32,8 +32,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "png.h"	/* libpng header; includes zlib.h */
-#include "readpng.h"	/* typedefs, common macros, public prototypes */
+#include "png.h"      /* libpng header; includes zlib.h */
+#include "readpng.h"  /* typedefs, common macros, public prototypes */
 
 
 static png_structp png_ptr = NULL;
@@ -50,7 +50,7 @@
       PNG_LIBPNG_VER_STRING, png_libpng_ver);
     fprintf(stderr, "   Compiled with zlib %s; using zlib %s.\n",
       ZLIB_VERSION, zlib_version);
-} 
+}
 
 
 /* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */
diff --git a/contrib/gregbook/readpng2.c b/contrib/gregbook/readpng2.c
index fe7b0fa..ee2d3d2 100644
--- a/contrib/gregbook/readpng2.c
+++ b/contrib/gregbook/readpng2.c
@@ -30,10 +30,10 @@
   ---------------------------------------------------------------------------*/
 
 
-#include <stdlib.h>	/* for exit() prototype */
+#include <stdlib.h>    /* for exit() prototype */
 
-#include "png.h"	/* libpng header; includes zlib.h and setjmp.h */
-#include "readpng2.h"	/* typedefs, common macros, public prototypes */
+#include "png.h"       /* libpng header; includes zlib.h and setjmp.h */
+#include "readpng2.h"  /* typedefs, common macros, public prototypes */
 
 
 /* local prototypes */
@@ -53,7 +53,7 @@
       PNG_LIBPNG_VER_STRING, png_libpng_ver);
     fprintf(stderr, "   Compiled with zlib %s; using zlib %s.\n",
       ZLIB_VERSION, zlib_version);
-} 
+}
 
 
 
@@ -70,7 +70,7 @@
 
 int readpng2_init(mainprog_info *mainprog_ptr)
 {
-    png_structp  png_ptr;	/* note:  temporary variables! */
+    png_structp  png_ptr; /* note:  temporary variables! */
     png_infop  info_ptr;
 
 
@@ -176,7 +176,7 @@
 
     mainprog_ptr = png_get_progressive_ptr(png_ptr);
 
-    if (mainprog_ptr == NULL) {		/* we be hosed */
+    if (mainprog_ptr == NULL) { /* we be hosed */
         fprintf(stderr,
           "readpng2 error:  main struct not recoverable in info_callback.\n");
         fflush(stderr);
@@ -408,7 +408,7 @@
     fflush(stderr);
 
     mainprog_ptr = png_get_error_ptr(png_ptr);
-    if (mainprog_ptr == NULL) {		/* we are completely hosed now */
+    if (mainprog_ptr == NULL) { /* we are completely hosed now */
         fprintf(stderr,
           "readpng2 severe error:  jmpbuf not recoverable; terminating.\n");
         fflush(stderr);
diff --git a/contrib/gregbook/readpng2.h b/contrib/gregbook/readpng2.h
index 9d22444..2ffd776 100644
--- a/contrib/gregbook/readpng2.h
+++ b/contrib/gregbook/readpng2.h
@@ -61,7 +61,7 @@
     uch *image_data;
     uch **row_pointers;
     jmp_buf jmpbuf;
-    int passes;			/* not used */
+    int passes;    /* not used */
     int rowbytes;
     int channels;
     int need_bgcolor;
diff --git a/contrib/gregbook/rpng-win.c b/contrib/gregbook/rpng-win.c
index 3460132..a75e609 100644
--- a/contrib/gregbook/rpng-win.c
+++ b/contrib/gregbook/rpng-win.c
@@ -53,7 +53,7 @@
 
 /* #define DEBUG  :  this enables the Trace() macros */
 
-#include "readpng.h"	/* typedefs, common macros, readpng prototypes */
+#include "readpng.h" /* typedefs, common macros, readpng prototypes */
 
 
 /* could just include png.h, but this macro is the only thing we need
@@ -61,10 +61,10 @@
  * only happen with alpha (which could easily be avoided with
  * "ush acopy = (alpha);") */
 
-#define alpha_composite(composite, fg, alpha, bg) {			\
-    ush temp = ((ush)(fg)*(ush)(alpha) +				\
-                (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128);	\
-    (composite) = (uch)((temp + (temp >> 8)) >> 8);			\
+#define alpha_composite(composite, fg, alpha, bg) {              \
+    ush temp = ((ush)(fg)*(ush)(alpha) +                         \
+                (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
+    (composite) = (uch)((temp + (temp >> 8)) >> 8);              \
 }
 
 
@@ -78,7 +78,7 @@
 static char titlebar[1024], *window_name = titlebar;
 static char *progname = PROGNAME;
 static char *appname = LONGNAME;
-static char *icon_name = PROGNAME;	/* GRR:  not (yet) used */
+static char *icon_name = PROGNAME;    /* GRR:  not (yet) used */
 static char *filename;
 static FILE *infile;
 
@@ -104,15 +104,15 @@
 
 int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
 {
-    char *args[1024];		/* arbitrary limit, but should suffice */
+    char *args[1024];                /* arbitrary limit, but should suffice */
     char *p, *q, **argv = args;
     int argc = 0;
     int rc, alen, flen;
     int error = 0;
     int have_bg = FALSE;
-    double LUT_exponent;		/* just the lookup table */
-    double CRT_exponent = 2.2;		/* just the monitor */
-    double default_display_exponent;	/* whole display system */
+    double LUT_exponent;             /* just the lookup table */
+    double CRT_exponent = 2.2;       /* just the monitor */
+    double default_display_exponent; /* whole display system */
     MSG msg;
 
 
@@ -150,7 +150,7 @@
     LUT_exponent = 1.8 / 2.61;
     /*
     if (some_mac_function_that_returns_gamma(&mac_gamma))
-        LUT_exponent = mac_gamma / 2.61;                 
+        LUT_exponent = mac_gamma / 2.61;
      */
 #else
     LUT_exponent = 1.0;   /* assume no LUT:  most PCs */
@@ -371,7 +371,7 @@
     if (!(dib = (uch *)malloc(sizeof(BITMAPINFOHEADER) +
                               wimage_rowbytes*image_height)))
     {
-        return 4;	/* fail */
+        return 4; /* fail */
     }
 
 /*---------------------------------------------------------------------------
@@ -477,7 +477,7 @@
                 g = *src++;
                 b = *src++;
                 *dest++ = b;
-                *dest++ = g;	/* note reverse order */
+                *dest++ = g; /* note reverse order */
                 *dest++ = r;
             }
         } else /* if (image_channels == 4) */ {
@@ -582,15 +582,15 @@
 
         /* wait for the user to tell us when to quit */
         case WM_CHAR:
-            switch (wP) {	/* only need one, so ignore repeat count */
+            switch (wP) { /* only need one, so ignore repeat count */
                 case 'q':
                 case 'Q':
-                case 0x1B:	/* Esc key */
+                case 0x1B: /* Esc key */
                     PostQuitMessage(0);
             }
             return 0;
 
-        case WM_LBUTTONDOWN:	/* another way of quitting */
+        case WM_LBUTTONDOWN: /* another way of quitting */
         case WM_DESTROY:
             PostQuitMessage(0);
             return 0;
diff --git a/contrib/gregbook/rpng-x.c b/contrib/gregbook/rpng-x.c
index ee9ebb7..5f0a8a1 100644
--- a/contrib/gregbook/rpng-x.c
+++ b/contrib/gregbook/rpng-x.c
@@ -54,18 +54,18 @@
 
 /* #define DEBUG  :  this enables the Trace() macros */
 
-#include "readpng.h"	/* typedefs, common macros, readpng prototypes */
+#include "readpng.h" /* typedefs, common macros, readpng prototypes */
 
 
 /* could just include png.h, but this macro is the only thing we need
- * (name and typedefs changed to local versions); note that side effects 
- * only happen with alpha (which could easily be avoided with 
+ * (name and typedefs changed to local versions); note that side effects
+ * only happen with alpha (which could easily be avoided with
  * "ush acopy = (alpha);") */
 
-#define alpha_composite(composite, fg, alpha, bg) {			\
-    ush temp = ((ush)(fg)*(ush)(alpha) +				\
-                (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128);	\
-    (composite) = (uch)((temp + (temp >> 8)) >> 8);			\
+#define alpha_composite(composite, fg, alpha, bg) {               \
+    ush temp = ((ush)(fg)*(ush)(alpha) +                          \
+                (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128);  \
+    (composite) = (uch)((temp + (temp >> 8)) >> 8);               \
 }
 
 
@@ -123,9 +123,9 @@
     int rc, alen, flen;
     int error = 0;
     int have_bg = FALSE;
-    double LUT_exponent;		/* just the lookup table */
-    double CRT_exponent = 2.2;		/* just the monitor */
-    double default_display_exponent;	/* whole display system */
+    double LUT_exponent;             /* just the lookup table */
+    double CRT_exponent = 2.2;       /* just the monitor */
+    double default_display_exponent; /* whole display system */
     XEvent e;
     KeySym k;
 
@@ -222,7 +222,7 @@
         fprintf(stderr, PROGNAME ":  can't open PNG file [%s]\n", filename);
         ++error;
     } else {
-        if ((rc = readpng_init(infile, (long *)(&image_width), 
+        if ((rc = readpng_init(infile, (long *)(&image_width),
                                (long *)(&image_height))) != 0) {
             switch (rc) {
                 case 1:
@@ -408,11 +408,11 @@
         }
         have_colormap = TRUE;
     } else if (depth == 16) {
-        RPixelShift = 15 - rpng_x_msb(RedMask);	/* these are right-shifts */
+        RPixelShift = 15 - rpng_x_msb(RedMask); /* these are right-shifts */
         GPixelShift = 15 - rpng_x_msb(GreenMask);
         BPixelShift = 15 - rpng_x_msb(BlueMask);
     } else /* if (depth > 16) */ {
-        RPixelShift = rpng_x_msb(RedMask) - 7;	/* these are left-shifts */
+        RPixelShift = rpng_x_msb(RedMask) - 7; /* these are left-shifts */
         GPixelShift = rpng_x_msb(GreenMask) - 7;
         BPixelShift = rpng_x_msb(BlueMask) - 7;
     }
diff --git a/contrib/gregbook/rpng2-win.c b/contrib/gregbook/rpng2-win.c
index fd32ec4..66e682e 100644
--- a/contrib/gregbook/rpng2-win.c
+++ b/contrib/gregbook/rpng2-win.c
@@ -1,6 +1,6 @@
 /*---------------------------------------------------------------------------
 
-   rpng2 - progressive-model PNG display program                rpng2-win.c 
+   rpng2 - progressive-model PNG display program                rpng2-win.c
 
    This program decodes and displays PNG files progressively, as if it were
    a web browser (though the front end is only set up to read from files).
@@ -57,9 +57,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <setjmp.h>	/* for jmpbuf declaration in readpng2.h */
+#include <setjmp.h>   /* for jmpbuf declaration in readpng2.h */
 #include <time.h>
-#include <math.h>	/* only for PvdM background code */
+#include <math.h>     /* only for PvdM background code */
 #include <windows.h>
 
 /* all for PvdM background code: */
@@ -80,9 +80,9 @@
 #define rgb2_max   bg_bsat
 #define rgb2_min   bg_brot
 
-/* #define DEBUG */	/* this enables the Trace() macros */
+/* #define DEBUG */      /* this enables the Trace() macros */
 
-#include "readpng2.h"	/* typedefs, common macros, readpng2 prototypes */
+#include "readpng2.h"    /* typedefs, common macros, readpng2 prototypes */
 
 
 /* could just include png.h, but this macro is the only thing we need
@@ -90,18 +90,18 @@
  * only happen with alpha (which could easily be avoided with
  * "ush acopy = (alpha);") */
 
-#define alpha_composite(composite, fg, alpha, bg) {			\
-    ush temp = ((ush)(fg)*(ush)(alpha) +				\
-                (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128);	\
-    (composite) = (uch)((temp + (temp >> 8)) >> 8);			\
+#define alpha_composite(composite, fg, alpha, bg) {              \
+    ush temp = ((ush)(fg)*(ush)(alpha) +                         \
+                (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
+    (composite) = (uch)((temp + (temp >> 8)) >> 8);              \
 }
 
 
-#define INBUFSIZE 4096	/* with pseudo-timing on (1 sec delay/block), this
-			 *  block size corresponds roughly to a download
-			 *  speed 10% faster than theoretical 33.6K maximum
-			 *  (assuming 8 data bits, 1 stop bit and no other
-			 *  overhead) */
+#define INBUFSIZE 4096 /* with pseudo-timing on (1 sec delay/block), this
+                        *  block size corresponds roughly to a download
+                        *  speed 10% faster than theoretical 33.6K maximum
+                        *  (assuming 8 data bits, 1 stop bit and no other
+                        *  overhead) */
 
 /* local prototypes */
 static void       rpng2_win_init(void);
@@ -116,7 +116,7 @@
 static char titlebar[1024], *window_name = titlebar;
 static char *progname = PROGNAME;
 static char *appname = LONGNAME;
-static char *icon_name = PROGNAME;	/* GRR:  not (yet) used */
+static char *icon_name = PROGNAME; /* GRR:  not (yet) used */
 static char *filename;
 static FILE *infile;
 
@@ -125,7 +125,7 @@
 static uch inbuf[INBUFSIZE];
 static int incount;
 
-static int pat = 6;		/* must be less than num_bgpat */
+static int pat = 6;       /* must be less than num_bgpat */
 static int bg_image = 0;
 static int bgscale = 16;
 static ulg bg_rowbytes;
@@ -134,22 +134,22 @@
 static struct rgb_color {
     uch r, g, b;
 } rgb[] = {
-    {  0,   0,   0},	/*  0:  black */
-    {255, 255, 255},	/*  1:  white */
-    {173, 132,  57},	/*  2:  tan */
-    { 64, 132,   0},	/*  3:  medium green */
-    {189, 117,   1},	/*  4:  gold */
-    {253, 249,   1},	/*  5:  yellow */
-    {  0,   0, 255},	/*  6:  blue */
-    {  0,   0, 120},	/*  7:  medium blue */
-    {255,   0, 255},	/*  8:  magenta */
-    { 64,   0,  64},	/*  9:  dark magenta */
-    {255,   0,   0},	/* 10:  red */
-    { 64,   0,   0},	/* 11:  dark red */
-    {255, 127,   0},	/* 12:  orange */
-    {192,  96,   0},	/* 13:  darker orange */
-    { 24,  60,   0},	/* 14:  dark green-yellow */
-    { 85, 125, 200} 	/* 15:  ice blue */
+    {  0,   0,   0},   /*  0:  black */
+    {255, 255, 255},   /*  1:  white */
+    {173, 132,  57},   /*  2:  tan */
+    { 64, 132,   0},   /*  3:  medium green */
+    {189, 117,   1},   /*  4:  gold */
+    {253, 249,   1},   /*  5:  yellow */
+    {  0,   0, 255},   /*  6:  blue */
+    {  0,   0, 120},   /*  7:  medium blue */
+    {255,   0, 255},   /*  8:  magenta */
+    { 64,   0,  64},   /*  9:  dark magenta */
+    {255,   0,   0},   /* 10:  red */
+    { 64,   0,   0},   /* 11:  dark red */
+    {255, 127,   0},   /* 12:  orange */
+    {192,  96,   0},   /* 13:  darker orange */
+    { 24,  60,   0},   /* 14:  dark green-yellow */
+    { 85, 125, 200}    /* 15:  ice blue */
 };
 /* not used for now, but should be for error-checking:
 static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
@@ -174,25 +174,25 @@
  */
 static struct background_pattern {
     ush type;
-    int rgb1_max, rgb1_min;	/* or bg_freq, bg_gray */
-    int rgb2_max, rgb2_min;	/* or bg_bsat, bg_brot (both scaled by 10)*/
+    int rgb1_max, rgb1_min;   /* or bg_freq, bg_gray */
+    int rgb2_max, rgb2_min;   /* or bg_bsat, bg_brot (both scaled by 10)*/
 } bg[] = {
-    {0+8,   2,0,  1,15},  	/* checkered:  tan/black vs. white/ice blue */
-    {0+24,  2,0,  1,0},  	/* checkered:  tan/black vs. white/black */
-    {0+8,   4,5,  0,2},  	/* checkered:  gold/yellow vs. black/tan */
-    {0+8,   4,5,  0,6},  	/* checkered:  gold/yellow vs. black/blue */
-    {0,     7,0,  8,9},  	/* checkered:  deep blue/black vs. magenta */
-    {0+8,  13,0,  5,14},  	/* checkered:  orange/black vs. yellow */
-    {0+8,  12,0, 10,11},  	/* checkered:  orange/black vs. red */
-    {1,     7,0,  8,0},  	/* diamonds:  deep blue/black vs. magenta */
-    {1,    12,0, 11,0},  	/* diamonds:  orange vs. dark red */
-    {1,    10,0,  7,0},  	/* diamonds:  red vs. medium blue */
-    {1,     4,0,  5,0},  	/* diamonds:  gold vs. yellow */
-    {1,     3,0,  0,0},  	/* diamonds:  medium green vs. black */
-    {2,    16, 100,  20,   0},  /* radial:  ~hard radial color-beams */
-    {2,    18, 100,  10,   2},  /* radial:  soft, curved radial color-beams */
-    {2,    16, 256, 100, 250},  /* radial:  very tight spiral */
-    {2, 10000, 256,  11,   0}   /* radial:  dipole-moire' (almost fractal) */
+    {0+8,   2,0,  1,15},       /* checkered:  tan/black vs. white/ice blue */
+    {0+24,  2,0,  1,0},        /* checkered:  tan/black vs. white/black */
+    {0+8,   4,5,  0,2},        /* checkered:  gold/yellow vs. black/tan */
+    {0+8,   4,5,  0,6},        /* checkered:  gold/yellow vs. black/blue */
+    {0,     7,0,  8,9},        /* checkered:  deep blue/black vs. magenta */
+    {0+8,  13,0,  5,14},       /* checkered:  orange/black vs. yellow */
+    {0+8,  12,0, 10,11},       /* checkered:  orange/black vs. red */
+    {1,     7,0,  8,0},        /* diamonds:  deep blue/black vs. magenta */
+    {1,    12,0, 11,0},        /* diamonds:  orange vs. dark red */
+    {1,    10,0,  7,0},        /* diamonds:  red vs. medium blue */
+    {1,     4,0,  5,0},        /* diamonds:  gold vs. yellow */
+    {1,     3,0,  0,0},        /* diamonds:  medium green vs. black */
+    {2,    16, 100,  20,   0}, /* radial:  ~hard radial color-beams */
+    {2,    18, 100,  10,   2}, /* radial:  soft, curved radial color-beams */
+    {2,    16, 256, 100, 250}, /* radial:  very tight spiral */
+    {2, 10000, 256,  11,   0}  /* radial:  dipole-moire' (almost fractal) */
 };
 static int num_bgpat = sizeof(bg) / sizeof(struct background_pattern);
 
@@ -212,16 +212,16 @@
 
 int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
 {
-    char *args[1024];		/* arbitrary limit, but should suffice */
+    char *args[1024];   /* arbitrary limit, but should suffice */
     char *p, *q, *bgstr = NULL, **argv = args;
     int argc = 0;
     int rc, alen, flen;
     int error = 0;
     int timing = FALSE;
     int have_bg = FALSE;
-    double LUT_exponent;		/* just the lookup table */
-    double CRT_exponent = 2.2;		/* just the monitor */
-    double default_display_exponent;	/* whole display system */
+    double LUT_exponent;             /* just the lookup table */
+    double CRT_exponent = 2.2;       /* just the monitor */
+    double default_display_exponent; /* whole display system */
     MSG msg;
 
 
@@ -267,7 +267,7 @@
     LUT_exponent = 1.8 / 2.61;
     /*
     if (some_mac_function_that_returns_gamma(&mac_gamma))
-        LUT_exponent = mac_gamma / 2.61;                 
+        LUT_exponent = mac_gamma / 2.61;
      */
 #else
     LUT_exponent = 1.0;   /* assume no LUT:  most PCs */
@@ -560,7 +560,7 @@
     if (!(dib = (uch *)malloc(sizeof(BITMAPINFOHEADER) +
                               wimage_rowbytes*rpng2_info.height)))
     {
-        return 4;	/* fail */
+        return 4; /* fail */
     }
 
 /*---------------------------------------------------------------------------
@@ -655,7 +655,7 @@
         TextOut(hdc, ((x < 0)? 0 : x), ((y < 0)? 0 : y), msg, len);
         ReleaseDC(global_hwnd, hdc);
 
-        rpng2_win_load_bg_image();	/* resets bg_image if fails */
+        rpng2_win_load_bg_image(); /* resets bg_image if fails */
     }
 
     if (!bg_image) {
@@ -753,7 +753,7 @@
                 even_odd = even_odd_vert ^ even_odd_horiz;
                 invert_column =
                   (even_odd_horiz && (bg[pat].type & 0x10));
-                if (even_odd == 0) {		/* gradient #1 */
+                if (even_odd == 0) {   /* gradient #1 */
                     if (invert_column) {
                         *dest++ = r1_inv;
                         *dest++ = g1_inv;
@@ -763,7 +763,7 @@
                         *dest++ = g1;
                         *dest++ = b1;
                     }
-                } else {			/* gradient #2 */
+                } else {                /* gradient #2 */
                     if ((invert_column && invert_gradient2) ||
                         (!invert_column && !invert_gradient2))
                     {
@@ -786,8 +786,8 @@
 
     } else if ((bg[pat].type & 0x07) == 1) {
 
-        hmax = (bgscale-1)/2;	/* half the max weight of a color */
-        max = 2*hmax;		/* the max weight of a color */
+        hmax = (bgscale-1)/2;   /* half the max weight of a color */
+        max = 2*hmax;           /* the max weight of a color */
 
         r1 = rgb[bg[pat].rgb1_max].r;
         g1 = rgb[bg[pat].rgb1_max].g;
@@ -908,7 +908,7 @@
             g1 = *src++;
             b1 = *src++;
             *dest++ = b1;
-            *dest++ = g1;	/* note reverse order */
+            *dest++ = g1; /* note reverse order */
             *dest++ = r1;
         }
     }
@@ -962,7 +962,7 @@
             g = *src++;
             b = *src++;
             *dest++ = b;
-            *dest++ = g;	/* note reverse order */
+            *dest++ = g; /* note reverse order */
             *dest++ = r;
         }
     } else /* if (rpng2_info.channels == 4) */ {
@@ -1084,15 +1084,15 @@
 
         /* wait for the user to tell us when to quit */
         case WM_CHAR:
-            switch (wP) {	/* only need one, so ignore repeat count */
+            switch (wP) { /* only need one, so ignore repeat count */
                 case 'q':
                 case 'Q':
-                case 0x1B:	/* Esc key */
+                case 0x1B: /* Esc key */
                     PostQuitMessage(0);
             }
             return 0;
 
-        case WM_LBUTTONDOWN:	/* another way of quitting */
+        case WM_LBUTTONDOWN: /* another way of quitting */
         case WM_DESTROY:
             PostQuitMessage(0);
             return 0;
diff --git a/contrib/gregbook/rpng2-x.c b/contrib/gregbook/rpng2-x.c
index f0ad730..8e536e7 100644
--- a/contrib/gregbook/rpng2-x.c
+++ b/contrib/gregbook/rpng2-x.c
@@ -1,6 +1,6 @@
 /*---------------------------------------------------------------------------
 
-   rpng2 - progressive-model PNG display program                  rpng2-x.c 
+   rpng2 - progressive-model PNG display program                  rpng2-x.c
 
    This program decodes and displays PNG files progressively, as if it were
    a web browser (though the front end is only set up to read from files).
@@ -49,13 +49,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <setjmp.h>	/* for jmpbuf declaration in readpng2.h */
+#include <setjmp.h> /* for jmpbuf declaration in readpng2.h */
 #include <time.h>
-#include <math.h>	/* only for PvdM background code */
+#include <math.h>   /* only for PvdM background code */
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xos.h>
-#include <X11/keysym.h>	/* defines XK_* macros */
+#include <X11/keysym.h> /* defines XK_* macros */
 
 #ifdef VMS
 #include <unistd.h>
@@ -79,9 +79,9 @@
 #define rgb2_max   bg_bsat
 #define rgb2_min   bg_brot
 
-/* #define DEBUG */	/* this enables the Trace() macros */
+/* #define DEBUG */ /* this enables the Trace() macros */
 
-#include "readpng2.h"	/* typedefs, common macros, readpng2 prototypes */
+#include "readpng2.h" /* typedefs, common macros, readpng2 prototypes */
 
 
 /* could just include png.h, but this macro is the only thing we need
@@ -89,18 +89,18 @@
  * only happen with alpha (which could easily be avoided with
  * "ush acopy = (alpha);") */
 
-#define alpha_composite(composite, fg, alpha, bg) {			\
-    ush temp = ((ush)(fg)*(ush)(alpha) +				\
-                (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128);	\
-    (composite) = (uch)((temp + (temp >> 8)) >> 8);			\
+#define alpha_composite(composite, fg, alpha, bg) {              \
+    ush temp = ((ush)(fg)*(ush)(alpha) +                         \
+                (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
+    (composite) = (uch)((temp + (temp >> 8)) >> 8);              \
 }
 
 
-#define INBUFSIZE 4096	/* with pseudo-timing on (1 sec delay/block), this
-			 *  block size corresponds roughly to a download
-			 *  speed 10% faster than theoretical 33.6K maximum
-			 *  (assuming 8 data bits, 1 stop bit and no other
-			 *  overhead) */
+#define INBUFSIZE 4096 /* with pseudo-timing on (1 sec delay/block), this
+                        *  block size corresponds roughly to a download
+                        *  speed 10% faster than theoretical 33.6K maximum
+                        *  (assuming 8 data bits, 1 stop bit and no other
+                        *  overhead) */
 
 /* local prototypes */
 static void rpng2_x_init(void);
@@ -123,7 +123,7 @@
 static uch inbuf[INBUFSIZE];
 static int incount;
 
-static int pat = 6;		/* must be less than num_bgpat */
+static int pat = 6;  /* must be less than num_bgpat */
 static int bg_image = 0;
 static int bgscale = 16;
 static ulg bg_rowbytes;
@@ -132,22 +132,22 @@
 static struct rgb_color {
     uch r, g, b;
 } rgb[] = {
-    {  0,   0,   0},	/*  0:  black */
-    {255, 255, 255},	/*  1:  white */
-    {173, 132,  57},	/*  2:  tan */
-    { 64, 132,   0},	/*  3:  medium green */
-    {189, 117,   1},	/*  4:  gold */
-    {253, 249,   1},	/*  5:  yellow */
-    {  0,   0, 255},	/*  6:  blue */
-    {  0,   0, 120},	/*  7:  medium blue */
-    {255,   0, 255},	/*  8:  magenta */
-    { 64,   0,  64},	/*  9:  dark magenta */
-    {255,   0,   0},	/* 10:  red */
-    { 64,   0,   0},	/* 11:  dark red */
-    {255, 127,   0},	/* 12:  orange */
-    {192,  96,   0},	/* 13:  darker orange */
-    { 24,  60,   0},	/* 14:  dark green-yellow */
-    { 85, 125, 200} 	/* 15:  ice blue */
+    {  0,   0,   0},    /*  0:  black */
+    {255, 255, 255},    /*  1:  white */
+    {173, 132,  57},    /*  2:  tan */
+    { 64, 132,   0},    /*  3:  medium green */
+    {189, 117,   1},    /*  4:  gold */
+    {253, 249,   1},    /*  5:  yellow */
+    {  0,   0, 255},    /*  6:  blue */
+    {  0,   0, 120},    /*  7:  medium blue */
+    {255,   0, 255},    /*  8:  magenta */
+    { 64,   0,  64},    /*  9:  dark magenta */
+    {255,   0,   0},    /* 10:  red */
+    { 64,   0,   0},    /* 11:  dark red */
+    {255, 127,   0},    /* 12:  orange */
+    {192,  96,   0},    /* 13:  darker orange */
+    { 24,  60,   0},    /* 14:  dark green-yellow */
+    { 85, 125, 200}     /* 15:  ice blue */
 };
 /* not used for now, but should be for error-checking:
 static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
@@ -172,21 +172,21 @@
  */
 static struct background_pattern {
     ush type;
-    int rgb1_max, rgb1_min;	/* or bg_freq, bg_gray */
-    int rgb2_max, rgb2_min;	/* or bg_bsat, bg_brot (both scaled by 10)*/
+    int rgb1_max, rgb1_min;     /* or bg_freq, bg_gray */
+    int rgb2_max, rgb2_min;     /* or bg_bsat, bg_brot (both scaled by 10)*/
 } bg[] = {
-    {0+8,   2,0,  1,15},  	/* checkered:  tan/black vs. white/ice blue */
-    {0+24,  2,0,  1,0},  	/* checkered:  tan/black vs. white/black */
-    {0+8,   4,5,  0,2},  	/* checkered:  gold/yellow vs. black/tan */
-    {0+8,   4,5,  0,6},  	/* checkered:  gold/yellow vs. black/blue */
-    {0,     7,0,  8,9},  	/* checkered:  deep blue/black vs. magenta */
-    {0+8,  13,0,  5,14},  	/* checkered:  orange/black vs. yellow */
-    {0+8,  12,0, 10,11},  	/* checkered:  orange/black vs. red */
-    {1,     7,0,  8,0},  	/* diamonds:  deep blue/black vs. magenta */
-    {1,    12,0, 11,0},  	/* diamonds:  orange vs. dark red */
-    {1,    10,0,  7,0},  	/* diamonds:  red vs. medium blue */
-    {1,     4,0,  5,0},  	/* diamonds:  gold vs. yellow */
-    {1,     3,0,  0,0},  	/* diamonds:  medium green vs. black */
+    {0+8,   2,0,  1,15},        /* checkered:  tan/black vs. white/ice blue */
+    {0+24,  2,0,  1,0},         /* checkered:  tan/black vs. white/black */
+    {0+8,   4,5,  0,2},         /* checkered:  gold/yellow vs. black/tan */
+    {0+8,   4,5,  0,6},         /* checkered:  gold/yellow vs. black/blue */
+    {0,     7,0,  8,9},         /* checkered:  deep blue/black vs. magenta */
+    {0+8,  13,0,  5,14},        /* checkered:  orange/black vs. yellow */
+    {0+8,  12,0, 10,11},        /* checkered:  orange/black vs. red */
+    {1,     7,0,  8,0},         /* diamonds:  deep blue/black vs. magenta */
+    {1,    12,0, 11,0},         /* diamonds:  orange vs. dark red */
+    {1,    10,0,  7,0},         /* diamonds:  red vs. medium blue */
+    {1,     4,0,  5,0},         /* diamonds:  gold vs. yellow */
+    {1,     3,0,  0,0},         /* diamonds:  medium green vs. black */
     {2,    16, 100,  20,   0},  /* radial:  ~hard radial color-beams */
     {2,    18, 100,  10,   2},  /* radial:  soft, curved radial color-beams */
     {2,    16, 256, 100, 250},  /* radial:  very tight spiral */
@@ -580,7 +580,7 @@
             return 2;
         }
         have_colormap = TRUE;
-        bg_image = FALSE;	/* gradient just wastes palette entries */
+        bg_image = FALSE; /* gradient just wastes palette entries */
     } else if (depth == 16) {
         RPixelShift = 15 - rpng2_x_msb(RedMask);   /* these are right-shifts */
         GPixelShift = 15 - rpng2_x_msb(GreenMask);
@@ -684,7 +684,7 @@
   ---------------------------------------------------------------------------*/
 
     if (bg_image)
-        rpng2_x_load_bg_image();	/* resets bg_image if fails */
+        rpng2_x_load_bg_image(); /* resets bg_image if fails */
 
     if (!bg_image) {
         if (depth == 24 || depth == 32) {
@@ -795,7 +795,7 @@
                 even_odd = even_odd_vert ^ even_odd_horiz;
                 invert_column =
                   (even_odd_horiz && (bg[pat].type & 0x10));
-                if (even_odd == 0) {		/* gradient #1 */
+                if (even_odd == 0) { /* gradient #1 */
                     if (invert_column) {
                         *dest++ = r1_inv;
                         *dest++ = g1_inv;
@@ -805,7 +805,7 @@
                         *dest++ = g1;
                         *dest++ = b1;
                     }
-                } else {			/* gradient #2 */
+                } else {              /* gradient #2 */
                     if ((invert_column && invert_gradient2) ||
                         (!invert_column && !invert_gradient2))
                     {
@@ -828,8 +828,8 @@
 
     } else if ((bg[pat].type & 0x07) == 1) {
 
-        hmax = (bgscale-1)/2;	/* half the max weight of a color */
-        max = 2*hmax;		/* the max weight of a color */
+        hmax = (bgscale-1)/2;   /* half the max weight of a color */
+        max = 2*hmax;           /* the max weight of a color */
 
         r1 = rgb[bg[pat].rgb1_max].r;
         g1 = rgb[bg[pat].rgb1_max].g;
diff --git a/contrib/gregbook/wpng.c b/contrib/gregbook/wpng.c
index 38f16f8..7709b33 100644
--- a/contrib/gregbook/wpng.c
+++ b/contrib/gregbook/wpng.c
@@ -57,27 +57,27 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <setjmp.h>	/* for jmpbuf declaration in writepng.h */
+#include <setjmp.h>  /* for jmpbuf declaration in writepng.h */
 #include <time.h>
 
 #ifdef DOS_OS2_W32
-#  include <io.h>	/* for isatty(), setmode() prototypes */
-#  include <fcntl.h>	/* O_BINARY for fdopen() without text translation */
+#  include <io.h>    /* for isatty(), setmode() prototypes */
+#  include <fcntl.h> /* O_BINARY for fdopen() without text translation */
 #  ifdef __EMX__
 #    ifndef getch
-#      define getch() _read_kbd(0, 1, 0)	/* need getche() */
+#      define getch() _read_kbd(0, 1, 0) /* need getche() */
 #    endif
 #  else /* !__EMX__ */
 #    ifdef __GO32__
 #      include <pc.h>
-#      define getch() getkey()	/* GRR:  need getche() */
+#      define getch() getkey() /* GRR:  need getche() */
 #    else
-#      include <conio.h>	/* for getche() console input */
+#      include <conio.h> /* for getche() console input */
 #    endif
 #  endif /* ?__EMX__ */
 #  define FGETS(buf,len,stream)  dos_kbd_gets(buf,len)
 #else
-#  include <unistd.h>		/* for isatty() prototype */
+#  include <unistd.h>  /* for isatty() prototype */
 #  define FGETS fgets
 #endif
 
@@ -87,7 +87,7 @@
    text that includes control characters discouraged by the PNG spec; text
    that includes an escape character (27) must be re-entered regardless */
 
-#include "writepng.h"	/* typedefs, common macros, writepng prototypes */
+#include "writepng.h" /* typedefs, common macros, writepng prototypes */
 
 
 
@@ -112,7 +112,7 @@
     FILE *keybd;
 #endif
 #ifdef sgi
-    FILE *tmpfile;	/* or we could just use keybd, since no overlap */
+    FILE *tmpfile; /* or we could just use keybd, since no overlap */
     char tmpline[80];
 #endif
     char *inname = NULL, outname[256];
@@ -269,7 +269,7 @@
                   ":  unable to reopen stdout in binary mode\n");
                 fclose(wpng_info.infile);
                 ++error;
-            } else 
+            } else
                 wpng_info.filter = TRUE;
         }
     } else if ((len = strlen(inname)) > 250) {
@@ -419,7 +419,7 @@
                     wpng_info.have_text &= ~TEXT_TITLE;
                     valid = FALSE;
 #else
-                    if (p[result] == 27) {	/* escape character */
+                    if (p[result] == 27) { /* escape character */
                         wpng_info.have_text &= ~TEXT_TITLE;
                         valid = FALSE;
                     }
@@ -449,7 +449,7 @@
                     wpng_info.have_text &= ~TEXT_AUTHOR;
                     valid = FALSE;
 #else
-                    if (p[result] == 27) {	/* escape character */
+                    if (p[result] == 27) { /* escape character */
                         wpng_info.have_text &= ~TEXT_AUTHOR;
                         valid = FALSE;
                     }
@@ -489,7 +489,7 @@
                     wpng_info.have_text &= ~TEXT_DESC;
                     valid = FALSE;
 #else
-                    if (p[result] == 27) {	/* escape character */
+                    if (p[result] == 27) { /* escape character */
                         wpng_info.have_text &= ~TEXT_DESC;
                         valid = FALSE;
                     }
@@ -519,7 +519,7 @@
                     wpng_info.have_text &= ~TEXT_COPY;
                     valid = FALSE;
 #else
-                    if (p[result] == 27) {	/* escape character */
+                    if (p[result] == 27) { /* escape character */
                         wpng_info.have_text &= ~TEXT_COPY;
                         valid = FALSE;
                     }
@@ -549,7 +549,7 @@
                     wpng_info.have_text &= ~TEXT_EMAIL;
                     valid = FALSE;
 #else
-                    if (p[result] == 27) {	/* escape character */
+                    if (p[result] == 27) { /* escape character */
                         wpng_info.have_text &= ~TEXT_EMAIL;
                         valid = FALSE;
                     }
@@ -579,7 +579,7 @@
                     wpng_info.have_text &= ~TEXT_URL;
                     valid = FALSE;
 #else
-                    if (p[result] == 27) {	/* escape character */
+                    if (p[result] == 27) { /* escape character */
                         wpng_info.have_text &= ~TEXT_URL;
                         valid = FALSE;
                     }
@@ -743,10 +743,10 @@
 
     for (i = 0;  i < len;  ++i) {
         if (p[i] == 10 || (p[i] > 31 && p[i] < 127) || p[i] > 160)
-            continue;		/* character is completely OK */
+            continue;           /* character is completely OK */
         if (result < 0 || (p[result] != 27 && p[i] == 27))
-            result = i;		/* mark location of first questionable one */
-    }                  		/*  or of first escape character (bad) */
+            result = i;         /* mark location of first questionable one */
+    }                           /*  or of first escape character (bad) */
 
     return result;
 }
@@ -791,11 +791,11 @@
         buf[count++] = ch = getche();
     } while (ch != '\r' && count < len-1);
 
-    buf[count--] = '\0';	/* terminate string */
-    if (buf[count] == '\r')	/* Enter key makes CR, so change to newline */
+    buf[count--] = '\0';     /* terminate string */
+    if (buf[count] == '\r')  /* Enter key makes CR, so change to newline */
         buf[count] = '\n';
 
-    fprintf(stderr, "\n");	/* Enter key does *not* cause a newline */
+    fprintf(stderr, "\n");   /* Enter key does *not* cause a newline */
     fflush(stderr);
 
     return buf;
diff --git a/contrib/gregbook/writepng.c b/contrib/gregbook/writepng.c
index 1bfe447..44b7e9f 100644
--- a/contrib/gregbook/writepng.c
+++ b/contrib/gregbook/writepng.c
@@ -30,10 +30,10 @@
   ---------------------------------------------------------------------------*/
 
 
-#include <stdlib.h>	/* for exit() prototype */
+#include <stdlib.h>   /* for exit() prototype */
 
-#include "png.h"	/* libpng header; includes zlib.h and setjmp.h */
-#include "writepng.h"	/* typedefs, common macros, public prototypes */
+#include "png.h"      /* libpng header; includes zlib.h and setjmp.h */
+#include "writepng.h" /* typedefs, common macros, public prototypes */
 
 
 /* local prototype */
@@ -48,7 +48,7 @@
     PNG_LIBPNG_VER_STRING, png_libpng_ver);
   fprintf(stderr, "   Compiled with zlib %s; using zlib %s.\n",
     ZLIB_VERSION, zlib_version);
-} 
+}
 
 
 
diff --git a/contrib/pngminus/README b/contrib/pngminus/README
index 02486c5..8683a59 100644
--- a/contrib/pngminus/README
+++ b/contrib/pngminus/README
@@ -1,4 +1,4 @@
-PngMinus 
+PngMinus
 --------
 (copyright Willem van Schaik, 1999)
 
@@ -19,7 +19,7 @@
 Soon after the creation of PNG in 1995, the need was felt for a set of
 pnmtopng / pngtopnm utilities. Independantly Alexander Lehmann and I
 (Willem van Schaik) started such a project. Luckily we discovered this
-and merged the two together into pnmtopng.tar.gz, which is available 
+and merged the two together into pnmtopng.tar.gz, which is available
 from a/o ftp://swrinde.nde.swri.edu/pub/png/.
 
 These two utilities have many, many options and make use of most of the
diff --git a/contrib/pngminus/makevms.com b/contrib/pngminus/makevms.com
index 15d4ad4..7a14be5 100644
--- a/contrib/pngminus/makevms.com
+++ b/contrib/pngminus/makevms.com
@@ -39,14 +39,14 @@
 $   write sys$output "Building pnm2png..."
 $   CALL MAKE pnm2png.OBJ "cc ''CCOPT' pnm2png" -
 	pnm2png.c
-$   call make pnm2png.exe - 
-	"LINK pnm2png,lib.opt/opt" - 
+$   call make pnm2png.exe -
+	"LINK pnm2png,lib.opt/opt" -
 	pnm2png.obj
 $   write sys$output "Building png2pnm..."
 $   CALL MAKE png2pnm.OBJ "cc ''CCOPT' png2pnm" -
 	png2pnm.c
-$   call make pnm2png.exe - 
-	"LINK pnm2png,lib.opt/opt" - 
+$   call make pnm2png.exe -
+	"LINK pnm2png,lib.opt/opt" -
 	pnm2png.obj
 $ exit
 $!
diff --git a/contrib/pngminus/png2pnm.c b/contrib/pngminus/png2pnm.c
index 8532109..a900ec2 100644
--- a/contrib/pngminus/png2pnm.c
+++ b/contrib/pngminus/png2pnm.c
@@ -183,7 +183,7 @@
 BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha)
 {
   png_struct    *png_ptr = NULL;
-  png_info		*info_ptr = NULL;
+  png_info	*info_ptr = NULL;
   png_byte      buf[8];
   png_byte      *png_pixels = NULL;
   png_byte      **row_pointers = NULL;
@@ -217,13 +217,13 @@
     return FALSE;   /* out of memory */
 
   info_ptr = png_create_info_struct (png_ptr);
-  if (!info_ptr) 
+  if (!info_ptr)
   {
     png_destroy_read_struct (&png_ptr, NULL, NULL);
     return FALSE;   /* out of memory */
   }
 
-  if (setjmp (png_ptr->jmpbuf)) 
+  if (setjmp (png_ptr->jmpbuf))
   {
     png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
     return FALSE;
@@ -237,7 +237,7 @@
   png_read_info (png_ptr, info_ptr);
 
   /* get size and bit-depth of the PNG-image */
-  png_get_IHDR (png_ptr, info_ptr, 
+  png_get_IHDR (png_ptr, info_ptr,
     &width, &height, &bit_depth, &color_type,
     NULL, NULL, NULL);
 
@@ -294,7 +294,7 @@
   else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
     channels = 4;
   else
-    channels = 0; /* should never happen */    
+    channels = 0; /* should never happen */
   alpha_present = (channels - 1) % 2;
 
   /* check if alpha is expected to be present in file */
@@ -313,7 +313,7 @@
     return FALSE;
   }
 
-  if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL) 
+  if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL)
   {
     png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
     free (png_pixels);
diff --git a/contrib/pngminus/pnm2png.c b/contrib/pngminus/pnm2png.c
index 7653351..67796dd 100644
--- a/contrib/pngminus/pnm2png.c
+++ b/contrib/pngminus/pnm2png.c
@@ -64,9 +64,9 @@
 
   for (argi = 1; argi < argc; argi++)
   {
-    if (argv[argi][0] == '-') 
+    if (argv[argi][0] == '-')
     {
-      switch (argv[argi][1]) 
+      switch (argv[argi][1])
       {
         case 'i':
           interlace = TRUE;
@@ -405,7 +405,7 @@
   /* if needed we will allocate memory for an new array of row-pointers */
   if (row_pointers == (unsigned char**) NULL)
   {
-    if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL) 
+    if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL)
     {
       png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
       return FALSE;
@@ -418,13 +418,13 @@
 
   /* write out the entire image data in one call */
   png_write_image (png_ptr, row_pointers);
-    
+
   /* write the additional chuncks to the PNG file (not really needed) */
   png_write_end (png_ptr, info_ptr);
-    
-  /* clean up after the write, and free any memory allocated */    
+
+  /* clean up after the write, and free any memory allocated */
   png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
-        
+
   if (row_pointers != (unsigned char**) NULL)
     free (row_pointers);
   if (png_pixels != (unsigned char*) NULL)