about summary refs log tree commit diff
path: root/editor
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-09-18 03:48:54 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-09-18 03:48:54 +0000
commit27d6da036c2aa20ecee53cb77ef8aecf04fc633d (patch)
tree8e852e267e9f3d614728dc22e7639c9e56cd9697 /editor
parent9e85aa0118c5e02daac094e1b650edfbeabb771e (diff)
downloadnetpbm-mirror-27d6da036c2aa20ecee53cb77ef8aecf04fc633d.tar.gz
netpbm-mirror-27d6da036c2aa20ecee53cb77ef8aecf04fc633d.tar.xz
netpbm-mirror-27d6da036c2aa20ecee53cb77ef8aecf04fc633d.zip
whitespace
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4668 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor')
-rw-r--r--editor/pamedge.c8
-rw-r--r--editor/pammasksharpen.c24
-rw-r--r--editor/pamperspective.c44
-rw-r--r--editor/pamrecolor.c1
-rw-r--r--editor/pamwipeout.c28
-rw-r--r--editor/pgmdeshadow.c22
-rw-r--r--editor/pgmenhance.c4
-rw-r--r--editor/pgmmedian.c2
-rw-r--r--editor/pnmalias.c58
-rw-r--r--editor/pnmgamma.c68
-rw-r--r--editor/pnminvert.c20
-rw-r--r--editor/pnmmontage.c44
-rw-r--r--editor/pnmnlfilt.c2
-rw-r--r--editor/pnmrotate.c202
-rw-r--r--editor/pnmscalefixed.c106
-rw-r--r--editor/pnmsmooth.c12
-rw-r--r--editor/pnmstitch.c152
-rw-r--r--editor/pnmtile.c2
-rw-r--r--editor/ppmchange.c40
-rw-r--r--editor/ppmdim.c159
-rw-r--r--editor/ppmflash.c9
-rw-r--r--editor/ppmlabel.c6
-rw-r--r--editor/specialty/pamdeinterlace.c8
-rw-r--r--editor/specialty/pamoil.c8
-rw-r--r--editor/specialty/pampop9.c4
-rw-r--r--editor/specialty/pbmlife.c114
-rw-r--r--editor/specialty/pgmabel.c2
-rw-r--r--editor/specialty/pgmbentley.c6
-rw-r--r--editor/specialty/pgmmorphconv.c56
-rw-r--r--editor/specialty/pnmmercator.c54
-rw-r--r--editor/specialty/ppm3d.c30
-rw-r--r--editor/specialty/ppmglobe.c14
-rw-r--r--editor/specialty/ppmntsc.c124
-rw-r--r--editor/specialty/ppmrelief.c2
-rw-r--r--editor/specialty/ppmshift.c1
-rw-r--r--editor/specialty/ppmtv.c167
36 files changed, 799 insertions, 804 deletions
diff --git a/editor/pamedge.c b/editor/pamedge.c
index f4384535..ca742573 100644
--- a/editor/pamedge.c
+++ b/editor/pamedge.c
@@ -30,7 +30,7 @@ writeBlackRow(struct pam * const pamP) {
             tuplerow[col][plane] = 0;
     }
     pnm_writepamrow(pamP, tuplerow);
-} 
+}
 
 
 
@@ -92,12 +92,12 @@ computeOneRow(struct pam * const inpamP,
         orow[0][plane] = 0;
 
         for (col = 1; col < inpamP->width - 1; ++col) {
-            double const grad1 = 
+            double const grad1 =
                 1 * horizGradient(row0, col, plane) +
                 2 * horizGradient(row1, col, plane) +
                 1 * horizGradient(row2, col, plane);
 
-            double const grad2 = 
+            double const grad2 =
                 horizAvg(row2, col, plane) - horizAvg(row0, col, plane);
 
             double const gradient = sqrt(SQR(grad1) + SQR(grad2));
@@ -163,7 +163,7 @@ main(int argc, const char ** argv) {
 
     pm_proginit(&argc, argv);
 
-    if (argc-1 == 1) 
+    if (argc-1 == 1)
         ifP = pm_openr(argv[1]);
     else if (argc-1 == 0)
         ifP = stdin;
diff --git a/editor/pammasksharpen.c b/editor/pammasksharpen.c
index 6e34ab20..1e3dee32 100644
--- a/editor/pammasksharpen.c
+++ b/editor/pammasksharpen.c
@@ -7,8 +7,8 @@ struct cmdlineInfo {
     /* All the information the user supplied in the command line,
        in a form easy for the program to use.
     */
-    const char * inputFilespec;  
-    const char * maskFilespec;  
+    const char * inputFilespec;
+    const char * maskFilespec;
     unsigned int verbose;
     float        sharpness;
     float        threshold;
@@ -31,7 +31,7 @@ parseCommandLine(int argc, const char ** const argv,
     unsigned int option_def_index;
 
     unsigned int sharpSpec, thresholdSpec;
-    
+
     MALLOCARRAY_NOFAIL(option_def, 100);
 
     option_def_index = 0;   /* incremented by OPTENTRY */
@@ -75,13 +75,13 @@ parseCommandLine(int argc, const char ** const argv,
             cmdlineP->inputFilespec = "-";
         else {
             cmdlineP->inputFilespec = argv[2];
-        
+
             if (argc-1 > 2)
                 pm_error("There are at most two arguments:  mask file name "
                          "and input file name.  You specified %d", argc-1);
         }
     }
-}        
+}
 
 
 
@@ -98,7 +98,7 @@ sharpened(sample const inputSample,
 
     if (abs(edgeness) > threshold) {
         float const rawResult = inputSample + edgeness * sharpness;
-        
+
         retval = MIN(maxval, (unsigned)MAX(0, (int)(rawResult+0.5)));
     } else
         retval = inputSample;
@@ -125,9 +125,9 @@ main(int argc, const char * *argv) {
         /* Magnitude of difference between image and unsharp mask below
            which they will be considered identical.
         */
-    
+
     pm_proginit(&argc, argv);
-    
+
     parseCommandLine(argc, argv, &cmdline);
 
     ifP = pm_openr(cmdline.inputFilespec);
@@ -136,7 +136,7 @@ main(int argc, const char * *argv) {
     pnm_readpaminit(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type));
     pnm_readpaminit(maskfP, &maskpam, PAM_STRUCT_SIZE(tuple_type));
 
-    if (inpam.width  != maskpam.width || 
+    if (inpam.width  != maskpam.width ||
         inpam.height != maskpam.height ||
         inpam.depth  != maskpam.depth)
         pm_error("The mask image must be the same dimensions as the "
@@ -165,10 +165,10 @@ main(int argc, const char * *argv) {
         unsigned int col;
         pnm_readpamrow(&inpam,   inputTuplerow);
         pnm_readpamrow(&maskpam, maskTuplerow);
-        
+
         for (col = 0; col < outpam.width; ++col) {
             unsigned int plane;
-            
+
             for (plane = 0; plane < outpam.depth; ++plane) {
                 outputTuplerow[col][plane] =
                     sharpened(inputTuplerow[col][plane],
@@ -187,6 +187,6 @@ main(int argc, const char * *argv) {
     pnm_freepamrow(inputTuplerow);
     pnm_freepamrow(maskTuplerow);
     pnm_freepamrow(outputTuplerow);
-    
+
     return 0;
 }
diff --git a/editor/pamperspective.c b/editor/pamperspective.c
index a8b1cf8f..487025bc 100644
--- a/editor/pamperspective.c
+++ b/editor/pamperspective.c
@@ -154,7 +154,7 @@ typedef struct {
 
 
 /* The collection of properties that correspond to the four specified
-   vertices 
+   vertices
 */
 
 typedef struct {
@@ -172,18 +172,18 @@ typedef struct {
      center of projection, that is the pixel the camera "looks at".  It
      turned out, maybe surprisingly, that this does not have any
      effect. So now this center is moved to (0,0).
-     
+
      Another original plan was to correct the output parameters
      depending on the lengths of the paralellograms sides or its
      angles.  This is, however, not possible without knowing something
      like the camera angle or focal length (in pixels).
   */
-  
+
   /* The coefficients for the map from output to world coordinates.
 
      The actual mapping is
      u,v -> (ax+bx*u+cx*v, ay+by*u+cy*v, az+bz*u+cz*v)
-  */     
+  */
   number ax,bx,cx, ay,by,cy, az,bz,cz;
 
 } world_data;
@@ -331,7 +331,7 @@ parseFloat(const char * const text) {
     char * end;
     number num;
     char * buffer;
-    
+
     buffer = strdup(text);
     if (!buffer)
         pm_error("Out of memory");
@@ -432,7 +432,7 @@ static void parse_include_points(const char * const include_opt,
              sem_seek++);
 
         hit_end = (*sem_seek == '\0');
-            
+
         *sem_seek = '\0';
         parse_include_point(cursor, include_pointsP);
 
@@ -735,15 +735,15 @@ static void determine_world_parallelogram (world_data *const world,
                                            const option *const options)
 /*----------------------------------------------------------------------------
   Construct xw_ul,...,zw_lr from xi_ul,...,yi_lr
-     
+
   This is a solution of a linear equation system.
-  
+
   We first solve 4 equations for 4 variables (the 4 z-coordinates):
   Each z-coordinate determines the corresponding x- and y-coordinates
   in a linear fashion, where the coefficients are taken from the image
   coordinates.  This corresponds to the fact that a point of an image
   determines a line in the world.
-  
+
   3 equations state that the 4 points form a parallelogram.  The 4th
   equation is for normalization and states that the center of the
   parallelogram has a z-coordinate of 1.
@@ -948,7 +948,7 @@ static number norm_side (number const x1, number const y1, number const z1,
   This is similar to norm_vector. But now the norm of the derivative
   is computed at both endpoints of the movement and the maximum is
   returned.
-  
+
   Why do we do this? The return value n is in fact the maximum of the
   norm of the derivative ALONG the movement. So we know that if we
   divide the movement into at least n steps, we will encounter every
@@ -1022,7 +1022,7 @@ static void determine_coefficients_lattice (world_data *const world,
                                             const option *const options)
 /*----------------------------------------------------------------------------
   Constructs ax,...,cz from xw_ul,...,zw_lr
-     
+
   The calculations assume lattice coordinates, that is the point ul
   corresponds to the upper left corner of the pixel (0,0) and the
   point lr corresponds to the lower left corner of the pixel
@@ -1052,7 +1052,7 @@ static void determine_coefficients_pixel (world_data *const world,
                                           const option *const options)
 /*----------------------------------------------------------------------------
   Constructs ax,...,cz from xw_ul,...,zw_lr
-     
+
   The calculations assume pixel coordinates, that is the point ul
   corresponds to the center of the pixel (0,0) and the point lr
   corresponds to the center of the pixel (width-1,height-1)
@@ -1086,7 +1086,7 @@ static void determine_coefficients_pixel (world_data *const world,
 
 static void
 outpixelToInPos(int                const outCol,
-                int                const outRow, 
+                int                const outRow,
                 number *           const inColP,
                 number *           const inRowP,
                 const world_data * const worldP) {
@@ -1149,7 +1149,7 @@ boundedRow(int                const unboundedRow,
    It doesn't work because the actual image generation produces rows
    in the middle that are derived from lines in the input quadrilateral
    with greater slope than either the top or bottom edge.  I.e. to
-   compute one output row, it needs more rows of input than this 
+   compute one output row, it needs more rows of input than this
    calculation provides.
 
    I don't know if that means the computation of the output is wrong
@@ -1162,7 +1162,7 @@ boundedRow(int                const unboundedRow,
 
    - Bryan Henderson 08.07.27.
 */
-   
+
 
 static unsigned int
 windowHeight(const world_data * const worldP,
@@ -1177,7 +1177,7 @@ windowHeight(const world_data * const worldP,
     yur = outpixelToInRow(outpamP->width-1, 0, worldP);
     yll = outpixelToInRow(0, outpamP->height-1, worldP);
     ylr = outpixelToInRow(outpamP->width-1, outpamP->height-1, worldP);
-    
+
     y_min = MIN(MIN(yul, yur), MIN(yll, ylr));
     numRows = MAX(MAX(diff(yul, yur),
                       diff(yll, ylr)),
@@ -1210,7 +1210,7 @@ windowHeight(const world_data * const worldP,
 
     unsigned int outRow;
     unsigned int maxRowWindowHeight;
-    
+
     maxRowWindowHeight = 1;  /* initial value */
 
     for (outRow = 0; outRow < outpamP->height; ++outRow) {
@@ -1220,12 +1220,12 @@ windowHeight(const world_data * const worldP,
             boundedRow(outpixelToInRow(leftCol, outRow, worldP), outpamP);
         unsigned int const rghtInRow =
             boundedRow(outpixelToInRow(rghtCol, outRow, worldP), outpamP);
-        
+
         unsigned int const rowWindowHeight = distance(leftInRow, rghtInRow);
 
         maxRowWindowHeight = MAX(maxRowWindowHeight, rowWindowHeight);
     }
-    
+
     /* We add 2 for rounding */
 
     return maxRowWindowHeight + 2;
@@ -1297,7 +1297,7 @@ buffer_getRow(buffer *     const bufferP,
     n = bufferP->nextImageRow - imageRow;
 
     assert(n <= bufferP->numRows);
-    
+
     if (n <= bufferP->nextBufferRow)
         bufferRow = bufferP->nextBufferRow - n;
     else
@@ -1328,7 +1328,7 @@ buffer_term(buffer * const bufferP) {
 
     for (i = 0; i < bufferP->numRows; ++i)
         pnm_freepamrow(bufferP->rows[i]);
-    
+
     free(bufferP->rows);
 }
 
@@ -1412,7 +1412,7 @@ takeNearest(tuple  const dest,
 
 
 static void
-linearInterpolation(tuple  const dest, 
+linearInterpolation(tuple  const dest,
                     number const x,
                     number const y) {
 
diff --git a/editor/pamrecolor.c b/editor/pamrecolor.c
index 86c1965c..60ed29a4 100644
--- a/editor/pamrecolor.c
+++ b/editor/pamrecolor.c
@@ -1,4 +1,3 @@
-
 /* ----------------------------------------------------------------------
  *
  * Replace every pixel in an image with one of equal luminance
diff --git a/editor/pamwipeout.c b/editor/pamwipeout.c
index 0fff3fca..5510c22e 100644
--- a/editor/pamwipeout.c
+++ b/editor/pamwipeout.c
@@ -34,12 +34,12 @@ struct cmdlineInfo {
 
 
 static void
-parseCommandLine(int                        argc, 
+parseCommandLine(int                        argc,
                  const char **              argv,
                  struct cmdlineInfo * const cmdlineP ) {
 /*----------------------------------------------------------------------------
    Parse program command line described in Unix standard form by argc
-   and argv.  Return the information in the options as *cmdlineP.  
+   and argv.  Return the information in the options as *cmdlineP.
 
    If command line is internally inconsistent (invalid options, etc.),
    issue error message to stderr and abort program.
@@ -59,9 +59,9 @@ parseCommandLine(int                        argc,
     MALLOCARRAY_NOFAIL(option_def, 100);
 
     option_def_index = 0;   /* incremented by OPTENT3 */
-    OPTENT3(0, "lr",     OPT_FLAG,   NULL,                  
+    OPTENT3(0, "lr",     OPT_FLAG,   NULL,
             &lr,       0);
-    OPTENT3(0, "tb",     OPT_FLAG,   NULL,                  
+    OPTENT3(0, "tb",     OPT_FLAG,   NULL,
             &tb,       0);
 
     opt.opt_table = option_def;
@@ -75,7 +75,7 @@ parseCommandLine(int                        argc,
         pm_error("You must specify either -lr or -tb");
     else if (lr && tb)
         pm_error("You may not specify both -lr and -tb");
-    else 
+    else
         cmdlineP->direction = lr ? DIR_LR : DIR_TB;
 
 
@@ -93,8 +93,8 @@ parseCommandLine(int                        argc,
 
 
 
-static void 
-wipeImgByRow (struct pam const inpam, 
+static void
+wipeImgByRow (struct pam const inpam,
               tuple **   const tuples) {
 
     double const h = (double) inpam.height;
@@ -120,9 +120,9 @@ wipeImgByRow (struct pam const inpam,
 
 
 
-static void 
-wipeRowByCol(struct pam const inpam, 
-             tuple **   const tuples, 
+static void
+wipeRowByCol(struct pam const inpam,
+             tuple **   const tuples,
              tuple *    const tuplerow) {
 
     double const w = (double) inpam.width;
@@ -153,16 +153,16 @@ wipeoutTb(FILE * const ifP,
 
     struct pam inpam, outpam;
     tuple ** tuples;
-    
+
     tuples = pnm_readpam(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type));
 
-    outpam = inpam; 
+    outpam = inpam;
     outpam.file = ofP;
 
     wipeImgByRow(inpam, tuples);
 
     pnm_writepam(&outpam, tuples);
-       
+
     pnm_freepamarray(tuples, &inpam);
 }
 
@@ -171,7 +171,7 @@ wipeoutTb(FILE * const ifP,
 static void
 wipeoutLr(FILE * const ifP,
           FILE * const ofP) {
-    
+
     /* left-right we can read row-by-row */
 
     struct pam inpam, outpam;
diff --git a/editor/pgmdeshadow.c b/editor/pgmdeshadow.c
index 2c3a90f8..42f94254 100644
--- a/editor/pgmdeshadow.c
+++ b/editor/pgmdeshadow.c
@@ -117,7 +117,7 @@ initializeDeshadowMarker(gray **      const inputPixels,
 -----------------------------------------------------------------------------*/
     { /* Make middle white */
         unsigned int row;
-        
+
         for (row = 1; row < rows-1; ++row) {
             unsigned int col;
             for (col = 1; col < cols-1; ++col)
@@ -154,7 +154,7 @@ min5(gray const a,
      gray const c,
      gray const d,
      gray const e) {
-    
+
     return MIN(a,MIN(b,MIN(c,MIN(d,e))));
 }
 
@@ -229,16 +229,16 @@ estimateBackground(gray **      const inputPixels,
                     stable = FALSE;
                 } else
                     markerPixels[row][col] = inputPixels[row][col];
-            }       
+            }
         }
         /* scan in anti-raster order */
-        
+
         for (row = rows-2; row >= 0; --row) {
             int col;
             for (col = cols-2; col > 0; --col) {
                 gray const minpixel =
                     minSouthwestPixel(markerPixels, col, row);
-                
+
                 if (minpixel > inputPixels[row][col]) {
                     markerPixels[row][col] = minpixel;
                     stable = FALSE;
@@ -285,7 +285,7 @@ divide(gray **      const dividendPixels,
                     quotient =
                         MIN(maxval,
                             maxval * (dividend + dividend/2) / divisor);
-            }        
+            }
             dividendPixels[row][col] = quotient;
         }
     }
@@ -307,9 +307,9 @@ deshadow(gray **      const inputPixels,
     markerPixels = pgm_allocarray(cols, rows);
 
     initializeDeshadowMarker(inputPixels, markerPixels, cols, rows, maxval);
-    
+
     estimateBackground(inputPixels, markerPixels, cols, rows, maxval);
-    
+
     divide(inputPixels, markerPixels, cols, rows, maxval);
 
     pgm_freearray(markerPixels, rows);
@@ -331,12 +331,12 @@ main(int argc, char* argv[]) {
     parseCommandLine(argc, argv, &cmdline);
 
     ifP = pm_openr(cmdline.inputFileName);
-    
+
     pixels = pgm_readpgm(ifP, &cols, &rows, &maxval);
     pm_close(ifP);
-    
+
     deshadow(pixels, cols, rows, maxval);
-    
+
     pgm_writepgm(stdout, pixels, cols, rows, maxval, 0);
 
     pgm_freearray(pixels, rows);
diff --git a/editor/pgmenhance.c b/editor/pgmenhance.c
index 83670568..23cfbb9e 100644
--- a/editor/pgmenhance.c
+++ b/editor/pgmenhance.c
@@ -77,7 +77,7 @@ main(int argc, char * argv[] ) {
         thisrow = nextrow;
         nextrow = temprow;
         pgm_readpgmrow( ifp, nextrow, cols, maxval, format );
-        
+
         newrow[0] = thisrow[0];
         for (col = 1; col < cols - 1; col++) {
             /* Compute the sum of the neighborhood. */
@@ -102,7 +102,7 @@ main(int argc, char * argv[] ) {
         pgm_writepgmrow( stdout, newrow, cols, maxval, 0 );
     }
     pm_close( ifp );
-    
+
     /* Last row. */
     pgm_writepgmrow( stdout, nextrow, cols, maxval, 0 );
 
diff --git a/editor/pgmmedian.c b/editor/pgmmedian.c
index 9cebeac8..60605713 100644
--- a/editor/pgmmedian.c
+++ b/editor/pgmmedian.c
@@ -55,7 +55,7 @@ static int const forceplain = 0;
 /* Global variables common to each median sort routine. */
 static gray ** grays;
     /* The convolution buffer.  This is a circular buffer that contains the
-       rows of the input image that are being convolved into the current 
+       rows of the input image that are being convolved into the current
        output row.
     */
 static gray * grayrow;
diff --git a/editor/pnmalias.c b/editor/pnmalias.c
index 36b41ce4..51a71312 100644
--- a/editor/pnmalias.c
+++ b/editor/pnmalias.c
@@ -43,23 +43,23 @@ main(int argc, char * argv[] ) {
 
     while ( argn < argc && argv[argn][0] == '-' )
         {
-        if ( pm_keymatch( argv[argn], "-fgcolor", 3 ) ) 
+        if ( pm_keymatch( argv[argn], "-fgcolor", 3 ) )
         {
-        if ( ++argn >= argc ) 
+        if ( ++argn >= argc )
         pm_usage( usage );
-        else 
+        else
         fgcolorppm = ppm_parsecolor( argv[argn], PPM_MAXMAXVAL );
         }
-        else if ( pm_keymatch( argv[argn], "-bgcolor", 3 ) ) 
+        else if ( pm_keymatch( argv[argn], "-bgcolor", 3 ) )
         {
-        if ( ++argn >= argc ) 
+        if ( ++argn >= argc )
         pm_usage( usage );
-        else 
+        else
         bgcolorppm = ppm_parsecolor( argv[argn], PPM_MAXMAXVAL );
         }
-        else if ( pm_keymatch( argv[argn], "-weight", 2 ) ) 
+        else if ( pm_keymatch( argv[argn], "-weight", 2 ) )
         {
-        if ( ++argn >= argc ) 
+        if ( ++argn >= argc )
         pm_usage( usage );
         else if ( sscanf( argv[argn], "%lf", &weight ) != 1 )
             pm_usage( usage );
@@ -103,7 +103,7 @@ main(int argc, char * argv[] ) {
     fmask[5] = fmask[6] = fmask[7] = fmask[8] = ( 1.0 - weight ) / 8.0;
 
     pnm_readpnminit( ifp, &cols, &rows, &maxval, &format );
-   
+
     xelrow[0] = pnm_allocrow( cols );
     xelrow[1] = pnm_allocrow( cols );
     xelrow[2] = pnm_allocrow( cols );
@@ -120,29 +120,29 @@ main(int argc, char * argv[] ) {
     }
 
     /* Figure out foreground pixel value if none was given */
-    if (PPM_GETR(fgcolorppm) == 0 && PPM_GETG(fgcolorppm) == 0 && 
+    if (PPM_GETR(fgcolorppm) == 0 && PPM_GETG(fgcolorppm) == 0 &&
         PPM_GETB(fgcolorppm) == 0 ) {
         if ( PNM_FORMAT_TYPE(newformat) == PGM_TYPE )
             PNM_ASSIGN1( fgcolor, newmaxval );
-        else 
+        else
             PPM_ASSIGN( fgcolor, newmaxval, newmaxval, newmaxval );
     } else {
         if ( PNM_FORMAT_TYPE(newformat) == PGM_TYPE )
             PNM_ASSIGN1( fgcolor, PPM_GETR( fgcolorppm ) );
-        else 
+        else
             fgcolor = fgcolorppm;
     }
 
-    if (PPM_GETR(bgcolorppm) != 0 || PPM_GETG(bgcolorppm) != 0 || 
+    if (PPM_GETR(bgcolorppm) != 0 || PPM_GETG(bgcolorppm) != 0 ||
         PPM_GETB(bgcolorppm) != 0 ) {
         if ( PNM_FORMAT_TYPE(newformat) == PGM_TYPE )
             PNM_ASSIGN1( bgcolor, PPM_GETR( bgcolorppm) );
-        else 
+        else
             bgcolor = bgcolorppm;
     } else {
         if ( PNM_FORMAT_TYPE(newformat) == PGM_TYPE )
             PNM_ASSIGN1( bgcolor, 0 );
-        else 
+        else
             PPM_ASSIGN( bgcolor, 0, 0, 0 );
     }
 
@@ -158,9 +158,9 @@ main(int argc, char * argv[] ) {
 
         pnm_readpnmrow( ifp, xelrow[(row+1)%3], cols, newmaxval, format );
         newxelrow[0] = xelrow[row%3][0];
-        
+
         for ( col = 1, xpP = (xelrow[(row-1)%3] + 1), xP = (xelrow[row%3] + 1),
-                  xnP = (xelrow[(row+1)%3] + 1), nxP = (newxelrow+1); 
+                  xnP = (xelrow[(row+1)%3] + 1), nxP = (newxelrow+1);
               col < cols - 1; ++col, ++xpP, ++xP, ++xnP, ++nxP ) {
 
             int fgflag, bgflag;
@@ -168,28 +168,28 @@ main(int argc, char * argv[] ) {
             /* Reset flags if anti-aliasing is to be done on foreground
              * or background pixels only */
             if ( ( bgonly && PNM_EQUAL( *xP, fgcolor ) ) ||
-                 ( fgonly && PNM_EQUAL( *xP, bgcolor ) ) ) 
+                 ( fgonly && PNM_EQUAL( *xP, bgcolor ) ) )
                 bgflag = fgflag = 0;
             else {
                 /* Do anti-aliasing here: see if pixel is at the border of a
                  * background or foreground stepwise side */
-                bgflag = 
+                bgflag =
                     (PNM_EQUAL(*xpP,bgcolor) && PNM_EQUAL(*(xP+1),bgcolor)) ||
                     (PNM_EQUAL(*(xP+1),bgcolor) && PNM_EQUAL(*xnP,bgcolor)) ||
                     (PNM_EQUAL(*xnP,bgcolor) && PNM_EQUAL(*(xP-1),bgcolor)) ||
                     (PNM_EQUAL(*(xP-1),bgcolor) && PNM_EQUAL(*xpP,bgcolor));
-                fgflag = 
+                fgflag =
                     (PNM_EQUAL(*xpP,fgcolor) && PNM_EQUAL(*(xP+1),fgcolor)) ||
                     (PNM_EQUAL(*(xP+1),fgcolor) && PNM_EQUAL(*xnP,fgcolor)) ||
                     (PNM_EQUAL(*xnP,fgcolor) && PNM_EQUAL(*(xP-1),fgcolor)) ||
-                    (PNM_EQUAL(*(xP-1),fgcolor) && PNM_EQUAL(*xpP,fgcolor)); 
+                    (PNM_EQUAL(*(xP-1),fgcolor) && PNM_EQUAL(*xpP,fgcolor));
             }
-            if ( ( bgflag && bgalias ) || ( fgflag && fgalias ) || 
+            if ( ( bgflag && bgalias ) || ( fgflag && fgalias ) ||
                  ( bgflag && fgflag ) )
-                switch( PNM_FORMAT_TYPE( newformat ) ) {   
+                switch( PNM_FORMAT_TYPE( newformat ) ) {
                 case PGM_TYPE:
                     value = PNM_GET1(*(xpP-1)) * fmask[0] +
-                        PNM_GET1(*(xpP  )) * fmask[1] + 
+                        PNM_GET1(*(xpP  )) * fmask[1] +
                         PNM_GET1(*(xpP+1)) * fmask[2] +
                         PNM_GET1(*(xP -1)) * fmask[3] +
                         PNM_GET1(*(xP   )) * fmask[4] +
@@ -202,7 +202,7 @@ main(int argc, char * argv[] ) {
                     break;
                 default:
                     valuer= PPM_GETR(*(xpP-1)) * fmask[0] +
-                        PPM_GETR(*(xpP  )) * fmask[1] + 
+                        PPM_GETR(*(xpP  )) * fmask[1] +
                         PPM_GETR(*(xpP+1)) * fmask[2] +
                         PPM_GETR(*(xP -1)) * fmask[3] +
                         PPM_GETR(*(xP   )) * fmask[4] +
@@ -212,7 +212,7 @@ main(int argc, char * argv[] ) {
                         PPM_GETR(*(xnP+1)) * fmask[8] +
                         0.5;
                     valueg= PPM_GETG(*(xpP-1)) * fmask[0] +
-                        PPM_GETG(*(xpP  )) * fmask[1] + 
+                        PPM_GETG(*(xpP  )) * fmask[1] +
                         PPM_GETG(*(xpP+1)) * fmask[2] +
                         PPM_GETG(*(xP -1)) * fmask[3] +
                         PPM_GETG(*(xP   )) * fmask[4] +
@@ -222,7 +222,7 @@ main(int argc, char * argv[] ) {
                         PPM_GETG(*(xnP+1)) * fmask[8] +
                         0.5;
                     valueb= PPM_GETB(*(xpP-1)) * fmask[0] +
-                        PPM_GETB(*(xpP  )) * fmask[1] + 
+                        PPM_GETB(*(xpP  )) * fmask[1] +
                         PPM_GETB(*(xpP+1)) * fmask[2] +
                         PPM_GETB(*(xP -1)) * fmask[3] +
                         PPM_GETB(*(xP   )) * fmask[4] +
@@ -241,9 +241,9 @@ main(int argc, char * argv[] ) {
         newxelrow[cols-1] = xelrow[row%3][cols-1];
         pnm_writepnmrow( stdout, newxelrow, cols, newmaxval, newformat, 0 );
     }
-        
+
     pnm_writepnmrow( stdout, xelrow[row%3], cols, newmaxval, newformat, 0 );
-    
+
     pm_close( ifp );
     exit ( 0 );
 }
diff --git a/editor/pnmgamma.c b/editor/pnmgamma.c
index e10e138b..9b8dcdac 100644
--- a/editor/pnmgamma.c
+++ b/editor/pnmgamma.c
@@ -80,13 +80,13 @@ interpretOldArguments(int                  const argc,
         cmdlineP->ggamma = atof(argv[2]);
         cmdlineP->bgamma = atof(argv[3]);
         cmdlineP->filespec = argv[4];
-    } else 
+    } else
         pm_error("Wrong number of arguments.  "
                  "You may have 0, 1, or 3 gamma values "
                  "plus zero or one filename");
-        
-    if (cmdlineP->rgamma <= 0.0 || 
-        cmdlineP->ggamma <= 0.0 || 
+
+    if (cmdlineP->rgamma <= 0.0 ||
+        cmdlineP->ggamma <= 0.0 ||
         cmdlineP->bgamma <= 0.0 )
         pm_error("Invalid gamma value.  Must be positive floating point "
                  "number.");
@@ -106,7 +106,7 @@ getGammaFromOpts(struct cmdlineInfo * const cmdlineP,
     if (gammaSpec)
         if (gammaOpt < 0.0)
             pm_error("Invalid gamma value %f.  Must be positive.", gammaOpt);
-    
+
     if (rgammaSpec) {
         if (cmdlineP->rgamma < 0.0)
             pm_error("Invalid red gamma value %f.  Must be positive.",
@@ -114,17 +114,17 @@ getGammaFromOpts(struct cmdlineInfo * const cmdlineP,
     } else {
         if (gammaSpec)
             cmdlineP->rgamma = gammaOpt;
-        else 
+        else
             cmdlineP->rgamma = defaultGamma;
     }
     if (ggammaSpec) {
-        if (cmdlineP->ggamma < 0.0) 
+        if (cmdlineP->ggamma < 0.0)
             pm_error("Invalid green gamma value %f.  Must be positive.",
                      cmdlineP->ggamma);
     } else {
         if (gammaSpec)
             cmdlineP->ggamma = gammaOpt;
-        else 
+        else
             cmdlineP->ggamma = defaultGamma;
     }
     if (bgammaSpec) {
@@ -142,7 +142,7 @@ getGammaFromOpts(struct cmdlineInfo * const cmdlineP,
 
 
 static void
-parseCommandLine(int argc, char ** argv, 
+parseCommandLine(int argc, char ** argv,
                  struct cmdlineInfo * const cmdlineP) {
 
     optEntry *option_def;
@@ -189,7 +189,7 @@ parseCommandLine(int argc, char ** argv,
 
     opt.opt_table = option_def;
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
-    opt.allowNegNum = TRUE; 
+    opt.allowNegNum = TRUE;
 
     pm_optParseOptions3(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdline_p and others. */
@@ -295,7 +295,7 @@ buildPowGamma(xelval       table[],
               double const gamma) {
 /*----------------------------------------------------------------------------
    Build a gamma table of size maxval+1 for the given gamma value.
-  
+
    This function depends on pow(3m).  If you don't have it, you can
    simulate it with '#define pow(x,y) exp((y)*log(x))' provided that
    you have the exponential function exp(3m) and the natural logarithm
@@ -310,7 +310,7 @@ buildPowGamma(xelval       table[],
             /* Xel sample value normalized to 0..1 */
         double const v = pow(normalized, oneOverGamma);
 
-        table[i] = MIN((xelval)(v * newMaxval + 0.5), newMaxval);  
+        table[i] = MIN((xelval)(v * newMaxval + 0.5), newMaxval);
             /* denormalize, round and clip */
     }
 }
@@ -337,17 +337,17 @@ buildBt709Gamma(xelval       table[],
        unlike the popular pure exponential gamma transfer function.
     */
     xelval const linearCutoff = (xelval) (maxval * 0.018 + 0.5);
-    double const linearExpansion = 
+    double const linearExpansion =
         (1.099 * pow(0.018, oneOverGamma) - 0.099) / 0.018;
     double const maxvalScaler = (double)newMaxval/maxval;
 
-    for (i = 0; i <= linearCutoff; ++i) 
+    for (i = 0; i <= linearCutoff; ++i)
         table[i] = i * linearExpansion * maxvalScaler + 0.5;
     for (; i <= maxval; ++i) {
         double const normalized = ((double) i) / maxval;
             /* Xel sample value normalized to 0..1 */
         double const v = 1.099 * pow(normalized, oneOverGamma) - 0.099;
-        table[i] = MIN((xelval)(v * newMaxval + 0.5), newMaxval);  
+        table[i] = MIN((xelval)(v * newMaxval + 0.5), newMaxval);
             /* denormalize, round, and clip */
     }
 }
@@ -375,18 +375,18 @@ buildBt709GammaInverse(xelval       table[],
     */
 
     xelval const linearCutoff = (xelval) (maxval * 0.018 + 0.5);
-    double const linearCompression = 
+    double const linearCompression =
         0.018 / (1.099 * pow(0.018, oneOverGamma) - 0.099);
     double const maxvalScaler = (double)newMaxval/maxval;
 
-    for (i = 0; i <= linearCutoff / linearCompression; ++i) 
+    for (i = 0; i <= linearCutoff / linearCompression; ++i)
         table[i] = i * linearCompression * maxvalScaler + 0.5;
 
     for (; i <= maxval; ++i) {
         double const normalized = ((double) i) / maxval;
             /* Xel sample value normalized to 0..1 */
         double const v = pow((normalized + 0.099) / 1.099, gamma);
-        table[i] = MIN((xelval)(v * newMaxval + 0.5), newMaxval);  
+        table[i] = MIN((xelval)(v * newMaxval + 0.5), newMaxval);
             /* denormalize, round, and clip */
     }
 }
@@ -413,17 +413,17 @@ buildSrgbGamma(xelval       table[],
        unlike the popular pure exponential gamma transfer function.
     */
     xelval const linearCutoff = (xelval) maxval * 0.0031308 + 0.5;
-    double const linearExpansion = 
+    double const linearExpansion =
         (1.055 * pow(0.0031308, oneOverGamma) - 0.055) / 0.0031308;
     double const maxvalScaler = (double)newMaxval/maxval;
 
-    for (i = 0; i <= linearCutoff; ++i) 
+    for (i = 0; i <= linearCutoff; ++i)
         table[i] = i * linearExpansion * maxvalScaler + 0.5;
     for (; i <= maxval; ++i) {
         double const normalized = ((double) i) / maxval;
             /* Xel sample value normalized to 0..1 */
         double const v = 1.055 * pow(normalized, oneOverGamma) - 0.055;
-        table[i] = MIN((xelval)(v * newMaxval + 0.5), newMaxval);  
+        table[i] = MIN((xelval)(v * newMaxval + 0.5), newMaxval);
             /* denormalize, round, and clip */
     }
 }
@@ -450,17 +450,17 @@ buildSrgbGammaInverse(xelval       table[],
        unlike the popular pure exponential gamma transfer function.
     */
     xelval const linearCutoff = (xelval) maxval * 0.0031308 + 0.5;
-    double const linearCompression = 
+    double const linearCompression =
         0.0031308 / (1.055 * pow(0.0031308, oneOverGamma) - 0.055);
     double const maxvalScaler = (double)newMaxval/maxval;
 
-    for (i = 0; i <= linearCutoff / linearCompression; ++i) 
+    for (i = 0; i <= linearCutoff / linearCompression; ++i)
         table[i] = i * linearCompression * maxvalScaler + 0.5;
     for (; i <= maxval; ++i) {
         double const normalized = ((double) i) / maxval;
             /* Xel sample value normalized to 0..1 */
         double const v = pow((normalized + 0.055) / 1.055, gamma);
-        table[i] = MIN((xelval)(v * newMaxval + 0.5), newMaxval);  
+        table[i] = MIN((xelval)(v * newMaxval + 0.5), newMaxval);
             /* denormalize, round, and clip */
     }
 }
@@ -491,11 +491,11 @@ buildBt709ToSrgbGamma(xelval       table[],
     */
 
     xelval const linearCutoff709 = (xelval) (maxval * 0.018 + 0.5);
-    double const linearCompression709 = 
+    double const linearCompression709 =
         0.018 / (1.099 * pow(0.018, oneOverGamma709) - 0.099);
 
     double const linearCutoffSrgb = 0.0031308;
-    double const linearExpansionSrgb = 
+    double const linearExpansionSrgb =
         (1.055 * pow(0.0031308, oneOverGammaSrgb) - 0.055) / 0.0031308;
 
     xelval i;
@@ -549,11 +549,11 @@ buildSrgbToBt709Gamma(xelval       table[],
        unlike the popular pure exponential gamma transfer function.
     */
     xelval const linearCutoffSrgb = (xelval) maxval * 0.0031308 + 0.5;
-    double const linearCompressionSrgb = 
+    double const linearCompressionSrgb =
         0.0031308 / (1.055 * pow(0.0031308, oneOverGammaSrgb) - 0.055);
 
     xelval const linearCutoff709 = (xelval) (maxval * 0.018 + 0.5);
-    double const linearExpansion709 = 
+    double const linearExpansion709 =
         (1.099 * pow(0.018, oneOverGamma709) - 0.099) / 0.018;
 
     xelval i;
@@ -588,8 +588,8 @@ static void
 createGammaTables(enum transferFunction const transferFunction,
                   xelval                const maxval,
                   xelval                const newMaxval,
-                  double                const rgamma, 
-                  double                const ggamma, 
+                  double                const rgamma,
+                  double                const ggamma,
                   double                const bgamma,
                   xelval **             const rtableP,
                   xelval **             const gtableP,
@@ -677,7 +677,7 @@ convertRaster(FILE *   const ifP,
     for (row = 0; row < rows; ++row) {
         pnm_readpnmrow(ifP, xelrow, cols, maxval, format);
 
-        pnm_promoteformatrow(xelrow, cols, maxval, format, 
+        pnm_promoteformatrow(xelrow, cols, maxval, format,
                              maxval, outputFormat);
 
         switch (PNM_FORMAT_TYPE(outputFormat)) {
@@ -730,10 +730,10 @@ main(int argc, char *argv[]) {
 
     if (PNM_FORMAT_TYPE(format) == PPM_TYPE)
         outputFormat = PPM_TYPE;
-    else if (cmdline.rgamma != cmdline.ggamma 
-             || cmdline.ggamma != cmdline.bgamma) 
+    else if (cmdline.rgamma != cmdline.ggamma
+             || cmdline.ggamma != cmdline.bgamma)
         outputFormat = PPM_TYPE;
-    else 
+    else
         outputFormat = PGM_TYPE;
 
     if (PNM_FORMAT_TYPE(format) != outputFormat) {
diff --git a/editor/pnminvert.c b/editor/pnminvert.c
index d4aad503..208b8bfa 100644
--- a/editor/pnminvert.c
+++ b/editor/pnminvert.c
@@ -38,18 +38,18 @@ invertPbm(FILE * const ifP,
 -----------------------------------------------------------------------------*/
     int const colChars = pbm_packed_bytes(cols);
 
-    unsigned char * bitrow; 
+    unsigned char * bitrow;
     unsigned int row;
-    
+
     bitrow = pbm_allocrow_packed(cols);
-    
+
     for (row = 0; row < rows; ++row) {
         unsigned int colChar;
-        
+
         pbm_readpbmrow_packed(ifP, bitrow, cols, format);
         for (colChar = 0; colChar < colChars; ++colChar)
             bitrow[colChar] = ~ bitrow[colChar];
-        
+
         /* Clean off remainder of fractional last character and write */
         pbm_cleanrowend_packed(bitrow, cols);
         pbm_writepbmrow_packed(ofP, bitrow, cols, 0);
@@ -69,15 +69,15 @@ invertPnm(FILE * const ifP,
 
     xel * xelrow;
     unsigned int row;
-    
+
     xelrow = pnm_allocrow(cols);
-    
+
     for (row = 0; row < rows; ++row) {
         unsigned int col;
         pnm_readpnmrow(ifP, xelrow, cols, maxval, format);
         for (col = 0; col < cols; ++col)
             pnm_invertxel(&xelrow[col], maxval, format);
-        
+
         pnm_writepnmrow(ofP, xelrow, cols, maxval, format, 0);
     }
     pnm_freerow(xelrow);
@@ -103,7 +103,7 @@ main(int argc, char * argv[]) {
 
     pnm_readpnminit(ifP, &cols, &rows, &maxval, &format);
     pnm_writepnminit(stdout, cols, rows, maxval, format, 0);
-    
+
     if (PNM_FORMAT_TYPE(format) == PBM_TYPE)
         /* Take fast path */
         invertPbm(ifP, stdout, cols, rows, format);
@@ -113,7 +113,7 @@ main(int argc, char * argv[]) {
 
     pm_close(ifP);
     pm_close(stdout);
-    
+
     return 0;
 }
 
diff --git a/editor/pnmmontage.c b/editor/pnmmontage.c
index 7bd00dbe..c6f03ead 100644
--- a/editor/pnmmontage.c
+++ b/editor/pnmmontage.c
@@ -42,7 +42,7 @@ parseCommandLine(int argc, const char ** argv,
                  struct CmdlineInfo * const cmdlineP) {
 /*----------------------------------------------------------------------------
    parse program command line described in Unix standard form by argc
-   and argv.  Return the information in the options as *cmdlineP.  
+   and argv.  Return the information in the options as *cmdlineP.
 
    If command line is internally inconsistent (invalid options, etc.),
    issue error message to stderr and abort program.
@@ -59,7 +59,7 @@ parseCommandLine(int argc, const char ** argv,
     unsigned int q[10];
 
     MALLOCARRAY_NOFAIL(option_def, 100);
-  
+
     option_def_index = 0;   /* incremented by OPTENTRY */
     OPTENT3( 0,  "data",    OPT_STRING, &cmdlineP->data, &dataSpec, 0);
     OPTENT3( 0,  "header",  OPT_STRING, &cmdlineP->header, &headerSpec, 0);
@@ -93,7 +93,7 @@ parseCommandLine(int argc, const char ** argv,
     if (!qualitySpec)
         cmdlineP->quality = 200;
 
-    
+
     /* cmdlineP->quality2 is the greatest number from the --1, --2, etc.
        options, or 5 if none of those are specified.
     */
@@ -150,7 +150,7 @@ lr(Rectangle const r) {
 
 
 
-static Factorset 
+static Factorset
 factor(unsigned int const arg) {
 /*----------------------------------------------------------------------------
    The prime factors of 'arg'.
@@ -177,7 +177,7 @@ factor(unsigned int const arg) {
 
 
 
-static int 
+static int
 gcf(unsigned int const n,
     unsigned int const m) {
 /*----------------------------------------------------------------------------
@@ -236,12 +236,12 @@ collides(Rectangle         const test,
 
 
 
-static void 
+static void
 recursefindpack(Rectangle *    const current,
                 Coord          const currentsz,
                 Coord *        const best,
                 unsigned int   const minarea,
-                unsigned int * const maxareaP, 
+                unsigned int * const maxareaP,
                 unsigned int   const depth,
                 unsigned int   const n,
                 unsigned int   const xinc,
@@ -295,7 +295,7 @@ recursefindpack(Rectangle *    const current,
 
 
 
-static void 
+static void
 findpack(struct pam * const imgs,
          unsigned int const imgCt,
          Coord **     const coordsP,
@@ -312,7 +312,7 @@ findpack(struct pam * const imgs,
     Coord c;
 
     MALLOCARRAY(coords, imgCt);
-  
+
     if (!coords)
         pm_error("Out of memory allocating %u-element coords array", imgCt);
 
@@ -356,12 +356,12 @@ findpack(struct pam * const imgs,
 
 
 
-static void 
+static void
 adjustDepth(tuple *            const tuplerow,
             const struct pam * const inpamP,
             const struct pam * const outpamP,
             Coord              const coord) {
-    
+
     if (inpamP->depth < outpamP->depth) {
         unsigned int i;
         for (i = coord.x; i < coord.x + inpamP->width; ++i) {
@@ -374,7 +374,7 @@ adjustDepth(tuple *            const tuplerow,
 
 
 
-static void 
+static void
 adjustMaxval(tuple *            const tuplerow,
              const struct pam * const inpamP,
              const struct pam * const outpamP,
@@ -420,14 +420,14 @@ writePam(struct pam *       const outpamP,
 -----------------------------------------------------------------------------*/
     tuple * tuplerow;
     unsigned int row;  /* Row number in the output image */
-  
+
     pnm_writepaminit(outpamP);
 
     tuplerow = pnm_allocpamrow(outpamP);
 
     for (row = 0; row < outpamP->height; ++row) {
         unsigned int imgIdx;
-        
+
         makeRowBlack(outpamP, tuplerow);  /* initial value */
 
         for (imgIdx = 0; imgIdx < imgCt; ++imgIdx) {
@@ -494,13 +494,13 @@ writeHeader(FILE * const headerFileP,
         struct pam const img = imgs[i];
 
         unsigned int j;
-        
+
         *strchr(buffer, '.') = 0;
         for (j = 0; buffer[j]; ++j) {
             if (ISLOWER(buffer[j]))
                 buffer[j] = TOUPPER(buffer[j]);
         }
-        fprintf(headerFileP, "#define %s%sX %u\n", 
+        fprintf(headerFileP, "#define %s%sX %u\n",
                 prefix, buffer, coord.x);
 
         fprintf(headerFileP, "#define %s%sY %u\n",
@@ -538,7 +538,7 @@ sortImagesByArea(unsigned int  const nfiles,
 
                 struct pam p;
                 const char * c;
-                
+
                 p = imgs[i]; imgs[i] = imgs[j]; imgs[j] = p;
                 c = names[i]; names[i] = names[j]; names[j] = c;
             }
@@ -600,7 +600,7 @@ computeOutputDimensions(int *              const widthP,
 
     widthGuess  = 0;  /* initial value */
     heightGuess = 0;  /* initial value */
-    
+
     for (i = 0; i < nfiles; ++i) {
         widthGuess  = MAX(widthGuess,  imgs[i].width  + coords[i].x);
         heightGuess = MAX(heightGuess, imgs[i].height + coords[i].y);
@@ -622,8 +622,8 @@ qfactorFromQuality(unsigned int const quality,
     case 0: case 1:
         qfactor = quality;
         break;
-    case 2: case 3: case 4: case 5: case 6: 
-        qfactor = 100 * (8 - quality2); 
+    case 2: case 3: case 4: case 5: case 6:
+        qfactor = 100 * (8 - quality2);
         break;
     case 7: qfactor = 150; break;
     case 8: qfactor = 125; break;
@@ -709,7 +709,7 @@ closeFiles(const struct pam * const imgPam,
 
 
 
-int 
+int
 main(int argc, const char **argv) {
 
     struct CmdlineInfo cmdline;
@@ -749,7 +749,7 @@ main(int argc, const char **argv) {
     pnm_setminallocationdepth(&outimg, outimg.depth);
     outimg.plainformat = false;
     outimg.file = stdout;
- 
+
     writePam(&outimg, fileCt, coords, imgPam);
 
     if (dataFileP)
diff --git a/editor/pnmnlfilt.c b/editor/pnmnlfilt.c
index bcb3680d..906ce460 100644
--- a/editor/pnmnlfilt.c
+++ b/editor/pnmnlfilt.c
@@ -990,7 +990,7 @@ main(int argc, char *argv[]) {
 
     FILE * ifP;
     struct cmdlineInfo cmdline;
-	int eof;  /* We've hit the end of the input stream */
+        int eof;  /* We've hit the end of the input stream */
     unsigned int imageSeq;  /* Sequence number of image, starting from 0 */
 
     pnm_init(&argc, argv);
diff --git a/editor/pnmrotate.c b/editor/pnmrotate.c
index 44952a59..b034d395 100644
--- a/editor/pnmrotate.c
+++ b/editor/pnmrotate.c
@@ -40,7 +40,7 @@ struct cmdlineInfo {
 enum rotationDirection {CLOCKWISE, COUNTERCLOCKWISE};
 
 struct shearParm {
-    /* These numbers tell how to shear a pixel, but I haven't figured out 
+    /* These numbers tell how to shear a pixel, but I haven't figured out
        yet exactly what each means.
     */
     long fracnew0;
@@ -67,13 +67,13 @@ parseCommandLine(int argc, char ** const argv,
     unsigned int option_def_index;
 
     option_def_index = 0;   /* incremented by OPTENTRY */
-    OPTENT3(0, "background",  OPT_STRING, &cmdlineP->background, 
+    OPTENT3(0, "background",  OPT_STRING, &cmdlineP->background,
             &backgroundSpec,        0);
-    OPTENT3(0, "noantialias", OPT_FLAG,   NULL, 
+    OPTENT3(0, "noantialias", OPT_FLAG,   NULL,
             &cmdlineP->noantialias, 0);
-    OPTENT3(0, "keeptemp",    OPT_FLAG,   NULL, 
+    OPTENT3(0, "keeptemp",    OPT_FLAG,   NULL,
             &cmdlineP->keeptemp,    0);
-    OPTENT3(0, "verbose",     OPT_FLAG,   NULL, 
+    OPTENT3(0, "verbose",     OPT_FLAG,   NULL,
             &cmdlineP->verbose,     0);
 
     opt.opt_table = option_def;
@@ -110,7 +110,7 @@ parseCommandLine(int argc, char ** const argv,
                 cmdlineP->inputFilespec = "-";
             else {
                 cmdlineP->inputFilespec = argv[2];
-                
+
                 if (argc-1 > 2)
                     pm_error("Program takes at most two arguments "
                              "(angle and filename).  You specified %d",
@@ -139,10 +139,10 @@ storeImage(const char * const fileName,
     pm_close(ofP);
 }
 
-  
+
 
 static void
-computeNewFormat(bool     const antialias, 
+computeNewFormat(bool     const antialias,
                  int      const format,
                  xelval   const maxval,
                  int *    const newformatP,
@@ -172,7 +172,7 @@ backgroundColor(const char * const backgroundColorName,
 
     if (backgroundColorName) {
         retval = pnm_parsecolorxel(backgroundColorName, maxval, format);
-    } else 
+    } else
         retval = pnm_backgroundxelrow(topRow, cols, maxval, format);
 
     return retval;
@@ -190,9 +190,9 @@ reportBackground(xel const bgColor) {
 
 
 static void
-shearX(xel * const inRow, 
-       xel * const outRow, 
-       int   const cols, 
+shearX(xel * const inRow,
+       xel * const outRow,
+       int   const cols,
        int   const format,
        xel   const bgxel,
        bool  const antialias,
@@ -210,9 +210,9 @@ shearX(xel * const inRow,
    We shift the row on a background of color 'bgxel'.
 
    The output row has the same format and maxval as the input.
-   
+
    'shiftAmount' may not be negative.
-   
+
    'shiftAmount' can be fractional, so we either just go by the
    nearest integer value or mix pixels to achieve the shift, depending
    on 'antialias'.
@@ -230,7 +230,7 @@ shearX(xel * const inRow,
 
         for (col = 0; col < newcols; ++col)
             outRow[col] = bgxel;
-            
+
         prevxel = bgxel;
         for (col = 0, nxP = &(outRow[shiftWhole]);
              col < cols; ++col, ++nxP) {
@@ -240,21 +240,21 @@ shearX(xel * const inRow,
             switch (PNM_FORMAT_TYPE(format)) {
             case PPM_TYPE:
                 PPM_ASSIGN(*nxP,
-                           (fracShift * PPM_GETR(prevxel) 
-                            + omfracShift * PPM_GETR(p) 
+                           (fracShift * PPM_GETR(prevxel)
+                            + omfracShift * PPM_GETR(p)
                             + HALFSCALE) / SCALE,
-                           (fracShift * PPM_GETG(prevxel) 
-                            + omfracShift * PPM_GETG(p) 
+                           (fracShift * PPM_GETG(prevxel)
+                            + omfracShift * PPM_GETG(p)
                             + HALFSCALE) / SCALE,
-                           (fracShift * PPM_GETB(prevxel) 
-                            + omfracShift * PPM_GETB(p) 
+                           (fracShift * PPM_GETB(prevxel)
+                            + omfracShift * PPM_GETB(p)
                             + HALFSCALE) / SCALE );
                 break;
-                
+
             default:
                 PNM_ASSIGN1(*nxP,
-                            (fracShift * PNM_GET1(prevxel) 
-                             + omfracShift * PNM_GET1(p) 
+                            (fracShift * PNM_GET1(prevxel)
+                             + omfracShift * PNM_GET1(p)
                              + HALFSCALE) / SCALE );
                 break;
             }
@@ -264,21 +264,21 @@ shearX(xel * const inRow,
             switch (PNM_FORMAT_TYPE(format)) {
             case PPM_TYPE:
                 PPM_ASSIGN(*nxP,
-                           (fracShift * PPM_GETR(prevxel) 
-                            + omfracShift * PPM_GETR(bgxel) 
+                           (fracShift * PPM_GETR(prevxel)
+                            + omfracShift * PPM_GETR(bgxel)
                             + HALFSCALE) / SCALE,
-                           (fracShift * PPM_GETG(prevxel) 
-                            + omfracShift * PPM_GETG(bgxel) 
+                           (fracShift * PPM_GETG(prevxel)
+                            + omfracShift * PPM_GETG(bgxel)
                             + HALFSCALE) / SCALE,
-                           (fracShift * PPM_GETB(prevxel) 
-                            + omfracShift * PPM_GETB(bgxel) 
+                           (fracShift * PPM_GETB(prevxel)
+                            + omfracShift * PPM_GETB(bgxel)
                             + HALFSCALE) / SCALE );
                 break;
-                    
+
             default:
                 PNM_ASSIGN1(*nxP,
-                            (fracShift * PNM_GET1(prevxel) 
-                             + omfracShift * PNM_GET1(bgxel) 
+                            (fracShift * PNM_GET1(prevxel)
+                             + omfracShift * PNM_GET1(bgxel)
                              + HALFSCALE) / SCALE );
                 break;
             }
@@ -289,14 +289,14 @@ shearX(xel * const inRow,
         unsigned int outcol;
 
         outcol = 0;  /* initial value */
-        
+
         for (col = 0; col < shiftCols; ++col)
             outRow[outcol++] = bgxel;
         for (col = 0; col < cols; ++col)
             outRow[outcol++] = inRow[col];
         for (col = shiftCols + cols; col < newcols; ++col)
             outRow[outcol++] = bgxel;
-        
+
         assert(outcol == newcols);
     }
 }
@@ -332,7 +332,7 @@ shearXFromInputFile(FILE *                 const ifP,
 -----------------------------------------------------------------------------*/
     unsigned int const maxShear = (rows - 0.5) * xshearfac + 0.5;
     unsigned int const newcols = cols + maxShear;
-    
+
     xel ** shearedXels;
     xel * xelrow;
     xel bgColor;
@@ -348,13 +348,13 @@ shearXFromInputFile(FILE *                 const ifP,
            the right pixel.  We use the distance of the center of this
            pixel from the relevant edge to compute shift amount:
         */
-        float const xDistance = 
+        float const xDistance =
             (direction == COUNTERCLOCKWISE ? row + 0.5 : (rows-0.5 - row));
         float const shiftAmount = xshearfac * xDistance;
 
         pnm_readpnmrow(ifP, xelrow, cols, maxval, format);
 
-        pnm_promoteformatrow(xelrow, cols, maxval, format, 
+        pnm_promoteformatrow(xelrow, cols, maxval, format,
                              newmaxval, newformat);
 
         if (row == 0)
@@ -375,7 +375,7 @@ shearXFromInputFile(FILE *                 const ifP,
 
 
 
-static void 
+static void
 shearYNoAntialias(xel **           const inxels,
                   xel **           const outxels,
                   int              const cols,
@@ -421,7 +421,7 @@ shearYNoAntialias(xel **           const inxels,
 
 
 static void
-shearYColAntialias(xel ** const inxels, 
+shearYColAntialias(xel ** const inxels,
                    xel ** const outxels,
                    int    const col,
                    int    const inrows,
@@ -435,12 +435,12 @@ shearYColAntialias(xel ** const inxels,
     long const fracnew0   = shearParm[col].fracnew0;
     long const omfracnew0 = shearParm[col].omfracnew0;
     int  const shiftWhole = shearParm[col].shiftWhole;
-        
+
     int outrow;
 
     xel prevxel;
     int inrow;
-        
+
     /* Initialize everything to background color */
     for (outrow = 0; outrow < outrows; ++outrow)
         outxels[outrow][col] = bgxel;
@@ -455,21 +455,21 @@ shearYColAntialias(xel ** const inxels,
             switch ( PNM_FORMAT_TYPE(format) ) {
             case PPM_TYPE:
                 PPM_ASSIGN(*nxP,
-                           (fracnew0 * PPM_GETR(prevxel) 
-                            + omfracnew0 * PPM_GETR(x) 
+                           (fracnew0 * PPM_GETR(prevxel)
+                            + omfracnew0 * PPM_GETR(x)
                             + HALFSCALE) / SCALE,
-                           (fracnew0 * PPM_GETG(prevxel) 
-                            + omfracnew0 * PPM_GETG(x) 
+                           (fracnew0 * PPM_GETG(prevxel)
+                            + omfracnew0 * PPM_GETG(x)
                             + HALFSCALE) / SCALE,
-                           (fracnew0 * PPM_GETB(prevxel) 
-                            + omfracnew0 * PPM_GETB(x) 
+                           (fracnew0 * PPM_GETB(prevxel)
+                            + omfracnew0 * PPM_GETB(x)
                             + HALFSCALE) / SCALE );
                 break;
-                        
+
             default:
                 PNM_ASSIGN1(*nxP,
-                            (fracnew0 * PNM_GET1(prevxel) 
-                             + omfracnew0 * PNM_GET1(x) 
+                            (fracnew0 * PNM_GET1(prevxel)
+                             + omfracnew0 * PNM_GET1(x)
                              + HALFSCALE) / SCALE );
                 break;
             }
@@ -481,26 +481,26 @@ shearYColAntialias(xel ** const inxels,
         switch (PNM_FORMAT_TYPE(format)) {
         case PPM_TYPE:
             PPM_ASSIGN(*nxP,
-                       (fracnew0 * PPM_GETR(prevxel) 
-                        + omfracnew0 * PPM_GETR(bgxel) 
+                       (fracnew0 * PPM_GETR(prevxel)
+                        + omfracnew0 * PPM_GETR(bgxel)
                         + HALFSCALE) / SCALE,
-                       (fracnew0 * PPM_GETG(prevxel) 
-                        + omfracnew0 * PPM_GETG(bgxel) 
+                       (fracnew0 * PPM_GETG(prevxel)
+                        + omfracnew0 * PPM_GETG(bgxel)
                         + HALFSCALE) / SCALE,
-                       (fracnew0 * PPM_GETB(prevxel) 
-                        + omfracnew0 * PPM_GETB(bgxel) 
+                       (fracnew0 * PPM_GETB(prevxel)
+                        + omfracnew0 * PPM_GETB(bgxel)
                         + HALFSCALE) / SCALE);
             break;
-                
+
         default:
             PNM_ASSIGN1(*nxP,
-                        (fracnew0 * PNM_GET1(prevxel) 
-                         + omfracnew0 * PNM_GET1(bgxel) 
+                        (fracnew0 * PNM_GET1(prevxel)
+                         + omfracnew0 * PNM_GET1(bgxel)
                          + HALFSCALE) / SCALE);
             break;
         }
     }
-} 
+}
 
 
 
@@ -516,14 +516,14 @@ shearImageY(xel **                 const inxels,
             int                    const yshearjunk,
             xel ***                const outxelsP,
             unsigned int *         const outrowsP) {
-    
+
     unsigned int const maxShear = (cols - 0.5) * yshearfac + 0.5;
     unsigned int const outrows = inrows + maxShear - 2 * yshearjunk;
 
     struct shearParm * shearParm;  /* malloc'ed */
     int col;
     xel ** outxels;
-    
+
     outxels = pnm_allocarray(cols, outrows);
 
     MALLOCARRAY(shearParm, cols);
@@ -536,7 +536,7 @@ shearImageY(xel **                 const inxels,
            the bottom pixel.  We use the distance of the center of this
            pixel from the relevant edge to compute shift amount:
         */
-        float const yDistance = 
+        float const yDistance =
             (direction == CLOCKWISE ? col + 0.5 : (cols-0.5 - col));
         float const shiftAmount = yshearfac * yDistance;
 
@@ -552,12 +552,12 @@ shearImageY(xel **                 const inxels,
         /* TODO: do this row-by-row, same as for noantialias, to save
            real memory.
         */
-        for (col = 0; col < cols; ++col) 
-            shearYColAntialias(inxels, outxels, col, inrows, outrows, format, 
+        for (col = 0; col < cols; ++col)
+            shearYColAntialias(inxels, outxels, col, inrows, outrows, format,
                                bgxel, shearParm);
     }
     free(shearParm);
-    
+
     *outxelsP = outxels;
     *outrowsP = outrows;
 }
@@ -565,9 +565,9 @@ shearImageY(xel **                 const inxels,
 
 
 static void
-shearFinal(xel * const inRow, 
-           xel * const outRow, 
-           int   const incols, 
+shearFinal(xel * const inRow,
+           xel * const outRow,
+           int   const incols,
            int   const outcols,
            int   const format,
            xel   const bgxel,
@@ -585,8 +585,8 @@ shearFinal(xel * const inRow,
     }
 
     if (antialias) {
-        long const fracnew0   = (shiftAmount - (int) shiftAmount) * SCALE; 
-        long const omfracnew0 = SCALE - fracnew0; 
+        long const fracnew0   = (shiftAmount - (int) shiftAmount) * SCALE;
+        long const omfracnew0 = SCALE - fracnew0;
         unsigned int const shiftWhole = (int)shiftAmount - x2shearjunk;
 
         xel prevxel;
@@ -601,21 +601,21 @@ shearFinal(xel * const inRow,
                 switch (PNM_FORMAT_TYPE(format)) {
                 case PPM_TYPE:
                     PPM_ASSIGN(*nxP,
-                               (fracnew0 * PPM_GETR(prevxel) 
-                                + omfracnew0 * PPM_GETR(x) 
+                               (fracnew0 * PPM_GETR(prevxel)
+                                + omfracnew0 * PPM_GETR(x)
                                 + HALFSCALE) / SCALE,
-                               (fracnew0 * PPM_GETG(prevxel) 
-                                + omfracnew0 * PPM_GETG(x) 
+                               (fracnew0 * PPM_GETG(prevxel)
+                                + omfracnew0 * PPM_GETG(x)
                                 + HALFSCALE) / SCALE,
-                               (fracnew0 * PPM_GETB(prevxel) 
-                                + omfracnew0 * PPM_GETB(x) 
+                               (fracnew0 * PPM_GETB(prevxel)
+                                + omfracnew0 * PPM_GETB(x)
                                 + HALFSCALE) / SCALE);
                     break;
-                    
+
                 default:
                     PNM_ASSIGN1(*nxP,
-                                (fracnew0 * PNM_GET1(prevxel) 
-                                 + omfracnew0 * PNM_GET1(x) 
+                                (fracnew0 * PNM_GET1(prevxel)
+                                 + omfracnew0 * PNM_GET1(x)
                                  + HALFSCALE) / SCALE );
                     break;
                 }
@@ -627,21 +627,21 @@ shearFinal(xel * const inRow,
             switch (PNM_FORMAT_TYPE(format)) {
             case PPM_TYPE:
                 PPM_ASSIGN(*nxP,
-                           (fracnew0 * PPM_GETR(prevxel) 
-                            + omfracnew0 * PPM_GETR(bgxel) 
+                           (fracnew0 * PPM_GETR(prevxel)
+                            + omfracnew0 * PPM_GETR(bgxel)
                             + HALFSCALE) / SCALE,
-                           (fracnew0 * PPM_GETG(prevxel) 
-                            + omfracnew0 * PPM_GETG(bgxel) 
+                           (fracnew0 * PPM_GETG(prevxel)
+                            + omfracnew0 * PPM_GETG(bgxel)
                             + HALFSCALE) / SCALE,
-                           (fracnew0 * PPM_GETB(prevxel) 
-                            + omfracnew0 * PPM_GETB(bgxel) 
+                           (fracnew0 * PPM_GETB(prevxel)
+                            + omfracnew0 * PPM_GETB(bgxel)
                             + HALFSCALE) / SCALE);
                 break;
-                
+
             default:
                 PNM_ASSIGN1(*nxP,
-                            (fracnew0 * PNM_GET1(prevxel) 
-                             + omfracnew0 * PNM_GET1(bgxel) 
+                            (fracnew0 * PNM_GET1(prevxel)
+                             + omfracnew0 * PNM_GET1(bgxel)
                              + HALFSCALE) / SCALE );
                 break;
             }
@@ -664,7 +664,7 @@ shearFinal(xel * const inRow,
 static void
 shearXToOutputFile(FILE *                 const ofP,
                    xel **                 const xels,
-                   unsigned int           const cols, 
+                   unsigned int           const cols,
                    unsigned int           const rows,
                    xelval                 const maxval,
                    int                    const format,
@@ -688,7 +688,7 @@ shearXToOutputFile(FILE *                 const ofP,
 
     unsigned int row;
     xel * xelrow;
-    
+
     pnm_writepnminit(ofP, newcols, rows, maxval, format, 0);
 
     xelrow = pnm_allocrow(newcols);
@@ -699,11 +699,11 @@ shearXToOutputFile(FILE *                 const ofP,
            the right pixel.  We use the distance of the center of this
            pixel from the relevant edge to compute shift amount:
         */
-        float const xDistance = 
+        float const xDistance =
             (direction == COUNTERCLOCKWISE ? row + 0.5 : (rows-0.5 - row));
         float const shiftAmount = xshearfac * xDistance;
 
-        shearFinal(xels[row], xelrow, cols, newcols, format, 
+        shearFinal(xels[row], xelrow, cols, newcols, format,
                    bgColor, antialias, shiftAmount, x2shearjunk);
 
         pnm_writepnmrow(ofP, xelrow, newcols, maxval, format, 0);
@@ -714,7 +714,7 @@ shearXToOutputFile(FILE *                 const ofP,
 
 
 int
-main(int argc, char *argv[]) { 
+main(int argc, char *argv[]) {
 
     struct cmdlineInfo cmdline;
     FILE * ifP;
@@ -738,8 +738,8 @@ main(int argc, char *argv[]) {
     ifP = pm_openr(cmdline.inputFilespec);
 
     pnm_readpnminit(ifP, &cols, &rows, &maxval, &format);
-    
-    computeNewFormat(!cmdline.noantialias, format, maxval, 
+
+    computeNewFormat(!cmdline.noantialias, format, maxval,
                      &newformat, &newmaxval);
 
     xshearfac = fabs(tan(cmdline.angle / 2.0));
@@ -755,7 +755,7 @@ main(int argc, char *argv[]) {
                         newmaxval, newformat,
                         !cmdline.noantialias, cmdline.background,
                         &shear1xels, &shear1Cols, &bgColor);
-    
+
     pm_close(ifP);
 
     if (cmdline.verbose)
@@ -777,16 +777,16 @@ main(int argc, char *argv[]) {
     pnm_freearray(shear1xels, rows);
 
     if (cmdline.keeptemp)
-        storeImage("pnmrotate_stage2.pnm", shear2xels, shear1Cols, newrows, 
+        storeImage("pnmrotate_stage2.pnm", shear2xels, shear1Cols, newrows,
                    newmaxval, newformat);
 
     shearXToOutputFile(stdout, shear2xels, shear1Cols, newrows,
                        newmaxval, newformat,
-                       direction, xshearfac, x2shearjunk, 
+                       direction, xshearfac, x2shearjunk,
                        bgColor, !cmdline.noantialias);
 
     pnm_freearray(shear2xels, newrows);
     pm_close(stdout);
-    
+
     return 0;
 }
diff --git a/editor/pnmscalefixed.c b/editor/pnmscalefixed.c
index 884ca315..7d33a9c2 100644
--- a/editor/pnmscalefixed.c
+++ b/editor/pnmscalefixed.c
@@ -15,10 +15,10 @@
 **               - added -reduce N to allow scaling by integer value
 **                 in this case, scale_comp becomes 1/N and x/yscale
 **                 get set as they should
-**    
+**
 **
 */
- 
+
 #include <math.h>
 
 #include "pm_c_util.h"
@@ -27,12 +27,12 @@
 #include "pnm.h"
 
 /* The pnm library allows us to code this program without branching cases
-   for PGM and PPM, but we do the branch anyway to speed up processing of 
+   for PGM and PPM, but we do the branch anyway to speed up processing of
    PGM images.
 */
 
 /* We do all our arithmetic in integers.  In order not to get killed by the
-   rounding, we scale every number up by the factor SCALE, do the 
+   rounding, we scale every number up by the factor SCALE, do the
    arithmetic, then scale it back down.
    */
 #define SCALE 4096
@@ -118,16 +118,16 @@ parse_command_line(int argc, char ** argv,
         pm_error("Cannot specify both -xsize/width and -xscale.");
     if (ysize != -1 && yscale != -1)
         pm_error("Cannot specify both -ysize/height and -yscale.");
-    
-    if (xysize && 
-        (xsize != -1 || xscale != -1 || ysize != -1 || yscale != -1 || 
+
+    if (xysize &&
+        (xsize != -1 || xscale != -1 || ysize != -1 || yscale != -1 ||
          reduce != -1 || pixels != -1) )
         pm_error("Cannot specify -xysize with other dimension options.");
-    if (pixels != -1 && 
+    if (pixels != -1 &&
         (xsize != -1 || xscale != -1 || ysize != -1 || yscale != -1 ||
          reduce != -1) )
         pm_error("Cannot specify -pixels with other dimension options.");
-    if (reduce != -1 && 
+    if (reduce != -1 &&
         (xsize != -1 || xscale != -1 || ysize != -1 || yscale != -1) )
         pm_error("Cannot specify -reduce with other dimension options.");
 
@@ -148,7 +148,7 @@ parse_command_line(int argc, char ** argv,
         else {
             cmdline_p->xbox = atoi(argv[1]);
             cmdline_p->ybox = atoi(argv[2]);
-            
+
             if (argc-1 < 3)
                 cmdline_p->input_filespec = "-";
             else
@@ -157,7 +157,7 @@ parse_command_line(int argc, char ** argv,
     } else {
         cmdline_p->xbox = 0;
         cmdline_p->ybox = 0;
-        
+
         if (xsize == -1 && xscale == -1 && ysize == -1 && yscale == -1
             && pixels == -1 && reduce == -1) {
             /* parameters are scale factor and optional filespec */
@@ -187,7 +187,7 @@ parse_command_line(int argc, char ** argv,
 
             if (reduce != -1) {
                 scale_parm = ((double) 1.0) / ((double) reduce);
-                pm_message("reducing by %d gives scale factor of %f.", 
+                pm_message("reducing by %d gives scale factor of %f.",
                            reduce, scale_parm);
             } else
                 scale_parm = 0.0;
@@ -210,7 +210,7 @@ parse_command_line(int argc, char ** argv,
 
 
 static void
-compute_output_dimensions(const struct cmdline_info cmdline, 
+compute_output_dimensions(const struct cmdline_info cmdline,
                           const int rows, const int cols,
                           int * newrowsP, int * newcolsP) {
 
@@ -226,9 +226,9 @@ compute_output_dimensions(const struct cmdline_info cmdline,
         }
     } else if (cmdline.xbox) {
         const double aspect_ratio = (float) cols / (float) rows;
-        const double box_aspect_ratio = 
+        const double box_aspect_ratio =
             (float) cmdline.xbox / (float) cmdline.ybox;
-        
+
         if (box_aspect_ratio > aspect_ratio) {
             *newrowsP = cmdline.ybox;
             *newcolsP = *newrowsP * aspect_ratio + 0.5;
@@ -254,24 +254,24 @@ compute_output_dimensions(const struct cmdline_info cmdline,
             *newrowsP = rows * ((float) cmdline.xsize/cols) +.5;
         else
             *newrowsP = rows;
-    }    
+    }
 
-    /* If the calculations above yielded (because of rounding) a zero 
+    /* If the calculations above yielded (because of rounding) a zero
        dimension, we fudge it up to 1.  We do this rather than considering
-       it a specification error (and dying) because it's friendlier to 
+       it a specification error (and dying) because it's friendlier to
        automated processes that work on arbitrary input.  It saves them
        having to check their numbers to avoid catastrophe.
     */
 
     if (*newcolsP < 1) *newcolsP = 1;
     if (*newrowsP < 1) *newrowsP = 1;
-}        
+}
 
 
 
 static void
-horizontal_scale(const xel inputxelrow[], xel newxelrow[], 
-                 const int cols, const int newcols, const long sxscale, 
+horizontal_scale(const xel inputxelrow[], xel newxelrow[],
+                 const int cols, const int newcols, const long sxscale,
                  const int format, const xelval maxval,
                  int * stretchP) {
 /*----------------------------------------------------------------------------
@@ -282,14 +282,14 @@ horizontal_scale(const xel inputxelrow[], xel newxelrow[],
    'format' and 'maxval' describe the Netpbm format of the both input and
    output rows.
 
-   *stretchP is the number of columns (could be fractional) on the right 
+   *stretchP is the number of columns (could be fractional) on the right
    that we had to fill by stretching because of rounding problems.
 -----------------------------------------------------------------------------*/
     long r, g, b;
     long fraccoltofill, fraccolleft;
     unsigned int col;
     unsigned int newcol;
-    
+
     newcol = 0;
     fraccoltofill = SCALE;  /* Output column is "empty" now */
     r = g = b = 0;          /* initial value */
@@ -302,7 +302,7 @@ horizontal_scale(const xel inputxelrow[], xel newxelrow[],
         */
         while (fraccolleft >= fraccoltofill) {
             /* Generate one output pixel in 'newxelrow'.  It will consist
-               of anything accumulated from prior input pixels in 'r','g', 
+               of anything accumulated from prior input pixels in 'r','g',
                and 'b', plus a fraction of the current input pixel.
             */
             switch (PNM_FORMAT_TYPE(format)) {
@@ -332,7 +332,7 @@ horizontal_scale(const xel inputxelrow[], xel newxelrow[],
             fraccoltofill = SCALE;
             r = g = b = 0;
         }
-        /* There's not enough left in the current input pixel to fill up 
+        /* There's not enough left in the current input pixel to fill up
            a whole output column, so just accumulate the remainder of the
            pixel into the current output column.
         */
@@ -343,7 +343,7 @@ horizontal_scale(const xel inputxelrow[], xel newxelrow[],
                 g += fraccolleft * PPM_GETG(inputxelrow[col]);
                 b += fraccolleft * PPM_GETB(inputxelrow[col]);
                 break;
-                    
+
             default:
                 g += fraccolleft * PNM_GET1(inputxelrow[col]);
                 break;
@@ -356,7 +356,7 @@ horizontal_scale(const xel inputxelrow[], xel newxelrow[],
     while (newcol < newcols) {
         /* We ran out of input columns before we filled up the output
            columns.  This would be because of rounding down.  For small
-           images, we're probably missing only a tiny fraction of a column, 
+           images, we're probably missing only a tiny fraction of a column,
            but for large images, it could be multiple columns.
 
            So we fake the remaining output columns by copying the rightmost
@@ -382,7 +382,7 @@ horizontal_scale(const xel inputxelrow[], xel newxelrow[],
             if ( b > maxval ) b = maxval;
             PPM_ASSIGN(newxelrow[newcol], r, g, b );
             break;
-                
+
         default:
             g += fraccoltofill * PNM_GET1(inputxelrow[cols-1]);
             g += HALFSCALE;  /* for rounding */
@@ -416,7 +416,7 @@ main(int argc, char **argv ) {
     long* gs;
     long* bs;
     int vertical_stretch;
-        /* The number of rows we had to fill by stretching because of 
+        /* The number of rows we had to fill by stretching because of
            rounding error, which made us run out of input rows before we
            had filled up the output rows.
            */
@@ -434,7 +434,7 @@ main(int argc, char **argv ) {
         newformat = PGM_TYPE;
         newmaxval = PGM_MAXMAXVAL;
         pm_message( "promoting from PBM to PGM" );
-	}  else {
+        }  else {
         newformat = format;
         newmaxval = maxval;
     }
@@ -450,14 +450,14 @@ main(int argc, char **argv ) {
     syscale = SCALE * newrows / rows;
 
     if (cmdline.verbose) {
-        pm_message("Scaling by %ld/%d = %f horizontally to %d columns.", 
+        pm_message("Scaling by %ld/%d = %f horizontally to %d columns.",
                    sxscale, SCALE, (float) sxscale/SCALE, newcols );
-        pm_message("Scaling by %ld/%d = %f vertically to %d rows.", 
+        pm_message("Scaling by %ld/%d = %f vertically to %d rows.",
                    syscale, SCALE, (float) syscale/SCALE, newrows);
     }
 
     xelrow = pnm_allocrow(cols);
-    if (newrows == rows)	/* shortcut Y scaling if possible */
+    if (newrows == rows)        /* shortcut Y scaling if possible */
         tempxelrow = xelrow;
     else
         tempxelrow = pnm_allocrow( cols );
@@ -468,18 +468,18 @@ main(int argc, char **argv ) {
     fracrowleft = syscale;
     needtoreadrow = 1;
     for ( col = 0; col < cols; ++col )
-	rs[col] = gs[col] = bs[col] = HALFSCALE;
+        rs[col] = gs[col] = bs[col] = HALFSCALE;
     fracrowtofill = SCALE;
     vertical_stretch = 0;
-    
+
     pnm_writepnminit( stdout, newcols, newrows, newmaxval, newformat, 0 );
     newxelrow = pnm_allocrow( newcols );
-    
+
     for ( row = 0; row < newrows; ++row ) {
         /* First scale vertically from xelrow into tempxelrow. */
         if ( newrows == rows ) { /* shortcut vertical scaling if possible */
             pnm_readpnmrow( ifp, xelrow, cols, newmaxval, format );
-	    } else {
+            } else {
             while ( fracrowleft < fracrowtofill ) {
                 if ( needtoreadrow )
                     if ( rowsread < rows ) {
@@ -513,8 +513,8 @@ main(int argc, char **argv ) {
                 } else {
                     /* We need another input row to fill up this output row,
                        but there aren't any more.  That's because of rounding
-                       down on our scaling arithmetic.  So we go ahead with 
-                       the data from the last row we read, which amounts to 
+                       down on our scaling arithmetic.  So we go ahead with
+                       the data from the last row we read, which amounts to
                        stretching out the last output row.
                     */
                     vertical_stretch += fracrowtofill;
@@ -544,7 +544,7 @@ main(int argc, char **argv ) {
                 for ( col = 0, xP = xelrow, nxP = tempxelrow;
                       col < cols; ++col, ++xP, ++nxP ) {
                     register long g;
-                    
+
                     g = gs[col] + fracrowtofill * PNM_GET1( *xP );
                     g /= SCALE;
                     if ( g > newmaxval ) g = newmaxval;
@@ -559,37 +559,37 @@ main(int argc, char **argv ) {
                 needtoreadrow = 1;
             }
             fracrowtofill = SCALE;
-	    }
+            }
 
         /* Now scale tempxelrow horizontally into newxelrow & write it out. */
 
-        if (newcols == cols)	/* shortcut X scaling if possible */
-            pnm_writepnmrow(stdout, tempxelrow, newcols, 
+        if (newcols == cols)    /* shortcut X scaling if possible */
+            pnm_writepnmrow(stdout, tempxelrow, newcols,
                             newmaxval, newformat, 0);
         else {
             int stretch;
 
-            horizontal_scale(tempxelrow, newxelrow, cols, newcols, sxscale, 
+            horizontal_scale(tempxelrow, newxelrow, cols, newcols, sxscale,
                              format, newmaxval, &stretch);
-            
+
             if (cmdline.verbose && row == 0 && stretch != 0)
                 pm_message("%d/%d = %f right columns filled by stretching "
-                           "because of arithmetic imprecision", 
+                           "because of arithmetic imprecision",
                            stretch, SCALE, (float) stretch/SCALE);
-            
-            pnm_writepnmrow(stdout, newxelrow, newcols, 
+
+            pnm_writepnmrow(stdout, newxelrow, newcols,
                             newmaxval, newformat, 0 );
         }
-	}
+        }
 
     if (cmdline.verbose && vertical_stretch != 0)
         pm_message("%d/%d = %f bottom rows filled by stretching due to "
-                   "arithmetic imprecision", 
-                   vertical_stretch, SCALE, 
+                   "arithmetic imprecision",
+                   vertical_stretch, SCALE,
                    (float) vertical_stretch/SCALE);
-    
+
     pm_close( ifp );
     pm_close( stdout );
-    
+
     exit( 0 );
 }
diff --git a/editor/pnmsmooth.c b/editor/pnmsmooth.c
index a76bd42b..b4dc1b9a 100644
--- a/editor/pnmsmooth.c
+++ b/editor/pnmsmooth.c
@@ -1,4 +1,4 @@
-/* pnmsmooth.c - smooth out an image by replacing each pixel with the 
+/* pnmsmooth.c - smooth out an image by replacing each pixel with the
 **               average of its width x height neighbors.
 **
 ** Version 2.0   December 5, 1994
@@ -51,7 +51,7 @@ parseCommandLine (int argc, const char ** argv,
                   struct cmdlineInfo *cmdlineP) {
 /*----------------------------------------------------------------------------
    parse program command line described in Unix standard form by argc
-   and argv.  Return the information in the options as *cmdlineP.  
+   and argv.  Return the information in the options as *cmdlineP.
 
    If command line is internally inconsistent (invalid options, etc.),
    issue error message to stderr and abort program.
@@ -69,9 +69,9 @@ parseCommandLine (int argc, const char ** argv,
     unsigned int widthSpec, heightSpec, sizeSpec;
 
     MALLOCARRAY_NOFAIL(option_def, 100);
-    
+
     option_def_index = 0;   /* incremented by OPTENT3 */
-    OPTENT3(0,   "dump",          OPT_FLAG,   
+    OPTENT3(0,   "dump",          OPT_FLAG,
             NULL,                       &cmdlineP->dump, 0);
     OPTENT3(0,   "width",         OPT_UINT,
             &cmdlineP->width,           &widthSpec, 0);
@@ -117,7 +117,7 @@ parseCommandLine (int argc, const char ** argv,
         else {
             cmdlineP->width  = atoi(argv[1]);
             cmdlineP->height = atoi(argv[2]);
-            
+
             if (argc-1 < 3)
                 cmdlineP->inputFilespec = "-";
             else
@@ -179,7 +179,7 @@ makeConvolutionKernel(unsigned int const cols,
     else {
         unsigned int row;
         unsigned int cursor;
-     
+
         for (row = 0, cursor = 0; row < rows; ++row) {
             unsigned int col;
 
diff --git a/editor/pnmstitch.c b/editor/pnmstitch.c
index b27445b0..ab21021c 100644
--- a/editor/pnmstitch.c
+++ b/editor/pnmstitch.c
@@ -152,7 +152,7 @@ typedef struct stitcher {
     bool      (* Match)(struct stitcher *me, Image * Left, Image * Right);
         /* Determine the transformation parameters for the stitching.
            I.e. determine the parameters that affect future invocations
-           of the transformation methods below.  You must execute a 
+           of the transformation methods below.  You must execute a
            'Match' before executing any of the transformation methods.
         */
     /*-----------------------------------------------------------------------
@@ -162,7 +162,7 @@ typedef struct stitcher {
 
       If there is no pixel in the left image that contributes to the output
       pixel in question, the methods return column or row numbers outside
-      the bounds of the left image (possibly negative).  Likewise for the 
+      the bounds of the left image (possibly negative).  Likewise for the
       right image.
     */
     float     (* XLeft)(struct stitcher *me, int x, int y);
@@ -225,7 +225,7 @@ parseCommandLine ( int argc, char ** argv,
 {
 /*----------------------------------------------------------------------------
    parse program command line described in Unix standard form by argc
-   and argv.  Return the information in the options as *cmdlineP.  
+   and argv.  Return the information in the options as *cmdlineP.
 
    If command line is internally inconsistent (invalid options, etc.),
    issue error message to stderr and abort program.
@@ -241,25 +241,25 @@ parseCommandLine ( int argc, char ** argv,
     unsigned int option_def_index;
 
     char *outputOpt;
-    unsigned int widthSpec, heightSpec, outputSpec, 
+    unsigned int widthSpec, heightSpec, outputSpec,
         xrightposSpec, yrightposSpec, stitcherSpec, filterSpec;
 
     option_def_index = 0;   /* incremented by OPTENT3 */
-    OPTENT3(0, "width",       OPT_UINT,   &cmdlineP->width, 
+    OPTENT3(0, "width",       OPT_UINT,   &cmdlineP->width,
             &widthSpec,         0);
-    OPTENT3(0, "height",      OPT_UINT,   &cmdlineP->height, 
+    OPTENT3(0, "height",      OPT_UINT,   &cmdlineP->height,
             &heightSpec,        0);
-    OPTENT3(0, "verbose",     OPT_FLAG,   NULL,                  
+    OPTENT3(0, "verbose",     OPT_FLAG,   NULL,
             &cmdlineP->verbose, 0 );
-    OPTENT3(0, "output",      OPT_STRING, &outputOpt, 
+    OPTENT3(0, "output",      OPT_STRING, &outputOpt,
             &outputSpec,        0);
-    OPTENT3(0, "xrightpos",   OPT_UINT,   &cmdlineP->xrightpos, 
+    OPTENT3(0, "xrightpos",   OPT_UINT,   &cmdlineP->xrightpos,
             &xrightposSpec,     0);
-    OPTENT3(0, "yrightpos",   OPT_UINT,   &cmdlineP->yrightpos, 
+    OPTENT3(0, "yrightpos",   OPT_UINT,   &cmdlineP->yrightpos,
             &yrightposSpec,     0);
-    OPTENT3(0, "stitcher",    OPT_STRING, &cmdlineP->stitcher, 
+    OPTENT3(0, "stitcher",    OPT_STRING, &cmdlineP->stitcher,
             &stitcherSpec,      0);
-    OPTENT3(0, "filter",      OPT_STRING, &cmdlineP->filter, 
+    OPTENT3(0, "filter",      OPT_STRING, &cmdlineP->filter,
             &filterSpec,        0);
 
     opt.opt_table = option_def;
@@ -333,14 +333,14 @@ main (int argc, char **argv)
 
     verbose = cmdline.verbose;
 
-    return pnmstitch (cmdline.leftFilespec, 
-                      cmdline.rightFilespec, 
-                      cmdline.outputFilespec, 
-                      cmdline.xrightpos, 
-                      cmdline.yrightpos, 
-                      cmdline.width, 
-                      cmdline.height, 
-                      cmdline.stitcher, 
+    return pnmstitch (cmdline.leftFilespec,
+                      cmdline.rightFilespec,
+                      cmdline.outputFilespec,
+                      cmdline.xrightpos,
+                      cmdline.yrightpos,
+                      cmdline.width,
+                      cmdline.height,
+                      cmdline.stitcher,
                       cmdline.filter);
 } /* main() - end */
 
@@ -353,10 +353,10 @@ static Image *
 allocate_image(void)
 {
     Image * retVal;
-    
+
     MALLOCVAR(retVal);
 
-    if (retVal != NULL) 
+    if (retVal != NULL)
         memset (retVal, 0, (unsigned)sizeof(Image));
 
     return retVal;
@@ -372,11 +372,11 @@ free_image(Image * image)
 {
     if (image->name) {
         pm_strfree(image->name);
-        image->name = NULL;     
+        image->name = NULL;
     }
     if (image->tuple) {
         pnm_freepamarray(image->tuple, &image->pam);
-        image->tuple = NULL; 
+        image->tuple = NULL;
     }
     if (image->pam.file) {
         fclose (image->pam.file);
@@ -393,8 +393,8 @@ openWithPossibleExtension(const char *  const baseName,
                           const char ** const filenameP) {
 
     /* list of possible extensions for input file */
-    const char * const extlist[] = { 
-        "", ".pnm", ".pam", ".pgm", ".pbm", ".ppm" 
+    const char * const extlist[] = {
+        "", ".pnm", ".pam", ".pgm", ".pbm", ".ppm"
     };
 
     FILE * ifP;
@@ -403,23 +403,23 @@ openWithPossibleExtension(const char *  const baseName,
     ifP = NULL;   /* initial value -- no file opened yet */
 
     for (extIndex = 0; extIndex < ARRAY_SIZE(extlist) && !ifP; ++extIndex) {
-        
+
         const char * trialName;
-        
+
         pm_asprintf(&trialName, "%s%s", baseName, extlist[extIndex]);
-        
+
         ifP = fopen(trialName, "rb");
-        
+
         if (ifP)
             *filenameP = trialName;
         else
             pm_strfree(trialName);
     }
-    if (!ifP) 
+    if (!ifP)
         pm_error ("Failed to open input file named '%s' "
-                  "or '%s' with one of various common extensions.", 
+                  "or '%s' with one of various common extensions.",
                   baseName, baseName);
-    
+
     *ifPP = ifP;
 }
 
@@ -435,7 +435,7 @@ readinit(const char * const name)
     Image * const image = allocate_image();
     Image * retVal;
 
-    if (image == NULL) 
+    if (image == NULL)
         retVal = NULL;
     else {
         FILE * ifP;
@@ -446,7 +446,7 @@ readinit(const char * const name)
         } else {
             openWithPossibleExtension(name, &ifP, &image->name);
         }
-        image->tuple = pnm_readpam(ifP, &(image->pam), 
+        image->tuple = pnm_readpam(ifP, &(image->pam),
                                    PAM_STRUCT_SIZE(tuple_type));
         fclose (ifP);
         image->pam.file = NULL;
@@ -507,7 +507,7 @@ regionDifference(Image * left,
 {
     unsigned long total;
     unsigned      row;
-    
+
     total = 0;  /* initial value */
 
     for (row = 0; row < height; ++row) {
@@ -830,7 +830,7 @@ stitchOnePixel(Image *    const Left,
                int        const right_column,
                unsigned * const firstRightP,
                tuple      const outPixel) {
-               
+
     unsigned plane;
 
     for (plane = 0; plane < outpam.depth; ++plane) {
@@ -848,7 +848,7 @@ stitchOnePixel(Image *    const Left,
         rightPixel = 0;
         if (right_column >= 0) {
             rightPixel = Right->tuple[right_row][right_column][plane];
-            if ((rightPixel > 0) && (*firstRightP == 0)) 
+            if ((rightPixel > 0) && (*firstRightP == 0))
                 *firstRightP = column;
         }
         if (leftPixel == 0) {
@@ -869,7 +869,7 @@ stitchOnePixel(Image *    const Left,
             } else {
                 int const v = w * 4;
                 leftPixel = (sample)(
-                    ((leftPixel 
+                    ((leftPixel
                       * (unsigned long)(Left->pam.width - column))
                      + (rightPixel
                         * (unsigned long)(column - Left->pam.width + v)))
@@ -929,22 +929,22 @@ stitchOneRow(Image *    const Left,
                 right_column = -1;
                 right_row    = -1;
             }
-        } else 
+        } else
             right_column = -1;
 
         /* Create the pixel at column 'column' of row 'row' of the
            output 'Out': Row[column].
         */
-        stitchOnePixel(Left, Right, Out->image->pam, row, column, y, 
+        stitchOnePixel(Left, Right, Out->image->pam, row, column, y,
                        right_row, right_column, &firstRight, Row[column]);
     }
 }
 
 
 
-static void 
-stitchit(Image *      const Left, 
-         Image *      const Right, 
+static void
+stitchit(Image *      const Left,
+         Image *      const Right,
          const char * const outfilename,
          const char * const filter,
          Stitcher *   const Stitch,
@@ -954,8 +954,8 @@ stitchit(Image *      const Left,
                                     sizeof(OutputMethods[0]));
     unsigned   row;
     int        xp[8], yp[8], x, y, width, height;
-    
-    if ((Out == (Output *)NULL) || (Out->Name == (char *)NULL)) 
+
+    if ((Out == (Output *)NULL) || (Out->Name == (char *)NULL))
         *retvalP = -2;
     else {
         if (verbose)
@@ -966,13 +966,13 @@ stitchit(Image *      const Left,
         determineMaskCorners(Stitch, Left, Right, xp, yp);
 
         /* Output the combined images */
-                
+
         /* Calculate generic x,y left top corner, and the width and height */
         calculateXyWidthHeight(xp, yp, &x, &y, &width, &height);
-                
-        if (verbose) 
+
+        if (verbose)
             printPlan(xp, yp, Left, Right);
-    
+
         if (!(*(Out->Alloc))(Out, outfilename, width, height, &Left->pam))
             *retvalP = -9;
         else {
@@ -989,7 +989,7 @@ stitchit(Image *      const Left,
             }
             (*(Out->FlushImage))(Out);
             (*(Out->DeAlloc))(Out);
-        
+
             *retvalP = 0;
         }
     }
@@ -1014,10 +1014,10 @@ pnmstitch(const char * const leftfilename,
     Image    * Right;
     int        retval;
 
-    if ((Stitch == (Stitcher *)NULL) || (Stitch->Name == (char *)NULL)) 
+    if ((Stitch == (Stitcher *)NULL) || (Stitch->Name == (char *)NULL))
         retval = -1;
     else {
-        if (verbose) 
+        if (verbose)
             fprintf (stderr, "Selected %s stitcher algorithm\n",
                      Stitch->Name);
 
@@ -1034,7 +1034,7 @@ pnmstitch(const char * const leftfilename,
                 if (Left->pam.depth != Right->pam.depth) {
                     fprintf(stderr, "Images should have matching depth.  "
                             "The left image has depth %d, "
-                            "while the right has depth %d.", 
+                            "while the right has depth %d.",
                             Left->pam.depth, Right->pam.depth);
                     retval = -5;
                 } else if (Left->pam.maxval != Right->pam.maxval) {
@@ -1042,19 +1042,19 @@ pnmstitch(const char * const leftfilename,
                              "Images should have matching maxval.  "
                              "The left image has maxval %u, "
                              "while the right has maxval %u.",
-                             (unsigned)Left->pam.maxval, 
+                             (unsigned)Left->pam.maxval,
                              (unsigned)Right->pam.maxval);
                     retval = -6;
-                } else if ((*(Stitch->Alloc))(Stitch) == FALSE) 
+                } else if ((*(Stitch->Alloc))(Stitch) == FALSE)
                     retval = -7;
                 else {
-                    (*(Stitch->Constrain))(Stitch, reqx, reqy, 
+                    (*(Stitch->Constrain))(Stitch, reqx, reqy,
                                            reqWidth, reqHeight);
 
-                    if ((*(Stitch->Match))(Stitch, Left, Right) == FALSE) 
+                    if ((*(Stitch->Match))(Stitch, Left, Right) == FALSE)
                         retval = -8;
-                    else 
-                        stitchit(Left, Right, outfilename, filter, Stitch, 
+                    else
+                        stitchit(Left, Right, outfilename, filter, Stitch,
                                  &retval);
                 }
                 free_image(Right);
@@ -1356,7 +1356,7 @@ LinearAlloc(Stitcher * me)
     bool retval;
 
     MALLOCARRAY(me->parms, 8);
-    if (me->parms == NULL) 
+    if (me->parms == NULL)
         retval = FALSE;
     else {
         /* Constraints unset */
@@ -1478,7 +1478,7 @@ LinearConstrain(Stitcher * me, int x, int y, int width, int height)
 /* Following global variables are for use by SliverMatch() */
 static unsigned long starPeriod;
     /* The number of events between printing of a "*" progress
-       indicator.  
+       indicator.
     */
 static unsigned long starCount;
     /* The number of events until the next * progress indicator needs to be
@@ -1487,7 +1487,7 @@ static unsigned long starCount;
 
 static void
 starEvent() {
-    
+
     if (--starCount == 0) {
         starCount = starPeriod;
         fprintf (stderr, "*");
@@ -1521,7 +1521,7 @@ findBestMatches(Image *  const Left,
                 unsigned const Xmax,
                 int      const Ymin,
                 int      const Ymax,
-                Best           best[NUM_BEST]) { 
+                Best           best[NUM_BEST]) {
 /*----------------------------------------------------------------------------
   Compare the rectangle 'width' columns by 'height' rows with upper
   left corner at Column 'x', Row y+offY in image 'Right' to a bunch of
@@ -1562,8 +1562,8 @@ allocate_best_array(Best *** const bestP, unsigned const bestSize) {
     MALLOCARRAY(best, bestSize);
     if (best == NULL)
         pm_error("No memory for Best array");
-    
-    for (i = 0; i < bestSize; ++i) 
+
+    for (i = 0; i < bestSize; ++i)
         best[i] = allocate_best();
     *bestP = best;
 }
@@ -1577,7 +1577,7 @@ static void determineXYRange(Stitcher * const me,
                              unsigned * const XmaxP,
                              int *      const YminP,
                              int *      const YmaxP) {
-    
+
     if (me->x == INT_MAX) {
         *XmaxP = Left->pam.width - me->width;
         /* I can't bring myself to go half way */
@@ -1594,7 +1594,7 @@ static void determineXYRange(Stitcher * const me,
         *YminP = me->y;
         *YmaxP = me->y + 1;
     }
-    if (verbose) 
+    if (verbose)
         pm_message("Test %d<x<%d %d<y<%d", *XminP, *XmaxP, *YminP, *YmaxP);
 }
 
@@ -1609,7 +1609,7 @@ SliverMatch(Stitcher * me, Image * Left, Image * Right,
             unsigned image_portion, unsigned skip_sliver)
 {
     /* up/down 3/10, make sure has an odd number of members */
-    unsigned const bestSize = 
+    unsigned const bestSize =
         1 + 2 * ((image_portion * 3) / (10 * skip_sliver));
     Best       ** best; /* malloc'ed array of Best * */
     float         sumydotx, sumx, sumydot, sum;
@@ -1681,8 +1681,8 @@ SliverMatch(Stitcher * me, Image * Left, Image * Right,
             }
             for (X = x; X < (x + me->width); ++X) {
                 for (Y = y + offY; Y < (y + offY + me->height); ++Y) {
-                    for (plane = 0; 
-                         plane < MIN(Right->pam.depth,3); 
+                    for (plane = 0;
+                         plane < MIN(Right->pam.depth,3);
                          ++plane) {
                         sample point = Right->tuple[Y][X][plane];
                         SUM[plane]   += point;
@@ -1693,7 +1693,7 @@ SliverMatch(Stitcher * me, Image * Left, Image * Right,
             /* How many features */
             features[in] = 0.0;
             for (plane = 0; plane < MIN(Right->pam.depth,3); ++plane) {
-                features[in] += SUMSQ[plane] - 
+                features[in] += SUMSQ[plane] -
                     (SUM[plane]*SUM[plane]/(float)(me->width*me->height));
             }
             if ((minf == 0.0) || (features[in] < minf)) {
@@ -1733,12 +1733,12 @@ SliverMatch(Stitcher * me, Image * Left, Image * Right,
             }
             if ((verbose == 1) || (verbose == 2))
                 for (X = Xmin; X < Xmax; ++X) {
-                    for (Y = Ymin; Y < Ymax; ++Y) 
+                    for (Y = Ymin; Y < Ymax; ++Y)
                         starEvent();
                 }
             continue;
         }
-        findBestMatches(Left, Right, x, y, me->width, me->height, 
+        findBestMatches(Left, Right, x, y, me->width, me->height,
                         offY, Xmin, Xmax, Ymin, Ymax,
                         best[in]);
         /* slop (noise in NUM_BEST) */
@@ -1980,7 +1980,7 @@ SliverMatch(Stitcher * me, Image * Left, Image * Right,
 static bool
 LinearMatch(Stitcher * me, Image * Left, Image * Right)
 {
-    if (SliverMatch(me, Left, Right, IMAGE_PORTION, SKIP_SLIVER * 8) 
+    if (SliverMatch(me, Left, Right, IMAGE_PORTION, SKIP_SLIVER * 8)
         == FALSE) {
         return FALSE;
     }
@@ -1989,7 +1989,7 @@ LinearMatch(Stitcher * me, Image * Left, Image * Right)
     me->y = - (me->parms[Sliver_yp] + me->parms[Sliver_ypp]
           + (1 - Left->pam.height)) / 2;
 
-    if (verbose) 
+    if (verbose)
         pm_message("LinearMatch translation parameters are (%d,%d)",
                    me->x, me->y);
 
diff --git a/editor/pnmtile.c b/editor/pnmtile.c
index 5ec53415..ca542c43 100644
--- a/editor/pnmtile.c
+++ b/editor/pnmtile.c
@@ -70,7 +70,7 @@ parseCommandLine(int argc, const char ** argv,
                 pm_error("There are at most three arguments: "
                          "width, height, file name.  You specified %u",
                          argc-1);
-        } else 
+        } else
             cmdlineP->inputFileName = "-";
     }
 }
diff --git a/editor/ppmchange.c b/editor/ppmchange.c
index cfc34769..16f4390e 100644
--- a/editor/ppmchange.c
+++ b/editor/ppmchange.c
@@ -33,8 +33,8 @@ struct CmdlineInfo {
         /* colors user wants replaced */
     const char * newcolorname[TCOLS];
         /* colors with which he wants them replaced */
-    float closeness;    
-    const char * remainder_colorname;  
+    float closeness;
+    const char * remainder_colorname;
       /* Color user specified for -remainder.  Null pointer if he didn't
          specify -remainder.
       */
@@ -87,8 +87,8 @@ parseCommandLine(int argc, const char ** const argv,
     if (cmdlineP->closeness > 100)
         pm_error("-closeness value %f is more than 100%%",
                  cmdlineP->closeness);
-    
-    if ((argc-1) % 2 == 0) 
+
+    if ((argc-1) % 2 == 0)
         cmdlineP->input_filespec = "-";
     else
         cmdlineP->input_filespec = argv[argc-1];
@@ -96,8 +96,8 @@ parseCommandLine(int argc, const char ** const argv,
     {
         int argn;
         cmdlineP->ncolors = 0;  /* initial value */
-        for (argn = 1; 
-             argn+1 < argc && cmdlineP->ncolors < TCOLS; 
+        for (argn = 1;
+             argn+1 < argc && cmdlineP->ncolors < TCOLS;
              argn += 2) {
             cmdlineP->oldcolorname[cmdlineP->ncolors] = argv[argn];
             cmdlineP->newcolorname[cmdlineP->ncolors] = argv[argn+1];
@@ -109,8 +109,8 @@ parseCommandLine(int argc, const char ** const argv,
 
 
 static bool
-colorMatches(pixel        const comparand, 
-             pixel        const comparator, 
+colorMatches(pixel        const comparand,
+             pixel        const comparator,
              unsigned int const allowableDiff) {
 /*----------------------------------------------------------------------------
    The colors 'comparand' and 'comparator' are within 'allowableDiff'
@@ -126,21 +126,21 @@ colorMatches(pixel        const comparand,
 
 
 static void
-changeRow(const pixel * const inrow, 
-          pixel *       const outrow, 
+changeRow(const pixel * const inrow,
+          pixel *       const outrow,
           int           const cols,
-          int           const ncolors, 
-          const pixel         colorfrom[], 
+          int           const ncolors,
+          const pixel         colorfrom[],
           const pixel         colorto[],
-          bool          const remainder_specified, 
-          pixel         const remainder_color, 
+          bool          const remainder_specified,
+          pixel         const remainder_color,
           unsigned int  const allowableDiff) {
 /*----------------------------------------------------------------------------
-   Replace the colors in a single row.  There are 'ncolors' colors to 
+   Replace the colors in a single row.  There are 'ncolors' colors to
    replace.  The to-replace colors are in the array colorfrom[], and the
    replace-with colors are in corresponding elements of colorto[].
    Iff 'remainder_specified' is true, replace all colors not mentioned
-   in colorfrom[] with 'remainder_color'.  
+   in colorfrom[] with 'remainder_color'.
 
    Consider the color in inrow[] to match a color in colorfrom[] if it is
    within 'allowableDiff' color levels of it, in cartesian distance (e.g.
@@ -155,7 +155,7 @@ changeRow(const pixel * const inrow,
     for (col = 0; col < cols; ++col) {
         unsigned int i;
         bool haveMatch; /* logical: It's a color user said to change */
-        pixel newcolor;  
+        pixel newcolor;
         /* Color to which we must change current pixel.  Undefined unless
            'haveMatch' is true.
         */
@@ -205,7 +205,7 @@ main(int argc, const char ** const argv) {
     pm_proginit(&argc, argv);
 
     parseCommandLine(argc, argv, &cmdline);
-    
+
     ifP = pm_openr(cmdline.input_filespec);
 
     ppm_readppminit(ifP, &cols, &rows, &maxval, &format);
@@ -213,7 +213,7 @@ main(int argc, const char ** const argv) {
     if (cmdline.remainder_colorname)
         remainder_color = ppm_parsecolor2(cmdline.remainder_colorname, maxval,
                                           cmdline.closeok);
-    { 
+    {
         int i;
         for (i = 0; i < cmdline.ncolors; ++i) {
             oldcolor[i] = ppm_parsecolor2(cmdline.oldcolorname[i], maxval,
@@ -223,7 +223,7 @@ main(int argc, const char ** const argv) {
         }
     }
     allowableDiff = ROUNDU(sqrt3 * maxval * cmdline.closeness/100);
-    
+
     ppm_writeppminit( stdout, cols, rows, maxval, 0 );
     inrow = ppm_allocrow(cols);
     outrow = ppm_allocrow(cols);
diff --git a/editor/ppmdim.c b/editor/ppmdim.c
index 4e64965a..0bcc8ebb 100644
--- a/editor/ppmdim.c
+++ b/editor/ppmdim.c
@@ -1,4 +1,3 @@
-
 /*********************************************************************/
 /* ppmdim -  dim a picture down to total blackness                   */
 /* Frank Neumann, October 1993                                       */
@@ -29,84 +28,84 @@ int main(argc, argv)
 int argc;
 char *argv[];
 {
-	FILE* ifp;
-	int argn, rows, cols, format, i = 0, j = 0;
-	pixel *srcrow, *destrow;
-	pixel *pP = NULL, *pP2 = NULL;
-	pixval maxval;
-	double dimfactor;
-	long longfactor;
-	const char * const usage = "dimfactor [ppmfile]\n        dimfactor: 0.0 = total blackness, 1.0 = original picture\n";
-
-	/* parse in 'default' parameters */
-	ppm_init(&argc, argv);
-
-	argn = 1;
-
-	/* parse in dim factor */
-	if (argn == argc)
-		pm_usage(usage);
-	if (sscanf(argv[argn], "%lf", &dimfactor) != 1)
-		pm_usage(usage);
-	if (dimfactor < 0.0 || dimfactor > 1.0)
-		pm_error("dim factor must be in the range from 0.0 to 1.0 ");
-	++argn;
-
-	/* parse in filename (if present, stdin otherwise) */
-	if (argn != argc)
-	{
-		ifp = pm_openr(argv[argn]);
-		++argn;
-	}
-	else
-		ifp = stdin;
-
-	if (argn != argc)
-		pm_usage(usage);
-
-	/* read first data from file */
-	ppm_readppminit(ifp, &cols, &rows, &maxval, &format);
-
-	/* no error checking required here, ppmlib does it all for us */
-	srcrow = ppm_allocrow(cols);
-
-	longfactor = (long)(dimfactor * 65536);
-
-	/* allocate a row of pixel data for the new pixels */
-	destrow = ppm_allocrow(cols);
-
-	ppm_writeppminit(stdout, cols, rows, maxval, 0);
-
-	/** now do the dim'ing **/
-	/* the 'float' parameter for dimming is sort of faked - in fact, we */
-	/* convert it to a range from 0 to 65536 for integer math. Shouldn't */
-	/* be something you'll have to worry about, though. */
-
-	for (i = 0; i < rows; i++)
-	{
-		ppm_readppmrow(ifp, srcrow, cols, maxval, format);
-
-		pP = srcrow;
-		pP2 = destrow;
-
-		for (j = 0; j < cols; j++)
-		{
-			PPM_ASSIGN(*pP2, (PPM_GETR(*pP) * longfactor) >> 16,
-							 (PPM_GETG(*pP) * longfactor) >> 16,
-							 (PPM_GETB(*pP) * longfactor) >> 16);
-
-			pP++;
-			pP2++;
-		}
-
-		/* write out one line of graphic data */
-		ppm_writeppmrow(stdout, destrow, cols, maxval, 0);
-	}
-
-	pm_close(ifp);
-	ppm_freerow(srcrow);
-	ppm_freerow(destrow);
-
-	exit(0);
+        FILE* ifp;
+        int argn, rows, cols, format, i = 0, j = 0;
+        pixel *srcrow, *destrow;
+        pixel *pP = NULL, *pP2 = NULL;
+        pixval maxval;
+        double dimfactor;
+        long longfactor;
+        const char * const usage = "dimfactor [ppmfile]\n        dimfactor: 0.0 = total blackness, 1.0 = original picture\n";
+
+        /* parse in 'default' parameters */
+        ppm_init(&argc, argv);
+
+        argn = 1;
+
+        /* parse in dim factor */
+        if (argn == argc)
+                pm_usage(usage);
+        if (sscanf(argv[argn], "%lf", &dimfactor) != 1)
+                pm_usage(usage);
+        if (dimfactor < 0.0 || dimfactor > 1.0)
+                pm_error("dim factor must be in the range from 0.0 to 1.0 ");
+        ++argn;
+
+        /* parse in filename (if present, stdin otherwise) */
+        if (argn != argc)
+        {
+                ifp = pm_openr(argv[argn]);
+                ++argn;
+        }
+        else
+                ifp = stdin;
+
+        if (argn != argc)
+                pm_usage(usage);
+
+        /* read first data from file */
+        ppm_readppminit(ifp, &cols, &rows, &maxval, &format);
+
+        /* no error checking required here, ppmlib does it all for us */
+        srcrow = ppm_allocrow(cols);
+
+        longfactor = (long)(dimfactor * 65536);
+
+        /* allocate a row of pixel data for the new pixels */
+        destrow = ppm_allocrow(cols);
+
+        ppm_writeppminit(stdout, cols, rows, maxval, 0);
+
+        /** now do the dim'ing **/
+        /* the 'float' parameter for dimming is sort of faked - in fact, we */
+        /* convert it to a range from 0 to 65536 for integer math. Shouldn't */
+        /* be something you'll have to worry about, though. */
+
+        for (i = 0; i < rows; i++)
+        {
+                ppm_readppmrow(ifp, srcrow, cols, maxval, format);
+
+                pP = srcrow;
+                pP2 = destrow;
+
+                for (j = 0; j < cols; j++)
+                {
+                        PPM_ASSIGN(*pP2, (PPM_GETR(*pP) * longfactor) >> 16,
+                                                         (PPM_GETG(*pP) * longfactor) >> 16,
+                                                         (PPM_GETB(*pP) * longfactor) >> 16);
+
+                        pP++;
+                        pP2++;
+                }
+
+                /* write out one line of graphic data */
+                ppm_writeppmrow(stdout, destrow, cols, maxval, 0);
+        }
+
+        pm_close(ifp);
+        ppm_freerow(srcrow);
+        ppm_freerow(destrow);
+
+        exit(0);
 }
 
diff --git a/editor/ppmflash.c b/editor/ppmflash.c
index d1d048df..c8335890 100644
--- a/editor/ppmflash.c
+++ b/editor/ppmflash.c
@@ -1,4 +1,3 @@
-
 /*********************************************************************/
 /* ppmflash -  brighten a picture up to total whiteout               */
 /* Frank Neumann, August 1993                                        */
@@ -89,12 +88,12 @@ int main(argc, argv)
         pP2 = destrow;
 
         for (j = 0; j < cols; j++) {
-            PPM_ASSIGN(*pP2, 
-                       PPM_GETR(*pP) + 
+            PPM_ASSIGN(*pP2,
+                       PPM_GETR(*pP) +
                        (((maxval - PPM_GETR(*pP)) * longfactor) >> 16),
-                       PPM_GETG(*pP) + 
+                       PPM_GETG(*pP) +
                        (((maxval - PPM_GETG(*pP)) * longfactor) >> 16),
-                       PPM_GETB(*pP) + 
+                       PPM_GETB(*pP) +
                        (((maxval - PPM_GETB(*pP)) * longfactor) >> 16));
 
             pP++;
diff --git a/editor/ppmlabel.c b/editor/ppmlabel.c
index 389ab59e..21e7d84c 100644
--- a/editor/ppmlabel.c
+++ b/editor/ppmlabel.c
@@ -26,7 +26,7 @@ static pixel rgbcolor, backcolor;
 /*  DRAWTEXT  --  Draw text at current location and advance to
           start of next line.  */
 
-static void 
+static void
 drawtext(const char * const text) {
 
     if (!transparent && strlen(text) > 0) {
@@ -38,10 +38,10 @@ drawtext(const char * const text) {
         double sina, cosa;
 
         handle = ppmd_fill_create();
-        
+
         ppmd_text_box(size, 0, text, &left, &top, &right, &bottom);
 
-        /* Displacement vector */ 
+        /* Displacement vector */
 
         lx = right;
         ly = -(top - bottom);
diff --git a/editor/specialty/pamdeinterlace.c b/editor/specialty/pamdeinterlace.c
index d6f6aee1..666daa16 100644
--- a/editor/specialty/pamdeinterlace.c
+++ b/editor/specialty/pamdeinterlace.c
@@ -2,7 +2,7 @@
                              pamdeinterlace
 *******************************************************************************
   De-interlace an image, i.e. select every 2nd row.
-   
+
   By Bryan Henderson, San Jose, CA 2001.11.11.
 
   Contributed to the public domain.
@@ -81,7 +81,7 @@ main(int argc, char *argv[]) {
     tuple * tuplerow;   /* Row from input image */
     unsigned int row;
     struct cmdlineInfo cmdline;
-    struct pam inpam;  
+    struct pam inpam;
     struct pam outpam;
 
     pnm_init( &argc, argv );
@@ -89,7 +89,7 @@ main(int argc, char *argv[]) {
     parseCommandLine(argc, argv, &cmdline);
 
     ifP = pm_openr(cmdline.inputFilespec);
-    
+
     pnm_readpaminit(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type));
 
     if (inpam.height < 2 && cmdline.rowsToTake == ODD)
@@ -133,7 +133,7 @@ main(int argc, char *argv[]) {
     pnm_freepamrow(tuplerow);
     pm_close(inpam.file);
     pm_close(outpam.file);
-    
+
     return 0;
 }
 
diff --git a/editor/specialty/pamoil.c b/editor/specialty/pamoil.c
index 6cb8d3ac..2618ac12 100644
--- a/editor/specialty/pamoil.c
+++ b/editor/specialty/pamoil.c
@@ -18,7 +18,7 @@
 #include "pam.h"
 #include "mallocvar.h"
 
-static void 
+static void
 convertRow(struct pam const inpam, tuple ** const tuples,
            tuple * const tuplerow, int const row, int const smearFactor,
            int * const hist) {
@@ -34,7 +34,7 @@ convertRow(struct pam const inpam, tuple ** const tuples,
                    of the pixel being examined
                 */
 
-            /* Compute hist[] - frequencies, in the neighborhood, of each 
+            /* Compute hist[] - frequencies, in the neighborhood, of each
                sample value
             */
             for (i = 0; i <= inpam.maxval; ++i) hist[i] = 0;
@@ -42,8 +42,8 @@ convertRow(struct pam const inpam, tuple ** const tuples,
             for (drow = row - smearFactor; drow <= row + smearFactor; ++drow) {
                 if (drow >= 0 && drow < inpam.height) {
                     int dcol;
-                    for (dcol = col - smearFactor; 
-                         dcol <= col + smearFactor; 
+                    for (dcol = col - smearFactor;
+                         dcol <= col + smearFactor;
                          ++dcol) {
                         if ( dcol >= 0 && dcol < inpam.width )
                             ++hist[tuples[drow][dcol][sample]];
diff --git a/editor/specialty/pampop9.c b/editor/specialty/pampop9.c
index b92c7d6b..7211c5eb 100644
--- a/editor/specialty/pampop9.c
+++ b/editor/specialty/pampop9.c
@@ -1,4 +1,4 @@
-/* 
+/*
  *
  * (c) Robert Tinsley, 2003 (http://www.thepoacher.net/contact)
  *
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
     ydelta = atoi(argv[5]);
 
     if (filename == NULL || *filename == '\0'
-        || xtiles <= 0 || ytiles <= 0 || xdelta < 0 || ydelta < 0) 
+        || xtiles <= 0 || ytiles <= 0 || xdelta < 0 || ydelta < 0)
         pm_error("invalid argument");
 
     /* read src pam */
diff --git a/editor/specialty/pbmlife.c b/editor/specialty/pbmlife.c
index be34cc69..03735d58 100644
--- a/editor/specialty/pbmlife.c
+++ b/editor/specialty/pbmlife.c
@@ -31,12 +31,12 @@ char* argv[];
     pbm_init( &argc, argv );
 
     if ( argc > 2 )
-	pm_usage( "[pbmfile]" );
+        pm_usage( "[pbmfile]" );
 
     if ( argc == 2 )
-	ifp = pm_openr( argv[1] );
+        ifp = pm_openr( argv[1] );
     else
-	ifp = stdin;
+        ifp = stdin;
 
     pbm_readpbminit( ifp, &cols, &rows, &format );
     prevrow = pbm_allocrow( cols );
@@ -49,63 +49,63 @@ char* argv[];
     pbm_readpbmrow( ifp, nextrow, cols, format );
 
     for ( row = 0; row < rows; ++row )
-	{
-	temprow = prevrow;
-	prevrow = thisrow;
-	thisrow = nextrow;
-	nextrow = temprow;
-	if ( row < rows - 1 )
-	    pbm_readpbmrow( ifp, nextrow, cols, format );
+        {
+        temprow = prevrow;
+        prevrow = thisrow;
+        thisrow = nextrow;
+        nextrow = temprow;
+        if ( row < rows - 1 )
+            pbm_readpbmrow( ifp, nextrow, cols, format );
 
         for ( col = 0; col < cols; ++col )
-	    {
-	    /* Check the neighborhood, with an unrolled double loop. */
-	    count = 0;
-	    if ( row > 0 )
-		{
-		/* upper left */
-		if ( col > 0 && prevrow[col - 1] == PBM_WHITE )
-		    ++count;
-		/* upper center */
-		if ( prevrow[col] == PBM_WHITE )
-		    ++count;
-		/* upper right */
-		if ( col < cols - 1 && prevrow[col + 1] == PBM_WHITE )
-		    ++count;
-		}
-	    /* left */
-	    if ( col > 0 && thisrow[col - 1] == PBM_WHITE )
-		++count;
-	    /* right */
-	    if ( col < cols - 1 && thisrow[col + 1] == PBM_WHITE )
-		++count;
-	    if ( row < rows - 1 )
-		{
-		/* lower left */
-		if ( col > 0 && nextrow[col - 1] == PBM_WHITE )
-		    ++count;
-		/* lower center */
-		if ( nextrow[col] == PBM_WHITE )
-		    ++count;
-		/* lower right */
-		if ( col < cols - 1 && nextrow[col + 1] == PBM_WHITE )
-		    ++count;
-		}
+            {
+            /* Check the neighborhood, with an unrolled double loop. */
+            count = 0;
+            if ( row > 0 )
+                {
+                /* upper left */
+                if ( col > 0 && prevrow[col - 1] == PBM_WHITE )
+                    ++count;
+                /* upper center */
+                if ( prevrow[col] == PBM_WHITE )
+                    ++count;
+                /* upper right */
+                if ( col < cols - 1 && prevrow[col + 1] == PBM_WHITE )
+                    ++count;
+                }
+            /* left */
+            if ( col > 0 && thisrow[col - 1] == PBM_WHITE )
+                ++count;
+            /* right */
+            if ( col < cols - 1 && thisrow[col + 1] == PBM_WHITE )
+                ++count;
+            if ( row < rows - 1 )
+                {
+                /* lower left */
+                if ( col > 0 && nextrow[col - 1] == PBM_WHITE )
+                    ++count;
+                /* lower center */
+                if ( nextrow[col] == PBM_WHITE )
+                    ++count;
+                /* lower right */
+                if ( col < cols - 1 && nextrow[col + 1] == PBM_WHITE )
+                    ++count;
+                }
 
-	    /* And compute the new value. */
-	    if ( thisrow[col] == PBM_WHITE )
-		if ( count == 2 || count == 3 )
-		    newrow[col] = PBM_WHITE;
-		else
-		    newrow[col] = PBM_BLACK;
-	    else
-		if ( count == 3 )
-		    newrow[col] = PBM_WHITE;
-		else
-		    newrow[col] = PBM_BLACK;
-	    }
-	pbm_writepbmrow( stdout, newrow, cols, 0 );
-	}
+            /* And compute the new value. */
+            if ( thisrow[col] == PBM_WHITE )
+                if ( count == 2 || count == 3 )
+                    newrow[col] = PBM_WHITE;
+                else
+                    newrow[col] = PBM_BLACK;
+            else
+                if ( count == 3 )
+                    newrow[col] = PBM_WHITE;
+                else
+                    newrow[col] = PBM_BLACK;
+            }
+        pbm_writepbmrow( stdout, newrow, cols, 0 );
+        }
 
     pm_close( ifp );
     pm_close( stdout );
diff --git a/editor/specialty/pgmabel.c b/editor/specialty/pgmabel.c
index 5badfd19..3e05be5e 100644
--- a/editor/specialty/pgmabel.c
+++ b/editor/specialty/pgmabel.c
@@ -117,7 +117,7 @@ abel ( float *y, int N, double *adl)
     for (n=0 ; n<N ; n++)
         {
             if (( n>=1 )&&( n<N-1 ))
-	       (*y++) = ((rho[n-1]*0.5+rho[n]+rho[n+1]*0.5)/2.0);/*1D median filter*/
+               (*y++) = ((rho[n-1]*0.5+rho[n]+rho[n+1]*0.5)/2.0);/*1D median filter*/
             else (*y++) = rho[n];
         }
     free(rho);
diff --git a/editor/specialty/pgmbentley.c b/editor/specialty/pgmbentley.c
index aed92074..87778a62 100644
--- a/editor/specialty/pgmbentley.c
+++ b/editor/specialty/pgmbentley.c
@@ -41,7 +41,7 @@ main(int argc, const char * argv[]) {
             pm_error("There are no options and only one argument.  "
                      "You specified %u", argc-1);
     }
-	ifP = pm_openr(inputFileName);
+        ifP = pm_openr(inputFileName);
 
     gin = pgm_readpgm(ifP, &cols, &rows, &maxval);
 
@@ -62,9 +62,9 @@ main(int argc, const char * argv[]) {
             unsigned int const brow = MIN(rows-1, row + gin[row][col] / N);
 
             gout[brow][col] = gin[row][col];
-	    }
+            }
     }
-     
+
     pgm_writepgm(stdout, gout, cols, rows, maxval, 0);
 
     pm_close(stdout);
diff --git a/editor/specialty/pgmmorphconv.c b/editor/specialty/pgmmorphconv.c
index 2ba2d62d..40ce5d76 100644
--- a/editor/specialty/pgmmorphconv.c
+++ b/editor/specialty/pgmmorphconv.c
@@ -1,9 +1,9 @@
-/* pgmmorphconv.c - morphological convolutions on a graymap: dilation and 
+/* pgmmorphconv.c - morphological convolutions on a graymap: dilation and
 ** erosion
 **
 ** Copyright (C) 2000 by Luuk van Dijk/Mind over Matter
 **
-** Based on 
+** Based on
 ** pnmconvol.c - general MxN convolution on a portable anymap
 **
 ** Copyright (C) 1989, 1991 by Jef Poskanzer.
@@ -95,7 +95,7 @@ parseCommandLine(int argc, const char ** const argv,
             cmdlineP->inputFileName = "-";
         else {
             cmdlineP->inputFileName = argv[2];
-            
+
             if (argc-1 > 2)
                 pm_error("Too many arguments: %u.  "
                          "The only possible arguments "
@@ -146,7 +146,7 @@ setAllPixel(gray **      const image,
     for (col = 0; col < cols; ++col) {
         unsigned int row;
         for (row = 0; row < rows; ++row)
-            image[row][col] = value; 
+            image[row][col] = value;
     }
 }
 
@@ -155,9 +155,9 @@ setAllPixel(gray **      const image,
 static void
 dilate(bit **         const template,
        int            const trowso2,
-       int            const tcolso2, 
+       int            const tcolso2,
        gray **        const inImage,
-       gray **        const outImage, 
+       gray **        const outImage,
        unsigned int   const rows,
        unsigned int   const cols,
        unsigned int * const templateCountP) {
@@ -198,9 +198,9 @@ dilate(bit **         const template,
 static void
 erode(bit **         const template,
       int            const trowso2,
-      int            const tcolso2, 
+      int            const tcolso2,
       gray **        const inImage,
-      gray **        const outImage, 
+      gray **        const outImage,
       unsigned int   const rows,
       unsigned int   const cols,
       unsigned int * const templateCountP) {
@@ -227,10 +227,10 @@ erode(bit **         const template,
                     for (c = ((tc > 0) ? 0 : -tc);
                          c < ((tc > 0) ? (cols-tc) : cols);
                          ++c) {
-                        
+
                         gray const source = inImage[r+tr][c+tc];
                         outImage[r][c] = MIN(source, outImage[r][c]);
-      
+
                     }
                 }
             }
@@ -244,9 +244,9 @@ erode(bit **         const template,
 static void
 openMorph(bit **         const template,
           int            const trowso2,
-          int            const tcolso2, 
+          int            const tcolso2,
           gray **        const inputImage,
-          gray **        const outputImage, 
+          gray **        const outputImage,
           unsigned int   const rows,
           unsigned int   const cols,
           unsigned int * const templateCountP) {
@@ -255,11 +255,11 @@ openMorph(bit **         const template,
     unsigned int erodedTemplateCount;
 
     erodedImage = pgm_allocarray(cols, rows);
-    
-    erode(template, trowso2, tcolso2, 
+
+    erode(template, trowso2, tcolso2,
           inputImage, erodedImage, rows, cols, &erodedTemplateCount);
 
-    dilate(template, trowso2, tcolso2, 
+    dilate(template, trowso2, tcolso2,
            erodedImage, outputImage, rows, cols, templateCountP);
 
     pgm_freearray(erodedImage, rows);
@@ -270,9 +270,9 @@ openMorph(bit **         const template,
 static void
 closeMorph(bit **         const template,
            int            const trowso2,
-           int            const tcolso2, 
+           int            const tcolso2,
            gray **        const inputImage,
-           gray **        const outputImage, 
+           gray **        const outputImage,
            unsigned int   const rows,
            unsigned int   const cols,
            unsigned int * const templateCountP) {
@@ -282,10 +282,10 @@ closeMorph(bit **         const template,
 
     dilatedImage = pgm_allocarray(cols, rows);
 
-    dilate(template, trowso2, tcolso2, 
+    dilate(template, trowso2, tcolso2,
            inputImage, dilatedImage, rows, cols, &dilatedTemplateCount);
 
-    erode(template, trowso2, tcolso2, 
+    erode(template, trowso2, tcolso2,
           dilatedImage, outputImage, rows, cols, templateCountP);
 
     pgm_freearray(dilatedImage, rows);
@@ -296,7 +296,7 @@ closeMorph(bit **         const template,
 static void
 subtract(gray **      const subtrahendImage,
          gray **      const subtractorImage,
-         gray **      const outImage, 
+         gray **      const outImage,
          unsigned int const rows,
          unsigned int const cols ) {
 
@@ -318,9 +318,9 @@ subtract(gray **      const subtrahendImage,
 static void
 gradient(bit **         const template,
          int            const trowso2,
-         int            const tcolso2, 
+         int            const tcolso2,
          gray **        const inputImage,
-         gray **        const outputImage, 
+         gray **        const outputImage,
          unsigned int   const rows,
          unsigned int   const cols,
          unsigned int * const templateCountP) {
@@ -328,14 +328,14 @@ gradient(bit **         const template,
     gray ** dilatedImage;
     gray ** erodedImage;
     unsigned int dilatedTemplateCount;
-    
+
     dilatedImage = pgm_allocarray(cols, rows);
     erodedImage = pgm_allocarray(cols, rows);
 
-    dilate(template, trowso2, tcolso2, 
+    dilate(template, trowso2, tcolso2,
            inputImage, dilatedImage, rows, cols, &dilatedTemplateCount);
 
-    erode(template, trowso2, tcolso2, 
+    erode(template, trowso2, tcolso2,
           inputImage, erodedImage, rows, cols, templateCountP);
 
     subtract(dilatedImage, erodedImage, outputImage, rows, cols);
@@ -369,14 +369,14 @@ main(int argc, const char ** argv) {
                        &template, &templateRows, &templateCols);
 
     /* Template coords run from -templateCols/2 .. 0 .. + templateCols/2 */
-  
+
     inputImage = pgm_readpgm(ifP, &cols, &rows, &maxval);
 
     if (cols < templateCols || rows < templateRows)
         pm_error("the image is smaller than the convolution matrix" );
-  
+
     outputImage = pgm_allocarray(cols, rows);
-  
+
     switch (cmdline.operation) {
     case DILATE:
         dilate(template, templateRows/2, templateCols/2,
diff --git a/editor/specialty/pnmmercator.c b/editor/specialty/pnmmercator.c
index 81f7f148..0c5c790f 100644
--- a/editor/specialty/pnmmercator.c
+++ b/editor/specialty/pnmmercator.c
@@ -27,16 +27,16 @@
 
 /* The pnm library allows us to code this program without branching cases for
    PGM and PPM, but we do the branch anyway to speed up processing of PGM
-   images. 
+   images.
 */
 
 
 
-struct cmdlineInfo 
+struct cmdlineInfo
 {
     /*
     All the information the user supplied in the command line,
-    in a form easy for the program to use. 
+    in a form easy for the program to use.
     */
 
     const char * input_filespec;  /* Filespecs of input files */
@@ -50,14 +50,14 @@ struct cmdlineInfo
 
 
 static void
-parseCommandLine(int                        argc, 
+parseCommandLine(int                        argc,
                  const char **              argv,
                  struct cmdlineInfo * const cmdlineP ) {
 
     optEntry * option_def;
     optStruct3 opt;
         /* Instructions to pm_optParseOptions3 on how to parse our options. */
-    
+
     unsigned int option_def_index;
 
     MALLOCARRAY_NOFAIL(option_def, 100);
@@ -85,9 +85,9 @@ parseCommandLine(int                        argc,
 
 
 static void
-computeOutputDimensions(const struct cmdlineInfo cmdline, 
+computeOutputDimensions(const struct cmdlineInfo cmdline,
                         const int rows, const int cols,
-                        int * newrowsP, int * newcolsP) 
+                        int * newrowsP, int * newcolsP)
 {
     *newcolsP = cols;
     if (!cmdline.inverse)
@@ -106,7 +106,7 @@ computeOutputDimensions(const struct cmdlineInfo cmdline,
             pm_message("Creating Degrees map, new size is %dx%d",
                        *newcolsP, *newrowsP);
     }
-}        
+}
 
 
 
@@ -117,15 +117,15 @@ transformWithMixing(FILE * const ifP,
                     int const newcols, int const newrows,
                     xelval const newmaxval, int const newformat,
                     bool const inverse,
-                    bool const verbose, bool const vverbose) 
+                    bool const verbose, bool const vverbose)
 {
-    /* 
-    Transform the map image on input file 'ifP' (which is described by 
+    /*
+    Transform the map image on input file 'ifP' (which is described by
     'cols', 'rows', 'format', and 'maxval') to a Mercator projection
-    and write the result to standard output as format 'newformat' and 
+    and write the result to standard output as format 'newformat' and
     with maxval 'newmaxval'.
 
-    We'll blend colors from subsequent rows in the output pixels. 
+    We'll blend colors from subsequent rows in the output pixels.
     */
 
     xel* oddxelrow;  /* an input row */
@@ -142,14 +142,14 @@ transformWithMixing(FILE * const ifP,
     double fLatRad;
     double fLatMerc;
 
-    oddxelrow = pnm_allocrow(cols); 
-    evenxelrow = pnm_allocrow(cols); 
+    oddxelrow = pnm_allocrow(cols);
+    evenxelrow = pnm_allocrow(cols);
     rowInXelrow = 0;
 
     newxelrow = pnm_allocrow(newcols);
 
     for (row = 0; row < newrows; ++row) {
-        
+
         fRow = (double)row + 0.5; /* center on half the pixel */
         if (!inverse) {
             /* the result is mercator, calculate back to degrees */
@@ -207,7 +207,7 @@ transformWithMixing(FILE * const ifP,
             }
         }
 
-        while ((rowInXelrow <= inputRow + 1) && 
+        while ((rowInXelrow <= inputRow + 1) &&
                (rowInXelrow < rows)) {
             /* we need to read one row ahead */
             if (rowInXelrow % 2 == 0) {
@@ -268,16 +268,16 @@ transformNoneMixing(FILE * const ifP,
                    int const newcols, int const newrows,
                    xelval const newmaxval, int const newformat,
                    bool const inverse,
-                   bool const verbose, bool const vverbose) 
+                   bool const verbose, bool const vverbose)
 {
     /*
-    Transform the map image on input file 'ifP' (which is described by 
+    Transform the map image on input file 'ifP' (which is described by
     'cols', 'rows', 'format', and 'maxval') to a Mercator projection and
-    write the result to standard output as format 'newformat' and with 
+    write the result to standard output as format 'newformat' and with
     maxval 'newmaxval'.
 
     Don't mix colors from different input pixels together in the output
-    pixels.  Each output pixel is an exact copy of some corresponding 
+    pixels.  Each output pixel is an exact copy of some corresponding
     input pixel.
     */
 
@@ -293,13 +293,13 @@ transformNoneMixing(FILE * const ifP,
     double fLatRad;
     double fLatMerc;
 
-    xelrow = pnm_allocrow(cols); 
+    xelrow = pnm_allocrow(cols);
     rowInXelrow = 0;
 
     newxelrow = pnm_allocrow(newcols);
 
     for (row = 0; row < newrows; ++row) {
-        
+
         fRow = (double)row + 0.5; /* center on half the pixel */
         if (!inverse) {
             /* the result is mercator, calculate back to degrees */
@@ -377,7 +377,7 @@ transformNoneMixing(FILE * const ifP,
 
 
 int
-main(int argc, const char ** argv ) 
+main(int argc, const char ** argv )
 {
     struct cmdlineInfo cmdline;
     FILE* ifP;
@@ -413,18 +413,18 @@ main(int argc, const char ** argv )
         if (verbose)
             pm_message("Transforming map without mixing/blending colors");
         transformNoneMixing(ifP, cols, rows, maxval, format,
-                            newcols, newrows, newmaxval, newformat, 
+                            newcols, newrows, newmaxval, newformat,
                             cmdline.inverse, verbose, cmdline.vverbose);
     } else {
         if (verbose)
             pm_message("Transforming map while using intermediate colors");
         transformWithMixing(ifP, cols, rows, maxval, format,
-                            newcols, newrows, newmaxval, newformat, 
+                            newcols, newrows, newmaxval, newformat,
                             cmdline.inverse, verbose, cmdline.vverbose);
     }
 
     pm_close(ifP);
     pm_close(stdout);
-    
+
     return 0;
 }
diff --git a/editor/specialty/ppm3d.c b/editor/specialty/ppm3d.c
index a6faa341..bb7cd1af 100644
--- a/editor/specialty/ppm3d.c
+++ b/editor/specialty/ppm3d.c
@@ -33,7 +33,7 @@ parseCommandLine(int argc, char ** argv,
                  struct cmdlineInfo * const cmdlineP) {
 /*----------------------------------------------------------------------------
    parse program command line described in Unix standard form by argc
-   and argv.  Return the information in the options as *cmdlineP.  
+   and argv.  Return the information in the options as *cmdlineP.
 
    If command line is internally inconsistent (invalid options, etc.),
    issue error message to stderr and abort program.
@@ -64,7 +64,7 @@ parseCommandLine(int argc, char ** argv,
 
     pm_optParseOptions3( &argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
-    
+
     if (argc-1 < 2)
         pm_error("You must specify at least two arguments: left and right "
                  "input file names.  You specified %u", argc-1);
@@ -122,7 +122,7 @@ compute3dRowMono(gray *       const lGrayrow,
                  pixel *      const pixelrow,
                  unsigned int const cols,
                  int          const offset) {
-    
+
     unsigned int col;
     gray *  lgP;
     gray *  rgP;
@@ -133,7 +133,7 @@ compute3dRowMono(gray *       const lGrayrow,
     for (col = 0, pP = pixelrow, lgP = lGrayrow, rgP = rGrayrow;
          col < cols + offset;
          ++col) {
-            
+
         if ((int)col < offset/2)
             ++lgP;
         else if ((int)col < offset) {
@@ -154,7 +154,7 @@ compute3dRowMono(gray *       const lGrayrow,
             ++rgP;
         }
     }
-}    
+}
 
 
 
@@ -164,7 +164,7 @@ compute3dRowColor(pixel *      const lPixelrow,
                   pixel *      const pixelrow,
                   unsigned int const cols,
                   unsigned int const offset) {
-    
+
     unsigned int col;
     pixel * lP;
     pixel * rP;
@@ -175,7 +175,7 @@ compute3dRowColor(pixel *      const lPixelrow,
     for (col = 0, pP = pixelrow, lP = lPixelrow, rP = rPixelrow;
          col < cols + offset;
          ++col) {
-            
+
         if ((int)col < offset/2)
             ++lP;
         else if ((int)col < offset) {
@@ -196,7 +196,7 @@ compute3dRowColor(pixel *      const lPixelrow,
             ++rP;
         }
     }
-}    
+}
 
 
 
@@ -265,11 +265,11 @@ main(int argc, char *argv[]) {
     int lRows, lCols;
     int lFormat;
     pixval lMaxval;
-   
+
     int rRows, rCols;
     int rFormat;
     pixval rMaxval;
-   
+
     ppm_init(&argc, argv);
 
     parseCommandLine(argc, argv, &cmdline);
@@ -279,12 +279,12 @@ main(int argc, char *argv[]) {
 
     ppm_readppminit(lIfP, &lCols, &lRows, &lMaxval, &lFormat);
     ppm_readppminit(rIfP, &rCols, &rRows, &rMaxval, &rFormat);
-    
-    if ((lCols != rCols) || (lRows != rRows) || 
-        (lMaxval != rMaxval) || 
+
+    if ((lCols != rCols) || (lRows != rRows) ||
+        (lMaxval != rMaxval) ||
         (PPM_FORMAT_TYPE(lFormat) != PPM_FORMAT_TYPE(rFormat)))
         pm_error ("Pictures are not of same size and format");
-    
+
     cols   = lCols;
     rows   = lRows;
     maxval = lMaxval;
@@ -293,7 +293,7 @@ main(int argc, char *argv[]) {
         pm_error("Magnitude of -offset (%u columns) is not less than "
                  "width of images "
                  "(%u columns)", abs(cmdline.offset), cols);
-   
+
     ppm_writeppminit(stdout, cols, rows, maxval, 0);
 
     write3dRaster(stdout, lIfP, rIfP, cols, rows, maxval,
diff --git a/editor/specialty/ppmglobe.c b/editor/specialty/ppmglobe.c
index bb043cc6..1ddaabc3 100644
--- a/editor/specialty/ppmglobe.c
+++ b/editor/specialty/ppmglobe.c
@@ -53,7 +53,7 @@ parseCommandLine(int argc, char ** argv,
     MALLOCARRAY_NOFAIL(option_def, 100);
 
     option_def_index = 0;   /* incremented by OPTENT3 */
-    OPTENT3(0, "background",     OPT_STRING, &cmdlineP->background, 
+    OPTENT3(0, "background",     OPT_STRING, &cmdlineP->background,
             &backgroundSpec, 0);
     OPTENT3(0, "closeok",        OPT_FLAG, NULL,
             &cmdlineP->closeok, 0);
@@ -68,21 +68,21 @@ parseCommandLine(int argc, char ** argv,
     if (!backgroundSpec)
         cmdlineP->background = NULL;
 
-    if (argc - 1 < 1) 
+    if (argc - 1 < 1)
         pm_error("You must specify at least one argument:  the strip count");
     else {
         int const stripcount = atoi(argv[1]);
         if (stripcount <= 0)
             pm_error("The strip count must be positive.  You specified %d",
                      stripcount);
-            
+
         cmdlineP->stripcount = stripcount;
 
         if (argc-1 < 2)
             cmdlineP->inputFileName = "-";
         else
             cmdlineP->inputFileName = argv[2];
-    
+
         if (argc - 1 > 2)
             pm_error("There are at most two arguments: strip count "
                      "and input file name.  "
@@ -113,9 +113,9 @@ main(int argc, char *argv[]) {
     ppm_init(&argc, argv);
 
     parseCommandLine(argc, argv, &cmdline);
-    
+
     ifP = pm_openr(cmdline.inputFileName);
-    
+
     srcPixels = ppm_readppm(ifP, &srcCols, &srcRows, &srcMaxval);
 
     pm_close(ifP);
@@ -139,7 +139,7 @@ main(int argc, char *argv[]) {
                                  &backgroundColor);
 
     dstPixels = ppm_allocarray(dstCols, dstRows);
-    
+
     for (row = 0; row < dstRows; ++row) {
         double const factor = sin(M_PI * row / dstRows);
             /* Amount by which we squeeze the foreground image of each
diff --git a/editor/specialty/ppmntsc.c b/editor/specialty/ppmntsc.c
index 08fbc835..24edc3bd 100644
--- a/editor/specialty/ppmntsc.c
+++ b/editor/specialty/ppmntsc.c
@@ -6,21 +6,21 @@
    The derivation was done by Bryan Henderson on 2000.04.21 to convert
    it from operating on the RLE format to operating on the PPM format
    and to rewrite it in a cleaner style, taking advantage of modern C
-   compiler technology.  
+   compiler technology.
 */
 
 
 /*
  * 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
@@ -28,12 +28,12 @@
  * and the reason for such modification.
  */
 
-/* 
+/*
  * rlelegal.c - Make RGB colors legal in the YIQ or YUV color systems.
- * 
- * Author:	Wes Barris
- * 		Minnesota Supercomputer Center, Inc.
- * Date:	Fri Oct 15, 1993
+ *
+ * Author:      Wes Barris
+ *              Minnesota Supercomputer Center, Inc.
+ * Date:        Fri Oct 15, 1993
  * @Copyright, Research Equipment Inc., d/b/a Minnesota Supercomputer
  * Center, Inc., 1993
 
@@ -104,32 +104,32 @@ parseCommandLine(int argc, const char ** argv,
         cmdlineP->inputFilename = "-";  /* he wants stdin */
     else if (argc - 1 == 1)
         cmdlineP->inputFilename = argv[1];
-    else 
+    else
         pm_error("Too many arguments.  The only arguments accepted "
                  "are the mask color and optional input file specification");
 
     if (legalonly + illegalonly + correctedonly > 1)
         pm_error("--legalonly, --illegalonly, and --correctedonly are "
                  "conflicting options.  Specify at most one of these.");
-        
-    if (legalonly) 
+
+    if (legalonly)
         cmdlineP->output = LEGAL_ONLY;
-    else if (illegalonly) 
+    else if (illegalonly)
         cmdlineP->output = ILLEGAL_ONLY;
-    else if (correctedonly) 
+    else if (correctedonly)
         cmdlineP->output = CORRECTED_ONLY;
-    else 
+    else
         cmdlineP->output = ALL;
 }
 
 
 
-static void 
-rgbtoyiq(const int r, const int g, const int b, 
-         double * const y_p, 
-         double * const i_p, 
+static void
+rgbtoyiq(const int r, const int g, const int b,
+         double * const y_p,
+         double * const i_p,
          double * const q_p) {
-    
+
     *y_p = .299*(r/255.0) + .587*(g/255.0) + .114*(b/255.0);
     *i_p = .596*(r/255.0) - .274*(g/255.0) - .322*(b/255.0);
     *q_p = .211*(r/255.0) - .523*(g/255.0) + .312*(b/255.0);
@@ -137,8 +137,8 @@ rgbtoyiq(const int r, const int g, const int b,
 
 
 
-static void 
-yiqtorgb(const double y, const double i, const double q, 
+static void
+yiqtorgb(const double y, const double i, const double q,
          int * const r_p, int * const g_p, int * const b_p) {
     *r_p = 255.0*(1.00*y + .9562*i + .6214*q);
     *g_p = 255.0*(1.00*y - .2727*i - .6468*q);
@@ -147,10 +147,10 @@ yiqtorgb(const double y, const double i, const double q,
 
 
 
-static void 
-rgbtoyuv(const int r, const int g, const int b, 
-         double * const y_p, 
-         double * const u_p, 
+static void
+rgbtoyuv(const int r, const int g, const int b,
+         double * const y_p,
+         double * const u_p,
          double * const v_p) {
     *y_p =  .299*(r/255.0) + .587*(g/255.0) + .114*(b/255.0);
     *u_p = -.147*(r/255.0) - .289*(g/255.0) + .437*(b/255.0);
@@ -159,10 +159,10 @@ rgbtoyuv(const int r, const int g, const int b,
 
 
 
-static void 
-yuvtorgb(const double y, const double u, const double v, 
+static void
+yuvtorgb(const double y, const double u, const double v,
          int * const r_p, int * const g_p, int * const b_p) {
-    
+
     *r_p = 255.0*(1.00*y + .0000*u +1.1398*v);
     *g_p = 255.0*(1.00*y - .3938*u - .5805*v);
     *b_p = 255.0*(1.00*y +2.0279*u + .0000*v);
@@ -173,12 +173,12 @@ yuvtorgb(const double y, const double u, const double v,
 static void
 makeLegalYiq(double          const y,
              double          const i,
-             double          const q, 
-             double *        const yNewP, 
-             double *        const iNewP, 
+             double          const q,
+             double *        const yNewP,
+             double *        const iNewP,
              double *        const qNewP,
              enum legalize * const actionP) {
-    
+
     double satOld, satNew;
     /*
      * I and Q are legs of a right triangle.  Saturation is the hypotenuse.
@@ -209,13 +209,13 @@ makeLegalYiq(double          const y,
 
 
 static void
-make_legal_yuv(const double y, const double u, const double v, 
-               double * const y_new_p, 
-               double * const u_new_p, 
+make_legal_yuv(const double y, const double u, const double v,
+               double * const y_new_p,
+               double * const u_new_p,
                double * const v_new_p,
                enum legalize * const action_p
     ) {
-    
+
     double sat_old, sat_new;
     /*
      * U and V are legs of a right triangle.  Saturation is the hypotenuse.
@@ -246,13 +246,13 @@ make_legal_yuv(const double y, const double u, const double v,
 
 
 static void
-make_legal_yiq_i(const int r_in, const int g_in, const int b_in, 
-                 int * const r_out_p, 
-                 int * const g_out_p, 
+make_legal_yiq_i(const int r_in, const int g_in, const int b_in,
+                 int * const r_out_p,
+                 int * const g_out_p,
                  int * const b_out_p,
                  enum legalize * const action_p
     ) {
-    
+
     double y, i, q;
     double y_new, i_new, q_new;
     /*
@@ -276,15 +276,15 @@ make_legal_yiq_i(const int r_in, const int g_in, const int b_in,
 
 
 static void
-make_legal_yuv_i(const int r_in, const int g_in, const int b_in, 
-                 int * const r_out_p, 
-                 int * const g_out_p, 
+make_legal_yuv_i(const int r_in, const int g_in, const int b_in,
+                 int * const r_out_p,
+                 int * const g_out_p,
                  int * const b_out_p,
                  enum legalize * const action_p
     ){
-    
+
     double y, u, v;
-    double y_new, u_new, v_new;  
+    double y_new, u_new, v_new;
     /*
      * Convert to YUV and compute the new saturation.
      */
@@ -305,7 +305,7 @@ make_legal_yuv_i(const int r_in, const int g_in, const int b_in,
 
 
 
-static void 
+static void
 make_legal_yiq_b(const pixel input,
                  pixel * const output_p,
                  enum legalize * const action_p) {
@@ -313,7 +313,7 @@ make_legal_yiq_b(const pixel input,
 
     int ir_in, ig_in, ib_in;
     int ir_out, ig_out, ib_out;
-    
+
     ir_in = (int)PPM_GETR(input);
     ig_in = (int)PPM_GETG(input);
     ib_in = (int)PPM_GETB(input);
@@ -327,14 +327,14 @@ make_legal_yiq_b(const pixel input,
 
 
 
-static void 
+static void
 make_legal_yuv_b(const pixel input,
                  pixel * const output_p,
                  enum legalize * const action_p) {
 
     int ir_in, ig_in, ib_in;
     int ir_out, ig_out, ib_out;
-    
+
     ir_in = (int)PPM_GETR(input);
     ig_in = (int)PPM_GETG(input);
     ib_in = (int)PPM_GETB(input);
@@ -347,7 +347,7 @@ make_legal_yuv_b(const pixel input,
 
 
 
-static void 
+static void
 reportMapping(pixel const oldPixel,
               pixel const newPixel) {
 /*----------------------------------------------------------------------------
@@ -358,7 +358,7 @@ reportMapping(pixel const oldPixel,
     static pixel lastChangedPixel;
     static bool firstTime = true;
 
-    if (!PPM_EQUAL(oldPixel, newPixel) && 
+    if (!PPM_EQUAL(oldPixel, newPixel) &&
         (firstTime || PPM_EQUAL(oldPixel, lastChangedPixel))) {
         pm_message("Mapping %u %u %u -> %u %u %u\n",
                    PPM_GETR(oldPixel),
@@ -371,14 +371,14 @@ reportMapping(pixel const oldPixel,
 
         lastChangedPixel = oldPixel;
         firstTime = false;
-    }    
+    }
 }
 
 
 
 static void
 convertOneImage(FILE *             const ifP,
-                struct cmdlineInfo const cmdline, 
+                struct cmdlineInfo const cmdline,
                 unsigned int *     const hiCountP,
                 unsigned int *     const loCountP) {
 
@@ -419,8 +419,8 @@ convertOneImage(FILE *             const ifP,
                         make_legal_yiq_b(inputRow[col],
                                          &corrected,
                                          &action);
-                        
-                    if (action == LOWER_SAT) 
+
+                    if (action == LOWER_SAT)
                         ++*hiCountP;
                     if (action == RAISE_SAT)
                         ++*loCountP;
@@ -456,7 +456,7 @@ convertOneImage(FILE *             const ifP,
 
 int
 main(int argc, const char **argv) {
-    
+
     struct cmdlineInfo cmdline;
     FILE * ifP;
     unsigned int totalHiCount, totalLoCount;
@@ -469,7 +469,7 @@ main(int argc, const char **argv) {
     parseCommandLine(argc, argv, &cmdline);
 
     ifP = pm_openr(cmdline.inputFilename);
-    
+
     imageCount = 0;    /* initial value */
     totalHiCount = 0;  /* initial value */
     totalLoCount = 0;  /* initial value */
@@ -488,14 +488,14 @@ main(int argc, const char **argv) {
     }
 
 
-	if (cmdline.verbose) {
+        if (cmdline.verbose) {
         pm_message("%u images processed.", imageCount);
-        pm_message("%u pixels were above the saturation limit.", 
+        pm_message("%u pixels were above the saturation limit.",
                    totalHiCount);
-        pm_message("%u pixels were below the saturation limit.", 
+        pm_message("%u pixels were below the saturation limit.",
                    totalLoCount);
     }
-    
+
     pm_close(ifP);
 
     return 0;
diff --git a/editor/specialty/ppmrelief.c b/editor/specialty/ppmrelief.c
index 14a6d0a8..94453bdd 100644
--- a/editor/specialty/ppmrelief.c
+++ b/editor/specialty/ppmrelief.c
@@ -85,7 +85,7 @@ main(int argc, const char * argv[]) {
         for (col = 0; col < cols - 2; ++col) {
             pixel const inputA = inputbuf[rowa][col];
             pixel const inputB = inputbuf[rowb][col + 2];
-            
+
             pixval const r =
                 clip(PPM_GETR(inputA) + (mv2 - PPM_GETR(inputB)), maxval);
             pixval const g =
diff --git a/editor/specialty/ppmshift.c b/editor/specialty/ppmshift.c
index 27cbb78c3..37ed3785 100644
--- a/editor/specialty/ppmshift.c
+++ b/editor/specialty/ppmshift.c
@@ -1,4 +1,3 @@
-
 /*********************************************************************/
 /* ppmshift -  shift lines of a picture left or right by x pixels    */
 /* Frank Neumann, October 1993                                       */
diff --git a/editor/specialty/ppmtv.c b/editor/specialty/ppmtv.c
index da25102a..7e540e34 100644
--- a/editor/specialty/ppmtv.c
+++ b/editor/specialty/ppmtv.c
@@ -1,4 +1,3 @@
-
 /*********************************************************************/
 /* ppmtv -  make a 'look-alike ntsc' picture from a PPM file       */
 /* Frank Neumann, October 1993                                       */
@@ -18,88 +17,88 @@ int main(argc, argv)
 int argc;
 char *argv[];
 {
-	FILE* ifp;
-	int argn, rows, cols, format, i = 0, j = 0;
-	pixel *srcrow, *destrow;
-	pixel *pP = NULL, *pP2 = NULL;
-	pixval maxval;
-	double dimfactor;
-	long longfactor;
-	const char * const usage = "dimfactor [ppmfile]\n        dimfactor: 0.0 = total blackness, 1.0 = original picture\n";
-
-	/* parse in 'default' parameters */
-	ppm_init(&argc, argv);
-
-	argn = 1;
-
-	/* parse in dim factor */
-	if (argn == argc)
-		pm_usage(usage);
-	if (sscanf(argv[argn], "%lf", &dimfactor) != 1)
-		pm_usage(usage);
-	if (dimfactor < 0.0 || dimfactor > 1.0)
-		pm_error("dim factor must be in the range from 0.0 to 1.0 ");
-	++argn;
-
-	/* parse in filename (if present, stdin otherwise) */
-	if (argn != argc)
-	{
-		ifp = pm_openr(argv[argn]);
-		++argn;
-	}
-	else
-		ifp = stdin;
-
-	if (argn != argc)
-		pm_usage(usage);
-
-	/* read first data from file */
-	ppm_readppminit(ifp, &cols, &rows, &maxval, &format);
-
-	/* no error checking required here, ppmlib does it all for us */
-	srcrow = ppm_allocrow(cols);
-
-	longfactor = (long)(dimfactor * 65536);
-
-	/* allocate a row of pixel data for the new pixels */
-	destrow = ppm_allocrow(cols);
-
-	ppm_writeppminit(stdout, cols, rows, maxval, 0);
-
-	/** now do the ntsc'ing (actually very similar to ppmdim) **/
-	for (i = 0; i < rows; i++)
-	{
-		ppm_readppmrow(ifp, srcrow, cols, maxval, format);
-
-		pP = srcrow;
-		pP2 = destrow;
-
-		for (j = 0; j < cols; j++)
-		{
-			/* every alternating row is left in unchanged condition */
-			if (i & 1)
-			{
-				PPM_ASSIGN(*pP2, PPM_GETR(*pP), PPM_GETG(*pP), PPM_GETB(*pP));
-			}
-			/* and the other lines are dimmed to the specified factor */
-			else
-			{
-				PPM_ASSIGN(*pP2, (PPM_GETR(*pP) * longfactor) >> 16,
-								 (PPM_GETG(*pP) * longfactor) >> 16,
-								 (PPM_GETB(*pP) * longfactor) >> 16);
-			}
-			pP++;
-			pP2++;
-		}
-
-		/* write out one line of graphic data */
-		ppm_writeppmrow(stdout, destrow, cols, maxval, 0);
-	}
-
-	pm_close(ifp);
-	ppm_freerow(srcrow);
-	ppm_freerow(destrow);
-
-	exit(0);
+        FILE* ifp;
+        int argn, rows, cols, format, i = 0, j = 0;
+        pixel *srcrow, *destrow;
+        pixel *pP = NULL, *pP2 = NULL;
+        pixval maxval;
+        double dimfactor;
+        long longfactor;
+        const char * const usage = "dimfactor [ppmfile]\n        dimfactor: 0.0 = total blackness, 1.0 = original picture\n";
+
+        /* parse in 'default' parameters */
+        ppm_init(&argc, argv);
+
+        argn = 1;
+
+        /* parse in dim factor */
+        if (argn == argc)
+                pm_usage(usage);
+        if (sscanf(argv[argn], "%lf", &dimfactor) != 1)
+                pm_usage(usage);
+        if (dimfactor < 0.0 || dimfactor > 1.0)
+                pm_error("dim factor must be in the range from 0.0 to 1.0 ");
+        ++argn;
+
+        /* parse in filename (if present, stdin otherwise) */
+        if (argn != argc)
+        {
+                ifp = pm_openr(argv[argn]);
+                ++argn;
+        }
+        else
+                ifp = stdin;
+
+        if (argn != argc)
+                pm_usage(usage);
+
+        /* read first data from file */
+        ppm_readppminit(ifp, &cols, &rows, &maxval, &format);
+
+        /* no error checking required here, ppmlib does it all for us */
+        srcrow = ppm_allocrow(cols);
+
+        longfactor = (long)(dimfactor * 65536);
+
+        /* allocate a row of pixel data for the new pixels */
+        destrow = ppm_allocrow(cols);
+
+        ppm_writeppminit(stdout, cols, rows, maxval, 0);
+
+        /** now do the ntsc'ing (actually very similar to ppmdim) **/
+        for (i = 0; i < rows; i++)
+        {
+                ppm_readppmrow(ifp, srcrow, cols, maxval, format);
+
+                pP = srcrow;
+                pP2 = destrow;
+
+                for (j = 0; j < cols; j++)
+                {
+                        /* every alternating row is left in unchanged condition */
+                        if (i & 1)
+                        {
+                                PPM_ASSIGN(*pP2, PPM_GETR(*pP), PPM_GETG(*pP), PPM_GETB(*pP));
+                        }
+                        /* and the other lines are dimmed to the specified factor */
+                        else
+                        {
+                                PPM_ASSIGN(*pP2, (PPM_GETR(*pP) * longfactor) >> 16,
+                                                                 (PPM_GETG(*pP) * longfactor) >> 16,
+                                                                 (PPM_GETB(*pP) * longfactor) >> 16);
+                        }
+                        pP++;
+                        pP2++;
+                }
+
+                /* write out one line of graphic data */
+                ppm_writeppmrow(stdout, destrow, cols, maxval, 0);
+        }
+
+        pm_close(ifp);
+        ppm_freerow(srcrow);
+        ppm_freerow(destrow);
+
+        exit(0);
 }