about summary refs log tree commit diff
path: root/urt
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-06-28 17:29:32 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-06-28 17:29:32 +0000
commit23ce26f64c34e30951ad9ade2151552ed77e7357 (patch)
treed73b31a0c2f7c7be4a69f8a8e84e00dd39c432b5 /urt
parent1b6e51a266008348ad93ed8b6ac9ec91b5024fea (diff)
downloadnetpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.gz
netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.xz
netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.zip
promote Advanced to Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@4558 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'urt')
-rw-r--r--urt/Makefile6
-rw-r--r--urt/README5
-rw-r--r--urt/Runput.c300
-rw-r--r--urt/Runput.h2
-rw-r--r--urt/cmd_name.c30
-rw-r--r--urt/rle.h202
-rw-r--r--urt/rle_addhist.c20
-rw-r--r--urt/rle_code.h57
-rw-r--r--urt/rle_config.h10
-rw-r--r--urt/rle_error.c119
-rw-r--r--urt/rle_getcom.c44
-rw-r--r--urt/rle_getrow.c97
-rw-r--r--urt/rle_getskip.c198
-rw-r--r--urt/rle_global.c78
-rw-r--r--urt/rle_hdr.c394
-rw-r--r--urt/rle_open_f.c63
-rw-r--r--urt/rle_put.h64
-rw-r--r--urt/rle_putcom.c57
-rw-r--r--urt/rle_putrow.c753
-rw-r--r--urt/rle_row_alc.c100
-rw-r--r--urt/scanargs.c918
-rw-r--r--urt/vaxshort.c39
22 files changed, 1069 insertions, 2487 deletions
diff --git a/urt/Makefile b/urt/Makefile
index 0aef5290..8c85dab4 100644
--- a/urt/Makefile
+++ b/urt/Makefile
@@ -10,10 +10,10 @@ default: all
 include $(BUILDDIR)/config.mk
 
 LIBOBJECTS = Runput.o cmd_name.o \
-	rle_addhist.o rle_error.o rle_getcom.o rle_getrow.o rle_getskip.o \
+	rle_addhist.o rle_getcom.o rle_getrow.o rle_getskip.o \
 	rle_global.o rle_hdr.o rle_open_f.o rle_putcom.o rle_putrow.o \
-        rle_row_alc.o \
-        scanargs.o vaxshort.o     
+	rle_row_alc.o \
+	vaxshort.o     
 
 MERGE_OBJECTS =
 
diff --git a/urt/README b/urt/README
index dc68889d..2cfbb3e2 100644
--- a/urt/README
+++ b/urt/README
@@ -18,3 +18,8 @@ in its initializer in the original.  But GNU C Library Version 2
 defines stdout as a variable, so that wouldn't compile.  So I changed
 it to NULL and added a line to rle_hdr_init to set that field to
 'stdout' dynamically.  2000.06.02 BJH.
+
+---
+
+Cleanup by Akira F Urushibata 2022.03.06
+Unused functions removed.
\ No newline at end of file
diff --git a/urt/Runput.c b/urt/Runput.c
index 3bc562ac..1a7f2f7b 100644
--- a/urt/Runput.c
+++ b/urt/Runput.c
@@ -1,14 +1,14 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
@@ -18,146 +18,146 @@
  *  Modified at BRL 16-May-88 by Mike Muuss to avoid Alliant STDC desire
  *  to have all "void" functions so declared.
  */
-/* 
+/*
  * Runput.c - General purpose Run Length Encoding.
- * 
- * Author:	Spencer W. Thomas
- * 		Computer Science Dept.
- * 		University of Utah
- * Date:	Mon Aug  9 1982
+ *
+ * Author:      Spencer W. Thomas
+ *              Computer Science Dept.
+ *              University of Utah
+ * Date:        Mon Aug  9 1982
  * Copyright (c) 1982,1986 Spencer W. Thomas
- * 
+ *
  * $Id: Runput.c,v 3.0.1.1 1992/01/28 18:17:40 spencer Exp $
- * 
- * Modified by:	Todd W. Fuqua
- * 	Date:	Jul 22 1984
+ *
+ * Modified by: Todd W. Fuqua
+ *      Date:   Jul 22 1984
  * convert to new RLE format to make room for larger frame buffers
  */
 
 /* THIS IS WAY OUT OF DATE.  See rle.5.
  * The output file format is:
- * 
- * Word 0:	A "magic" number.  The top byte of the word contains
- *		the letter 'R' or the letter 'W'.  'W' indicates that
- *		only black and white information was saved.  The bottom
- *		byte is one of the following:
- *	' ':	Means a straight "box" save, -S flag was given.
- *	'B':	Image saved with background color, clear screen to
- *		background before restoring image.
- *	'O':	Image saved in overlay mode.
- * 
- * Words 1-6:	The structure
- * {     short   xpos,			Lower left corner
+ *
+ * Word 0:      A "magic" number.  The top byte of the word contains
+ *              the letter 'R' or the letter 'W'.  'W' indicates that
+ *              only black and white information was saved.  The bottom
+ *              byte is one of the following:
+ *      ' ':    Means a straight "box" save, -S flag was given.
+ *      'B':    Image saved with background color, clear screen to
+ *              background before restoring image.
+ *      'O':    Image saved in overlay mode.
+ *
+ * Words 1-6:   The structure
+ * {     short   xpos,                  Lower left corner
  *             ypos,
- *             xsize,			Size of saved box
+ *             xsize,                   Size of saved box
  *             ysize;
- *     char    rgb[3];			Background color
- *     char    map;			flag for map presence
+ *     char    rgb[3];                  Background color
+ *     char    map;                     flag for map presence
  * }
- * 
- * If the map flag is non-zero, then the color map will follow as 
+ *
+ * If the map flag is non-zero, then the color map will follow as
  * 3*256 16 bit words, first the red map, then the green map, and
  * finally the blue map.
- * 
+ *
  * Following the setup information is the Run Length Encoded image.
  * Each instruction consists of a 4-bit opcode, a 12-bit datum and
  * possibly one or more following words (all words are 16 bits).  The
  * instruction opcodes are:
- * 
+ *
  * SkipLines (1):   The bottom 10 bits are an unsigned number to be added to
- *		    current Y position.
- * 
+ *                  current Y position.
+ *
  * SetColor (2):    The datum indicates which color is to be loaded with
- * 		    the data described by the following ByteData and
- * 		    RunData instructions.  0->red, 1->green, 2->blue.  The
- * 		    operation also resets the X position to the initial
- * 		    X (i.e. a carriage return operation is performed).
- * 
+ *                  the data described by the following ByteData and
+ *                  RunData instructions.  0->red, 1->green, 2->blue.  The
+ *                  operation also resets the X position to the initial
+ *                  X (i.e. a carriage return operation is performed).
+ *
  * SkipPixels (3):  The bottom 10 bits are an unsigned number to be
- * 		    added to the current X position.
- * 
+ *                  added to the current X position.
+ *
  * ByteData (5):    The datum is one less than the number of bytes of
- * 		    color data following.  If the number of bytes is
- * 		    odd, a filler byte will be appended to the end of
- * 		    the byte string to make an integral number of 16-bit
- * 		    words.  The bytes are in PDP-11 order.  The X
- * 		    position is incremented to follow the last byte of
- * 		    data.
- * 
- * RunData (6):	    The datum is one less than the run length.  The
- * 		    following word contains (in its lower 8 bits) the
- * 		    color of the run.  The X position is incremented to
- * 		    follow the last byte in the run.
+ *                  color data following.  If the number of bytes is
+ *                  odd, a filler byte will be appended to the end of
+ *                  the byte string to make an integral number of 16-bit
+ *                  words.  The bytes are in PDP-11 order.  The X
+ *                  position is incremented to follow the last byte of
+ *                  data.
+ *
+ * RunData (6):     The datum is one less than the run length.  The
+ *                  following word contains (in its lower 8 bits) the
+ *                  color of the run.  The X position is incremented to
+ *                  follow the last byte in the run.
  */
 
 #include    <string.h>
-#include	<stdio.h>
+#include        <stdio.h>
 
-#include	"rle_put.h"
-#include	"rle.h"
-#include	"rle_code.h"
+#include        "rle_put.h"
+#include        "rle.h"
+#include        "rle_code.h"
 #include    "vaxshort.h"
 #include    "Runput.h"
 
-#define UPPER 255			/* anything bigger ain't a byte */
+#define UPPER 255                       /* anything bigger ain't a byte */
 
 /*
  * Macros to make writing instructions with correct byte order easier.
  */
 /* Write a two-byte value in little_endian order. */
-#define	put16(a)    (putc((a)&0xff,rle_fd),putc((char)(((a)>>8)&0xff),rle_fd))
+#define put16(a)    (putc((a)&0xff,rle_fd),putc((char)(((a)>>8)&0xff),rle_fd))
 
 /* short instructions */
-#define mk_short_1(oper,a1)		/* one argument short */ \
+#define mk_short_1(oper,a1)             /* one argument short */ \
     putc(oper,rle_fd), putc((char)a1,rle_fd)
 
-#define mk_short_2(oper,a1,a2)		/* two argument short */ \
+#define mk_short_2(oper,a1,a2)          /* two argument short */ \
     putc(oper,rle_fd), putc((char)a1,rle_fd), put16(a2)
 
 /* long instructions */
-#define mk_long_1(oper,a1)		/* one argument long */ \
+#define mk_long_1(oper,a1)              /* one argument long */ \
     putc((char)(LONG|oper),rle_fd), putc('\0', rle_fd), put16(a1)
 
-#define mk_long_2(oper,a1,a2)		/* two argument long */ \
+#define mk_long_2(oper,a1,a2)           /* two argument long */ \
     putc((char)(LONG|oper),rle_fd), putc('\0', rle_fd), \
     put16(a1), put16(a2)
 
 /* choose between long and short format instructions */
 /* NOTE: these macros can only be used where a STATEMENT is legal */
 
-#define mk_inst_1(oper,a1)		/* one argument inst */ \
+#define mk_inst_1(oper,a1)              /* one argument inst */ \
     if (a1>UPPER) (mk_long_1(oper,a1)); else (mk_short_1(oper,a1))
 
-#define mk_inst_2(oper,a1,a2)		/* two argument inst */ \
+#define mk_inst_2(oper,a1,a2)           /* two argument inst */ \
     if (a1>UPPER) (mk_long_2(oper,a1,a2)); else (mk_short_2(oper,a1,a2))
 
-/* 
+/*
  * Opcode definitions
  */
-#define	    RSkipLines(n)   	    mk_inst_1(RSkipLinesOp,(n))
+#define     RSkipLines(n)           mk_inst_1(RSkipLinesOp,(n))
 
-#define	    RSetColor(c)	    mk_short_1(RSetColorOp,(c))
-				    /* has side effect of performing */
-				    /* "carriage return" action */
+#define     RSetColor(c)            mk_short_1(RSetColorOp,(c))
+                                    /* has side effect of performing */
+                                    /* "carriage return" action */
 
-#define	    RSkipPixels(n)	    mk_inst_1(RSkipPixelsOp,(n))
+#define     RSkipPixels(n)          mk_inst_1(RSkipPixelsOp,(n))
 
-#define	    RNewLine		    RSkipLines(1)
+#define     RNewLine                RSkipLines(1)
 
-#define	    RByteData(n)	    mk_inst_1(RByteDataOp,n)
-					/* followed by ((n+1)/2)*2 bytes */
-					/* of data.  If n is odd, last */
-					/* byte will be ignored */
-					/* "cursor" is left at pixel */
-					/* following last pixel written */
+#define     RByteData(n)            mk_inst_1(RByteDataOp,n)
+                                        /* followed by ((n+1)/2)*2 bytes */
+                                        /* of data.  If n is odd, last */
+                                        /* byte will be ignored */
+                                        /* "cursor" is left at pixel */
+                                        /* following last pixel written */
 
-#define	    RRunData(n,c)	    mk_inst_2(RRunDataOp,(n),(c))
-					/* next word contains color data */
-					/* "cursor" is left at pixel after */
-					/* end of run */
+#define     RRunData(n,c)           mk_inst_2(RRunDataOp,(n),(c))
+                                        /* next word contains color data */
+                                        /* "cursor" is left at pixel after */
+                                        /* end of run */
 
-#define     REOF		    mk_inst_1(REOFOp,0)
-					/* Really opcode only */
+#define     REOF                    mk_inst_1(REOFOp,0)
+                                        /* Really opcode only */
 
 /*****************************************************************
  * TAG( RunSetup )
@@ -167,33 +167,33 @@ void
 RunSetup(rle_hdr * the_hdr)
 {
     struct XtndRsetup setup;
-    register FILE * rle_fd = the_hdr->rle_file;
+    FILE * rle_fd = the_hdr->rle_file;
 
     put16( RLE_MAGIC );
 
     if ( the_hdr->background == 2 )
-	setup.h_flags = H_CLEARFIRST;
+        setup.h_flags = H_CLEARFIRST;
     else if ( the_hdr->background == 0 )
-	setup.h_flags = H_NO_BACKGROUND;
+        setup.h_flags = H_NO_BACKGROUND;
     else
-	setup.h_flags = 0;
+        setup.h_flags = 0;
     if ( the_hdr->alpha )
-	setup.h_flags |= H_ALPHA;
+        setup.h_flags |= H_ALPHA;
     if ( the_hdr->comments != NULL && *the_hdr->comments != NULL )
-	setup.h_flags |= H_COMMENT;
+        setup.h_flags |= H_COMMENT;
 
     setup.h_ncolors = the_hdr->ncolors;
-    setup.h_pixelbits = 8;		/* Grinnell dependent */
+    setup.h_pixelbits = 8;              /* Grinnell dependent */
     if ( the_hdr->ncmap > 0 && the_hdr->cmap == NULL )
     {
-	fprintf( stderr,
+        fprintf( stderr,
        "%s: Color map of size %d*%d specified, but not supplied, writing %s\n",
-		 the_hdr->cmd, the_hdr->ncmap, (1 << the_hdr->cmaplen),
-		 the_hdr->file_name );
-	the_hdr->ncmap = 0;
+                 the_hdr->cmd, the_hdr->ncmap, (1 << the_hdr->cmaplen),
+                 the_hdr->file_name );
+        the_hdr->ncmap = 0;
     }
-    setup.h_cmaplen = the_hdr->cmaplen;	/* log2 of color map size */
-    setup.h_ncmap = the_hdr->ncmap;	/* no of color channels */
+    setup.h_cmaplen = the_hdr->cmaplen; /* log2 of color map size */
+    setup.h_ncmap = the_hdr->ncmap;     /* no of color channels */
     vax_pshort(setup.hc_xpos,the_hdr->xmin);
     vax_pshort(setup.hc_ypos,the_hdr->ymin);
     vax_pshort(setup.hc_xlen,the_hdr->xmax - the_hdr->xmin + 1);
@@ -201,61 +201,61 @@ RunSetup(rle_hdr * the_hdr)
     fwrite((char *)&setup, SETUPSIZE, 1, rle_fd);
     if ( the_hdr->background != 0 )
     {
-	register int i;
-	register rle_pixel *background =
-	    (rle_pixel *)malloc( (unsigned)(the_hdr->ncolors + 1) );
-	register int *bg_color;
-	/* 
-	 * If even number of bg color bytes, put out one more to get to 
-	 * 16 bit boundary.
-	 */
-	bg_color = the_hdr->bg_color;
-	for ( i = 0; i < the_hdr->ncolors; i++ )
-	    background[i] =  *bg_color++;
-	/* Extra byte, if written, should be 0. */
-	background[i] = 0;
-	fwrite((char *)background, (the_hdr->ncolors / 2) * 2 + 1, 1, rle_fd);
-	free( background );
+        int i;
+        rle_pixel *background =
+            (rle_pixel *)malloc( (unsigned)(the_hdr->ncolors + 1) );
+        int *bg_color;
+        /*
+         * If even number of bg color bytes, put out one more to get to
+         * 16 bit boundary.
+         */
+        bg_color = the_hdr->bg_color;
+        for ( i = 0; i < the_hdr->ncolors; i++ )
+            background[i] =  *bg_color++;
+        /* Extra byte, if written, should be 0. */
+        background[i] = 0;
+        fwrite((char *)background, (the_hdr->ncolors / 2) * 2 + 1, 1, rle_fd);
+        free( background );
     }
     else
-	putc( '\0', rle_fd );
+        putc( '\0', rle_fd );
     if (the_hdr->ncmap > 0)
     {
-	/* Big-endian machines are harder */
-	register int i, nmap = (1 << the_hdr->cmaplen) *
-			       the_hdr->ncmap;
-	register char *h_cmap = (char *)malloc( nmap * 2 );
-	if ( h_cmap == NULL )
-	{
-	    fprintf( stderr,
-	     "%s: Malloc failed for color map of size %d, writing %s\n",
-		     the_hdr->cmd, nmap, the_hdr->file_name );
-	    exit( 1 );
-	}
-	for ( i = 0; i < nmap; i++ )
-	    vax_pshort( &h_cmap[i*2], the_hdr->cmap[i] );
-
-	fwrite( h_cmap, nmap, 2, rle_fd );
-	free( h_cmap );
+        /* Big-endian machines are harder */
+        int i, nmap = (1 << the_hdr->cmaplen) *
+                               the_hdr->ncmap;
+        char *h_cmap = (char *)malloc( nmap * 2 );
+        if ( h_cmap == NULL )
+        {
+            fprintf( stderr,
+             "%s: Malloc failed for color map of size %d, writing %s\n",
+                     the_hdr->cmd, nmap, the_hdr->file_name );
+            exit( 1 );
+        }
+        for ( i = 0; i < nmap; i++ )
+            vax_pshort( &h_cmap[i*2], the_hdr->cmap[i] );
+
+        fwrite( h_cmap, nmap, 2, rle_fd );
+        free( h_cmap );
     }
 
     /* Now write out comments if given */
     if ( setup.h_flags & H_COMMENT )
     {
-	int comlen;
-	register CONST_DECL char ** com_p;
+        int comlen;
+        CONST_DECL char ** com_p;
 
-	/* Get the total length of comments */
-	comlen = 0;
-	for ( com_p = the_hdr->comments; *com_p != NULL; com_p++ )
-	    comlen += 1 + strlen( *com_p );
+        /* Get the total length of comments */
+        comlen = 0;
+        for ( com_p = the_hdr->comments; *com_p != NULL; com_p++ )
+            comlen += 1 + strlen( *com_p );
 
-	put16( comlen );
-	for ( com_p = the_hdr->comments; *com_p != NULL; com_p++ )
-	    fwrite( *com_p, 1, strlen( *com_p ) + 1, rle_fd );
+        put16( comlen );
+        for ( com_p = the_hdr->comments; *com_p != NULL; com_p++ )
+            fwrite( *com_p, 1, strlen( *com_p ) + 1, rle_fd );
 
-	if ( comlen & 1 )	/* if odd length, round up */
-	    putc( '\0', rle_fd );
+        if ( comlen & 1 )       /* if odd length, round up */
+            putc( '\0', rle_fd );
     }
 }
 
@@ -266,7 +266,7 @@ RunSetup(rle_hdr * the_hdr)
 void
 RunSkipBlankLines(int nblank, rle_hdr * the_hdr)
 {
-    register FILE * rle_fd = the_hdr->rle_file;
+    FILE * rle_fd = the_hdr->rle_file;
     RSkipLines(nblank);
 }
 
@@ -278,7 +278,7 @@ RunSkipBlankLines(int nblank, rle_hdr * the_hdr)
 void
 RunSetColor(int c, rle_hdr * the_hdr)
 {
-    register FILE * rle_fd = the_hdr->rle_file;
+    FILE * rle_fd = the_hdr->rle_file;
     RSetColor(c);
 }
 
@@ -291,10 +291,10 @@ RunSetColor(int c, rle_hdr * the_hdr)
 void
 RunSkipPixels(int nskip, int last, int wasrun, rle_hdr * the_hdr)
 {
-    register FILE * rle_fd = the_hdr->rle_file;
+    FILE * rle_fd = the_hdr->rle_file;
     if (! last && nskip > 0)
     {
-	RSkipPixels(nskip);
+        RSkipPixels(nskip);
     }
 }
 
@@ -306,10 +306,10 @@ RunSkipPixels(int nskip, int last, int wasrun, rle_hdr * the_hdr)
 void
 RunNewScanLine(int flag, rle_hdr * the_hdr)
 {
-    register FILE * rle_fd = the_hdr->rle_file;
+    FILE * rle_fd = the_hdr->rle_file;
     if (flag)
     {
-	RNewLine;
+        RNewLine;
     }
 }
 
@@ -320,14 +320,14 @@ RunNewScanLine(int flag, rle_hdr * the_hdr)
 void
 Runputdata(rle_pixel * buf, int n, rle_hdr * the_hdr)
 {
-    register FILE * rle_fd = the_hdr->rle_file;
+    FILE * rle_fd = the_hdr->rle_file;
     if (n == 0)
-	return;
+        return;
 
     RByteData(n-1);
     fwrite((char *)buf, n, 1, rle_fd);
     if ( n & 1 )
-	putc( 0, rle_fd );
+        putc( 0, rle_fd );
 }
 
 /*****************************************************************
@@ -339,7 +339,7 @@ Runputdata(rle_pixel * buf, int n, rle_hdr * the_hdr)
 void
 Runputrun(int color, int n, int last, rle_hdr * the_hdr)
 {
-    register FILE * rle_fd = the_hdr->rle_file;
+    FILE * rle_fd = the_hdr->rle_file;
     RRunData(n-1,color);
 }
 
@@ -351,6 +351,6 @@ Runputrun(int color, int n, int last, rle_hdr * the_hdr)
 void
 RunputEof(rle_hdr * the_hdr)
 {
-    register FILE * rle_fd = the_hdr->rle_file;
+    FILE * rle_fd = the_hdr->rle_file;
     REOF;
 }
diff --git a/urt/Runput.h b/urt/Runput.h
index 776e3ec5..1d22a971 100644
--- a/urt/Runput.h
+++ b/urt/Runput.h
@@ -1,4 +1,4 @@
-void 
+void
 RunSetup(rle_hdr * the_hdr);
 
 void
diff --git a/urt/cmd_name.c b/urt/cmd_name.c
index 31fe5f42..4b3f169b 100644
--- a/urt/cmd_name.c
+++ b/urt/cmd_name.c
@@ -1,27 +1,27 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
  * name of the person performing the modification, the date of modification,
  * and the reason for such modification.
  */
-/* 
+/*
  * cmd_name.c - Extract command name from argv[0].
- * 
- * Author:	Spencer W. Thomas
- * 		EECS Dept.
- * 		University of Michigan
- * Date:	Wed Jun 27 1990
+ *
+ * Author:      Spencer W. Thomas
+ *              EECS Dept.
+ *              University of Michigan
+ * Date:        Wed Jun 27 1990
  * Copyright (c) 1990, University of Michigan
  */
 
@@ -35,23 +35,23 @@ char *
 cmd_name( argv )
 char **argv;
 {
-    register char *cp, *a;
+    char *cp, *a;
 
     /* Be paranoid. */
     if ( !argv || !(a = *argv) )
-	return no_name;
+        return no_name;
 
     /* Find end of file name. */
     for ( cp = a; *cp; cp++ )
-	;
+        ;
 
     /* Find last / or beginning of command name. */
     for ( cp--; *cp != '/' && cp > a; cp-- )
-	;
-    
+        ;
+
     /* If it's a /, skip it. */
     if ( *cp == '/' )
-	cp++;
+        cp++;
 
     return cp;
 }
diff --git a/urt/rle.h b/urt/rle.h
index 0766d22a..1e7ddd0c 100644
--- a/urt/rle.h
+++ b/urt/rle.h
@@ -1,29 +1,29 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
  * name of the person performing the modification, the date of modification,
  * and the reason for such modification.
  */
-/* 
+/*
  * rle.h - Global declarations for Utah Raster Toolkit RLE programs.
- * 
+ *
  * Author:  Todd W. Fuqua
  *      Computer Science Dept.
  *      University of Utah
  * Date:    Sun Jul 29 1984
  * Copyright (c) 1984 Todd W. Fuqua
- * 
+ *
  * $Id: rle.h,v 3.0.1.5 1992/04/30 14:05:56 spencer Exp $
  */
 
@@ -50,33 +50,25 @@ typedef unsigned short rle_map;
 /*
  * Defines for traditional channel numbers.
  */
-#define RLE_RED     0   /* Red channel traditionally here. */
-#define RLE_GREEN   1   /* Green channel traditionally here. */
-#define RLE_BLUE    2   /* Blue channel traditionally here. */
-#define RLE_ALPHA      -1   /* Alpha channel here. */
+#define RLE_RED    0   /* Red channel traditionally here. */
+#define RLE_GREEN  1   /* Green channel traditionally here. */
+#define RLE_BLUE   2   /* Blue channel traditionally here. */
+#define RLE_ALPHA -1   /* Alpha channel here. */
 
 /*
  * Return values from rle_get_setup.
  */
-#define RLE_SUCCESS  0
-#define RLE_NOT_RLE -1
-#define RLE_NO_SPACE    -2
-#define RLE_EMPTY   -3
-#define RLE_EOF     -4
+#define RLE_SUCCESS   0
+#define RLE_NOT_RLE  -1
+#define RLE_NO_SPACE -2
+#define RLE_EMPTY    -3
+#define RLE_EOF      -4
 
 /*
  * "Magic" value for is_init field.  Pi * 2^29.
  */
 #define RLE_INIT_MAGIC  0x6487ED51L
 
-/*****************************************************************
- * TAG( RLE_CHECK_ALLOC )
- *
- * Test for allocation failure, scream and die if so.
- */
-#define RLE_CHECK_ALLOC( pgm, ptr, name )               \
-    ( !(ptr) ?  rle_alloc_error( pgm, name ) : 0 )
-
 /*
  * TAG( rle_hdr )
  *
@@ -103,15 +95,15 @@ typedef
         rle_map * cmap;       /* Pointer to color map array. */
         const char ** comments; /* Pointer to array of pointers to comments. */
         FILE *    rle_file;   /* Input or output file. */
-        /* 
+        /*
          * Bit map of channels to read/save.  Indexed by (channel mod 256).
          * Alpha channel sets bit 255.
-         * 
+         *
          * Indexing (0 <= c <= 255):
          *      bits[c/8] & (1 << (c%8))
          */
 #define RLE_SET_BIT(glob,bit) \
-        ((glob).bits[((bit)&0xff)/8] |= (1<<((bit)&0x7)))
+            ((glob).bits[((bit)&0xff)/8] |= (1<<((bit)&0x7)))
 #define RLE_CLR_BIT(glob,bit) \
             ((glob).bits[((bit)&0xff)/8] &= ~(1<<((bit)&0x7)))
 #define RLE_BIT(glob,bit) \
@@ -119,12 +111,12 @@ typedef
             char    bits[256/8];
             /* Set to magic pattern if following fields are initialized. */
             /* This gives a 2^(-32) chance of missing. */
-            long int is_init;   
+            long int is_init;
             /* Command, file name and image number for error messages. */
             const char *cmd;
             const char *file_name;
             int img_num;
-            /* 
+            /*
              * Local storage for rle_getrow & rle_putrow.
              * rle_getrow has
              *      scan_y  int     current Y scanline.
@@ -153,7 +145,7 @@ rle_hdr             /* End of typedef. */
 #endif
 ;
 
-/* 
+/*
  * TAG( rle_dflt_hdr )
  *
  * Global variable with possibly useful default values.
@@ -163,15 +155,6 @@ extern rle_hdr rle_dflt_hdr;
 
 /* Declare RLE library routines. */
 
-/* From rle_error.c. */
-/*****************************************************************
- * TAG( rle_alloc_error )
- * 
- * Print memory allocation error message and exit.
- */
-extern int rle_alloc_error( const char *pgm,
-                            const char *name );
-
 /*****************************************************************
  * TAG( rle_get_error )
  *
@@ -181,15 +164,8 @@ extern int rle_alloc_error( const char *pgm,
 extern int rle_get_error( int code,
                           const char *pgmname,
                           const char *fname );
-              
-/* From rle_getrow.c */
 
-/*****************************************************************
- * TAG( rle_debug )
- * 
- * Turn RLE debugging on or off.
- */
-extern void rle_debug( int on_off );
+/* From rle_getrow.c */
 
 int
 rle_get_setup(rle_hdr * const the_hdr);
@@ -199,7 +175,7 @@ rle_get_setup(rle_hdr * const the_hdr);
  *
  * Call rle_get_setup.  If it returns an error code, call
  * rle_get_error to print the error message, then exit with the error
- * code. 
+ * code.
  */
 extern void rle_get_setup_ok( rle_hdr *the_hdr,
                               const char *prog_name,
@@ -210,7 +186,7 @@ extern void rle_get_setup_ok( rle_hdr *the_hdr,
  *
  * Read a scanline worth of data from an RLE file.
  */
-extern int rle_getrow( rle_hdr * the_hdr, 
+extern int rle_getrow( rle_hdr * the_hdr,
                        rle_pixel * scanline[] );
 
 /* From rle_getskip.c */
@@ -235,7 +211,7 @@ extern void rle_names( rle_hdr *the_hdr,
 
 /*****************************************************************
  * TAG( rle_hdr_cp )
- * 
+ *
  * Make a "safe" copy of a rle_hdr structure.
  */
 extern rle_hdr * rle_hdr_cp( rle_hdr *from_hdr,
@@ -243,29 +219,19 @@ extern rle_hdr * rle_hdr_cp( rle_hdr *from_hdr,
 
 /*****************************************************************
  * TAG( rle_hdr_init )
- * 
+ *
  * Initialize a rle_hdr structure.
  */
 extern rle_hdr * rle_hdr_init( rle_hdr *the_hdr );
 
 /*****************************************************************
  * TAG( rle_hdr_clear )
- * 
+ *
  */
 extern void rle_hdr_clear( rle_hdr *the_hdr );
 
 /* From rle_putrow.c. */
 
-/*****************************************************************
- * TAG( rgb_to_bw )
- *
- * Converts RGB data to gray data via the NTSC Y transform.
- */
-extern void rgb_to_bw( rle_pixel *red_row,
-                       rle_pixel *green_row,
-                       rle_pixel *blue_row,
-                       rle_pixel *bw_row,
-                       int rowlen );
 
 /*****************************************************************
  * TAG( rle_puteof )
@@ -302,13 +268,6 @@ extern void rle_put_setup( rle_hdr * the_hdr );
  */
 extern void rle_skiprow( rle_hdr *the_hdr, int nrow );
 
-/* From rle_cp.c */
-/*****************************************************************
- * TAG( rle_cp )
- * Copy image data from input to output with minimal interpretation.
- */
-extern void rle_cp( rle_hdr *in_hdr, rle_hdr *out_hdr );
-
 /* From rle_row_alc.c. */
 /*****************************************************************
  * TAG( rle_row_alloc )
@@ -325,14 +284,6 @@ extern int rle_row_alloc( rle_hdr * the_hdr,
      */
 extern void rle_row_free( rle_hdr *the_hdr, rle_pixel **scanp );
 
-/* From buildmap.c. */
-/* 
- * buildmap - build a more usable colormap from data in the_hdr struct.
-     */
-extern rle_pixel **buildmap( rle_hdr *the_hdr,
-                             int minmap,
-                             double orig_gamma,
-                             double new_gamma );
 
 /* From rle_getcom.c. */
 /*****************************************************************
@@ -346,55 +297,11 @@ rle_getcom(const char * const name,
 
 /* From rle_putcom.c. */
 
-/* Delete a specific comment from the image comments. */
-const char *
-rle_delcom(const char * const name,
-           rle_hdr *    const the_hdr);
-
 /* Put (or replace) a comment into the image comments. */
 const char *
 rle_putcom(const char * const value,
            rle_hdr *    const the_hdr);
 
-/* From dither.c. */
-/*****************************************************************
- * TAG( bwdithermap )
- * Create a color map for ordered dithering in grays.
- */
-extern void bwdithermap( int levels, double gamma, int bwmap[],
-                         int divN[256], int modN[256], int magic[16][16] );
-/*****************************************************************
- * TAG( ditherbw )
- * Dither a gray-scale value.
- */
-extern int ditherbw( int x, int y, int val, 
-                     int divN[256], int modN[256], int magic[16][16] );
-/*****************************************************************
- * TAG( dithergb )
- * Dither a color value.
- */
-extern int dithergb( int x, int y, int r, int g, int b,
-                     int divN[256], int modN[256], int magic[16][16] );
-/*****************************************************************
- * TAG( dithermap )
- * Create a color map for ordered dithering in color.
- */
-extern void dithermap( int levels, double gamma, int rgbmap[][3],
-                       int divN[256], int modN[256], int magic[16][16] );
-/*****************************************************************
- * TAG( make_square )
- * Make a 16x16 magic square for ordered dithering.
- */
-extern void make_square( double N, int divN[256], int modN[256],
-                         int magic[16][16] );
-
-/* From float_to_exp.c. */
-/*****************************************************************
- * TAG( float_to_exp )
- * Convert a list of floating point numbers to "exp" format.
- */
-extern void float_to_exp( int count, float * floats, rle_pixel * pixels );
-
 /* From rle_open_f.c. */
 /*****************************************************************
  * TAG( rle_open_f )
@@ -402,7 +309,7 @@ extern void float_to_exp( int count, float * floats, rle_pixel * pixels );
  * Open an input/output file with default.
  */
 FILE *
-rle_open_f(const char * prog_name, const char * file_name, 
+rle_open_f(const char * prog_name, const char * file_name,
            const char * mode);
 
 /*****************************************************************
@@ -412,27 +319,9 @@ rle_open_f(const char * prog_name, const char * file_name,
  */
 FILE *
 rle_open_f_noexit(const char * const prog_name,
-                  const char * const file_name, 
+                  const char * const file_name,
                   const char * const mode);
 
-/*****************************************************************
- * TAG( rle_close_f )
- * 
- * Close a file opened by rle_open_f.  If the file is stdin or stdout,
- * it will not be closed.
- */
-extern void 
-rle_close_f( FILE *fd );
-
-/* From colorquant.c. */
-/*****************************************************************
- * TAG( colorquant )
- * Compute a colormap for quantizing an image to a limited set of colors.
- */
-extern int colorquant( rle_pixel *red, rle_pixel *green, rle_pixel *blue,
-                       unsigned long pixels, rle_pixel *colormap[3],
-                       int colors, int bits,
-                       rle_pixel *rgbmap, int fast, int otherimages );
 
 /* From rle_addhist.c. */
 
@@ -449,38 +338,5 @@ rle_addhist(char *          argv[],
  */
 extern char *cmd_name( char **argv );
 
-/* From scanargs.c. */
-/*****************************************************************
- * TAG( scanargs )
- * Scan command argument list and parse arguments.
- */
-extern int scanargs( int argc,
-                     char **argv,
-                     const char *format,
-                     ... );
-
-/* From hilbert.c */
-/*****************************************************************
- * TAG( hilbert_i2c )
- * Convert an index into a Hilbert curve to a set of coordinates.
- */
-extern void hilbert_c2i( int n, int m, int a[], long int *r );
-
-/*****************************************************************
- * TAG( hilbert_c2i )
- * Convert coordinates of a point on a Hilbert curve to its index.
- */
-extern void hilbert_i2c( int n, int m, long int r, int a[] );
-
-/* From inv_cmap.c */
-/*****************************************************************
- * TAG( inv_cmap )
- * Compute an inverse colormap efficiently.
- */
-extern void inv_cmap( int colors,
-                      unsigned char *colormap[3],
-                      int bits,
-                      unsigned long *dist_buf,
-                      unsigned char *rgbmap );
 
 #endif /* RLE_H */
diff --git a/urt/rle_addhist.c b/urt/rle_addhist.c
index b1651754..45c3dbfd 100644
--- a/urt/rle_addhist.c
+++ b/urt/rle_addhist.c
@@ -1,25 +1,25 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
  * name of the person performing the modification, the date of modification,
  * and the reason for such modification.
  */
-/* 
+/*
  * rle_addhist.c - Add to the HISTORY comment in header
- * 
+ *
  * Author:  Andrew Marriott.
- *      School of Computer Science 
+ *      School of Computer Science
  *      Curtin University of Technology
  * Date:    Mon Sept 10 1988
  * Copyright (c) 1988, Curtin University of Technology
@@ -35,7 +35,7 @@
 
 /*****************************************************************
  * TAG( rle_addhist )
- * 
+ *
  * Put a history comment into the header struct.
  * Inputs:
  *  argv:       Command line history to add to comments.
@@ -68,7 +68,7 @@ rle_addhist(char *          argv[],
 
     if (getenv("NO_ADD_RLE_HISTORY"))
         return;
-    
+
     length = 0;
     for (i = 0; argv[i]; ++i)
         length += strlen(argv[i]) +1;   /* length of each arg plus space. */
@@ -83,7 +83,7 @@ rle_addhist(char *          argv[],
         old = rle_getcom(histoire, in_hdr);     /* get old comment. */
     else
         old = NULL;
-    
+
     if (old && *old)
         length += strlen(old);       /* add length if there. */
 
@@ -104,6 +104,6 @@ rle_addhist(char *          argv[],
     strcat(newc,"on ");
     strcat(newc,timedate);         /* \n supplied by time. */
     strcat(newc,padding);          /* to line up multiple histories.*/
-    
+
     rle_putcom(newc, out_hdr);
 }
diff --git a/urt/rle_code.h b/urt/rle_code.h
index 955e7d42..493cdc02 100644
--- a/urt/rle_code.h
+++ b/urt/rle_code.h
@@ -1,50 +1,50 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
  * name of the person performing the modification, the date of modification,
  * and the reason for such modification.
  */
-/* 
+/*
  * rle_code.h - Definitions for Run Length Encoding.
- * 
- * Author:	Spencer W. Thomas
- * 		Computer Science Dept.
- * 		University of Utah
- * Date:	Mon Aug  9 1982
+ *
+ * Author:      Spencer W. Thomas
+ *              Computer Science Dept.
+ *              University of Utah
+ * Date:        Mon Aug  9 1982
  * Copyright (c) 1982 Spencer W. Thomas
- * 
+ *
  * $Header: /usr/users/spencer/src/urt/include/RCS/rle_code.h,v 3.0 90/08/03 15:19:48 spencer Exp $
  */
 
 #ifndef RLE_MAGIC
 
-/* 
+/*
  * Opcode definitions
  */
 
 #define     LONG                0x40
-#define	    RSkipLinesOp	1
-#define	    RSetColorOp		2
-#define	    RSkipPixelsOp	3
-#define	    RByteDataOp		5
-#define	    RRunDataOp		6
-#define	    REOFOp		7
+#define     RSkipLinesOp        1
+#define     RSetColorOp         2
+#define     RSkipPixelsOp       3
+#define     RByteDataOp         5
+#define     RRunDataOp          6
+#define     REOFOp              7
 
-#define     H_CLEARFIRST        0x1	/* clear framebuffer flag */
-#define	    H_NO_BACKGROUND	0x2	/* if set, no bg color supplied */
-#define	    H_ALPHA		0x4   /* if set, alpha channel (-1) present */
-#define	    H_COMMENT		0x8	/* if set, comments present */
+#define     H_CLEARFIRST        0x1   /* clear framebuffer flag */
+#define     H_NO_BACKGROUND     0x2   /* if set, no bg color supplied */
+#define     H_ALPHA             0x4   /* if set, alpha channel (-1) present */
+#define     H_COMMENT           0x8   /* if set, comments present */
 
 struct XtndRsetup
 {
@@ -54,17 +54,16 @@ struct XtndRsetup
             hc_ylen[2];
     char    h_flags,
             h_ncolors,
-	    h_pixelbits,
-	    h_ncmap,
-	    h_cmaplen;
+            h_pixelbits,
+            h_ncmap,
+            h_cmaplen;
 };
-#define	    SETUPSIZE	((4*2)+5)
+#define     SETUPSIZE   ((4*2)+5)
 
 /* "Old" RLE format magic numbers */
-#define	    RMAGIC	('R' << 8)	/* top half of magic number */
-#define	    WMAGIC	('W' << 8)	/* black&white rle image */
+#define     RMAGIC      ('R' << 8)      /* top half of magic number */
+#define     WMAGIC      ('W' << 8)      /* black&white rle image */
 
-#define	    RLE_MAGIC	((short)0xcc52)	/* RLE file magic number */
+#define     RLE_MAGIC   ((short)0xcc52) /* RLE file magic number */
 
 #endif /* RLE_MAGIC */
-
diff --git a/urt/rle_config.h b/urt/rle_config.h
index 57126a18..5923c00d 100644
--- a/urt/rle_config.h
+++ b/urt/rle_config.h
@@ -49,7 +49,7 @@
 
 /* Typedef for void * so we can use it consistently. */
 #ifdef VOID_STAR
-typedef	void *void_star;
+typedef void *void_star;
 #else
 typedef char *void_star;
 #endif
@@ -59,7 +59,7 @@ typedef char *void_star;
  * before including this file.
  */
 #ifndef NO_DECLARE_MALLOC
-#   include <sys/types.h>	/* For size_t. */
+#   include <sys/types.h>       /* For size_t. */
     extern void_star malloc( size_t );
     extern void_star calloc( size_t, size_t );
     extern void_star realloc( void_star, size_t );
@@ -75,12 +75,12 @@ extern char *getenv( CONST_DECL char *name );
      * TAG( bstring bzero )
      * 'Byte string' functions.
      */
-#   define bzero( _str, _n )		memset( _str, '\0', _n )
-#   define bcopy( _from, _to, _count )	memcpy( _to, _from, _count )
+#   define bzero( _str, _n )            memset( _str, '\0', _n )
+#   define bcopy( _from, _to, _count )  memcpy( _to, _from, _count )
 #endif
 
 #ifdef NEED_SETLINEBUF
-#   define setlinebuf( _s )	setvbuf( (_s), NULL, _IOLBF, 0 )
+#   define setlinebuf( _s )     setvbuf( (_s), NULL, _IOLBF, 0 )
 #endif
 
 #endif
diff --git a/urt/rle_error.c b/urt/rle_error.c
deleted file mode 100644
index 702c6e2d..00000000
--- a/urt/rle_error.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
- * preserved on all copies.
- * 
- * There is no warranty or other guarantee of fitness for this software,
- * it is provided solely "as is".  Bug reports or fixes may be sent
- * to the author, who may or may not act on them as he desires.
- *
- * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
- * source is available for no extra charge.
- *
- * If you modify this software, you should include a notice giving the
- * name of the person performing the modification, the date of modification,
- * and the reason for such modification.
- */
-/* 
- * rle_error.c - Error message stuff for URT.
- * 
- * Author:	Spencer W. Thomas
- * 		EECS Dept.
- * 		University of Michigan
- * Date:	Mon Mar  2 1992
- * Copyright (c) 1992, University of Michigan
- */
-
-#include <string.h>
-
-#include "rle_config.h"
-#include "rle.h"
-
-/*****************************************************************
- * TAG( rle_alloc_error )
- * 
- * Print memory allocation error message and exit.
- * Inputs:
- * 	pgm:		Name of this program.
- * 	name:		Name of memory trying to be allocated.
- * Outputs:
- * 	Prints message and exits.
- *
- * Returns int because it's used in a conditional expression.
- */
-int
-rle_alloc_error( pgm, name )
-CONST_DECL char *pgm, *name;
-{
-    if ( !name )
-	fprintf( stderr, "%s: memory allocation failed.\n", pgm );
-    else
-	fprintf( stderr, "%s: memory allocation failed (no space for %s).\n",
-		 pgm, name );
-
-    exit( RLE_NO_SPACE );
-
-    /* Will some compilers bitch about this because they know exit
-     * doesn't return??
-     */
-    return 0;
-}
-
-/*****************************************************************
- * TAG( rle_get_error )
- * 
- * Print an error message for the return code from rle_get_setup
- * Inputs:
- * 	code:		The return code from rle_get_setup.
- *	pgmname:	Name of this program (argv[0]).
- *	fname:		Name of the input file.
- * Outputs:
- * 	Prints an error message on standard output.
- *	Returns code.
- */
-int
-rle_get_error( code, pgmname, fname )
-int code;
-CONST_DECL char *pgmname;
-CONST_DECL char *fname;
-{
-    if (! fname || strcmp( fname, "-" ) == 0 )
-	fname = "Standard Input";
-
-    switch( code )
-    {
-    case RLE_SUCCESS:		/* success */
-	break;
-
-    case RLE_NOT_RLE:		/* Not an RLE file */
-	fprintf( stderr, "%s: %s is not an RLE file\n",
-		 pgmname, fname );
-	break;
-
-    case RLE_NO_SPACE:			/* malloc failed */
-	fprintf( stderr,
-		 "%s: Malloc failed reading header of file %s\n",
-		 pgmname, fname );
-	break;
-
-    case RLE_EMPTY:
-	fprintf( stderr, "%s: %s is an empty file\n",
-		 pgmname, fname );
-	break;
-
-    case RLE_EOF:
-	fprintf( stderr,
-		 "%s: RLE header of %s is incomplete (premature EOF)\n",
-		 pgmname, fname );
-	break;
-
-    default:
-	fprintf( stderr, "%s: Error encountered reading header of %s\n",
-		 pgmname, fname );
-	break;
-    }
-    return code;
-}
-
-
diff --git a/urt/rle_getcom.c b/urt/rle_getcom.c
index 4226eaaf..a0a1e5ae 100644
--- a/urt/rle_getcom.c
+++ b/urt/rle_getcom.c
@@ -1,27 +1,27 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
  * name of the person performing the modification, the date of modification,
  * and the reason for such modification.
  */
-/* 
+/*
  * rle_getcom.c - Get specific comments from the_hdr structure.
- * 
- * Author:	Spencer W. Thomas
- * 		Computer Science Dept.
- * 		University of Utah
- * Date:	Sun Jan 25 1987
+ *
+ * Author:      Spencer W. Thomas
+ *              Computer Science Dept.
+ *              University of Utah
+ * Date:        Sun Jan 25 1987
  * Copyright (c) 1987, University of Utah
  */
 
@@ -31,21 +31,21 @@
 
 /*****************************************************************
  * TAG( match )
- * 
+ *
  * Match a name against a test string for "name=value" or "name".
  * If it matches name=value, return pointer to value part, if just
  * name, return pointer to NUL at end of string.  If no match, return NULL.
  *
  * Inputs:
- * 	n:	Name to match.  May also be "name=value" to make it easier
- *		to replace comments.
- *	v:	Test string.
+ *      n:      Name to match.  May also be "name=value" to make it easier
+ *              to replace comments.
+ *      v:      Test string.
  * Outputs:
- * 	Returns pointer as above.
+ *      Returns pointer as above.
  * Assumptions:
- *	[None]
+ *      [None]
  * Algorithm:
- *	[None]
+ *      [None]
  */
 static const char *
 match(const char * const nArg,
@@ -69,17 +69,17 @@ match(const char * const nArg,
 
 /*****************************************************************
  * TAG( rle_getcom )
- * 
+ *
  * Return a pointer to the value part of a name=value pair in the comments.
  * Inputs:
- * 	name:		Name part of the comment to search for.
- *	the_hdr:	rle_dflt_hdr structure.
+ *      name:           Name part of the comment to search for.
+ *      the_hdr:        rle_dflt_hdr structure.
  * Outputs:
- * 	Returns pointer to value part of comment or NULL if no match.
+ *      Returns pointer to value part of comment or NULL if no match.
  * Assumptions:
- *	[None]
+ *      [None]
  * Algorithm:
- *	[None]
+ *      [None]
  */
 const char *
 rle_getcom(const char * const name,
diff --git a/urt/rle_getrow.c b/urt/rle_getrow.c
index 679811cc..a24870ac 100644
--- a/urt/rle_getrow.c
+++ b/urt/rle_getrow.c
@@ -1,14 +1,14 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
@@ -18,15 +18,15 @@
  *  Modified at BRL 16-May-88 by Mike Muuss to avoid Alliant STDC desire
  *  to have all "void" functions so declared.
  */
-/* 
+/*
  * rle_getrow.c - Read an RLE file in.
- * 
+ *
  * Author:  Spencer W. Thomas
  *      Computer Science Dept.
  *      University of Utah
  * Date:    Wed Apr 10 1985
  * Copyright (c) 1985 Spencer W. Thomas
- * 
+ *
  * $Id: rle_getrow.c,v 3.0.1.5 1992/03/04 19:33:08 spencer Exp spencer $
  */
 
@@ -43,7 +43,7 @@
 /* Read a two-byte "short" that started in VAX (LITTLE_ENDIAN) order */
 #define VAXSHORT( var, fp )\
     { var = fgetc(fp)&0xFF; var |= (fgetc(fp)) << 8; }
-  
+
 /* Instruction format -- first byte is opcode, second is datum. */
 
 #define OPCODE(inst) (inst[0] & ~LONG)
@@ -77,7 +77,7 @@ rle_get_setup(rle_hdr * const the_hdr) {
     FILE * infile = the_hdr->rle_file;
     int i;
     char * comment_buf;
-    
+
     /* Clear old stuff out of the header. */
     rle_hdr_clear(the_hdr);
     if (the_hdr->is_init != RLE_INIT_MAGIC)
@@ -102,9 +102,13 @@ rle_get_setup(rle_hdr * const the_hdr) {
         rle_pixel * bg_color;
 
         MALLOCARRAY(the_hdr->bg_color, setup.h_ncolors);
+        if (!the_hdr->bg_color)
+            pm_error("Failed to allocation array for %u background colors",
+                     setup.h_ncolors);
         MALLOCARRAY(bg_color, 1 + (setup.h_ncolors / 2) * 2);
-        RLE_CHECK_ALLOC(the_hdr->cmd, the_hdr->bg_color && bg_color,
-                        "background color" );
+        if (!bg_color)
+            pm_error("Failed to allocation array for %u background colors",
+                     1+(setup.h_ncolors / 2) * 2);
         fread((char *)bg_color, 1, 1 + (setup.h_ncolors / 2) * 2, infile);
         for (i = 0; i < setup.h_ncolors; ++i)
             the_hdr->bg_color[i] = bg_color[i];
@@ -163,7 +167,7 @@ rle_get_setup(rle_hdr * const the_hdr) {
         evenlen = (comlen + 1) & ~1;    /* make it even */
         if (evenlen) {
             MALLOCARRAY(comment_buf, evenlen);
-    
+
             if (comment_buf == NULL) {
                 pm_error("Malloc failed for comment buffer of size %d "
                          "in rle_get_setup, reading '%s'",
@@ -214,78 +218,13 @@ rle_get_setup(rle_hdr * const the_hdr) {
 
 
 
-void
-rle_get_setup_ok(rle_hdr *    const the_hdr,
-                 const char * const prog_name,
-                 const char * const file_name) {
-/*-----------------------------------------------------------------------------
-  Read the initialization information from an RLE file.
-
-  Inputs:
-   the_hdr:    Contains pointer to the input file.
-   prog_name:  Program name to be printed in the error message.
-       file_name:  File name to be printed in the error message.
-                   If NULL, the string "stdin" is generated.
-
-  Outputs:
-   the_hdr:    Initialized with information from the input file.
-       If reading the header fails, it prints an error message
-       and exits with the appropriate status code.
-  Algorithm:
-   rle_get_setup does all the work.
----------------------------------------------------------------------------- */
-    int code;
-
-    /* Backwards compatibility: if is_init is not properly set, 
-     * initialize the header.
-     */
-    if (the_hdr->is_init != RLE_INIT_MAGIC) {
-        FILE * const f = the_hdr->rle_file;
-        rle_hdr_init( the_hdr );
-        the_hdr->rle_file = f;
-        rle_names(the_hdr, prog_name, file_name, 0);
-    }
-
-    code = rle_get_error(rle_get_setup(the_hdr),
-                         the_hdr->cmd, the_hdr->file_name);
-    if (code)
-        exit(code);
-}
-
-
-
-void
-rle_debug( on_off )
-    int on_off;
-{
-/*-----------------------------------------------------------------------------
-  Turn RLE debugging on or off.
-  Inputs:
-   on_off:     if 0, stop debugging, else start.
-  Outputs:
-   Sets internal debug flag.
-  Assumptions:
-   [None]
-  Algorithm:
-   [None]
----------------------------------------------------------------------------- */
-    debug_f = on_off;
-
-    /* Set line buffering on stderr.  Character buffering is the default, and
-     * it is SLOOWWW for large amounts of output.
-     */
-    setvbuf(stderr, NULL, _IOLBF, 0);
-}
-
-
-
 int
 rle_getrow(rle_hdr *    const the_hdr,
            rle_pixel ** const scanline) {
 /*-----------------------------------------------------------------------------
   Get a scanline from the input file.
   Inputs:
-   the_hdr:    Header structure containing information about 
+   the_hdr:    Header structure containing information about
            the input file.
   Outputs:
    scanline:   an array of pointers to the individual color
@@ -300,10 +239,10 @@ rle_getrow(rle_hdr *    const the_hdr,
    specified (the_hdr->background is true), just set the
    scanlines to the background color.  If clear-to-background is
    not set, just increment the scanline number and return.
-  
+
    Otherwise, read input until a vertical skip is encountered,
    decoding the instructions into scanline data.
- 
+
    If ymax is reached (or, somehow, passed), continue reading and
    discarding input until end of image.
 ---------------------------------------------------------------------------- */
diff --git a/urt/rle_getskip.c b/urt/rle_getskip.c
index 1366e162..3d36fba4 100644
--- a/urt/rle_getskip.c
+++ b/urt/rle_getskip.c
@@ -1,27 +1,27 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
  * name of the person performing the modification, the date of modification,
  * and the reason for such modification.
  */
-/* 
+/*
  * rle_getskip.c - Skip scanlines on input.
- * 
- * Author:	Spencer W. Thomas
- * 		EECS Dept.
- * 		University of Michigan
- * Date:	Wed Jun 27 1990
+ *
+ * Author:      Spencer W. Thomas
+ *              EECS Dept.
+ *              University of Michigan
+ * Date:        Wed Jun 27 1990
  * Copyright (c) 1990, University of Michigan
  */
 
@@ -32,133 +32,133 @@
 
 /* Read a two-byte "short" that started in VAX (LITTLE_ENDIAN) order */
 #define VAXSHORT( var, fp )\
-	{ var = fgetc(fp)&0xFF; var |= (fgetc(fp)) << 8; }
-  
+        { var = fgetc(fp)&0xFF; var |= (fgetc(fp)) << 8; }
+
 /* Instruction format -- first byte is opcode, second is datum. */
 
 #define OPCODE(inst) (inst[0] & ~LONG)
 #define LONGP(inst) (inst[0] & LONG)
-#define DATUM(inst) (inst[1] & 0xff)	/* Make sure it's unsigned. */
+#define DATUM(inst) (inst[1] & 0xff)    /* Make sure it's unsigned. */
 
 /*****************************************************************
  * TAG( rle_getskip )
- * 
+ *
  * Skip the next scanline with data on it.
  * Most useful for skipping to end-of-image.
  * Inputs:
- * 	the_hdr:	Describes input image.
+ *      the_hdr:        Describes input image.
  * Outputs:
- * 	Returns the number of the next scanline.  At EOF returns 32768.
+ *      Returns the number of the next scanline.  At EOF returns 32768.
  * Assumptions:
- * 	rle_get_setup has been called.
+ *      rle_get_setup has been called.
  * Algorithm:
- * 	Read input to the beginning of the next scanline, or to EOF or
- * 	end of image.
+ *      Read input to the beginning of the next scanline, or to EOF or
+ *      end of image.
  */
 unsigned int
 rle_getskip( the_hdr )
 rle_hdr *the_hdr;
 {
     unsigned char inst[2];
-    register FILE *infile = the_hdr->rle_file;
+    FILE *infile = the_hdr->rle_file;
     int nc;
 
     /* Add in vertical skip from last scanline */
-    if ( the_hdr->priv.get.vert_skip > 0) 
-	the_hdr->priv.get.scan_y += the_hdr->priv.get.vert_skip;
+    if ( the_hdr->priv.get.vert_skip > 0)
+        the_hdr->priv.get.scan_y += the_hdr->priv.get.vert_skip;
     the_hdr->priv.get.vert_skip = 0;
 
     if ( the_hdr->priv.get.is_eof )
-	return 32768;		/* too big for 16 bits, signal EOF */
-    
+        return 32768;           /* too big for 16 bits, signal EOF */
+
     /* Otherwise, read and interpret instructions until a skipLines
      * instruction is encountered.
      */
     for (;;)
     {
         inst[0] = getc( infile );
-	inst[1] = getc( infile );
-	if ( feof(infile) )
-	{
-	    the_hdr->priv.get.is_eof = 1;
-	    break;		/* <--- one of the exits */
-	}
-
-	switch( OPCODE(inst) )
-	{
-	case RSkipLinesOp:
-	    if ( LONGP(inst) )
-	    {
-		VAXSHORT( the_hdr->priv.get.vert_skip, infile );
-	    }
-	    else
-		the_hdr->priv.get.vert_skip = DATUM(inst);
-	    break;			/* need to break for() here, too */
-
-	case RSetColorOp:
-	    /* No-op here. */
-	    break;
-
-	case RSkipPixelsOp:
-	    if ( LONGP(inst) )
-	    {
-		(void)getc( infile );
-		(void)getc( infile );
-	    }
-	    break;
-
-	case RByteDataOp:
-	    if ( LONGP(inst) )
-	    {
-	        VAXSHORT( nc, infile );
-	    }
-	    else
-		nc = DATUM(inst);
-	    nc++;
-	    if ( the_hdr->priv.get.is_seek )
-		fseek( infile, ((nc + 1) / 2) * 2, 1 );
-	    else
-	    {
-		register int ii;
-		for ( ii = ((nc + 1) / 2) * 2; ii > 0; ii-- )
-		    (void) getc( infile );	/* discard it */
-	    }
-
-	    break;
-
-	case RRunDataOp:
-	    if ( LONGP(inst) )
-	    {
-		(void)getc( infile );
-		(void)getc( infile );
-	    }
-	    (void)getc( infile );
-	    (void)getc( infile );
-	    break;
-
-	case REOFOp:
-	    the_hdr->priv.get.is_eof = 1;
-	    break;
-
-	default:
-	    fprintf( stderr,
-		     "%s: rle_getskip: Unrecognized opcode: %d, reading %s\n",
-		     the_hdr->cmd, OPCODE(inst), the_hdr->file_name );
-	    exit(1);
-	}
-	if ( OPCODE(inst) == REOFOp )
-	    break;			/* <--- the other loop exit */
-	if ( OPCODE(inst) == RSkipLinesOp )
-	    break;
+        inst[1] = getc( infile );
+        if ( feof(infile) )
+        {
+            the_hdr->priv.get.is_eof = 1;
+            break;              /* <--- one of the exits */
+        }
+
+        switch( OPCODE(inst) )
+        {
+        case RSkipLinesOp:
+            if ( LONGP(inst) )
+            {
+                VAXSHORT( the_hdr->priv.get.vert_skip, infile );
+            }
+            else
+                the_hdr->priv.get.vert_skip = DATUM(inst);
+            break;                      /* need to break for() here, too */
+
+        case RSetColorOp:
+            /* No-op here. */
+            break;
+
+        case RSkipPixelsOp:
+            if ( LONGP(inst) )
+            {
+                (void)getc( infile );
+                (void)getc( infile );
+            }
+            break;
+
+        case RByteDataOp:
+            if ( LONGP(inst) )
+            {
+                VAXSHORT( nc, infile );
+            }
+            else
+                nc = DATUM(inst);
+            nc++;
+            if ( the_hdr->priv.get.is_seek )
+                fseek( infile, ((nc + 1) / 2) * 2, 1 );
+            else
+            {
+                int ii;
+                for ( ii = ((nc + 1) / 2) * 2; ii > 0; ii-- )
+                    (void) getc( infile );      /* discard it */
+            }
+
+            break;
+
+        case RRunDataOp:
+            if ( LONGP(inst) )
+            {
+                (void)getc( infile );
+                (void)getc( infile );
+            }
+            (void)getc( infile );
+            (void)getc( infile );
+            break;
+
+        case REOFOp:
+            the_hdr->priv.get.is_eof = 1;
+            break;
+
+        default:
+            fprintf( stderr,
+                     "%s: rle_getskip: Unrecognized opcode: %d, reading %s\n",
+                     the_hdr->cmd, OPCODE(inst), the_hdr->file_name );
+            exit(1);
+        }
+        if ( OPCODE(inst) == REOFOp )
+            break;                      /* <--- the other loop exit */
+        if ( OPCODE(inst) == RSkipLinesOp )
+            break;
     }
 
     /* Return the number of the NEXT scanline. */
     the_hdr->priv.get.scan_y +=
-	the_hdr->priv.get.vert_skip;
+        the_hdr->priv.get.vert_skip;
     the_hdr->priv.get.vert_skip = 0;
 
     if ( the_hdr->priv.get.is_eof )
-	return 32768;		/* too big for 16 bits, signal EOF */
+        return 32768;           /* too big for 16 bits, signal EOF */
     else
-	return the_hdr->priv.get.scan_y;
+        return the_hdr->priv.get.scan_y;
 }
diff --git a/urt/rle_global.c b/urt/rle_global.c
index 6014a229..f7228ea9 100644
--- a/urt/rle_global.c
+++ b/urt/rle_global.c
@@ -1,14 +1,14 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
@@ -18,15 +18,15 @@
  *  Modified at BRL 16-May-88 by Mike Muuss to avoid Alliant STDC desire
  *  to have all "void" functions so declared.
  */
-/* 
+/*
  * rle_global.c - Global variable initialization for rle routines.
- * 
- * Author:	Spencer W. Thomas
- * 		Computer Science Dept.
- * 		University of Utah
- * Date:	Thu Apr 25 1985
+ *
+ * Author:      Spencer W. Thomas
+ *              Computer Science Dept.
+ *              University of Utah
+ * Date:        Thu Apr 25 1985
  * Copyright (c) 1985,1986 Spencer W. Thomas
- * 
+ *
  * $Id: rle_global.c,v 3.0.1.1 1992/01/28 18:23:03 spencer Exp $
  */
 
@@ -39,40 +39,40 @@
 
 struct rle_dispatch_tab rle_DTable[] = {
     {
-	" OB",
-	RunSetup,
-	RunSkipBlankLines,
-	RunSetColor,
-	RunSkipPixels,
-	RunNewScanLine,
-	Runputdata,
-	Runputrun,
-	DefaultBlockHook,
-	RunputEof
+        " OB",
+        RunSetup,
+        RunSkipBlankLines,
+        RunSetColor,
+        RunSkipPixels,
+        RunNewScanLine,
+        Runputdata,
+        Runputrun,
+        DefaultBlockHook,
+        RunputEof
     },
 };
 
 static int bg_color[3] = { 0, 0, 0 };
 
 rle_hdr rle_dflt_hdr = {
-    RUN_DISPATCH,		/* dispatch value */
-    3,				/* 3 colors */
-    bg_color,			/* background color */
-    0,				/* (alpha) if 1, save alpha channel */
-    2,				/* (background) 0->just save pixels, */
-				/* 1->overlay, 2->clear to bg first */
-    0, 511,			/* (xmin, xmax) X bounds to save */
-    0, 511,			/* (ymin, ymax) Y bounds to save */
-    0,				/* ncmap (if != 0, save color map) */
-    8,				/* cmaplen (log2 of length of color map) */
-    NULL,			/* pointer to color map */
-    NULL,			/* pointer to comment strings */
-    NULL,			/* output file -- must be set dynamically */
-    { 7 },			/* RGB channels only */
-    0L,				/* Can't free name and file fields. */
-    "Urt",			/* Default "program name". */
-    "no file",			/* No file name given. */
-    0				/* First image. */
+    RUN_DISPATCH,               /* dispatch value */
+    3,                          /* 3 colors */
+    bg_color,                   /* background color */
+    0,                          /* (alpha) if 1, save alpha channel */
+    2,                          /* (background) 0->just save pixels, */
+                                /* 1->overlay, 2->clear to bg first */
+    0, 511,                     /* (xmin, xmax) X bounds to save */
+    0, 511,                     /* (ymin, ymax) Y bounds to save */
+    0,                          /* ncmap (if != 0, save color map) */
+    8,                          /* cmaplen (log2 of length of color map) */
+    NULL,                       /* pointer to color map */
+    NULL,                       /* pointer to comment strings */
+    NULL,                       /* output file -- must be set dynamically */
+    { 7 },                      /* RGB channels only */
+    0L,                         /* Can't free name and file fields. */
+    "Urt",                      /* Default "program name". */
+    "no file",                  /* No file name given. */
+    0                           /* First image. */
     /* Can't initialize the union */
 };
 
@@ -82,6 +82,6 @@ void
 NullputEof(the_hdr)
 rle_hdr * the_hdr;
 {
-				/* do nothing */
+                                /* do nothing */
 }
 #endif
diff --git a/urt/rle_hdr.c b/urt/rle_hdr.c
index 1611324c..8ceaa9eb 100644
--- a/urt/rle_hdr.c
+++ b/urt/rle_hdr.c
@@ -1,298 +1,286 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
  * name of the person performing the modification, the date of modification,
  * and the reason for such modification.
  */
-/* 
+/*
  * rle_hdr.c - Functions to manipulate rle_hdr structures.
- * 
- * Author:	Spencer W. Thomas
- * 		EECS Dept.
- * 		University of Michigan
- * Date:	Mon May 20 1991
+ *
+ * Author:  Spencer W. Thomas
+ *      EECS Dept.
+ *      University of Michigan
+ * Date:    Mon May 20 1991
  * Copyright (c) 1991, University of Michigan
  */
 
 #include <string.h>
 
+#include "nstring.h"
+#include "mallocvar.h"
+
 #include "rle_config.h"
 #include "rle.h"
 
-/*****************************************************************
- * TAG( rle_names )
- *
+
+
+void
+rle_names(rle_hdr *    const hdrP,
+          const char * const pgmname,
+          const char * const fname,
+          int          const imgNum) {
+/*----------------------------------------------------------------------------
  * Load program and file names into header.
  * Inputs:
- * 	the_hdr:	Header to modify.
- * 	pgmname:	The program name.
- * 	fname:		The file name.
- * 	img_num:	Number of the image within the file.
+ *  hdrP:      Header to modify.
+ *  pgmname:   The program name.
+ *  fname:     The file name.
+ *  imgNum:    Number of the image within the file.
  * Outputs:
- * 	the_hdr:	Modified header.
- * Algorithm:
- * 	If values previously filled in (by testing is_init field),
- * 	free them.  Make copies of file name and program name,
- * 	modifying file name for standard i/o.  Set is_init field.
- */
-void
-rle_names( the_hdr, pgmname, fname, img_num )
-rle_hdr *the_hdr;
-CONST_DECL char *pgmname;
-CONST_DECL char *fname;
-int img_num;
-{
-#if 0
-    /* Can't do this because people do hdr1 = hdr2, which copies
-       the pointers. */
-
-    /* If filled in, free previous values. */
-    if ( the_hdr->is_init == RLE_INIT_MAGIC &&
-	 the_hdr->cmd != NULL && the_hdr->file_name != NULL )
-    {
-	if ( pgmname != the_hdr->cmd )
-	    free( the_hdr->cmd );
-	if ( fname != the_hdr->file_name )
-	    free( the_hdr->file_name );
-    }
-#endif
+ *  *hdrP:     Modified header.
+-----------------------------------------------------------------------------*/
+
+    /* Algorithm:
+       If values previously filled in (by testing is_init field),
+       free them.  Make copies of file name and program name,
+       modifying file name for standard i/o.  Set is_init field.
+    */
+    const char * newFname;
+    const char * newPgmname;
 
     /* Mark as filled in. */
-    the_hdr->is_init = RLE_INIT_MAGIC;
+    hdrP->is_init = RLE_INIT_MAGIC;
 
     /* Default file name for stdin/stdout. */
-    if ( fname == NULL || strcmp( fname, "-" ) == 0 || *fname == '\0' )
-	fname = "Standard I/O";
-    if ( pgmname == NULL )
-	pgmname = rle_dflt_hdr.cmd;
+    if (!fname || streq(fname, "-") || strlen(fname) == 0)
+        newFname = "Standard I/O";
+    else
+        newFname = fname;
+
+    if (pgmname)
+        newPgmname = pgmname;
+    else
+        newPgmname = rle_dflt_hdr.cmd;
 
     /* Fill in with copies of the strings. */
-    if ( the_hdr->cmd != pgmname )
-    {
-	char *tmp = (char *)malloc( strlen( pgmname ) + 1 );
-	RLE_CHECK_ALLOC( pgmname, tmp, 0 );
-	strcpy( tmp, pgmname );
-	the_hdr->cmd = tmp;
-    }
+    if (hdrP->cmd != newPgmname)
+        hdrP->cmd = pm_strdup(newPgmname);
 
-    if ( the_hdr->file_name != fname )
-    {
-	char *tmp = (char *)malloc( strlen( fname ) + 1 );
-	RLE_CHECK_ALLOC( pgmname, tmp, 0 );
-	strcpy( tmp, fname );
-	the_hdr->file_name = tmp;
-    }
+    if (hdrP->file_name != newFname)
+        hdrP->file_name = pm_strdup(newFname);
 
-    the_hdr->img_num = img_num;
+    hdrP->img_num = imgNum;
 }
 
 
+
 /* Used by rle_hdr_cp and rle_hdr_init to avoid recursion loops. */
-static int no_recurse = 0;
+static int noRecurse = 0;
 
-/*****************************************************************
- * TAG( rle_hdr_cp )
- * 
+
+
+rle_hdr *
+rle_hdr_cp(rle_hdr * const fromHdrP,
+           rle_hdr * const toHdrArgP) {
+/*----------------------------------------------------------------------------
  * Make a "safe" copy of a rle_hdr structure.
  * Inputs:
- * 	from_hdr:	Header to be copied.
+ *  *fromHdrP:   Header to be copied.
  * Outputs:
- * 	to_hdr:		Copy of from_hdr, with all memory referred to
- * 			by pointers copied.  Also returned as function
- * 			value.  If NULL, a static header is used.
+ *  *toHdrPd:    Copy of from_hdr, with all memory referred to
+ *               by pointers copied.  Also returned as function
+ *               value.  If NULL, a static header is used.
  * Assumptions:
- * 	It is safe to call rle_hdr_init on to_hdr.
- * Algorithm:
- * 	Initialize to_hdr, copy from_hdr to it, then copy the memory
- * 	referred to by all non-null pointers.
- */
-rle_hdr *
-rle_hdr_cp( from_hdr, to_hdr )
-rle_hdr *from_hdr, *to_hdr;
-{
-    static rle_hdr dflt_hdr;
-    CONST_DECL char *cmd, *file;
-    int num;
+ *  It is safe to call rle_hdr_init on *toHdrP.
+-----------------------------------------------------------------------------*/
+    /* Algorithm:
+       Initialize *toHdrP, copy *fromHdrP to it, then copy the memory
+       referred to by all non-null pointers.
+    */
+    static rle_hdr dfltHdr;
+    rle_hdr * toHdrP;
+    const char * cmd;
+    const char * file;
+    unsigned int num;
 
     /* Save command, file name, and image number if already initialized. */
-    if ( to_hdr &&  to_hdr->is_init == RLE_INIT_MAGIC )
-    {
-	cmd = to_hdr->cmd;
-	file = to_hdr->file_name;
-	num = to_hdr->img_num;
-    }
-    else
-    {
-	cmd = file = NULL;
-	num = 0;
+    if (toHdrArgP &&  toHdrArgP->is_init == RLE_INIT_MAGIC) {
+        cmd  = toHdrArgP->cmd;
+        file = toHdrArgP->file_name;
+        num  = toHdrArgP->img_num;
+    } else {
+        cmd = file = NULL;
+        num = 0;
     }
 
-    if ( !no_recurse )
-    {
-	no_recurse++;
-	rle_hdr_init( to_hdr );
-	no_recurse--;
+    if (!noRecurse) {
+        ++noRecurse;
+        rle_hdr_init(toHdrArgP);
+        --noRecurse;
     }
 
-    if ( to_hdr == NULL )
-	to_hdr = &dflt_hdr;
+    toHdrP = toHdrArgP ? toHdrArgP : &dfltHdr;
+
+    *toHdrP = *fromHdrP;
 
-    *to_hdr = *from_hdr;
+    if (toHdrP->bg_color) {
+        unsigned int i;
 
-    if ( to_hdr->bg_color )
-    {
-	int size = to_hdr->ncolors * sizeof(int);
-	to_hdr->bg_color = (int *)malloc( size );
-	RLE_CHECK_ALLOC( to_hdr->cmd, to_hdr->bg_color, "background color" );
-	memcpy( to_hdr->bg_color, from_hdr->bg_color, size );
+        MALLOCARRAY(toHdrP->bg_color, toHdrP->ncolors);
+        if (!toHdrP->bg_color)
+            pm_error("Failed to allocate array for %u background colors",
+                     toHdrP->ncolors);
+        for (i = 0; i < toHdrP->ncolors; ++i)
+            toHdrP->bg_color[i] = fromHdrP->bg_color[i];
     }
 
-    if ( to_hdr->cmap )
-    {
-	int size = to_hdr->ncmap * (1 << to_hdr->cmaplen) * sizeof(rle_map);
-	to_hdr->cmap = (rle_map *)malloc( size );
-	RLE_CHECK_ALLOC( to_hdr->cmd, to_hdr->cmap, "color map" );
-	memcpy( to_hdr->cmap, from_hdr->cmap, size );
+    if (toHdrP->cmap) {
+        size_t const size =
+            toHdrP->ncmap * (1 << toHdrP->cmaplen) * sizeof(rle_map);
+        toHdrP->cmap = malloc(size);
+        if (!toHdrP->cmap)
+            pm_error("Failed to allocate memory for %u color maps "
+                     "of length %u", toHdrP->ncmap, 1 << toHdrP->cmaplen);
+        memcpy(toHdrP->cmap, fromHdrP->cmap, size);
     }
 
     /* Only copy array of pointers, as the original comment memory
      * never gets overwritten.
      */
-    if ( to_hdr->comments )
-    {
-	int size = 0;
-	CONST_DECL char **cp;
-	for ( cp=to_hdr->comments; *cp; cp++ )
-	    size++;		/* Count the comments. */
-	/* Check if there are really any comments. */
-	if ( size )
-	{
-	    size++;		/* Copy the NULL pointer, too. */
-	    size *= sizeof(char *);
-	    to_hdr->comments = (CONST_DECL char **)malloc( size );
-	    RLE_CHECK_ALLOC( to_hdr->cmd, to_hdr->comments, "comments" );
-	    memcpy( to_hdr->comments, from_hdr->comments, size );
-	}
-	else
-	    to_hdr->comments = NULL;	/* Blow off empty comment list. */
+    if (toHdrP->comments) {
+        unsigned int  size;
+        const char ** cp;
+
+        /* Count the comments. */
+        for (cp = toHdrP->comments, size = 0; *cp; ++cp)
+            ++size;
+
+        /* Check if there are really any comments. */
+        if (size > 0) {
+            ++size;     /* Copy the NULL pointer, too. */
+            size *= sizeof(char *);
+            toHdrP->comments = malloc(size);
+            if (!toHdrP->comments)
+                pm_error("Failed to allocation %u bytes for comments", size);
+            memcpy(toHdrP->comments, fromHdrP->comments, size);
+        } else
+            toHdrP->comments = NULL;    /* Blow off empty comment list. */
     }
 
     /* Restore the names to their original values. */
-    to_hdr->cmd = cmd;
-    to_hdr->file_name = file;
+    toHdrP->cmd       = cmd;
+    toHdrP->file_name = file;
 
     /* Lines above mean nothing much happens if cmd and file are != NULL. */
-    rle_names( to_hdr, to_hdr->cmd, to_hdr->file_name, num );
+    rle_names(toHdrP, toHdrP->cmd, toHdrP->file_name, num);
 
-    return to_hdr;
+    return toHdrP;
 }
 
-/*****************************************************************
- * TAG( rle_hdr_clear )
- * 
+
+
+void
+rle_hdr_clear(rle_hdr * const hdrP) {
+/*----------------------------------------------------------------------------
  * Clear out the allocated memory pieces of a header.
  *
  * This routine is intended to be used internally by the library, to
  * clear a header before putting new data into it.  It clears all the
  * fields that would be set by reading in a new image header.
  * Therefore, it does not clear the program and file names.
- * 
+ *
  * Inputs:
- * 	the_hdr:	To be cleared.
+ *  hdrP:    To be cleared.
  * Outputs:
- * 	the_hdr:	After clearing.
+ *  *hdrP:   After clearing.
  * Assumptions:
- * 	If is_init field is RLE_INIT_MAGIC, the header has been
- * 	properly initialized.  This will fail every 2^(-32) times, on
- * 	average.
- * Algorithm:
- * 	Free memory and set to zero all pointers, except program and
- * 	file name.
- */
-void
-rle_hdr_clear( the_hdr )
-rle_hdr *the_hdr;
-{
+ *  If is_init field is RLE_INIT_MAGIC, the header has been
+ *  properly initialized.  This will fail every 2^(-32) times, on
+ *  average.
+-----------------------------------------------------------------------------*/
+    /* Algorithm:
+       Free memory and set to zero all pointers, except program and
+       file name.
+    */
+
     /* Try to free memory.  Assume if is_init is properly set that this
      * header has been previously initialized, therefore it is safe to
      * free memory.
      */
-    if ( the_hdr && the_hdr->is_init == RLE_INIT_MAGIC )
-    {
-	if ( the_hdr->bg_color )
-	    free( the_hdr->bg_color );
-	the_hdr->bg_color = 0;
-	if ( the_hdr->cmap )
-	    free( the_hdr->cmap );
-	the_hdr->cmap = 0;
-	/* Unfortunately, we don't know how to free the comment memory. */
-	if ( the_hdr->comments )
-	    free( the_hdr->comments );
-	the_hdr->comments = 0;
+    if (hdrP && hdrP->is_init == RLE_INIT_MAGIC) {
+        if (hdrP->bg_color )
+            free(hdrP->bg_color);
+        hdrP->bg_color = NULL;
+        if (hdrP->cmap )
+            free(hdrP->cmap);
+        hdrP->cmap = NULL;
+        /* Unfortunately, we don't know how to free the comment memory. */
+        if (hdrP->comments)
+            free(hdrP->comments);
+        hdrP->comments = NULL;
     }
 }
 
 
 
-/*****************************************************************
- * TAG( rle_hdr_init )
- * 
+rle_hdr *
+rle_hdr_init(rle_hdr * const hdrP) {
+/*----------------------------------------------------------------------------
  * Initialize a rle_hdr structure.
  * Inputs:
- * 	the_hdr:	Header to be initialized.
+ *  hdrP:    Header to be initialized.
  * Outputs:
- * 	the_hdr:	Initialized header.
+ *  *hdrP:   Initialized header.
  * Assumptions:
- * 	If the_hdr->is_init is RLE_INIT_MAGIC, the header has been
- * 	previously initialized.
- * 	If the_hdr is a copy of another rle_hdr structure, the copy
- * 	was made with rle_hdr_cp.
- * Algorithm:
- *  Fill in fields of rle_dflt_hdr that could not be set by the loader
- *	If the_hdr is rle_dflt_hdr, do nothing else
- *  Else:
- *	  If the_hdr is NULL, return a copy of rle_dflt_hdr in static storage
- * 	  If the_hdr->is_init is RLE_INIT_MAGIC, free all memory
- * 	     pointed to by non-null pointers.
- *    If this is a recursive call to rle_hdr_init, clear *the_hdr and
- *      return the_hdr.
- *    Else make a copy of rle_dflt_hdr and return its address.  Make the
- *      copy in static storage if the_hdr is NULL, and in the_hdr otherwise.
- */
-rle_hdr *
-rle_hdr_init( the_hdr )
-rle_hdr *the_hdr;
-{
-    rle_hdr *ret_hdr;
+ *  If hdrP->is_init is RLE_INIT_MAGIC, the header has been
+ *  previously initialized.
+ *  If the_hdr is a copy of another rle_hdr structure, the copy
+ *  was made with rle_hdr_cp.
+-----------------------------------------------------------------------------*/
+    /* Algorithm:
+       Fill in fields of rle_dflt_hdr that could not be set by the loader
+       If the_hdr is rle_dflt_hdr, do nothing else
+       Else:
+         If hdrP is NULL, return a copy of rle_dflt_hdr in static storage
+         If hdrP->is_init is RLE_INIT_MAGIC, free all memory
+            pointed to by non-null pointers.
+         If this is a recursive call to rle_hdr_init, clear *hdrP and
+           return hdrP.
+         Else make a copy of rle_dflt_hdr and return its address.  Make the
+           copy in static storage if hdrP is NULL, and in *hdrP otherwise.
+    */
+    rle_hdr * retval;
 
     rle_dflt_hdr.rle_file = stdout;
-    /* The rest of rle_dflt_hdr is set by the loader's data initialization */
 
-    if ( the_hdr == &rle_dflt_hdr )
-	return the_hdr;
+    /* The rest of rle_dflt_hdr is set by the loader's data initialization */
 
-    rle_hdr_clear( the_hdr );
+    if (hdrP == &rle_dflt_hdr)
+        retval = hdrP;
+    else {
+        rle_hdr_clear(hdrP);
 
-    /* Only call rle_hdr_cp if not called from there. */
-    if ( !no_recurse )
-    {
-	no_recurse++;
-	ret_hdr = rle_hdr_cp( &rle_dflt_hdr, the_hdr );
-	no_recurse--;
+        /* Call rle_hdr_cp only if not called from there. */
+        if (!noRecurse) {
+            ++noRecurse;
+            retval = rle_hdr_cp(&rle_dflt_hdr, hdrP);
+            --noRecurse;
+        } else
+            retval = hdrP;
     }
-    else
-	ret_hdr = the_hdr;
-
-    return ret_hdr;
+    return retval;
 }
+
+
+
diff --git a/urt/rle_open_f.c b/urt/rle_open_f.c
index ae8548b9..65362a53 100644
--- a/urt/rle_open_f.c
+++ b/urt/rle_open_f.c
@@ -1,7 +1,7 @@
-/* 
+/*
  * rle_open_f.c - Open a file with defaults.
- * 
- * Author :     Jerry Winters 
+ *
+ * Author :     Jerry Winters
  *      EECS Dept.
  *      University of Michigan
  * Date:    11/14/89
@@ -37,8 +37,8 @@
 
 
 static FILE *
-my_popen(const char * const cmd, 
-         const char * const mode, 
+my_popen(const char * const cmd,
+         const char * const mode,
          int  *       const pid) {
 
     FILE *retfile;
@@ -55,7 +55,7 @@ my_popen(const char * const cmd,
 
     if (pm_pipe(pipefd) < 0 )
         return NULL;
-    
+
     /* Flush known files. */
     fflush(stdout);
     fflush(stderr);
@@ -86,7 +86,7 @@ my_popen(const char * const cmd,
         if ( execl("/bin/sh", "sh", "-c", cmd, NULL) < 0 )
             exit(127);
         /* NOTREACHED */
-    }   
+    }
 
     /* Close file descriptors, and gen up a FILE ptr */
     if ( *mode == 'r' )
@@ -173,10 +173,10 @@ dealWithSubprocess(const char *  const file_name,
 
     /*  Real file, not stdin or stdout.  If name ends in ".Z",
      *  pipe from/to un/compress (depending on r/w mode).
-     *  
+     *
      *  If it starts with "|", popen that command.
      */
-        
+
     cp = file_name + strlen(file_name) - 2;
     /* Pipe case. */
     if (file_name[0] == '|') {
@@ -198,14 +198,14 @@ dealWithSubprocess(const char *  const file_name,
         const char * command;
 
         *noSubprocessP = FALSE;
-        
+
         if (*mode == 'w')
             pm_asprintf(&command, "compress > %s", file_name);
         else if (*mode == 'a')
             pm_asprintf(&command, "compress >> %s", file_name);
         else
             pm_asprintf(&command, "compress -d < %s", file_name);
-        
+
         *fpP = my_popen(command, mode, &thepid);
 
         if (*fpP == NULL)
@@ -227,8 +227,8 @@ dealWithSubprocess(const char *  const file_name,
 
 
 
-/* 
- *  Purpose : Open a file for input or ouput as controlled by the mode
+/*
+ *  Purpose : Open a file for input or output as controlled by the mode
  *  parameter.  If no file name is specified (ie. file_name is null) then
  *  a pointer to stdin or stdout will be returned.  The calling routine may
  *  call this routine with a file name of "-".  For this case rle_open_f
@@ -246,11 +246,11 @@ dealWithSubprocess(const char *  const file_name,
  *
  *   output:
  *     a file pointer
- * 
+ *
  */
 FILE *
-rle_open_f_noexit(const char * const prog_name, 
-                  const char * const file_name, 
+rle_open_f_noexit(const char * const prog_name,
+                  const char * const file_name,
                   const char * const mode ) {
 
     FILE * retval;
@@ -265,12 +265,12 @@ rle_open_f_noexit(const char * const prog_name,
         fp = stdout;     /* Set the default value */
     else
         fp = stdin;
-    
+
     if (file_name != NULL && !streq(file_name, "-")) {
         bool noSubprocess;
         dealWithSubprocess(file_name, mode, &catching_children, pids,
                            &fp, &noSubprocess, &err_str);
-        
+
         if (!err_str) {
             if (noSubprocess) {
                 /* Ordinary, boring file case. */
@@ -286,7 +286,7 @@ rle_open_f_noexit(const char * const prog_name,
                 mode_string[0] = mode[0];
                 mode_string[1] = 'b';
                 strcpy( mode_string + 2, mode + 1 );
-        
+
                 fp = fopen(file_name, mode_string);
                 if (fp == NULL )
                     err_str = "%s: can't open %s for %s: ";
@@ -322,28 +322,3 @@ rle_open_f(const char * prog_name, const char * file_name, const char * mode)
     return fp;
 }
 
-
-/*****************************************************************
- * TAG( rle_close_f )
- * 
- * Close a file opened by rle_open_f.  If the file is stdin or stdout,
- * it will not be closed.
- * Inputs:
- *  fd: File to close.
- * Outputs:
- *  None.
- * Assumptions:
- *  fd is open.
- * Algorithm:
- *  If fd is NULL, just return.
- *  If fd is stdin or stdout, don't close it.  Otherwise, call fclose.
- */
-void
-rle_close_f( fd )
-    FILE *fd;
-{
-    if ( fd == NULL || fd == stdin || fd == stdout )
-        return;
-    else
-        fclose( fd );
-}
diff --git a/urt/rle_put.h b/urt/rle_put.h
index 1f8cc85b..bfabd617 100644
--- a/urt/rle_put.h
+++ b/urt/rle_put.h
@@ -1,29 +1,29 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
  * name of the person performing the modification, the date of modification,
  * and the reason for such modification.
  */
-/* 
+/*
  * rle_put.h - Definitions and a few global variables for rle_putrow/putraw.
- * 
- * Author:	Spencer W. Thomas
- * 		Computer Science Dept.
- * 		University of Utah
- * Date:	Mon Aug  9 1982
+ *
+ * Author:      Spencer W. Thomas
+ *              Computer Science Dept.
+ *              University of Utah
+ * Date:        Mon Aug  9 1982
  * Copyright (c) 1982 Spencer W. Thomas
- * 
+ *
  * $Id: rle_put.h,v 3.0.1.2 1992/02/27 21:14:35 spencer Exp $
  */
 
@@ -35,7 +35,7 @@
  */
 #ifdef __cplusplus        /* Cfront 2.0  or g++ */
 #ifndef c_plusplus
-#define c_plusplus        
+#define c_plusplus
 #endif
 extern "C" {
 #endif
@@ -67,38 +67,38 @@ struct rle_dispatch_tab {
 
 extern struct rle_dispatch_tab rle_DTable[];
 
-/* 
+/*
  * These definitions presume the existence of a variable called
  * "fileptr", declared "long * fileptr".  *fileptr should be
  * initialized to 0 before calling Setup().
  * A pointer "the_hdr" declared "rle_hdr * the_hdr" is also
  * presumed to exist.
  */
-#define	    rle_magic		(rle_DTable[(int)the_hdr->dispatch].magic)
-#define	    Setup()		(*rle_DTable[(int)the_hdr->dispatch].setup)(the_hdr)
-#define	    SkipBlankLines(n)	(*rle_DTable[(int)the_hdr->dispatch].skipBlankLines)(n, the_hdr)
-#define	    SetColor(c)		(*rle_DTable[(int)the_hdr->dispatch].setColor)(c, the_hdr)
-#define	    SkipPixels(n, l, r)	(*rle_DTable[(int)the_hdr->dispatch].skipPixels)(n,l,r, the_hdr)
-#define	    NewScanLine(flag)	(*rle_DTable[(int)the_hdr->dispatch].newScanLine)(flag, the_hdr)
-#define	    putdata(buf, len)	(*rle_DTable[(int)the_hdr->dispatch].putdat)(buf, len, the_hdr)
-#define	    putrun(val, len, f)	(*rle_DTable[(int)the_hdr->dispatch].putrn)(val,len,f, the_hdr)
-#define	    BlockHook()		(*rle_DTable[(int)the_hdr->dispatch].blockHook)(the_hdr)
-#define	    PutEof()		(*rle_DTable[(int)the_hdr->dispatch].putEof)(the_hdr)
+#define     rle_magic           (rle_DTable[(int)the_hdr->dispatch].magic)
+#define     Setup()             (*rle_DTable[(int)the_hdr->dispatch].setup)(the_hdr)
+#define     SkipBlankLines(n)   (*rle_DTable[(int)the_hdr->dispatch].skipBlankLines)(n, the_hdr)
+#define     SetColor(c)         (*rle_DTable[(int)the_hdr->dispatch].setColor)(c, the_hdr)
+#define     SkipPixels(n, l, r) (*rle_DTable[(int)the_hdr->dispatch].skipPixels)(n,l,r, the_hdr)
+#define     NewScanLine(flag)   (*rle_DTable[(int)the_hdr->dispatch].newScanLine)(flag, the_hdr)
+#define     putdata(buf, len)   (*rle_DTable[(int)the_hdr->dispatch].putdat)(buf, len, the_hdr)
+#define     putrun(val, len, f) (*rle_DTable[(int)the_hdr->dispatch].putrn)(val,len,f, the_hdr)
+#define     BlockHook()         (*rle_DTable[(int)the_hdr->dispatch].blockHook)(the_hdr)
+#define     PutEof()            (*rle_DTable[(int)the_hdr->dispatch].putEof)(the_hdr)
 
 void
 DefaultBlockHook(rle_hdr * the_hdr);
-/* 
+/*
  * States for run detection
  */
-#define	DATA	0
-#define	RUN1	1
-#define RUN2	2
-#define	RUN3	3
-#define RUN4	4
-#define RUN5	5
-#define RUN6	6
-#define RUN7	7
-#define	INRUN	-1
+#define DATA    0
+#define RUN1    1
+#define RUN2    2
+#define RUN3    3
+#define RUN4    4
+#define RUN5    5
+#define RUN6    6
+#define RUN7    7
+#define INRUN  -1
 
 #ifdef __cplusplus
 }
diff --git a/urt/rle_putcom.c b/urt/rle_putcom.c
index ab2eb208..0bebd8d7 100644
--- a/urt/rle_putcom.c
+++ b/urt/rle_putcom.c
@@ -1,23 +1,23 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
  * name of the person performing the modification, the date of modification,
  * and the reason for such modification.
  */
-/* 
+/*
  * rle_putcom.c - Add a picture comment to the header struct.
- * 
+ *
  * Author:  Spencer W. Thomas
  *      Computer Science Dept.
  *      University of Utah
@@ -33,7 +33,7 @@
 
 /*****************************************************************
  * TAG( match )
- * 
+ *
  * Match a name against a test string for "name=value" or "name".
  * If it matches name=value, return pointer to value part, if just
  * name, return pointer to NUL at end of string.  If no match, return NULL.
@@ -72,7 +72,7 @@ match(const char * const nArg,
 
 /*****************************************************************
  * TAG( rle_putcom )
- * 
+ *
  * Put a comment into the header struct.
  * Inputs:
  *  value:      Value to add to comments.
@@ -124,46 +124,3 @@ rle_putcom(const char * const value,
 
     return NULL;
 }
-
-
-
-/*****************************************************************
- * TAG( rle_delcom )
- * 
- * Delete a comment from header struct.
- * Inputs:
- *  name:       Name of comment to delete.
- *  the_hdr:    Header to delete comment from.
- * Outputs:
- *  the_hdr:    Modified header struct.
- *  Returns original comment value.
- * Assumptions:
- *  [None]
- * Algorithm:
- *  [None]
- */
-const char *
-rle_delcom(const char * const name,
-           rle_hdr *    const the_hdr) {
-
-    const char * v = NULL;
-
-    if (the_hdr->comments == NULL)
-        v = NULL;
-    else {
-        const char ** cp;
-
-        for (cp = the_hdr->comments; *cp != NULL; ++cp)
-            if (match(name, *cp) != NULL) {
-                v = *cp;
-                for ( ; *cp != NULL; ++cp)
-                    *cp = cp[1];
-                break;
-            }
-        /* Not found */
-        if (*the_hdr->comments == NULL)
-            the_hdr->comments = NULL;
-    }
-
-    return v;
-}
diff --git a/urt/rle_putrow.c b/urt/rle_putrow.c
index 399633e4..5f808c92 100644
--- a/urt/rle_putrow.c
+++ b/urt/rle_putrow.c
@@ -1,14 +1,14 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
@@ -18,60 +18,57 @@
  *  Modified at BRL 16-May-88 by Mike Muuss to avoid Alliant STDC desire
  *  to have all "void" functions so declared.
  */
-/* 
+/*
  * rle_putrow.c - Save a row of the fb to a file.
- * 
- * Author:	Spencer W. Thomas
- * 		Computer Science Dept.
- * 		University of Utah
- * Date:	1 April 1981
+ *
+ * Author:      Spencer W. Thomas
+ *              Computer Science Dept.
+ *              University of Utah
+ * Date:        1 April 1981
  * Copyright (c) 1981,1986 Spencer W. Thomas
  *
  * $Id: rle_putrow.c,v 3.0.1.2 1992/01/28 18:29:22 spencer Exp $
  */
- 
+
 #include <stdio.h>
 
 #include "rle_put.h"
 #include "rle.h"
 
 
-#define FASTRUNS		/* Faster run finding */
-#ifdef vax
-#define LOCC			/* Use vax instructions for more speed */
-#endif
+#define FASTRUNS                /* Faster run finding */
 
-#define	FALSE	0
-#define	TRUE	1
+#define FALSE   0
+#define TRUE    1
 
 /* Save some typing. */
 #define PBRUN the_hdr->priv.put.brun
 
 /*****************************************************************
  * TAG( findruns )
- * 
+ *
  * Find runs not a given color in the row.
  * Inputs:
- * 	row:		Row of pixel values
- *	rowlen:		Number of pixels in the row.
- *	color:		Color to compare against.
- *	nrun:		Number of runs already found (in different colors).
- *	brun:		Runs found in other color channels already.
+ *      row:            Row of pixel values
+ *      rowlen:         Number of pixels in the row.
+ *      color:          Color to compare against.
+ *      nrun:           Number of runs already found (in different colors).
+ *      brun:           Runs found in other color channels already.
  * Outputs:
- * 	brun:		Modified to reflect merging of runs in this color.
- *	Returns number of runs in brun.
+ *      brun:           Modified to reflect merging of runs in this color.
+ *      Returns number of runs in brun.
  * Assumptions:
  *
  * Algorithm:
- * 	Search for occurrences of pixels not of the given color outside
- *	the runs already found.  When some are found, add a new run or
- *	extend an existing one.  Adjacent runs with fewer than two
- *	pixels intervening are merged.
+ *      Search for occurrences of pixels not of the given color outside
+ *      the runs already found.  When some are found, add a new run or
+ *      extend an existing one.  Adjacent runs with fewer than two
+ *      pixels intervening are merged.
  */
 static int
-findruns(rle_pixel * const row, 
-         int         const rowlen, 
-         int         const color, 
+findruns(rle_pixel * const row,
+         int         const rowlen,
+         int         const color,
          int         const nrunAlready,
          short    (* const brun)[2]) {
 
@@ -99,9 +96,9 @@ findruns(rle_pixel * const row,
         /* Assert: 0 <= i <= rowlen
          * brun[i] is the run following the "blank" space being
          * searched.  If i == rowlen, search after brun[i-1].
-	 */
+         */
 
-	/* get lower and upper bounds of search */
+        /* get lower and upper bounds of search */
 
         if ( i == 0 )
             lower = 0;
@@ -118,15 +115,13 @@ findruns(rle_pixel * const row,
                  i, lower, upper );
 #endif
         /* Search for beginning of run != color */
-#if  defined(LOCC)&defined(vax)
-        s = upper - skpc( (char *)row + lower, upper - lower + 1, color ) + 1;
-#else
+
         for ( s = lower; s <= upper; s++ )
             if ( row[s] != color )
                 break;
-#endif
 
-        if ( s <= upper )	/* found a new run? */
+
+        if ( s <= upper )       /* found a new run? */
         {
             if ( s > lower + 1 || i == 0 ) /* disjoint from preceding run? */
             {
@@ -144,19 +139,16 @@ findruns(rle_pixel * const row,
             }
             else
             {
-                i--;		/* just add to preceding run */
+                i--;            /* just add to preceding run */
 #ifdef DEBUG
                 fprintf( stderr, "Adding to previous run\n" );
 #endif
             }
 
-#if defined(LOCC)&defined(vax)
-            s = upper - locc( (char *)row + s, upper - s + 1, color ) + 1;
-#else
             for ( ; s <= upper; s++ )
                 if ( row[s] == color )
                     break;
-#endif
+
             brun[i][1] = s - 1;
 
 #ifdef DEBUG
@@ -180,7 +172,7 @@ findruns(rle_pixel * const row,
             putc( '\n', stderr );
 #endif
         }
-	
+
         /* Search in next space */
         i++;
     }
@@ -193,319 +185,313 @@ findruns(rle_pixel * const row,
 /*****************************************************************
  * TAG( rle_putrow )
  * Write a scanline to the output file.
- * 
+ *
  * Inputs:
- *	rows:		Pointer to vector of pointers to
- *			rle_pixel arrays containing the pixel information.
- *			If NULL, rowlen scanlines are skipped.
- *	rowlen:		The number of pixels in the scanline, or the
- *			number of scanlines to skip (see above).
+ *      rows:           Pointer to vector of pointers to
+ *                      rle_pixel arrays containing the pixel information.
+ *                      If NULL, rowlen scanlines are skipped.
+ *      rowlen:         The number of pixels in the scanline, or the
+ *                      number of scanlines to skip (see above).
  * Outputs:
- * 	Run length encoded information is written to the_hdr.rle_file.
+ *      Run length encoded information is written to the_hdr.rle_file.
  * Assumptions:
- * 	I'm sure there are lots of assumptions in here.
+ *      I'm sure there are lots of assumptions in here.
  * Algorithm:
- * 	There are two parts:
- * 		1. Find all "sufficiently long" runs of background
- * 		   color.  These will not be saved at all.
- * 		2. For each run of non-background, for each color
- * 		   channel, find runs of identical pixel values
- * 		   between "data" segments (of differing pixel
- * 		   values).
- * 	For part 1, "sufficiently long" is 2 pixels, if the following
- * 	data is less than 256 pixels long, otherwise it is 4 pixels.
- * 	This is enforced by a post-process merge.
+ *      There are two parts:
+ *              1. Find all "sufficiently long" runs of background
+ *                 color.  These will not be saved at all.
+ *              2. For each run of non-background, for each color
+ *                 channel, find runs of identical pixel values
+ *                 between "data" segments (of differing pixel
+ *                 values).
+ *      For part 1, "sufficiently long" is 2 pixels, if the following
+ *      data is less than 256 pixels long, otherwise it is 4 pixels.
+ *      This is enforced by a post-process merge.
  *
- * 	Part 1 can be done in two different ways, depending on whether
- * 	FASTRUNS is defined or not.  With FASTRUNS defined, it finds
- * 	runs of the background pixel value in each channel
- * 	independently, and then merges the results.  With FASTRUNS not
- * 	defined, it scans all channels in parallel.
+ *      Part 1 can be done in two different ways, depending on whether
+ *      FASTRUNS is defined or not.  With FASTRUNS defined, it finds
+ *      runs of the background pixel value in each channel
+ *      independently, and then merges the results.  With FASTRUNS not
+ *      defined, it scans all channels in parallel.
  *
- * 	Part 2 uses a state machine.  For each run of non-background
- * 	data, it searches for sufficiently long sequences of a single
- * 	value (in each channel independently).  Sufficiently long is 4
- * 	pixels if the following data is < 256 pixels, 6 pixels
- * 	otherwise.  This is because the startup cost for the run is 2
- * 	bytes, and the startup cost for a data segment is 2 bytes if
- * 	it is < 256 pixels long, 4 bytes otherwise.  Thus a run
- * 	shorter than 4 or 6 pixels (respectively) would actually make
- * 	the output longer.  An additional pixel is required if the
- * 	preceding data is an odd number of pixels long (because a
- * 	filler byte will be output at the end of it.)
+ *      Part 2 uses a state machine.  For each run of non-background
+ *      data, it searches for sufficiently long sequences of a single
+ *      value (in each channel independently).  Sufficiently long is 4
+ *      pixels if the following data is < 256 pixels, 6 pixels
+ *      otherwise.  This is because the startup cost for the run is 2
+ *      bytes, and the startup cost for a data segment is 2 bytes if
+ *      it is < 256 pixels long, 4 bytes otherwise.  Thus a run
+ *      shorter than 4 or 6 pixels (respectively) would actually make
+ *      the output longer.  An additional pixel is required if the
+ *      preceding data is an odd number of pixels long (because a
+ *      filler byte will be output at the end of it.)
  */
 
 void
 rle_putrow(rows, rowlen, the_hdr)
-register rle_pixel *rows[];
+rle_pixel *rows[];
 int rowlen;
-register rle_hdr * the_hdr;
+rle_hdr * the_hdr;
 {
-    register int i, j;
+    int i, j;
     int nrun;
-    register rle_pixel *row;
+    rle_pixel *row;
     int mask;
     char bits[256];
-    short   state,		/* State of run-finding state machine. */
-	    dstart,		/* Starting point for current data segment. */
-    	    dend,		/* Ending point of current data segment. */
-	    rstart = 0,		/* Starting point of current run. */
-	    runval = 0;		/* Data value for current run. */
+    short   state,              /* State of run-finding state machine. */
+            dstart,             /* Starting point for current data segment. */
+            dend,               /* Ending point of current data segment. */
+            rstart = 0,         /* Starting point of current run. */
+            runval = 0;         /* Data value for current run. */
 
     if (rows == NULL)
     {
-	the_hdr->priv.put.nblank += rowlen;
-	return;
+        the_hdr->priv.put.nblank += rowlen;
+        return;
     }
-    /* 
+    /*
      * If not done already, allocate space to remember runs of
      * non-background color.  A run of bg color must be at least 2
      * bytes long to count, so there can be at most rowlen/3 of them.
      */
     if ( PBRUN == NULL )
     {
-	PBRUN = (short (*)[2])malloc(
-	    (unsigned)((rowlen/3 + 1) * 2 * sizeof(short)) );
-	if ( PBRUN == NULL )
-	{
-	    fprintf( stderr, "%s: Malloc failed in rle_putrow, writing %s\n",
-		     the_hdr->cmd, the_hdr->file_name );
-	    exit(1);
-	}
+        PBRUN = (short (*)[2])malloc(
+            (unsigned)((rowlen/3 + 1) * 2 * sizeof(short)) );
+        if ( PBRUN == NULL )
+        {
+            fprintf( stderr, "%s: Malloc failed in rle_putrow, writing %s\n",
+                     the_hdr->cmd, the_hdr->file_name );
+            exit(1);
+        }
     }
     /* Unpack bitmask in the_hdr struct */
     for ( i=0; i < the_hdr->ncolors; i++ )
-	bits[i] = RLE_BIT( *the_hdr, i );
+        bits[i] = RLE_BIT( *the_hdr, i );
     bits[255] = RLE_BIT( *the_hdr, -1 );
 
-    /* 
+    /*
      * If saving only non-background pixels, find runs of them.  Note
      * that the alpha channel is considered to be background iff it is
      * zero.
      */
-#ifdef	FASTRUNS
+#ifdef  FASTRUNS
     if ( the_hdr->background )
     {
-	/* 
-	 * Find runs in each color individually, merging them as we go.
-	 */
-	nrun = 0;		/* start out with no runs */
-	/* Alpha channel first */
-	if ( the_hdr->alpha )
-	    nrun = findruns( rows[-1], rowlen, 0, nrun, PBRUN );
-	/* Now the color channels */
-	for ( i = 0; i < the_hdr->ncolors; i++ )
-	    if ( bits[i] )
-		nrun = findruns( rows[i], rowlen, the_hdr->bg_color[i],
-				 nrun, PBRUN );
+        /*
+         * Find runs in each color individually, merging them as we go.
+         */
+        nrun = 0;               /* start out with no runs */
+        /* Alpha channel first */
+        if ( the_hdr->alpha )
+            nrun = findruns( rows[-1], rowlen, 0, nrun, PBRUN );
+        /* Now the color channels */
+        for ( i = 0; i < the_hdr->ncolors; i++ )
+            if ( bits[i] )
+                nrun = findruns( rows[i], rowlen, the_hdr->bg_color[i],
+                                 nrun, PBRUN );
     }
     else
     {
-	PBRUN[0][0] = 0;
-	PBRUN[0][1] = rowlen-1;
-	nrun = 1;
+        PBRUN[0][0] = 0;
+        PBRUN[0][1] = rowlen-1;
+        nrun = 1;
     }
-#else				/* FASTRUNS */
-    if (the_hdr->background)	/* find non-background runs */
+#else                           /* FASTRUNS */
+    if (the_hdr->background)    /* find non-background runs */
     {
-	j = 0;
-	for (i=0; i<rowlen; i++)
-	    if (!same_color( i, rows, the_hdr->bg_color,
-			     the_hdr->ncolors, bits ) ||
-		(the_hdr->alpha && rows[-1][i] != 0))
-	    {
-		if (j > 0 && i - PBRUN[j-1][1] <= 2)
-		    j--;
-		else
-		    PBRUN[j][0] = i; /* start of run */
-		for ( i++;
-		      i < rowlen && 
-			( !same_color( i, rows, the_hdr->bg_color,
-					 the_hdr->ncolors, bits ) ||
-			  (the_hdr->alpha && rows[-1][i] != 0) );
-		      i++)
-		    ;			/* find the end of this run */
-		PBRUN[j][1] = i-1;    /* last in run */
-		j++;
-	    }
-	nrun = j;
+        j = 0;
+        for (i=0; i<rowlen; i++)
+            if (!same_color( i, rows, the_hdr->bg_color,
+                             the_hdr->ncolors, bits ) ||
+                (the_hdr->alpha && rows[-1][i] != 0))
+            {
+                if (j > 0 && i - PBRUN[j-1][1] <= 2)
+                    j--;
+                else
+                    PBRUN[j][0] = i; /* start of run */
+                for ( i++;
+                      i < rowlen &&
+                        ( !same_color( i, rows, the_hdr->bg_color,
+                                         the_hdr->ncolors, bits ) ||
+                          (the_hdr->alpha && rows[-1][i] != 0) );
+                      i++)
+                    ;                   /* find the end of this run */
+                PBRUN[j][1] = i-1;    /* last in run */
+                j++;
+            }
+        nrun = j;
     }
     else
     {
-	PBRUN[0][0] = 0;
-	PBRUN[0][1] = rowlen-1;
-	nrun = 1;
+        PBRUN[0][0] = 0;
+        PBRUN[0][1] = rowlen-1;
+        nrun = 1;
     }
-#endif				/* FASTRUNS */
+#endif                          /* FASTRUNS */
     /* One final pass merges runs with fewer than 4 intervening pixels
      * if the second run is longer than 255 pixels.  This is because
      * the startup cost for such a run is 4 bytes.
      */
     if ( nrun > 1 )
     {
-	for ( i = nrun - 1; i > 0; i-- )
-	{
-	    if ( PBRUN[i][1] - PBRUN[i][0] > 255 &&
-		 PBRUN[i-1][1] + 4 > PBRUN[i][0] )
-	    {
-		PBRUN[i-1][1] = PBRUN[i][1];
-		for ( j = i; j < nrun - 1; j++ )
-		{
-		    PBRUN[j][0] = PBRUN[j+1][0];
-		    PBRUN[j][1] = PBRUN[j+1][1];
-		}
-		nrun--;
-	    }
-	}
+        for ( i = nrun - 1; i > 0; i-- )
+        {
+            if ( PBRUN[i][1] - PBRUN[i][0] > 255 &&
+                 PBRUN[i-1][1] + 4 > PBRUN[i][0] )
+            {
+                PBRUN[i-1][1] = PBRUN[i][1];
+                for ( j = i; j < nrun - 1; j++ )
+                {
+                    PBRUN[j][0] = PBRUN[j+1][0];
+                    PBRUN[j][1] = PBRUN[j+1][1];
+                }
+                nrun--;
+            }
+        }
     }
 
     if (nrun > 0)
     {
-	if (the_hdr->priv.put.nblank > 0)
-	{
-	    SkipBlankLines(the_hdr->priv.put.nblank);
-	    the_hdr->priv.put.nblank = 0;
-	}
-	for ( mask = (the_hdr->alpha ? -1 : 0);
-	      mask < the_hdr->ncolors;
-	      mask++)			/* do all colors */
-	{
-	    if ( ! bits[mask & 0xff] )
-	    {
-		continue;
-	    }
-	    row = rows[mask];
-	    SetColor(mask);
-	    if (PBRUN[0][0] > 0)
-	    {
-		SkipPixels(PBRUN[0][0], FALSE, FALSE);
-	    }
-	    for (j=0; j<nrun; j++)
-	    {
-		state = DATA;
-		dstart = PBRUN[j][0];
-		dend = PBRUN[j][1];
-		for (i=dstart; i<=dend; i++)
-		{
-		    switch(state)
-		    {
-		    case DATA:
-			if (i > dstart && runval == row[i])
-			{
-			    /* 2 in a row may be a run. */
-			    /* If odd data length, start with RUN1 */
-			    if ( ((i - dstart) % 2) == 0)
-				state = RUN1;
-			    else
-				state = RUN2;
-			}
-			else
-			{
-			    runval = row[i];	/* maybe a run starts here? */
-			    rstart = i;
-			}
-			break;
-	    
-		    case RUN4:
-			if (runval == row[i])
-			{
-			    /* If the following data might be longer
-			     * than 255 pixels then look for 8 in a
-			     * row, otherwise, 6 in a row is
-			     * sufficient.  Fake this by skipping to
-			     * state RUN5.
-			     */
-			    if ( dend - i > 255 )
-				state  = RUN5;	/* Need some more. */
-			    else
-				state = RUN7;	/* Next one makes a run. */
-			    
-			}
-			else
-			{
-			    state = DATA;	/* Nope, back to data */
-			    runval = row[i];	/* but maybe a new run here? */
-			    rstart = i;
-			}
-			break;
-
-		    case RUN1:
-		    case RUN2:
-		    case RUN3:
-		    case RUN5:
-		    case RUN6:
-			if (runval == row[i])
-			{
-			    /* Move to the next state. */
-			    state++;
-			}
-			else
-			{
-			    state = DATA;	/* Nope, back to data */
-			    runval = row[i];	/* but maybe a new run here? */
-			    rstart = i;
-			}
-			break;
-
-
-		    case RUN7:
-			if (runval == row[i])	/* enough in a row for a run */
-			{
-			    state = INRUN;
-			    putdata(row + dstart, rstart - dstart);
+        if (the_hdr->priv.put.nblank > 0)
+        {
+            SkipBlankLines(the_hdr->priv.put.nblank);
+            the_hdr->priv.put.nblank = 0;
+        }
+        for ( mask = (the_hdr->alpha ? -1 : 0);
+              mask < the_hdr->ncolors;
+              mask++)                   /* do all colors */
+        {
+            if ( ! bits[mask & 0xff] )
+            {
+                continue;
+            }
+            row = rows[mask];
+            SetColor(mask);
+            if (PBRUN[0][0] > 0)
+            {
+                SkipPixels(PBRUN[0][0], FALSE, FALSE);
+            }
+            for (j=0; j<nrun; j++)
+            {
+                state = DATA;
+                dstart = PBRUN[j][0];
+                dend = PBRUN[j][1];
+                for (i=dstart; i<=dend; i++)
+                {
+                    switch(state)
+                    {
+                    case DATA:
+                        if (i > dstart && runval == row[i])
+                        {
+                            /* 2 in a row may be a run. */
+                            /* If odd data length, start with RUN1 */
+                            if ( ((i - dstart) % 2) == 0)
+                                state = RUN1;
+                            else
+                                state = RUN2;
+                        }
+                        else
+                        {
+                            runval = row[i];    /* maybe a run starts here? */
+                            rstart = i;
+                        }
+                        break;
+
+                    case RUN4:
+                        if (runval == row[i])
+                        {
+                            /* If the following data might be longer
+                             * than 255 pixels then look for 8 in a
+                             * row, otherwise, 6 in a row is
+                             * sufficient.  Fake this by skipping to
+                             * state RUN5.
+                             */
+                            if ( dend - i > 255 )
+                                state  = RUN5;  /* Need some more. */
+                            else
+                                state = RUN7;   /* Next one makes a run. */
+
+                        }
+                        else
+                        {
+                            state = DATA;       /* Nope, back to data */
+                            runval = row[i];    /* but maybe a new run here? */
+                            rstart = i;
+                        }
+                        break;
+
+                    case RUN1:
+                    case RUN2:
+                    case RUN3:
+                    case RUN5:
+                    case RUN6:
+                        if (runval == row[i])
+                        {
+                            /* Move to the next state. */
+                            state++;
+                        }
+                        else
+                        {
+                            state = DATA;       /* Nope, back to data */
+                            runval = row[i];    /* but maybe a new run here? */
+                            rstart = i;
+                        }
+                        break;
+
+
+                    case RUN7:
+                        if (runval == row[i])   /* enough in a row for a run */
+                        {
+                            state = INRUN;
+                            putdata(row + dstart, rstart - dstart);
 #ifdef FASTRUNS
-#ifdef LOCC
-			    /* Shortcut to find end of run! */
-			    i = dend - skpc( (char *)row + i, dend + 1 - i,
-					     runval );
-#else
-			    while ( row[++i] == runval && i <= dend)
-				; /* not quite so good, but not bad */
-			    i--;
-#endif /* LOCC */
+                            while ( row[++i] == runval && i <= dend)
+                                ; /* not quite so good, but not bad */
+                            i--;
 #endif /* FASTRUNS */
-			}
-			else
-			{
-			    state = DATA;		/* not a run, */
-			    runval = row[i];	/* but may this starts one */
-			    rstart = i;
-			}
-			break;
-	    
-		    case INRUN:
-			if (runval != row[i])	/* if run out */
-			{
-			    state = DATA;
-			    putrun(runval, i - rstart, FALSE);
-			    runval = row[i];	/* who knows, might be more */
-			    rstart = i;
-			    dstart = i;	/* starting a new 'data' run */
-			}
-			break;
-		    }
-		}
-		if (state == INRUN)
-		    putrun(runval, i - rstart, TRUE);	/* last bit */
-		else
-		    putdata(row + dstart, i - dstart);
-
-		if (j < nrun-1)
-		    SkipPixels(
-			    PBRUN[j+1][0] - dend - 1,
-			    FALSE, state == INRUN);
-		else
-		{
-		    if (rowlen - dend > 0)
-			SkipPixels(
-			    rowlen - dend - 1,
-			    TRUE, state == INRUN);
-		}
-	    }
-
-	    if ( mask != the_hdr->ncolors - 1 )
-		NewScanLine(FALSE);
-	}
+                        }
+                        else
+                        {
+                            state = DATA;               /* not a run, */
+                            runval = row[i];    /* but may this starts one */
+                            rstart = i;
+                        }
+                        break;
+
+                    case INRUN:
+                        if (runval != row[i])   /* if run out */
+                        {
+                            state = DATA;
+                            putrun(runval, i - rstart, FALSE);
+                            runval = row[i];    /* who knows, might be more */
+                            rstart = i;
+                            dstart = i; /* starting a new 'data' run */
+                        }
+                        break;
+                    }
+                }
+                if (state == INRUN)
+                    putrun(runval, i - rstart, TRUE);   /* last bit */
+                else
+                    putdata(row + dstart, i - dstart);
+
+                if (j < nrun-1)
+                    SkipPixels(
+                            PBRUN[j+1][0] - dend - 1,
+                            FALSE, state == INRUN);
+                else
+                {
+                    if (rowlen - dend > 0)
+                        SkipPixels(
+                            rowlen - dend - 1,
+                            TRUE, state == INRUN);
+                }
+            }
+
+            if ( mask != the_hdr->ncolors - 1 )
+                NewScanLine(FALSE);
+        }
     }
 
     /* Increment to next scanline */
@@ -517,55 +503,30 @@ register rle_hdr * the_hdr;
 
 
 /*****************************************************************
- * TAG( rle_skiprow )
- * 
- * Skip rows in RLE file.
- * Inputs:
- * 	the_hdr:    	Header struct for RLE output file.
- *  	nrow:	    	Number of rows to skip.
- * Outputs:
- * 	Increments the nblank field in the the_hdr struct, so that a Skiplines
- *  	code will be output the next time rle_putrow or rle_putraw is called.
- * Assumptions:
- * 	Only effective when called between rle_putrow or rle_putraw calls (or
- *  	some other routine that follows the same conventions.
- * Algorithm:
- *	[None]
- */
-void
-rle_skiprow( the_hdr, nrow )
-rle_hdr *the_hdr;
-int nrow;
-{
-    the_hdr->priv.put.nblank += nrow;
-}
-
-
-/*****************************************************************
  * TAG( rle_put_init )
- * 
- * Initialize the header structure for writing scanlines. 
+ *
+ * Initialize the header structure for writing scanlines.
  * Inputs:
- *	[None]
+ *      [None]
  * Outputs:
- * 	the_hdr:	Private portions initialized for output.
+ *      the_hdr:        Private portions initialized for output.
  * Assumptions:
- *	[None]
+ *      [None]
  * Algorithm:
- *	[None]
+ *      [None]
  */
 void
 rle_put_init( the_hdr )
-register rle_hdr *the_hdr;
+rle_hdr *the_hdr;
 {
     the_hdr->dispatch = RUN_DISPATCH;
 
     if ( the_hdr->is_init != RLE_INIT_MAGIC )
     {
-	the_hdr->cmd = "Urt";
-	the_hdr->file_name = "some file";
+        the_hdr->cmd = "Urt";
+        the_hdr->file_name = "some file";
     }
-    the_hdr->priv.put.nblank = 0;	/* Reinit static vars */
+    the_hdr->priv.put.nblank = 0;       /* Reinit static vars */
     /* Would like to be able to free previously allocated storage,
      * but can't count on a non-NULL value being a valid pointer.
      */
@@ -574,37 +535,37 @@ register rle_hdr *the_hdr;
 
     /* Only save alpha if alpha AND alpha channel bit are set. */
     if ( the_hdr->alpha )
-	the_hdr->alpha = (RLE_BIT( *the_hdr, -1 ) != 0);
+        the_hdr->alpha = (RLE_BIT( *the_hdr, -1 ) != 0);
     else
-	RLE_CLR_BIT( *the_hdr, -1 );
+        RLE_CLR_BIT( *the_hdr, -1 );
 }
 
 /*****************************************************************
  * TAG( rle_put_setup )
- * 
+ *
  * Initialize for writing RLE, and write header to output file.
  * Inputs:
- * 	the_hdr:	Describes output image.
+ *      the_hdr:        Describes output image.
  * Outputs:
- * 	the_hdr:	Initialized.
+ *      the_hdr:        Initialized.
  * Assumptions:
- *	Lots of them.
+ *      Lots of them.
  * Algorithm:
- *	[None]
+ *      [None]
  */
 void
 rle_put_setup( the_hdr )
-register rle_hdr * the_hdr;
+rle_hdr * the_hdr;
 {
     rle_put_init( the_hdr );
-    the_hdr->img_num++;		/* Count output images. */
+    the_hdr->img_num++;         /* Count output images. */
     Setup();
 }
 
 void
 DefaultBlockHook(rle_hdr * the_hdr)
 {
-    					/* Do nothing */
+                                        /* Do nothing */
 }
 
 /*****************************************************************
@@ -613,18 +574,18 @@ DefaultBlockHook(rle_hdr * the_hdr)
  */
 void
 rle_puteof( the_hdr )
-register rle_hdr * the_hdr;
+rle_hdr * the_hdr;
 {
     /* Don't puteof twice. */
     if ( the_hdr->dispatch == NO_DISPATCH )
-	return;
+        return;
     PutEof();
     fflush( the_hdr->rle_file );
     /* Free storage allocated by rle_put_init. */
     if ( PBRUN != NULL )
     {
-	free( PBRUN );
-	PBRUN = NULL;
+        free( PBRUN );
+        PBRUN = NULL;
     }
     /* Signal that puteof has been called. */
     the_hdr->dispatch = NO_DISPATCH;
@@ -633,97 +594,33 @@ register rle_hdr * the_hdr;
 #ifndef FASTRUNS
 /*****************************************************************
  * TAG( same_color )
- * 
+ *
  * Determine if the color at the given index position in the scan rows
  * is the same as the background color.
  * Inputs:
- * 	index:	    Index to the pixel position in each row.
- *	rows:	    array of pointers to the scanlines
- *	bg_color:   the background color
- *	ncolors:    number of color elements/pixel
+ *      index:      Index to the pixel position in each row.
+ *      rows:       array of pointers to the scanlines
+ *      bg_color:   the background color
+ *      ncolors:    number of color elements/pixel
  * Outputs:
- * 	TRUE if the color at row[*][i] is the same as bg_color[*].
+ *      TRUE if the color at row[*][i] is the same as bg_color[*].
  * Assumptions:
- *	[None]
+ *      [None]
  * Algorithm:
- *	[None]
+ *      [None]
  */
 static int
 same_color( index, rows, bg_color, ncolors, bits )
-register rle_pixel *rows[];
-register int bg_color[];
+rle_pixel *rows[];
+int bg_color[];
 char *bits;
 {
-    register int i;
+    int i;
 
     for ( i = 0; i < ncolors; i++, bits++ )
-	if ( *bits &&
-	     rows[i][index] != bg_color[i] )
-	    return 0;
-    return 1;				/* all the same */
+        if ( *bits &&
+             rows[i][index] != bg_color[i] )
+            return 0;
+    return 1;                           /* all the same */
 }
 #endif /* !FASTRUNS */
-
-/*****************************************************************
- * TAG( rgb_to_bw )
- * 
- * Perform the NTSC Y transform on RGB data to get B&W data.
- * Inputs:
- * 	red_row, green_row, blue_row:	Given RGB pixel data.
- *	rowlen:	    Number of pixels in the rows.
- * Outputs:
- * 	bw_row:	    Output B&W data.  May coincide with one of the
- *		    inputs.
- * Assumptions:
- *	[None]
- * Algorithm:
- * 	BW = .30*R + .59*G + .11*B
- */
-void
-rgb_to_bw( red_row, green_row, blue_row, bw_row, rowlen )
-rle_pixel *red_row;
-rle_pixel *green_row;
-rle_pixel *blue_row;
-rle_pixel *bw_row;
-int rowlen;
-{
-    register int x, bw;
-
-    for (x=0; x<rowlen; x++)
-    {
-	/* 68000 won't store float > 127 into byte? */
-	/* HP compiler blows it */
-	bw = 0.5 + .30*red_row[x] + .59*green_row[x] + .11*blue_row[x];
-	bw_row[x] = bw;
-    }
-}
-
-#ifdef LOCC
-/*ARGSUSED*/
-locc( p, l, c )
-register char *p;
-register int l;
-register int c;
-{
-    asm( "locc	r9,r10,(r11)" );
-#ifdef lint
-    c = (int) p;		/* why doesn't ARGSUSED work? */
-    l = c;
-    return l;			/* Needs return value, at least */
-#endif
-}
-
-/*ARGSUSED*/
-skpc( p, l, c )
-register char *p;
-register int l;
-register int c;
-{
-    asm( "skpc r9,r10,(r11)" );
-#ifdef lint
-    c = (int) p;		/* why doesn't ARGSUSED work? */
-    l = c;
-    return l;			/* Needs return value, at least */
-#endif
-}
-#endif
diff --git a/urt/rle_row_alc.c b/urt/rle_row_alc.c
index 982e1c5e..d7631744 100644
--- a/urt/rle_row_alc.c
+++ b/urt/rle_row_alc.c
@@ -1,14 +1,14 @@
 /*
  * This software is copyrighted as noted below.  It may be freely copied,
- * modified, and redistributed, provided that the copyright notice is 
+ * modified, and redistributed, provided that the copyright notice is
  * preserved on all copies.
- * 
+ *
  * There is no warranty or other guarantee of fitness for this software,
  * it is provided solely "as is".  Bug reports or fixes may be sent
  * to the author, who may or may not act on them as he desires.
  *
  * You may not include this software in a program or other software product
- * without supplying the source, or without informing the end-user that the 
+ * without supplying the source, or without informing the end-user that the
  * source is available for no extra charge.
  *
  * If you modify this software, you should include a notice giving the
@@ -18,13 +18,13 @@
  *  Modified at BRL 16-May-88 by Mike Muuss to avoid Alliant STDC desire
  *  to have all "void" functions so declared.
  */
-/* 
+/*
  * rle_row_alc.c - Allocate buffers for rle_getrow/rle_putrow.
- * 
- * Author:	Spencer W. Thomas
- * 		Computer Science Dept.
- * 		University of Utah
- * Date:	Fri Nov 14 1986
+ *
+ * Author:      Spencer W. Thomas
+ *              Computer Science Dept.
+ *              University of Utah
+ * Date:        Fri Nov 14 1986
  * Copyright (c) 1986, Spencer W. Thomas
  */
 
@@ -35,24 +35,24 @@
 
 /*****************************************************************
  * TAG( rle_row_alloc )
- * 
+ *
  * Allocate buffer space for use by rle_getrow and rle_putrow.
  * Inputs:
- * 	the_hdr:	Header structure for RLE file to be read or
- *			written.
+ *      the_hdr:        Header structure for RLE file to be read or
+ *                      written.
  * Outputs:
- *	scanp:		Pointer to pointer to created scanline buffer.
- *			This pointer is adjusted for the alpha channel,
- *			if present.
- *	Returns 0 for success, -1 if malloc failed.
+ *      scanp:          Pointer to pointer to created scanline buffer.
+ *                      This pointer is adjusted for the alpha channel,
+ *                      if present.
+ *      Returns 0 for success, -1 if malloc failed.
  * Assumptions:
- * 	No input scanline will extend beyond the declared xmax endpoint.
+ *      No input scanline will extend beyond the declared xmax endpoint.
  * Algorithm:
- *	Count number of channels actually used (check bitmap).
- * 	Allocate nchan*rowlength pixels, allocate a buffer
- *	to hold ncolors+alpha pointers, and give each channel
- *	rowlength pixels.  Rowlength is xmax + 1, to allow for rle_getrow
- *	usage.
+ *      Count number of channels actually used (check bitmap).
+ *      Allocate nchan*rowlength pixels, allocate a buffer
+ *      to hold ncolors+alpha pointers, and give each channel
+ *      rowlength pixels.  Rowlength is xmax + 1, to allow for rle_getrow
+ *      usage.
  */
 int
 rle_row_alloc( the_hdr, scanp )
@@ -64,33 +64,33 @@ rle_pixel ***scanp;
 
     rowlen = the_hdr->xmax + 1;
     if ( the_hdr->alpha && RLE_BIT( *the_hdr, RLE_ALPHA ) )
-	nchan++;
+        nchan++;
     for ( i = 0; i < the_hdr->ncolors; i++ )
-	if ( RLE_BIT( *the_hdr, i ) )
-	     nchan++;
+        if ( RLE_BIT( *the_hdr, i ) )
+             nchan++;
 
     ncol = the_hdr->ncolors + the_hdr->alpha;
 
     if ( (scanbuf = (rle_pixel **)malloc( ncol * sizeof(rle_pixel *) )) == 0 )
-	return -1;
+        return -1;
     if ( (pixbuf = (rle_pixel *)malloc( nchan * rowlen *
-				       sizeof(rle_pixel) )) == 0 )
+                                       sizeof(rle_pixel) )) == 0 )
     {
-	free( scanbuf );
-	return -1;
+        free( scanbuf );
+        return -1;
     }
 
     if ( the_hdr->alpha )
-	scanbuf++;
+        scanbuf++;
 
     for ( i = -the_hdr->alpha; i < the_hdr->ncolors; i++ )
-	if ( RLE_BIT( *the_hdr, i ) )
-	{
-	    scanbuf[i] = pixbuf;
-	    pixbuf += rowlen;
-	}
-	else
-	    scanbuf[i] = 0;
+        if ( RLE_BIT( *the_hdr, i ) )
+        {
+            scanbuf[i] = pixbuf;
+            pixbuf += rowlen;
+        }
+        else
+            scanbuf[i] = 0;
     *scanp = scanbuf;
 
     return 0;
@@ -99,18 +99,18 @@ rle_pixel ***scanp;
 
 /*****************************************************************
  * TAG( rle_row_free )
- * 
+ *
  * Free storage allocated by rle_row_alloc().
  * Inputs:
- * 	the_hdr:	Header structure as above.
- *	scanp:		Pointer to scanbuf above.
+ *      the_hdr:        Header structure as above.
+ *      scanp:          Pointer to scanbuf above.
  * Outputs:
- * 	Frees storage referenced by scanp and nrawp.
+ *      Frees storage referenced by scanp and nrawp.
  * Assumptions:
- * 	Storage was allocated by rle_row_alloc, or by use of same
- *	algorithm, at least.
+ *      Storage was allocated by rle_row_alloc, or by use of same
+ *      algorithm, at least.
  * Algorithm:
- * 	free scanp[0] and scanp.
+ *      free scanp[0] and scanp.
  */
 void
 rle_row_free( the_hdr, scanp )
@@ -120,12 +120,12 @@ rle_pixel **scanp;
     int i;
 
     if ( the_hdr->alpha )
-	scanp--;
+        scanp--;
     for ( i = 0; i < the_hdr->ncolors + the_hdr->alpha; i++ )
-	if ( scanp[i] != 0 )
-	{
-	    free( (char *)scanp[i] );
-	    break;
-	}
+        if ( scanp[i] != 0 )
+        {
+            free( (char *)scanp[i] );
+            break;
+        }
     free( (char *)scanp );
 }
diff --git a/urt/scanargs.c b/urt/scanargs.c
deleted file mode 100644
index f3af3342..00000000
--- a/urt/scanargs.c
+++ /dev/null
@@ -1,918 +0,0 @@
-/* 
- * $Id: scanargs.c,v 3.0.1.3 1992/02/27 21:18:14 spencer Exp $
- * 		Version 7 compatible
- * 	Argument scanner, scans argv style argument list.
- * 
- * 	Some stuff is a kludge because sscanf screws up
- * 
- * 	Gary Newman - 10/4/1979 - Ampex Corp. 
- * 
- * 	Modified by Spencer W. Thomas, Univ. of Utah, 5/81 to
- * 	add args introduced by 	a flag, add qscanargs call,
- * 	allow empty flags.
- * 
- * 	If you make improvements we'd like to get them too.
- * 	Jay Lepreau	lepreau@utah-20, decvax!harpo!utah-cs!lepreau
- * 	Spencer Thomas	thomas@utah-20, decvax!harpo!utah-cs!thomas 
- * 
- *	(I know the code is ugly, but it just grew, you see ...)
- * 
- * Modified by:	Spencer W. Thomas
- * 	Date:	Feb 25 1983
- * 1. Fixed scanning of optional args.  Now args introduced by a flag
- *    must follow the flag which introduces them and precede any other
- *    flag argument.  It is still possible for a flag introduced
- *    argument to be mistaken for a "bare" argument which occurs
- *    earlier in the format string.  This implies that flags may not
- *    be conditional upon other flags, and a message will be generated
- *    if this is attempted.
- * 
- * 2. Usage message can be formatted by inserting newlines, tabs and
- *    spaces into the format string.  This is especially useful for
- *    long argument lists.
- * 
- * 3. Added n/N types for "numeric" args.  These args are scanned
- *    using the C language conventions - a number starting 0x is
- *    hexadecimal, a number starting with 0 is octal, otherwise it is
- *    decimal.
- *
- *  Modified at BRL 16-May-88 by Mike Muuss to avoid Alliant STDC desire
- *  to have all "void" functions so declared.
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <stdarg.h>
-
-#include "netpbm/pm_c_util.h"
-#include "netpbm/nstring.h"
-#include "rle_config.h"
-#include "rle.h"
-
-/* 
- * An explicit assumption is made in this code that all pointers look
- * alike, except possible char * pointers.
- */
-typedef int *ptr;
-
-#define YES 1
-#define NO 0
-#define ERROR(msg)  {fprintf(stderr, "%s\n", msg); goto error; }
-
-/* 
- * Storage allocation macros
- */
-#define NEW( type, cnt )	(type *) malloc( (cnt) * sizeof( type ) )
-#define RENEW( type, ptr, cnt )	(type *) realloc( ptr, (cnt) * sizeof( type ) )
-
-static CONST_DECL char * prformat( CONST_DECL char *, int );
-static int isnum( CONST_DECL char *, int, int );
-static int	_do_scanargs( int argc, char **argv, CONST_DECL char *format,
-			      va_list argl );
-void		scan_usage( char **, CONST_DECL char * );
-
-/* 
- * Argument list is (argc, argv, format, ... )
- */
-int
-scanargs ( int argc, char **argv, CONST_DECL char *format, ... )
-{
-    va_list argl;
-    int retval;
-    va_start( argl, format );
-    retval = _do_scanargs( argc, argv, format, argl );
-    va_end( argl );
-    return retval;
-}
-    
-/* 
- * This routine is necessary because of a pyramid compiler botch that
- * uses parameter registers in a varargs routine.  The extra
- * subroutine call isolates the args on the register stack so they
- * don't get trashed.
- */
-
-static int
-_do_scanargs( argc, argv, format, argl )
-int     argc;			/* Actual arguments */
-char  **argv;
-CONST_DECL char   *format;
-va_list argl;
-{
-
-    int    check;			/* check counter to be sure all argvs
-					   are processed */
-    register CONST_DECL char  *cp;
-    int    cnt;
-    int	    optarg = 0;			/* where optional args start */
-    int	    nopt = 0;
-    char    tmpflg,			/* temp flag */
-	    typchr;			/* type char from format string */
-    char    c;
-    bool  * arg_used;			/* array of flags */
-    ptr	    aptr = 0;			/* pointer to return loc */
-
-    bool    required;
-    int	    excnt;			/* which flag is set */
-    bool    exflag;			/* when set, one of a set of exclusive
-					   flags is set */
-
-    bool    list_of;			/* set if parsing off a list of args */
-    bool    comma_list;			/* set if AT&T style multiple args */
-    bool    no_usage;			/* If set, don't print usage msg. */
-    bool    help = NO;			/* If set, always print usage. */
-    int	  * cnt_arg = 0;		/* where to stuff list count */
-    int	    list_cnt;			/* how many in list */
-    /* These are used to build return lists */
-    char ** strlist = 0;
-    int   * intlist = 0;
-    long  * longlist = 0;
-    float * fltlist = 0;
-    double *dbllist = 0;
-    char  * argp;			/* Pointer to argument. */
-
-    CONST_DECL char   *ncp;		/* remember cp during flag scanning */
-    static char   cntrl[7] = "%  %1s";	/* control string for scanf's */
-    char    junk[2];			/* junk buffer for scanf's */
-
-    /* Set up for argument counting. */
-    arg_used = NEW( bool, argc );
-    if (arg_used == NULL)
-    {
-	fprintf(stderr, "malloc failed in scanargs, exiting\n");
-	exit(-1);
-    }
-    else
-    {
-	for (cnt=0; cnt<argc; cnt++)
-	    arg_used[cnt] = NO;
-    }
-    check = 0;
-
-    /* Scan for -help in arg list. */
-    for ( cnt=1; cnt<argc; cnt++ )
-	if ( strcmp( argv[cnt], "-help" ) == 0 )
-	{
-	    check += cnt;
-	    arg_used[cnt] = YES;
-	    if ( argc == 2 )
-	    {
-		scan_usage( argv, format );
-		return 0;
-	    }
-	    else
-		help = YES;
-	}
-
-    /* If format string ends in @, don't print a usage message. */
-    no_usage = *(format + strlen( format ) - 1) == '&';
-
-    cp = format;
-    /* 
-     * Skip program name
-     */
-    while ( *cp != ' ' && *cp != '\t' && *cp != '\n' && *cp != '\0' )
-	cp++;
-
-    while (*cp)
-    {
-	required = NO;			/* reset per-arg flags */
-	list_of = NO;
-	comma_list = NO;
-	list_cnt = 0;
-	switch (*(cp++))
-	{
-	    default: 			/* all other chars */
-		break;
-	    case ' ':			/* separators */
-	    case '\t':
-	    case '\n':
-		optarg = 0;		/* end of optional arg string */
-		break;
-
-	    case '(':			/* Surrounds a comment. */
-	    {
-		int depth = 1;		/* Count parenthesis depth. */
-		while ( *cp && depth > 0 )
-		    switch ( *(cp++) )
-		    {
-		    case '(':	depth++;		break;
-		    case ')':	depth--;		break;
-		    }
-		break;
-	    }
-
-	    case '!': 			/* required argument */
-		required = YES;
-	    case '%': 			/* not required argument */
-reswitch:				/* after finding '*' or ',' */
-		switch (typchr = *(cp++))
-		{
-		    case ',':		/* argument is AT&T list of things */
-			comma_list = YES;
-		    case '*':		/* argument is list of things */
-			list_of = YES;
-			list_cnt = 0;	/* none yet */
-			cnt_arg = va_arg( argl, int *);	/* item count * here */
-			goto reswitch;	/* try again */
-
-		    case '$':		/* "rest" of argument list */
-			while ( argc > 1 && !arg_used[argc-1] )
-			    argc--;	/* find last used argument */
-			*va_arg( argl, int * ) = argc;
-			break;
-
-		    case '&':		/* Return unused args. */
-			/* Count how many.  Always include argv[0]. */
-			for ( nopt = cnt = 1; cnt < argc; cnt++ )
-			    if ( !arg_used[cnt] )
-				nopt++;
-			if ( nopt == 1 )
-			    nopt = 0;	/* Special case for no args. */
-			if ( nopt > 0 )
-			{
-			    strlist = NEW( char *, nopt + 1 );
-			    /* Copy program name, for sure. */
-			    strlist[0] = argv[0];
-			    for ( nopt = cnt = 1; cnt < argc; cnt++ )
-				if ( !arg_used[cnt] )
-				{
-				    strlist[nopt++] = argv[cnt];
-				    check += cnt;
-				    arg_used[cnt] = 1;
-				}
-			    strlist[nopt] = NULL;
-			}
-			else
-			    strlist = NULL;	/* No args, return empty. */
-
-			/* Return count and arg list. */
-			*va_arg( argl, int * ) = nopt;
-			*va_arg( argl, char *** ) = strlist;
-			break;
-
-		    case '-': 		/* argument is flag */
-			if (optarg > 0)
-			    ERROR("Format error: flag conditional on flag not allowed");
-
-		    /* go back to label */
-			ncp = cp-1;	/* remember */
-			cp -= 3;
-			for (excnt = exflag = 0
-				; *cp != ' ' && !(*cp=='-' &&(cp[-1]=='!'||cp[-1]=='%'));
-				(--cp, excnt++))
-			{
-			    for (cnt = optarg+1; cnt < argc; cnt++)
-			    {
-			    /* flags all start with - */
-				if (*argv[cnt] == '-' && !arg_used[cnt] &&
-					!ISDIGIT(argv[cnt][1]))
-				    if (*(argv[cnt] + 1) == *cp)
-				    {
-					if (*(argv[cnt] + 2) != 0)
-					    ERROR ("extra flags ignored");
-					if (exflag)
-					    ERROR ("more than one exclusive flag chosen");
-					exflag++;
-					required = NO;
-					check += cnt;
-					arg_used[cnt] = 1;
-					nopt = cnt;
-					*va_arg( argl, int *) |= (1 << excnt);
-					break;
-				    }
-			    }
-			}
-			if (required)
-			    ERROR ("flag argument missing");
-			cp = ncp;
-			/* 
-			 * If none of these flags were found, skip any
-			 * optional arguments (in the varargs list, too).
-			 */
-			if (!exflag)
-			{
-			    (void)va_arg( argl, int * );/* skip the arg, too */
-			    while (*++cp && ! ISSPACE(*cp))
-				if (*cp == '!' || *cp == '%')
-				{
-				    if ( *++cp == '*' || *cp == ',' )
-				    {
-					cp++;
-					(void)va_arg( argl, int * );
-				    }
-				    /* 
-				     * Assume that char * might be a
-				     * different size, but that all
-				     * other pointers are same size.
-				     */
-				    if ( *cp == 's' )
-					(void)va_arg( argl, char * );
-				    else
-					(void)va_arg( argl, ptr );
-				}
-			}
-			else
-			{
-			    optarg = nopt;
-			    cp++;	/* skip over - */
-			}
-
-			break;
-
-		    case 's': 		/* char string */
-		    case 'd': 		/* decimal # */
-		    case 'o': 		/* octal # */
-		    case 'x': 		/* hexadecimal # */
-		    case 'n':		/* "number" in C syntax */
-		    case 'f': 		/* floating # */
-		    case 'D': 		/* long decimal # */
-		    case 'O': 		/* long octal # */
-		    case 'X': 		/* long hexadecimal # */
-		    case 'N':		/* long number in C syntax */
-		    case 'F': 		/* double precision floating # */
-#if defined(sgi) && !defined(mips)
-			/* Fix for broken SGI IRIS 2400/3000 floats */
-			if ( typchr == 'F' ) typchr = 'f';
-#endif /* sgi */
-			for (cnt = optarg+1; cnt < argc; cnt++)
-			{
-			    argp = argv[cnt];
-
-			    if ( isnum( argp, typchr, comma_list ) )
-			    {
-				;	/* it's ok, then */
-			    }
-			    else if ( *argp == '-' && argp[1] != '\0' )
-				if ( optarg > 0 ) /* end optional args? */
-				{
-				    /* Eat the arg, too, if necessary */
-				    if ( list_cnt == 0 ) {
-					if ( typchr == 's' )
-					    (void)va_arg( argl, char * );
-					else
-					    (void)va_arg( argl, ptr );
-                    }
-				    break;
-				}
-				else
-				    continue;
-			    else if ( typchr != 's' )
-				continue;	/* not number, keep looking */
-			    
-			    /* 
-			     * Otherwise usable argument may already
-			     * be used.  (Must check this after
-			     * checking for flag, though.)
-			     */
-			    if (arg_used[cnt]) continue;
-
-			    /* 
-			     * If it's a comma-and-or-space-separated
-			     * list then count how many, and separate
-			     * the list into an array of strings.
-			     */
-			    if ( comma_list )
-			    {
-				register char * s;
-				int pass;
-
-				/*
-				 * Copy the string so we remain nondestructive
-				 */
-				s = NEW( char, strlen(argp)+1 );
-				strcpy( s, argp );
-				argp = s;
-
-				/* 
-				 * On pass 0, just count them.  On
-				 * pass 1, null terminate each string 
-				 */
-				for ( pass = 0; pass <= 1; pass++ )
-				{
-				    for ( s = argp; *s != '\0'; )
-				    {
-					if ( pass )
-					    strlist[list_cnt] = s;
-					while ( (c = *s) != '\0' && c != ' ' &&
-						c != '\t' && c != ',' )
-					    s++;
-					if ( pass )
-					    *s = '\0';
-
-					list_cnt++;	/* count separators */
-					/* 
-					 * Two commas in a row give a null
-					 * string, but two spaces
-					 * don't.  Also skip spaces
-					 * after a comma.
-					 */
-					if ( c != '\0' )
-					    while ( *++s == ' ' || *s == '\t' )
-						;
-				    }
-				    if ( pass == 0 )
-				    {
-					strlist = NEW( char *, list_cnt );
-					list_cnt = 0;
-				    }
-				}
-			    }
-			    else if ( list_of )
-				list_cnt++;   /* getting them one at a time */
-			    /* 
-			     * If it's either type of list, then alloc
-			     * storage space for the returned values
-			     * (except that comma-separated string
-			     * lists already are done).
-			     */
-			    if ( list_of )
-			    {
-				if ( list_cnt == 1 || comma_list )
-				    switch( typchr )
-				    {
-					case 's':
-					    if ( !comma_list )
-						strlist = NEW( char *, 1 );
-					    aptr = (ptr) &strlist[0];
-					    break;
-					case 'n':
-					case 'd':
-					case 'o':
-					case 'x':
-					    intlist = NEW( int, list_cnt );
-					    aptr = (ptr) &intlist[0];
-					    break;
-					case 'N':
-					case 'D':
-					case 'O':
-					case 'X':
-					    longlist = NEW( long, list_cnt );
-					    aptr = (ptr) &longlist[0];
-					    break;
-					case 'f':
-					    fltlist = NEW( float, list_cnt );
-					    aptr = (ptr) &fltlist[0];
-					    break;
-					case 'F':
-					    dbllist = NEW( double, list_cnt );
-					    aptr = (ptr) &dbllist[0];
-					    break;
-				    }
-				else
-				    switch( typchr )
-				    {
-					case 's':
-					    strlist = RENEW( char *, strlist,
-							     list_cnt );
-					    aptr = (ptr) &strlist[list_cnt-1];
-					    break;
-					case 'n':
-					case 'd':
-					case 'o':
-					case 'x':
-					    intlist = RENEW( int, intlist,
-							     list_cnt );
-					    aptr = (ptr) &intlist[list_cnt-1];
-					    break;
-					case 'N':
-					case 'D':
-					case 'O':
-					case 'X':
-					    longlist = RENEW( long, longlist,
-							      list_cnt );
-					    aptr = (ptr) &longlist[list_cnt-1];
-					    break;
-					case 'f':
-					    fltlist = RENEW( float, fltlist,
-							     list_cnt );
-					    aptr = (ptr) &fltlist[list_cnt-1];
-					    break;
-					case 'F':
-					    dbllist = RENEW( double, dbllist,
-							     list_cnt );
-					    aptr = (ptr) &dbllist[list_cnt-1];
-					    break;
-				    }
-			    }
-			    else
-				aptr = va_arg( argl, ptr );
-
-			    if ( typchr == 's' )
-			    {
-				if ( ! comma_list )
-				    *(char **)aptr = argp;
-			    }
-			    else
-			    {
-				nopt = 0;
-				do {
-				    /* 
-				     * Need to update aptr if parsing
-				     * a comma list
-				     */
-				    if ( comma_list && nopt > 0 )
-				    {
-					argp = strlist[nopt];
-					switch( typchr )
-					{
-					    case 'n':
-					    case 'd':
-					    case 'o':
-					    case 'x':
-						aptr = (ptr) &intlist[nopt];
-						break;
-					    case 'N':
-					    case 'D':
-					    case 'O':
-					    case 'X':
-						aptr = (ptr) &longlist[nopt];
-						break;
-					    case 'f':
-						aptr = (ptr) &fltlist[nopt];
-						break;
-					    case 'F':
-						aptr = (ptr) &dbllist[nopt];
-						break;
-					}
-				    }
-				    /* 
-				     * Do conversion for n and N types
-				     */
-				    tmpflg = typchr;
-				    if (typchr == 'n' || typchr == 'N' ) {
-					if (*argp != '0')
-					    tmpflg = 'd';
-					else if (*(argp+1) == 'x' ||
-						 *(argp+1) == 'X')
-					{
-					    tmpflg = 'x';
-					    argp += 2;
-					}
-					else
-					    tmpflg = 'o';
-                    }
-				    if (typchr == 'N')
-					tmpflg = toupper( tmpflg );
-
-
-				    /* put in conversion */
-				    if ( isupper( tmpflg ) )
-				    {
-					cntrl[1] = 'l';
-					cntrl[2] = tolower( tmpflg );
-				    }
-				    else
-				    {
-					cntrl[1] = tmpflg;
-					cntrl[2] = ' ';
-				    }
-				    if (sscanf (argp, cntrl, aptr, junk) != 1)
-					ERROR ("Bad numeric argument");
-				} while ( comma_list && ++nopt < list_cnt );
-			    }
-			    check += cnt;
-			    arg_used[cnt] = 1;
-			    required = NO;
-			    /*
-			     * If not looking for multiple args,
-			     * then done, otherwise, keep looking.
-			     */
-			    if ( !( list_of && !comma_list ) )
-				break;
-			    else
-				continue;
-			}
-			if (required)
-			    switch (typchr)
-			    {
-				case 'x': 
-				case 'X': 
-				    ERROR ("missing hexadecimal argument");
-				case 's': 
-				    ERROR ("missing string argument");
-				case 'o': 
-				case 'O': 
-				    ERROR ("missing octal argument");
-				case 'd': 
-				case 'D': 
-				    ERROR ("missing decimal argument");
-				case 'f': 
-				case 'F': 
-				    ERROR ("missing floating argument");
-				case 'n':
-				case 'N':
-				    ERROR ("missing numeric argument");
-			    }
-			if ( list_cnt > 0 )
-			{
-			    *cnt_arg = list_cnt;
-			    switch ( typchr )
-			    {
-				case 's':
-				    *va_arg( argl, char *** ) = strlist;
-				    break;
-				case 'n':
-				case 'd':
-				case 'o':
-				case 'x':
-				    *va_arg( argl, int ** ) = intlist;
-				    break;
-				case 'N':
-				case 'D':
-				case 'O':
-				case 'X':
-				    *va_arg( argl, long ** ) = longlist;
-				    break;
-				case 'f':
-				    *va_arg( argl, float ** ) = fltlist;
-				    break;
-				case 'F':
-				    *va_arg( argl, double **) = dbllist;
-				    break;
-			    }
-			    if ( typchr != 's' && comma_list )
-				free( (char *) strlist );
-			}
-			else if ( cnt >= argc )
-			{
-			    /* Fell off end looking, so must eat the arg */
-			    if ( typchr == 's' )
-				(void)va_arg( argl, char * );
-			    else
-				(void)va_arg( argl, ptr );
-			}
-			break;
-		    default: 		/* error */
-			fprintf (stderr,
-				 "scanargs: Corrupt or invalid format spec\n");
-			return 0;
-		}
-	}
-    }
-
-    /*  Count up empty flags */
-    for (cnt=1; cnt<argc; cnt++)
-	if (argv[cnt][0] == '-' && argv[cnt][1] == '-' && argv[cnt][2] == 0
-	    && !arg_used[cnt] )
-	    check += cnt;
-
-    /* sum from 1 to N = n*(n+1)/2 used to count up checks */
-    if (check != (((argc - 1) * argc) / 2))
-	ERROR ("extra arguments not processed");
-
-    /* If -help, always print usage. */
-    if ( help )
-	scan_usage( argv, format );
-
-    free(arg_used);
-    return 1;
-
-error: 
-    if ( !no_usage )
-	scan_usage( argv, format );
-    free(arg_used);
-    return 0;
-}
-
-void
-scan_usage( argv, format )
-char ** argv;
-CONST_DECL char * format;
-{
-    register CONST_DECL char * cp;
-
-    fprintf (stderr, "usage : ");
-    if (*(cp = format) != ' ')
-    {
-	if ( *cp == '%' )
-	{
-	    /* 
-	     * This is bogus, but until everyone can agree on a name
-	     * for (rindex/strrchr) ....
-	     */
-	    for ( cp = argv[0]; *cp != '\0'; cp++ )
-		;			/* find the end of the string */
-	    for ( ; cp > argv[0] && *cp != '/'; cp-- )
-		;			/* find the last / */
-	    if ( *cp == '/' )
-		cp++;
-	    fprintf( stderr, "%s", cp );
-
-	    cp = format + 1;		/* reset to where it should be */
-	}
-	while (putc (*cp++, stderr) != ' ');
-    }
-    else
-	fprintf (stderr, "?? ");
-    while (*cp == ' ')
-	cp++;
-    (void)prformat (cp, NO);
-}
-
-static CONST_DECL char *
-prformat (format, recurse)
-CONST_DECL char   *format;
-int 	recurse;
-{
-    register CONST_DECL char  *cp;
-    bool    required, comma_list;
-    int    list_of, depth;
-
-    cp = format;
-    if (recurse)
-	putc (' ', stderr);
-
-    required = NO;
-    list_of = 0;
-    comma_list = NO;
-    while (*cp)
-    {
-	switch (*cp)
-	{
-	    default:
-	    	cp++;
-		break;
-	    case ' ':
-	    case '\n':
-	    case '\t':
-		/* allow annotations */
-		for ( ; format < cp; format++ )
-		    putc( *format, stderr );
-		putc(*cp, stderr);
-		format = ++cp;
-		break;
-
-	    case '(':
-		/* Parentheses surround an arbitrary (parenthesis
-		 * balanced) comment.
-		 */
-		for ( ; format < cp; format++ )
-		    putc( *format, stderr );
-		for ( cp++, depth = 1; *cp && depth > 0; )
-		{
-		    /* Don't print last close paren. */
-		    if ( *cp != ')' || depth > 1 )
-			putc( *cp, stderr );
-		    switch( *(cp++) )
-		    {
-		    case '(':	depth++;		break;
-		    case ')':	depth--;		break;
-		    }
-		}
-		format = cp;
-		break;
-
-	    case '!': 
-		required = YES;
-	    case '%': 
-reswitch:
-		switch (*++cp)
-		{
-		    case ',':
-			comma_list++;
-		    case '*':
-			list_of++;
-			goto reswitch;
-
-		    case '$':		/* "rest" of argument list */
-			if (!required)
-			    putc ('[', stderr);
-			for (; format < cp - 1 - list_of; format++)
-			    putc (*format, stderr);
-			fputs( " ...", stderr );
-			if ( !required )
-			    putc( ']', stderr );
-			break;
-
-		    case '-': 		/* flags */
-			if (!required)
-			    putc ('[', stderr);
-			putc ('-', stderr);
-
-			if (cp - format > 2 + list_of)
-			    putc ('{', stderr);
-			cp = format;
-			while (*cp != '%' && *cp != '!')
-			    putc (*cp++, stderr);
-			if (cp - format > 1 + list_of)
-			    putc ('}', stderr);
-			cp += 2;	/* skip !- or %- */
-			if (*cp && !ISSPACE(*cp))
-			    cp = prformat (cp, YES);
-					/* this is a recursive call */
-
-			cp--;	/* don't ignore next character */
-
-			if (!required)
-			    putc (']', stderr);
-			break;
-		    case 's': 		/* char string */
-		    case 'd': 		/* decimal # */
-		    case 'o': 		/* octal # */
-		    case 'x': 		/* hexadecimal # */
-		    case 'f': 		/* floating # */
-		    case 'D': 		/* long decimal # */
-		    case 'O': 		/* long octal # */
-		    case 'X': 		/* long hexadecimal # */
-		    case 'F': 		/* double precision floating # */
-		    case 'n':		/* numeric arg (C format) */
-		    case 'N':		/* long numeric arg */
-			if (!required)
-			    putc ('[', stderr);
-			for (; format < cp - 1 - list_of; format++)
-			    putc (*format, stderr);
-			if ( list_of != 0 )
-			{
-			    if ( comma_list )
-				putc( ',', stderr );
-			    else
-				putc( ' ', stderr );
-			    fputs( "...", stderr );
-			}
-			if (!required)
-			    putc (']', stderr);
-			break;
-		    default: 
-			break;
-		}
-		required = NO;
-		list_of = NO;
-		comma_list = NO;
-		if (*cp)		/* check for end of string */
-		    format = ++cp;
-		if (*cp && !ISSPACE(*cp))
-		    putc (' ', stderr);
-	}
-	if (recurse && ISSPACE(*cp))
-	    break;
-    }
-    if (!recurse)
-    {
-	for ( ; format < cp; format++ )
-	    putc( *format, stderr );
-	putc ('\n', stderr);
-    }
-    return (cp);
-}
-
-/* 
- * isnum - determine whether a string MIGHT represent a number.
- * typchr indicates the type of argument we are looking for, and
- * determines the legal character set.  If comma_list is YES, then
- * space and comma are also legal characters.
- */
-static int
-isnum( str, typchr, comma_list )
-register CONST_DECL char * str;
-int typchr;
-int comma_list;
-{
-    register CONST_DECL char *allowed, *digits, *cp;
-    int hasdigit = NO;
-
-    switch( typchr )
-    {
-	case 'n':
-	case 'N':
-	    allowed = " \t,+-x0123456789abcdefABCDEF";
-	    break;
-	case 'd':
-	case 'D':
-	    allowed = " \t,+-0123456789";
-	    break;
-	case 'o':
-	case 'O':
-	    allowed = " \t,01234567";
-	    break;
-	case 'x':
-	case 'X':
-	    allowed = " \t,0123456789abcdefABCDEF";
-	    break;
-	case 'f':
-	case 'F':
-	    allowed = " \t,+-eE.0123456789";
-	    break;
-	case 's':			/* only throw out decimal numbers */
-	default:
-	    allowed = " \t,+-.0123456789";
-	    break;
-    }
-    digits = allowed;
-    while ( *digits != '0' )
-	digits++;
-    if ( ! comma_list )
-	allowed += 3;		      /* then don't allow space, tab, comma */
-
-    while ( *str != '\0' )
-    {
-    	for ( cp = allowed; *cp != '\0' && *cp != *str; cp++ )
-    	    ;
-    	if ( *cp == '\0' )
-	    return NO;		     /* if not in allowed chars, not number */
-	if ( cp - digits >= 0 )
-	    hasdigit = YES;
-	str++;
-    }
-    return hasdigit;
-}
diff --git a/urt/vaxshort.c b/urt/vaxshort.c
index 4b57b516..c39e78ec 100644
--- a/urt/vaxshort.c
+++ b/urt/vaxshort.c
@@ -1,5 +1,5 @@
 /*
- *			V A X S H O R T
+ *                      V A X S H O R T
  *
  *  Code to manipulate 16-bit integers in VAX order in a
  *  machine independent manner.
@@ -7,21 +7,21 @@
  *  (VAX is a trademark of Digital Equipment Corporation)
  *
  *  Author -
- *	Michael John Muuss
- *  
+ *      Michael John Muuss
+ *
  *  Source -
- *	SECAD/VLD Computing Consortium, Bldg 394
- *	The U. S. Army Ballistic Research Laboratory
- *	Aberdeen Proving Ground, Maryland  21005-5066
- *  
+ *      SECAD/VLD Computing Consortium, Bldg 394
+ *      The U. S. Army Ballistic Research Laboratory
+ *      Aberdeen Proving Ground, Maryland  21005-5066
+ *
  *  Distribution Status -
- *	Public Domain, Distribution Unlimitied.
+ *      Public Domain, Distribution Unlimited.
  */
 
 #include "vaxshort.h"
 
 /*
- *			V A X _ G S H O R T
+ *                      V A X _ G S H O R T
  *
  *  Obtain a 16-bit signed integer from two adjacent characters,
  *  stored in VAX order, regardless of word alignment.
@@ -29,22 +29,25 @@
 int
 vax_gshort(char *msgp)
 {
-	register unsigned char *p = (unsigned char *) msgp;
-	register int	i;
+        unsigned char *p = (unsigned char *) msgp;
+        int     i;
 
-	if( (i = (p[1] << 8) | p[0]) & 0x8000 )
-		return(i | ~0xFFFF);	/* Sign extend */
-	return(i);
+        if( (i = (p[1] << 8) | p[0]) & 0x8000 )
+                return(i | ~0xFFFF);    /* Sign extend */
+        return(i);
 }
 
 /*
- *			V A X _ P S H O R T
+ *                      V A X _ P S H O R T
  */
 char *
 vax_pshort(char *msgp, unsigned short s)
 {
 
-	msgp[0] = s & 0xFF;
-	msgp[1] = s >> 8;
-	return(msgp+2);
+        msgp[0] = s & 0xFF;
+        msgp[1] = s >> 8;
+        return(msgp+2);
 }
+
+
+