about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-06-30 19:38:50 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-06-30 19:38:50 +0000
commitffa495eb1f02bfc0e5f83a17e917e8709ec41356 (patch)
tree509aee1a7696e401ad791c39f9a4fab440b180c9
parentaa813fa24371ead6a50fed6080fe82f8ccc7f491 (diff)
downloadnetpbm-mirror-ffa495eb1f02bfc0e5f83a17e917e8709ec41356.tar.gz
netpbm-mirror-ffa495eb1f02bfc0e5f83a17e917e8709ec41356.tar.xz
netpbm-mirror-ffa495eb1f02bfc0e5f83a17e917e8709ec41356.zip
Release 10.95.00
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@4119 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rwxr-xr-xbuildtools/configure.pl8
-rwxr-xr-xbuildtools/makeman54
-rw-r--r--doc/HISTORY33
-rw-r--r--test/Test-Order8
-rwxr-xr-xtest/pamarith.test254
-rwxr-xr-xtest/pamchannel.test14
-rwxr-xr-xtest/pamcrater.test18
-rwxr-xr-xtest/pamcut.test62
-rwxr-xr-xtest/pamdepth.test10
-rw-r--r--test/pamdice.ok7
-rwxr-xr-xtest/pamdice.test25
-rwxr-xr-xtest/pamditherbw.test61
-rwxr-xr-xtest/pamfile.test16
-rwxr-xr-xtest/pamfind.test25
-rwxr-xr-xtest/pamfix.test5
-rwxr-xr-xtest/pamfunc.test147
-rwxr-xr-xtest/pamgauss.test26
-rwxr-xr-xtest/pamhue.test6
-rwxr-xr-xtest/pamrecolor.test41
-rwxr-xr-xtest/pamscale-reportonly.test35
-rwxr-xr-xtest/pamseq.test20
-rwxr-xr-xtest/pamsumm.test21
-rwxr-xr-xtest/pamundice.test53
-rwxr-xr-xtest/pbmclean.test6
-rwxr-xr-xtest/pbmmake.test41
-rwxr-xr-xtest/pbmpage.test16
-rwxr-xr-xtest/pbmpscale.test14
-rwxr-xr-xtest/pbmtext-utf8.test50
-rwxr-xr-xtest/pbmtext.test26
-rwxr-xr-xtest/pbmtopgm.test18
-rwxr-xr-xtest/pbmupc.test46
-rwxr-xr-xtest/pgmhist.test21
-rwxr-xr-xtest/pgmmake.test41
-rwxr-xr-xtest/pgmnoise-parameters.test20
-rwxr-xr-xtest/pgmnoise.test55
-rwxr-xr-xtest/pgmramp.test9
-rwxr-xr-xtest/pnmcat.test58
-rwxr-xr-xtest/pnmcolormap.test38
-rwxr-xr-xtest/pnmcrop1.test5
-rwxr-xr-xtest/pnmpsnr.test21
-rwxr-xr-xtest/pnmquant.test59
-rwxr-xr-xtest/pnmremap1.test31
-rwxr-xr-xtest/pnmtile.test18
-rwxr-xr-xtest/ppmforge-parameters.test36
-rw-r--r--test/ppmforge.ok11
-rwxr-xr-xtest/ppmforge.test53
-rwxr-xr-xtest/ppmhist.test16
-rwxr-xr-xtest/ppmmake.test51
-rwxr-xr-xtest/ppmpat.test134
-rwxr-xr-xtest/ppmwheel.test18
-rwxr-xr-xtest/random-generator.test24
-rw-r--r--version.mk4
52 files changed, 1341 insertions, 548 deletions
diff --git a/buildtools/configure.pl b/buildtools/configure.pl
index a2a1fd22..aa94a6bb 100755
--- a/buildtools/configure.pl
+++ b/buildtools/configure.pl
@@ -2489,6 +2489,14 @@ if ($platform eq "GNU") {
     push(@config_mk, "CC = cc -no-cpp-precomp\n");
     push(@config_mk, gnuCflags('cc'));
     push(@config_mk, 'CFLAGS_SHLIB = -fno-common', "\n");
+    # -D_DARWIN_SOURCE is a hack.  We've seen build fail on MacOS because the
+    # C library erroneously neglects to include 'sprintf' and 'vasprintf' in
+    # <stdio.h> under the conditions under which Netpbm includes it.
+    # -D_DARWIN_SOURCE makes it include them.  *_SOURCE macros are supposed to
+    # be defined in the source code to which they apply, but since this is
+    # just a hack, we prefer to do it with a compiler option and leave the
+    # source code unsullied.
+    push(@config_mk, "CFLAGS += -D_DARWIN_SOURCE\n");
 
     my $installNameOpt;
     if ($netpbmlib_runtime_path eq '') {
diff --git a/buildtools/makeman b/buildtools/makeman
index 196dbd0a..6ff40aca 100755
--- a/buildtools/makeman
+++ b/buildtools/makeman
@@ -2,17 +2,24 @@
 #
 # makeman -- compile netpbm's stereotyped HTML to troff markup
 #
-# This approach works because we control the entire document universe 
+# Example:
+#
+#    $ makeman pamcut.html pamcomp.html
+#
+#    $ makeman -v -d /tmp/inputdir pamcut.html
+#
+# The output troff file is in the same directory as the input HTML file, named
+# the same except with .1 extension.
+
+# This approach works because we control the entire document universe
 # this is going to convert and can reinforce useful stereotypes.
 #
 # The output of this tool uses cliches parseable by doclifter,
 # which should thus be able to recover all the semantic information
 # it looks like this thing is losing.
 #
-# Known bugs:
-#  * Ordered lists are smashed into unordered lists
-#
 # Limitations:
+#  * Ordered lists are smashed into unordered lists
 #  * IMG tags are issued as .IMG preceded by a bolded caption containing
 #    the alt content.  This will only work if the page is formatted with
 #    mwww macros.
@@ -29,7 +36,7 @@
 # Version 1.1, February 11 2016
 #
 #   Added ability to process &mdash; &minus;
-#   Added footer message to clarify original source. 
+#   Added footer message to clarify original source.
 #
 
 import os, sys, re
@@ -110,7 +117,7 @@ def makeman(name, file, indoc):
     indoc = ('.TH "%s" %d "%s" "%s"\n' % (title,section,date,source)) + indoc
     # Literal layout
     indoc = re.sub("(?i)\n *<PRE>", "\n.nf", indoc)
-    indoc = re.sub("(?i)\n *</PRE>", "\n.fi", indoc)
+    indoc = re.sub("(?i) *</PRE>\n", "\n.fi\n", indoc)
     indoc = re.sub("(?i)\n *<BLOCKQUOTE>", "\n.RS", indoc)
     indoc = re.sub("(?i)\n *</BLOCKQUOTE>", "\n.RE", indoc)
     # Highlight processing
@@ -151,7 +158,7 @@ def makeman(name, file, indoc):
     indoc = "\n".join(lines)
     indoc = re.sub(r"\s*\.sp", "\n.sp", indoc)
     # Format email addresses as italic
-    indoc = re.sub('(?i)<A[ \n]+HREF="mailto:[^>]+">([^<]+)</A>', r'\\fI\1\\fP', indoc)    
+    indoc = re.sub('(?i)<A[ \n]+HREF="mailto:[^>]+">([^<]+)</A>', r'\\fI\1\\fP', indoc)
     # Format manual cross-references
     def xrefmatch(match):
         xrefto = match.group(2)
@@ -200,7 +207,8 @@ def makeman(name, file, indoc):
     indoc = re.sub('(?i)<H2>([^><]*)</H2>', ".SH \\1", indoc)
     indoc = re.sub('(?i)<H3>([^><]*)</H3>', ".SS \\1", indoc)
     indoc = re.sub('(?i)<H4>([^><]*)</H4>', ".B \\1", indoc)
-    # 
+    indoc = re.sub('(?i)<H5>([^><]*)</H5>', ".B \\1", indoc)
+    #
     # Process definition lists -- just turn them into .TPs
     indoc = re.sub("(?i) *<DL *(COMPACT)?>", "", indoc)
     indoc = re.sub("(?i) *</DL>", "", indoc)
@@ -221,6 +229,15 @@ def makeman(name, file, indoc):
     # Acronyms
     indoc = re.sub('<acronym [a-zA-Z0-9:= \n"]*>', "", indoc)
     indoc = re.sub("</acronym>", "", indoc)
+    # Abbreviation - just erase tags
+    indoc = re.sub('<abbr [^>]+>', '', indoc)
+    indoc = re.sub('</abbr>', '', indoc)
+    # Subscript - just erase tags
+    indoc = re.sub('(?i)<sub [^>]+>', '', indoc)
+    indoc = re.sub('(?i)</sub>', '', indoc)
+    # Span - just erase tags
+    indoc = re.sub('(?i)<span [^>]+>', '', indoc)
+    indoc = re.sub('(?i)</span>', '', indoc)
     # Image tags
     indoc = re.sub(' *<img src="([^"]*)" alt="([^"]*)"( *[a-z]*="?[0-9]*"?)*>', ".B \\2\n.IMG -C \\1", indoc)
     # Special characters
@@ -236,7 +253,7 @@ def makeman(name, file, indoc):
     indoc = re.sub("(?i) *</table>.*", ".TE", indoc)
     # First the single-line case
     indoc = re.sub("(?i)</td> *<td>", "\t", indoc)
-    indoc = re.sub("(?i)<tr> *<td>", "", indoc)
+    indoc = re.sub("(?i)<tr> *<td( [^>]*)?>", "", indoc)
     indoc = re.sub("(?i)</td> *</tr>", "", indoc)
     # Then the multiline case
     indoc = re.sub(r'(?i)\s*<t[hd][^>]*>([^<\n]*)</t[dh]>\s*', '\t\\1', indoc)
@@ -248,6 +265,9 @@ def makeman(name, file, indoc):
     # Debugging
     #sys.stderr.write("Name: %s, Title: %s, Date: %s\n" % (name, title, date))
     # Time for error checking now
+    # We replaced every HTML tag we could above, so any remaining in
+    #   'indoc' represent material we don't know how to convert, which we call
+    #   bad lines.
     badlines = []
     for line in indoc.split("\n"):
         if "<" in line or ">" in line.replace(" >", "") or re.search(r'(?<!^\\)&.*;', line):
@@ -282,10 +302,12 @@ def main(args, mainout=sys.stdout, mainerr=sys.stderr):
         # First pass: gather locations for cross-references:
         sectmap = {}
         for file in arguments:
-            try: 
-                infp = open(os.path.join(dirprefix, file))
+            fullfilenm = os.path.join(dirprefix, file)
+            try:
+                infp = open(fullfilenm)
             except:
-                sys.stderr.write("makeman: can't open %s\n" % file)
+                sys.stderr.write(
+                    "makeman: can't open input file '%s'\n" % fullfilenm)
                 continue
             indoc = infp.read()
             infp.close()
@@ -313,10 +335,12 @@ def main(args, mainout=sys.stdout, mainerr=sys.stderr):
                 LiftException("%s has two <HR> tags!" % file)
         # Second pass: do formatting
         for file in arguments:
-            try: 
-                infp = open(os.path.join(dirprefix, file))
+            fullfilenm = os.path.join(dirprefix, file)
+            try:
+                infp = open(fullfilenm)
             except:
-                sys.stderr.write("makeman: can't open %s\n" % file)
+                sys.stderr.write(
+                    "makeman: can't open output file '%s'\n" % fullfilenm)
                 continue
             indoc = infp.read()
             infp.close()
diff --git a/doc/HISTORY b/doc/HISTORY
index 161aad71..2ce5844a 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,20 +4,7 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
-21.05.26 BJH  Release 10.94.05
-
-              pamtopng: Fix -transparent option - program recognized
-              -transparency instead.  Always broken (pamtopng was new in
-              Netpbm 10.71 (June 2015)).
-
-              Build: make it work on systems that don't have date +%s.  Broken
-              in Netpbm 10.78 (March 2017).  Thanks Claes Nästén
-              (pekdon@gmail.com).
-
-              Mkdeb: fix failure with message about unrecognized format of
-              VERSION file.  Introduced in Netpbm 10.90 (March 2020).
-
-21.05.15 BJH  Release 10.94.04
+21.06.30 BJH  Release 10.95.00
 
               pamtopng: Fix rejection of all BLACKANDWHITE_ALPHA images with
               message about wrong depth.  Always broken (pamtopng was new in
@@ -32,15 +19,17 @@ CHANGE HISTORY
               BLACKANDWHITE.  Always broken (pamtopng was new in Netpbm 10.71
               (June 2015)).
 
-21.05.08 BJH  Release 10.94.03
+              pamtopng: Fix -transparent option - program recognized
+              -transparency instead.  Always broken (pamtopng was new in
+              Netpbm 10.71 (June 2015)).
 
               pamtogif: Fix failure with bogus message about wrong depth with
               grayscale and black and white PAM images with transparency.
               Always broken (pamtogif was new in Netpbm 10.37 (December 2006)).
               Thanks Karol Kosek <krkk@krkk.ct8.pl>.
 
-21.04.08 BJH  Release 10.94.02
-
+              ppmtogif: Same as 'pamtogif' fix above, but with -alpha option.
+              
               Build: Fix build failure due to missing 'random' function on
               Mingw platform.  Bug introduced in Netpbm 10.94 (March 2021).
 
@@ -48,9 +37,15 @@ CHANGE HISTORY
               Unix process management.  Bug introduced in Netpbm 10.94
               (March 2021).
 
-21.03.30 BJH  Release 10.94.01
+              Build: Make it work on systems that don't have date +%s.  Broken
+              in Netpbm 10.78 (March 2017).  Thanks Claes Nästén
+              (pekdon@gmail.com).
 
-              Add missing test files.
+              Build: Fix for MacOS build failures with missing sprintf and
+              vasprintf in broken build environment.
+              
+              Mkdeb: fix failure with message about unrecognized format of
+              VERSION file.  Introduced in Netpbm 10.90 (March 2020).
 
 21.03.27 BJH  Release 10.94.00
 
diff --git a/test/Test-Order b/test/Test-Order
index aaf46985..6f4334af 100644
--- a/test/Test-Order
+++ b/test/Test-Order
@@ -2,6 +2,7 @@
 
 all-in-place.test
 legacy-names.test
+random-generator.test
 
 # Generator tests
 
@@ -61,6 +62,7 @@ pnmtopnm-plain.test
 pamdepth.test
 
 pamditherbw.test
+pamditherbw-random.test
 pamhue.test
 
 pbmclean.test
@@ -77,7 +79,11 @@ ppmchange.test
 pambackground.test
 pnmpaste-pbm.test
 
+ppmshift.test
+ppmspread.test
+
 pbmpscale.test
+pamrecolor.test
 pnmremap1.test
 pnmremap2.test
 pnmquant.test
@@ -136,6 +142,7 @@ ppmdfont.test
 pamfix.test
 pamvalidate.test
 pamexec.test
+pbmlife.test
 
 # Round-trip tests : editors
 
@@ -157,6 +164,7 @@ pamhue-roundtrip.test
 
 # Round-trip tests: miscellaneous utilities
 
+pamendian-roundtrip.test
 pamexec-roundtrip.test
 channel-stack-roundtrip.test
 
diff --git a/test/pamarith.test b/test/pamarith.test
index a4c98859..b7fe3212 100755
--- a/test/pamarith.test
+++ b/test/pamarith.test
@@ -1,7 +1,7 @@
 #! /bin/bash
 # This script tests: pamarith
-# Also requires: pamtopnm rgb3toppm pamenlarge pnmcat pamseq pbmmake pgmmake 
-# Also requires: ppmpat pamchannel 
+# Also requires: pamtopnm rgb3toppm pamenlarge pnmcat pamseq pbmmake pgmmake
+# Also requires: ppmpat pamchannel
 
 tmpdir=${tmpdir:-/tmp}
 input1_pgm=${tmpdir}/input1.pgm
@@ -15,8 +15,8 @@ echo "Test 1"
 pamseq 1 15 | pamtopnm -assume > ${input1_pgm}
 pgmmake -maxval 15 0.15 16 1 > ${input2_pgm}
 
-rgb3toppm ${input1_pgm} ${input1_pgm} ${input1_pgm} > ${input1_ppm} 
-rgb3toppm ${input2_pgm} ${input2_pgm} ${input2_pgm} > ${input2_ppm} 
+rgb3toppm ${input1_pgm} ${input1_pgm} ${input1_pgm} > ${input1_ppm}
+rgb3toppm ${input2_pgm} ${input2_pgm} ${input2_pgm} > ${input2_ppm}
 
 pnmcat -tb -plain ${input1_pgm} ${input2_pgm}
 
@@ -93,7 +93,7 @@ echo "cksum is 2425386270 41 or 2921940274 59"
 for image in testgrid.pbm ${input1_ppm}
   do
   echo "input image"
-  cat ${image} | cksum 
+  cat ${image} | cksum
   for fn in "-minimum" "-maximum" "-mean" "-and" "-or"
     do
     echo ${fn}
@@ -123,105 +123,136 @@ echo "-----------------------------------------------------------" 1>&2
 
 echo "Test Invalid"
 
-output_ppm=${tmpdir}/output.ppm
+test_out=${tmpdir}/test_out
 
 # multiple functions
 
-pamarith -add -subtract testimg.ppm testimg.ppm > ${output_ppm} || \
+pamarith -add -subtract testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 1"
-  test -s ${output_ppm}; echo " "$?
-pamarith -multiply -divide testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -multiply -divide testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 2"
-  test -s ${output_ppm}; echo " "$?
-pamarith -difference -minimum testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -difference -minimum testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 3"
-  test -s ${output_ppm}; echo " "$?
-pamarith -maximum -mean testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -maximum -mean testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 4"
-  test -s ${output_ppm}; echo " "$?
-pamarith -compare -and testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -compare -and testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 5"
-  test -s ${output_ppm}; echo " "$?
-pamarith -compare -equal testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -compare -equal testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 6"
-  test -s ${output_ppm}; echo " "$?
-pamarith -or -nand testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -or -nand testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 7"
-  test -s ${output_ppm}; echo " "$?
-pamarith -nor -xor testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -nor -xor testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 8"
-  test -s ${output_ppm}; echo " "$?
-pamarith -shiftleft -shiftright testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -shiftleft -shiftright testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 9"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 # -add does not take a value
 
-pamarith -add=1 testimg.ppm testimg.ppm > ${output_ppm} || \
+pamarith -add=1 testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 10"
- test -s ${output_ppm}; echo " "$?
+ test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 # No function
 
-pamarith -plain testimg.ppm testimg.ppm > ${output_ppm} || \
+pamarith -plain testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 11"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
-pamarith testimg.ppm testimg.ppm > ${output_ppm} || \
+pamarith testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 12"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 # Just one input image file
 
-pamarith -add testimg.ppm > ${output_ppm} || \
+pamarith -add testimg.ppm > ${test_out} || \
   echo -n "Expected failure 13"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 # No input image file
 
-pamarith -add > ${output_ppm} || \
+pamarith -add > ${test_out} || \
   echo -n "Expected failure 14"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 # Input images with different depth (number of planes)
 
 pamchannel -infile testimg.ppm 0 1 | \
-  pamarith -add testimg.ppm - > ${output_ppm} || \
+  pamarith -add testimg.ppm - > ${test_out} || \
   echo -n "Expected failure 15"
-  test -s ${output_ppm}; echo " "$?
-
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 # Input images with different x/y dimensions
 
-pamarith -add testimg.ppm testgrid.pbm > ${output_ppm} || \
+pamarith -add testimg.ppm testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 16"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 pamenlarge -xscale=2 testgrid.pbm | \
-  pamarith -add testgrid.pbm - > ${output_ppm} || \
+  pamarith -add testgrid.pbm - > ${test_out} || \
   echo -n "Expected failure 17"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 pamenlarge -yscale=3 testgrid.pbm | \
-  pamarith -add testgrid.pbm - > ${output_ppm} || \
+  pamarith -add testgrid.pbm - > ${test_out} || \
   echo -n "Expected failure 18"
-  test -s ${output_ppm}; echo " "$?
-
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 # Invalid usage of -closeness
 
-pamarith -equal -closeness=100.1 testgrid.pbm > ${output_ppm} || \
+pamarith -equal -closeness=100.1 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 19"
-  test -s ${output_ppm}; echo " "$?
-pamarith -equal -closeness=-10 testgrid.pbm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -equal -closeness=-10 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 20"
-  test -s ${output_ppm}; echo " "$?
-pamarith -closeness -equal testgrid.pbm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -closeness -equal testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 21"
-  test -s ${output_ppm}; echo " "$?
-pamarith -compare -closeness=10 testgrid.pbm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -compare -closeness=10 testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 22"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 # Bit string functions
 # Create PGM test input
@@ -230,52 +261,73 @@ input3_pgm=${tmpdir}/input3.pgm
 input4_pgm=${tmpdir}/input4.pgm
 input5_pgm=${tmpdir}/input5.pgm
 
-pgmmake -maxval=4095 1.0 3 1 > ${input3_pgm} 
+pgmmake -maxval=4095 1.0 3 1 > ${input3_pgm}
 pgmmake -maxval=4096 1.0 3 1 > ${input4_pgm}
 pgmmake -maxval=8191 1.0 3 1 > ${input5_pgm}
 
 # Bit string functions - Maxval must match
 
-pamarith -and ${input3_pgm} ${input5_pgm} > ${output_ppm} || \
+pamarith -and ${input3_pgm} ${input5_pgm} > ${test_out} || \
   echo -n "Expected failure 23"
-  test -s ${output_ppm}; echo " "$?
-pamarith -or ${input3_pgm} ${input5_pgm} > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -or ${input3_pgm} ${input5_pgm} > ${test_out} || \
   echo -n "Expected failure 24"
-  test -s ${output_ppm}; echo " "$?
-pamarith -nand ${input3_pgm} ${input5_pgm} > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -nand ${input3_pgm} ${input5_pgm} > ${test_out} || \
   echo -n "Expected failure 25"
-  test -s ${output_ppm}; echo " "$?
-pamarith -nor ${input3_pgm} ${input5_pgm} > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -nor ${input3_pgm} ${input5_pgm} > ${test_out} || \
   echo -n "Expected failure 26"
-  test -s ${output_ppm}; echo " "$?
-pamarith -xor ${input3_pgm} ${input5_pgm} > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -xor ${input3_pgm} ${input5_pgm} > ${test_out} || \
   echo -n "Expected failure 27"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 # Bit string functions - Maxval must be 2^n -1
 
-pamarith -and ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
+pamarith -and ${input4_pgm} ${input4_pgm} > ${test_out} || \
   echo -n "Expected failure 28"
-  test -s ${output_ppm}; echo " "$?
-pamarith -or ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -or ${input4_pgm} ${input4_pgm} > ${test_out} || \
   echo -n "Expected failure 29"
-  test -s ${output_ppm}; echo " "$?
-pamarith -nand ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -nand ${input4_pgm} ${input4_pgm} > ${test_out} || \
   echo -n "Expected failure 30"
-  test -s ${output_ppm}; echo " "$?
-pamarith -nor ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -nor ${input4_pgm} ${input4_pgm} > ${test_out} || \
   echo -n "Expected failure 31"
-  test -s ${output_ppm}; echo " "$?
-pamarith -xor ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -xor ${input4_pgm} ${input4_pgm} > ${test_out} || \
   echo -n "Expected failure 32"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
-pamarith -shiftleft ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
+pamarith -shiftleft ${input4_pgm} ${input4_pgm} > ${test_out} || \
   echo -n "Expected failure 33"
-  test -s ${output_ppm}; echo " "$?
-pamarith -shiftright ${input4_pgm} ${input4_pgm} > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -shiftright ${input4_pgm} ${input4_pgm} > ${test_out} || \
   echo -n "Expected failure 34"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 rm ${input3_pgm} ${input4_pgm} ${input5_pgm}
 
@@ -283,33 +335,45 @@ rm ${input3_pgm} ${input4_pgm} ${input5_pgm}
 # Only the functions that are commutative and associative allow
 # three or more inputs.
 
-pamarith -subtract testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
+pamarith -subtract testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 35"
-  test -s ${output_ppm}; echo " "$?
-pamarith -divide testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -divide testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 36"
-  test -s ${output_ppm}; echo " "$?
-pamarith -compare testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -compare testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 37"
-  test -s ${output_ppm}; echo " "$?
-pamarith -difference testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -difference testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 38"
-  test -s ${output_ppm}; echo " "$?
-pamarith -shiftleft testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -shiftleft testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 39"
-  test -s ${output_ppm}; echo " "$?
-pamarith -shiftright testimg.ppm testimg.ppm testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamarith -shiftright testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
   echo -n "Expected failure 40"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 # Currently -equal and -mean do not allow more than two input images.
 # These two cases should be removed once improvements are made.
 
-pamarith -equal testgrid.pbm testgrid.pbm testgrid.pbm > ${output_ppm} || \
+pamarith -equal testgrid.pbm testgrid.pbm testgrid.pbm > ${test_out} || \
   echo -n "Expected failure 41"
-  test -s ${output_ppm}; echo " "$?
-pamarith -mean testgrid.pbm  testgrid.pbm testgrid.pbm > ${output_ppm} || \
-  echo -n "Expected failure 42"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
-rm ${output_ppm}
+pamarith -mean testgrid.pbm  testgrid.pbm testgrid.pbm > ${test_out} || \
+  echo -n "Expected failure 42"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
diff --git a/test/pamchannel.test b/test/pamchannel.test
index 2e017ef2..6bb0cf67 100755
--- a/test/pamchannel.test
+++ b/test/pamchannel.test
@@ -46,12 +46,16 @@ test_out=${tmpdir}/test_out
 echo "Test Invalid"
 
 pamchannel  -infile testgrid.pbm 1 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamchannel  -infile testimg.ppm 3 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamtopam testimg.ppm | pamchannel -infile=- 4 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
-
-rm ${test_out}
\ No newline at end of file
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamcrater.test b/test/pamcrater.test
index ba10ca24..027e34e3 100755
--- a/test/pamcrater.test
+++ b/test/pamcrater.test
@@ -64,15 +64,21 @@ echo "Error messages should appear below the line." 1>&2
 echo "------------------------------" 1>&2
 
 pamcrater -width 0 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcrater -height 0 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcrater -number 0 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcrater -test -radius=10 | pamshadedrelief -gamma 0 > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
-
-rm -f ${test_out}
\ No newline at end of file
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamcut.test b/test/pamcut.test
index e4d8c62f..ced45f9c 100755
--- a/test/pamcut.test
+++ b/test/pamcut.test
@@ -59,51 +59,79 @@ echo "-----------------------------------------------------------" 1>&2
 
 # overspecification
 pamcut -left=1 -right=1 -width=14 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -top=1 -bottom=1 -height=16 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -right=1 -cropright=1 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -top=1 -croptop=1 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -bottom=1 -cropbottom=1 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -left=1 -cropleft=1 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # excessive cropping
 pamcut -cropleft=7 -cropright=8 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -left=7 -right=6 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -croptop=8 -cropbottom=8 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -top=10 -bottom=9 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # pad absent
 pamcut -cropleft=1 -width=14 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut -croptop=1  -height=16 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 11"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # legacy style: insufficient number of positional parameters
 pamcut 5 testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 12"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 12"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut 5 4 testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 13"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 13"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamcut 5 5 30 testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 14"; test -s ${test_out}; echo " "$?
-
-rm -f ${test_out}
\ No newline at end of file
+  echo -n "Expected failure 14"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamdepth.test b/test/pamdepth.test
index da198973..eaa1b165 100755
--- a/test/pamdepth.test
+++ b/test/pamdepth.test
@@ -30,9 +30,11 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamdepth 0 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pamdepth 65536 testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
-
-rm ${test_out}
\ No newline at end of file
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamdice.ok b/test/pamdice.ok
index 99504ec0..9e978168 100644
--- a/test/pamdice.ok
+++ b/test/pamdice.ok
@@ -13,9 +13,14 @@ P1@1 1@0@
 P1@1 1@1@
 Test Invalid
 Expected failure 1
+Expected failure 1.rm
 Expected failure 2
+Expected failure 2.rm
 Expected failure 3
+Expected failure 3.rm
 Expected failure 4
+Expected failure 4.rm
 Expected failure 5
+Expected failure 5.rm
 Expected failure 6
-Expected failure (output files)
+Expected failure 6.rm
diff --git a/test/pamdice.test b/test/pamdice.test
index 3199fd4a..25695d5a 100755
--- a/test/pamdice.test
+++ b/test/pamdice.test
@@ -11,7 +11,7 @@ echo "Test 1."
 pbmmake -w 2 5 | pamdice -height=1 -width=1 -outstem=${fname_stem} -plain
 ls ${fname_stem}*.pbm | while read file
   do
-  cat ${file} | tr '\n'  '@' ; echo 
+  cat ${file} | tr '\n'  '@' ; echo
   done | sort | uniq -c | sed 's/^ *//'
 
 rm ${fname_stem}*.pbm
@@ -22,7 +22,7 @@ echo "Test 2."
 pbmmake -g 2 5 | pamdice -height=1 -width=1 -outstem=${fname_stem} -plain
 ls ${fname_stem}*.pbm | while read file
   do
-  cat ${file} | tr '\n'  '@' ; echo 
+  cat ${file} | tr '\n'  '@' ; echo
   done
 
 rm ${fname_stem}*.pbm
@@ -36,33 +36,44 @@ echo "Invalid command-line argument combinations." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
+# No output files should be producd.  With nothing to remove,
+# the rm commands should always fail.
+
 # No input file
 pamdice -width=10 -height=10  -outstem=${fname_stem} /dev/null || \
 echo "Expected failure 1"
+rm ${fname_stem}* ||
+echo "Expected failure 1.rm"
 
 # No -outstem
 pamdice -width=10 -height=10 testgrid.pbm || \
 echo "Expected failure 2"
+rm ${fname_stem}* ||
+echo "Expected failure 2.rm"
 
 # -width=0
 pamdice -width=0 -height=10 -outstem=${fname_stem} testgrid.pbm || \
 echo "Expected failure 3"
+rm ${fname_stem}* ||
+echo "Expected failure 3.rm"
 
 # -height=0
 pamdice -width=10 -height=0 -outstem=${fname_stem} testgrid.pbm || \
 echo "Expected failure 4"
+rm ${fname_stem}* ||
+echo "Expected failure 4.rm"
 
 # -hoverlap larger than width
 pamdice -width=10 -height=10 -hoverlap=11 \
   -outstem=${fname_stem} testgrid.pbm || \
 echo "Expected failure 5"
+rm ${fname_stem}* ||
+echo "Expected failure 5.rm"
+
 
 # -voverlap larger than height
 pamdice -width=10 -height=10 -voverlap=11 \
   -outstem=${fname_stem} testgrid.pbm || \
 echo "Expected failure 6"
-
-
-# Ensure that no output files are produced by the above
-ls ${fname_stem}* || \
-echo "Expected failure (output files)"
\ No newline at end of file
+rm ${fname_stem}* ||
+echo "Expected failure 6.rm"
diff --git a/test/pamditherbw.test b/test/pamditherbw.test
index 40eb0a4d..378d7e94 100755
--- a/test/pamditherbw.test
+++ b/test/pamditherbw.test
@@ -47,28 +47,63 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamditherbw -fs -atkinson       ${test_red} > ${test_out} || \
- echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -floyd -atkinson    ${test_red} > ${test_out} || \
- echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -dither8  -cluster3 ${test_red} > ${test_out} || \
- echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -cluster3 -cluster4 ${test_red} > ${test_out} || \
- echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -cluster3 -cluster8 ${test_red} > ${test_out} || \
- echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -cluster4 -cluster8 ${test_red} > ${test_out} || \
- echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -hilbert -threshold ${test_red} > ${test_out} || \
- echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -clump=8            ${test_red} > ${test_out} || \
- echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -fs -clump=8        ${test_red} > ${test_out} || \
- echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -hilbert -clump=1   ${test_red} > ${test_out} || \
- echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -th -value=-1       ${test_red} > ${test_out} || \
- echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 11"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamditherbw -th -value=1.1      ${test_red} > ${test_out} || \
- echo -n "Expected failure 12"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 12"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_red} ${test_out}
+rm ${test_red}
diff --git a/test/pamfile.test b/test/pamfile.test
index aa3e2895..16d084ea 100755
--- a/test/pamfile.test
+++ b/test/pamfile.test
@@ -31,10 +31,16 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamfile -size -machine  testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamfile -count -machine testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
-head -n1 testimg.ppm | pamfile > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+head -n1 testimg.ppm | pamfile > ${test_out} || \
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamfind.test b/test/pamfind.test
index 074dde5c..7b612f78 100755
--- a/test/pamfind.test
+++ b/test/pamfind.test
@@ -8,7 +8,7 @@ sorted1_res=${tmpdir}/pamfind_sorted1.res
 
 # Test 1
 echo "Test 1"
-pamfind -color=grey17     testimg.ppm 
+pamfind -color=grey17     testimg.ppm
 pamfind -target=210,57,41 testimg.ppm
 pamfind -target=50,55,49 -machine testimg.ppm
 
@@ -25,7 +25,7 @@ pamfind -target=1 testgrid.pbm | sort > ${sorted1_res}
 comm -3 ${sorted0_res}  ${sorted1_res}  |
   awk 'END {if (NR==226) print  "okay";
             else printf("failure (line count=%d)\n", NR)}'
-comm -12 ${sorted0_res}  ${sorted1_res} | 
+comm -12 ${sorted0_res}  ${sorted1_res} |
   awk '{print}; END { if(NR == 0) print  "okay";
             else printf("failure (line count=%d)\n", NR)}'
 
@@ -44,12 +44,21 @@ echo "-----------------------------------------------------------" 1>&2
 echo "Test Invalid"
 
 pamfind -color=black -target=1,1,1 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamfind -target=0,0 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamfind -target=0,0,0,0 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
-pamfind testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pamfind testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamfix.test b/test/pamfix.test
index e6021b56..d13e0230 100755
--- a/test/pamfix.test
+++ b/test/pamfix.test
@@ -54,13 +54,14 @@ echo "-----------------------------------------------------------" 1>&2
 echo -e "P2\n3 2\n7\n0 1 2\n6 7 8" | pamfix -change -clip > ${test_out} || \
   echo -n "Expected failure 1";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 echo -e "P1\n5 5" | pamfix -truncate -plain > ${test_out} || \
   echo -n "Expected failure 2";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 echo -e "P2\n3 3\255" | pamfix -truncate -plain > ${test_out} || \
   echo -n "Expected failure 3";
   test -s ${test_out}; echo " "$?
-
-rm ${test_out}
+  rm -f ${test_out}
diff --git a/test/pamfunc.test b/test/pamfunc.test
index f9a8a33e..e52584b4 100755
--- a/test/pamfunc.test
+++ b/test/pamfunc.test
@@ -5,7 +5,7 @@
 tmpdir=${tmpdir:-/tmp}
 input_pgm=${tmpdir}/input.pgm
 
-echo "Test 1"  
+echo "Test 1"
 
 pamseq 1 15 | pamtopnm -assume > ${input_pgm}
 pamtopnm -plain ${input_pgm} | tr '\n' ' '; echo
@@ -90,77 +90,124 @@ echo "-----------------------------------------------------------" 1>&2
 
 echo "Test Invalid"
 
-output_ppm=${tmpdir}/output.ppm
+test_out=${tmpdir}/test_out
 
-pamfunc -multiplier testimg.ppm > ${output_ppm} || \
+pamfunc -multiplier testimg.ppm > ${test_out} || \
   echo -n "Expected failure 1"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -multiplier=-1 testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -multiplier=-1 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 2"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -divisor testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -divisor testimg.ppm > ${test_out} || \
   echo -n "Expected failure 3"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -divisor=-20 testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -divisor=-20 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 4"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -adder testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -adder testimg.ppm > ${test_out} || \
   echo -n "Expected failure 5"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -adder 0.5 testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -adder 0.5 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 6"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -subtractor testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -subtractor testimg.ppm > ${test_out} || \
   echo -n "Expected failure 7"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -subtractor 0.1 testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -subtractor 0.1 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 8"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -multiplier=1 -divisor=2 testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -multiplier=1 -divisor=2 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 9"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -adder=2 -subtractor=3 testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -adder=2 -subtractor=3 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 10"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -min testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -min testimg.ppm > ${test_out} || \
   echo -n "Expected failure 11"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -max testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -max testimg.ppm > ${test_out} || \
   echo -n "Expected failure 12"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -andmask testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -andmask testimg.ppm > ${test_out} || \
   echo -n "Expected failure 13"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -ormask testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -ormask testimg.ppm > ${test_out} || \
   echo -n "Expected failure 14"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -xormask testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -xormask testimg.ppm > ${test_out} || \
   echo -n "Expected failure 15"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -not 1 testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -not 1 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 16"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -min=1 -max=2 testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -min=1 -max=2 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 17"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -andmask=1 -ormask=0 testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -andmask=1 -ormask=0 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 18"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -andmask=0xffff testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -andmask=0xffff testimg.ppm > ${test_out} || \
   echo -n "Expected failure 19"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -shiftleft testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -shiftleft testimg.ppm > ${test_out} || \
   echo -n "Expected failure 20"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -shiftright testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -shiftright testimg.ppm > ${test_out} || \
   echo -n "Expected failure 21"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -changemaxval testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -changemaxval testimg.ppm > ${test_out} || \
   echo -n "Expected failure 22"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -shiftleft=1 -shiftright=1 testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -shiftleft=1 -shiftright=1 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 23"
-  test -s ${output_ppm}; echo " "$?
-pamfunc -multiplier=0.5 -changemaxval=65535 testimg.ppm > ${output_ppm} || \
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamfunc -multiplier=0.5 -changemaxval=65535 testimg.ppm > ${test_out} || \
   echo -n "Expected failure 24"
-  test -s ${output_ppm}; echo " "$?
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
diff --git a/test/pamgauss.test b/test/pamgauss.test
index bb006ce9..7952c7df 100755
--- a/test/pamgauss.test
+++ b/test/pamgauss.test
@@ -28,14 +28,26 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pamgauss 3 3               > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamgauss 3 3   -sigma=0    > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamgauss 3 3   -sigma=-1.5 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamgauss 3     -sigma=0.5  > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
-pamgauss 3 3 3 -sigma=0.5  > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pamgauss 3 3 3 -sigma=0.5  > ${test_out} || \
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamhue.test b/test/pamhue.test
index d81a0acb..47688175 100755
--- a/test/pamhue.test
+++ b/test/pamhue.test
@@ -43,6 +43,6 @@ echo "An error message should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamhue testimg.ppm  > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
-
-rm -f ${test_out}
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamrecolor.test b/test/pamrecolor.test
index cc79a124..67c6f19d 100755
--- a/test/pamrecolor.test
+++ b/test/pamrecolor.test
@@ -26,18 +26,37 @@ echo "Invalid command-line argument combinations." 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
-pamrecolor --targetcolor=rgb:00/11/22 --colorfile={base1_pgm} testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
-pamrecolor --rmult=0.3  --gmult=0.3  --bmult=0.3 --colorfile={base1_pgm} testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
-pamrecolor --colorspace=void --targetcolor=rgb:80/80/80 testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+pamrecolor --targetcolor=rgb:00/11/22 \
+           --colorfile=${base1_pgm} testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamrecolor --rmult=0.3  --gmult=0.3  --bmult=0.3 \
+           --colorfile=${base1_pgm} testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
+pamrecolor --colorspace=void \
+           --targetcolor=rgb:80/80/80 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pamrecolor --targetcolor=vague testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pamrecolor --colorfile=${truncated_file} testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
-pamrecolor --rmult=0.2989 --gmult=0.5866 testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
+pamrecolor --rmult=0.2989 --gmult=0.5866 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
-rm ${base_pgm} ${test_out} ${truncated_file}
\ No newline at end of file
+rm ${base_pgm} ${truncated_file}
diff --git a/test/pamscale-reportonly.test b/test/pamscale-reportonly.test
index 45a38687..9aacab56 100755
--- a/test/pamscale-reportonly.test
+++ b/test/pamscale-reportonly.test
@@ -30,22 +30,37 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamscale -reportonly -xsize=640 -ysize=400 -xscale=2 testimg.ppm > \
-  ${test_out} \
-  || echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  ${test_out} || \
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamscale -reportonly -xsize=640 -xscale=2 -yscale=3 testimg.ppm > \
-  ${test_out} \
-  || echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  ${test_out} || \
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamscale -reportonly -xsize=640 -ysize=400 -pixels=200000 testimg.ppm \
   > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamscale -reportonly -xsize=640 -ysize=400 -xysize 640 400 testimg.ppm \
   > ${test_out} || \
-  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamscale -reportonly -xsize=640 -ysize=400 -xyfit  640 400 testimg.ppm \
   > ${test_out} || \
-  echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamscale -reportonly -xsize=640 -ysize=400 -xyfill 640 400 testimg.ppm \
   > ${test_out} || \
-  echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
-
-rm ${test_out}
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamseq.test b/test/pamseq.test
index 0681d396..9c089cf3 100755
--- a/test/pamseq.test
+++ b/test/pamseq.test
@@ -17,11 +17,19 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pamseq 1 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamseq 0 255 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamseq 3 0   > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 c64="0123456789012345678901234567890123456789012345678901234567890123"
 c256=${c64}${c64}${c64}${c64}
@@ -29,6 +37,6 @@ c256=${c64}${c64}${c64}${c64}
 # Tupletype string length=256
 
 pamseq -tupletype="${c256}" 3 15 > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
-
-rm ${test_out}
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamsumm.test b/test/pamsumm.test
index 5b4fdb17..3d008533 100755
--- a/test/pamsumm.test
+++ b/test/pamsumm.test
@@ -28,12 +28,21 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamsumm -sum -min  testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamsumm -sum -max  testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pamsumm -mean -max testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
-pamsumm            testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pamsumm            testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pamundice.test b/test/pamundice.test
index e8add587..5c1f9c6b 100755
--- a/test/pamundice.test
+++ b/test/pamundice.test
@@ -18,7 +18,7 @@ for ((x=0; x<3; ++x))
 pamundice -across=3 -down=5 ${fname_stem}"_%1d_%1a".pgm | cksum
 
 ls ${fname_stem}_?_?.pgm | \
-    pamundice -across=3 -down=5 -listfile=- | cksum 
+    pamundice -across=3 -down=5 -listfile=- | cksum
 
 
 # Test 2.
@@ -30,7 +30,7 @@ for ((y=0; y<5; ++y))
   do
   pamundice -across=3 ${fname_stem}"_"$y"_%1a".pgm > ${tempfile}_"$y"
   done
- 
+
 pnmcat -tb ${tempfile}_[01234] | cksum
 rm ${tempfile}_[01234]
 
@@ -129,55 +129,78 @@ echo "-----------------------------------------------------------" 1>&2
 
 # No input file pattern specified
 pamundice -down=5 -across=2 > ${test_out} || \
-echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # -down=0
 pamundice -down=0 -across=2 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
-echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # -across=0
 pamundice -down=5 -across=0 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
-echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # -down too large
 pamundice -down=6 -across=2 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
-echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # -across too large
 pamundice -down=5 -across=3 ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
-echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # precision does not match
 pamundice -down=5 -across=2 ${fname_stem}_"%2d"_"%2a".pbm > ${test_out} || \
-echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # precision set to zero
 pamundice -down=5 -across=2 ${fname_stem}_"%0d"_"%0a".pbm > ${test_out} || \
-echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # no precision
 pamundice -down=5 -across=2 ${fname_stem}_"%d"_"%a".pbm > ${test_out} || \
-echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # -hoverlap too large
 pamundice -down=5 -across=2 -hoverlap=18 \
   ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
-echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # -voverlap too large
 pamundice -down=5 -across=2 -voverlap=19 \
   ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
-echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # corrupt listfile : file names do not exist
 seq 10 | sed -e 's/^/::::::/' -e 's/$/::::::/' | \
   pamundice -down=5 -across=2 -listfile=- > ${test_out} || \
-echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 11"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # listfile with insufficient lines (insufficient file entries)
 ls ${fname_stem}_*_*.pbm | head -n 9 | \
   pamundice -down=5 -across=2 -listfile=- > ${test_out} || \
-echo -n "Expected failure 12"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 12"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 rm ${fname_stem}*.pbm
-
diff --git a/test/pbmclean.test b/test/pbmclean.test
index c0c3a759..3fb24b25 100755
--- a/test/pbmclean.test
+++ b/test/pbmclean.test
@@ -46,8 +46,8 @@ echo "-----------------------------------------------------------" 1>&2
 
 # overspecification
 pbmclean -black -white -min=1 -extended testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # note that without -extended the above is valid.
-
-rm -f ${test_out}
\ No newline at end of file
diff --git a/test/pbmmake.test b/test/pbmmake.test
index 3f815617..9945394a 100755
--- a/test/pbmmake.test
+++ b/test/pbmmake.test
@@ -32,20 +32,41 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pbmmake -b -w -plain 1 1 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmmake -b -g -plain 1 1 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmmake -white -gray -plain 1 1 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmmake -white -plain   > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmmake -white -plain 1 > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmmake -white -plain 1 0 > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmmake -white -plain 0 1 > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
-pbmmake -white -plain 1 1 1 > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pbmmake -white -plain 1 1 1 > ${test_out} || \
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pbmpage.test b/test/pbmpage.test
index 50570e3e..cfacefa7 100755
--- a/test/pbmpage.test
+++ b/test/pbmpage.test
@@ -20,10 +20,16 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pbmpage -a3 1 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmpage 0 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
-pbmpage 4 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pbmpage 4 > ${test_out} || \
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pbmpscale.test b/test/pbmpscale.test
index 9c34734a..21ad6cd1 100755
--- a/test/pbmpscale.test
+++ b/test/pbmpscale.test
@@ -19,12 +19,16 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pbmpscale testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pbmpscale 0 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pbmpscale 2 3 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
-
-rm -f ${test_out}
\ No newline at end of file
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pbmtext-utf8.test b/test/pbmtext-utf8.test
index 8ebb6e31..0677d161 100755
--- a/test/pbmtext-utf8.test
+++ b/test/pbmtext-utf8.test
@@ -7,7 +7,7 @@ LC_ALL=C
 export LANG LC_ALL
 
 
-# This test requires a working UTF-8 locale 
+# This test requires a working UTF-8 locale
 # Skip this test if it is are not available
 
 iconv /dev/null
@@ -22,11 +22,11 @@ utf_locale_list=${tmpdir}/utf_locale_list
 
 locale_to_test="en_US.utf8"  # Initial value
 # Edit the above value if necessary
-  
+
 # Make a list of available locales which end in "utf8"
 locale -a | grep "\.utf8$" > ${utf_locale_list}
 
-# Hunt for a valid utf8 locale  
+# Hunt for a valid utf8 locale
 # Submit each candidate to a trial pbmtext run until one that works is
 # encountered
 
@@ -142,12 +142,15 @@ cat ${long_txt} | \
   LC_ALL=${locale_for_test} \
   pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \
   echo -n "Expected failure 1";
-  test -s ${test_out}; echo " "$? 
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 cat ${long_txt} | \
   LC_ALL=${locale_for_test} \
   pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \
   echo -n "Expected failure 2";
-  test -s ${test_out}; echo " "$?  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 rm ${long_txt}
 
@@ -165,39 +168,42 @@ echo "Test 6 Invalid"
 
 awk 'BEGIN { printf("%c%c",128,129);  print ""}' | \
         LC_ALL=${locale_for_test} \
-        pbmtext -builtin bdf -wchar -text-dump > ${test_out} 
+        pbmtext -builtin bdf -wchar -text-dump > ${test_out}
   echo -n "6-1:" ${PIPESTATUS[@]} ":" $?
-  test -s ${test_out}; echo " "$?  
-  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 awk 'BEGIN { printf("ABC%c%c",192, 193);  print ""}' | \
         LC_ALL=${locale_for_test} \
-        pbmtext -builtin bdf -wchar -text-dump > ${test_out} 
+        pbmtext -builtin bdf -wchar -text-dump > ${test_out}
   echo -n "6-2:" ${PIPESTATUS[@]} ":" $?
-  test -s ${test_out}; echo " "$?  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 awk 'BEGIN { printf("abcde%c%c", 254, 253);  print ""}' | \
         LC_ALL=${locale_for_test} \
-        pbmtext -builtin bdf -wchar -text-dump > ${test_out} 
+        pbmtext -builtin bdf -wchar -text-dump > ${test_out}
   echo -n "6-3:" ${PIPESTATUS[@]} ":" $?
-  test -s ${test_out}; echo " "$?  
-  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 awk 'BEGIN { printf("abcdefg%c%c", 195, 15);  print ""}' | \
         LC_ALL=${locale_for_test} \
-        pbmtext -builtin bdf -wchar -text-dump > ${test_out} 
+        pbmtext -builtin bdf -wchar -text-dump > ${test_out}
   echo -n "6-4:" ${PIPESTATUS[@]} ":" $?
-  test -s ${test_out}; echo " "$?  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 awk 'BEGIN { printf("123456789%c%c%c", 224, 143 ,0);  print ""}' | \
         LC_ALL=${locale_for_test} \
-        pbmtext -builtin bdf -wchar -text-dump > ${test_out} 
+        pbmtext -builtin bdf -wchar -text-dump > ${test_out}
   echo -n "6-5:" ${PIPESTATUS[@]} ":" $?
-  test -s ${test_out}; echo " "$?  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 awk 'BEGIN { printf("abcdefg123ABCDEFG%c%c%c%c",247, 135, 135, 7);  print ""}' | \
         LC_ALL=${locale_for_test} \
-        pbmtext -builtin bdf -wchar -text-dump > ${test_out} 
+        pbmtext -builtin bdf -wchar -text-dump > ${test_out}
   echo -n "6-6:" ${PIPESTATUS[@]} ":" $?
-  test -s ${test_out}; echo " "$? 
-  
-rm ${test_out}
-  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
diff --git a/test/pbmtext.test b/test/pbmtext.test
index 515711e4..a7c75c23 100755
--- a/test/pbmtext.test
+++ b/test/pbmtext.test
@@ -114,27 +114,42 @@ test_out=${tmpdir}/test_out
 pbmtext -font=testgrid.pbm foo > ${test_out} || \
   echo -n "Expected failure 1";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -font=testimg.ppm  foo > ${test_out} || \
   echo -n "Expected failure 2";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -builtin=void      foo > ${test_out} || \
-  echo -n "Expected failure 3";  
+  echo -n "Expected failure 3";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -font=${font_pbm} -builtin=fixed foo > ${test_out}  || \
   echo -n "Expected failure 4";
-  test -s ${test_out}; echo " "$?  
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -dry-run    -text-dump  foo > ${test_out} || \
   echo -n "Expected failure 5";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -dump-sheet -text-dump  foo > ${test_out} || \
   echo -n "Expected failure 6";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -dry-run    -dump-sheet foo > ${test_out} || \
   echo -n "Expected failure 7";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pbmtext -wchar foo > ${test_out} || \
   echo -n "Expected failure 8";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
 rm ${font_pbm}
 
@@ -164,12 +179,17 @@ echo "-----------------------------------------------------------" 1>&2
 pbmtext -nomargins -builtin fixed `cat ${long_txt}` > ${test_out}  || \
   echo -n "Expected failure 1";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 cat ${long_txt} | pbmtext -nomargins -builtin fixed > ${test_out}  || \
   echo -n "Expected failure 2";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 cat ${long_txt} | \
   LC_ALL=C pbmtext -nomargins -builtin fixed -wchar > ${test_out}  || \
   echo -n "Expected failure 3";
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 
-rm ${long_txt} ${test_out}
+rm ${long_txt}
diff --git a/test/pbmtopgm.test b/test/pbmtopgm.test
index a7ba6f7c..dc872640 100755
--- a/test/pbmtopgm.test
+++ b/test/pbmtopgm.test
@@ -18,15 +18,21 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pbmtopgm 5 0 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pbmtopgm 0 9 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pbmtopgm 15 5 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pbmtopgm 5 17 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
-
-rm -f ${test_out}
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pbmupc.test b/test/pbmupc.test
index fb9ec90e..a29a06f3 100755
--- a/test/pbmupc.test
+++ b/test/pbmupc.test
@@ -20,22 +20,46 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pbmupc -s3 0 72890 00011     > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1   72890 00011     > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1 0 72890           > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1 10 72890 00011    > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1 0 172890 00011    > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1 0   2890 00011    > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1 0 72890 100011    > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pbmupc -s1 0 72890   0011    > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
-pbmupc -s1 0 72890 100011 1  > ${test_out} || \
-   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pbmupc -s1 0 72890 100011 1  > ${test_out} || \
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pgmhist.test b/test/pgmhist.test
index ab3763fd..0179a4f6 100755
--- a/test/pgmhist.test
+++ b/test/pgmhist.test
@@ -35,12 +35,21 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pgmhist -median   -quartile testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmhist -median   -decile   testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmhist -quartile -decile   testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
-pgmhist testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pgmhist testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pgmmake.test b/test/pgmmake.test
index 2fc63e72..bd9882a5 100755
--- a/test/pgmmake.test
+++ b/test/pgmmake.test
@@ -19,20 +19,41 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pgmmake 100  5 5 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmmake 1.01 5 5 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmmake .5   5   > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmmake .5       > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmmake -maxval=5        5 5 > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmmake -maxval=0     .5 5 5 > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmmake -maxval=-1    .5 5 5 > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
-pgmmake -maxval=65536 .5 5 5 > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pgmmake -maxval=65536 .5 5 5 > ${test_out} || \
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pgmnoise-parameters.test b/test/pgmnoise-parameters.test
index 1682afca..d2a96530 100755
--- a/test/pgmnoise-parameters.test
+++ b/test/pgmnoise-parameters.test
@@ -11,16 +11,26 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pgmnoise -maxval=255  -randomseed=1 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pgmnoise 100 -randomseed=1 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pgmnoise 100 0 -randomseed=1 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pgmnoise 0 100 -randomseed=1 > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pgmnoise 100 100 100 -randomseed=1 > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pgmnoise.test b/test/pgmnoise.test
index 21a2729e..ab98a5e2 100755
--- a/test/pgmnoise.test
+++ b/test/pgmnoise.test
@@ -20,7 +20,7 @@ echo "Test 3."
 for maxval in `seq 16` 255 65535
   do
   echo ${maxval}
-  pgmnoise -maxval=${maxval} -randomseed=1 -plain 16 1 | tr '\n' ' ' 
+  pgmnoise -maxval=${maxval} -randomseed=1 -plain 16 1 | tr '\n' ' '
   done
 echo
 
@@ -35,7 +35,7 @@ for maxval in `seq 16` 30 31 32 254 255 256 65534 65535
 
 echo "Test 5."
 echo "Should print four identical lines"
-# width height values do not affect random number sequence 
+# width height values do not affect random number sequence
 for xysize in "1 10000" "100 100" "250 40" "1000 10"
   do pgmnoise --randomseed=0 ${xysize} | pgmhist -mach | cksum
   done
@@ -48,7 +48,7 @@ echo "Test 6."
 echo "First column should be 2^n - 1"
 # The "pool" method of generating pixvals is used iff maxval is
 # a power of 2 minus 1: 1, 3, 7, 15, 31 ...
-for maxval in `seq 35; seq 60 69; seq 120 129; seq 250 259` 
+for maxval in `seq 35; seq 60 69; seq 120 129; seq 250 259`
   do
   pgmnoise -maxval=${maxval} -randomseed=1 -verbose 1 1 > /dev/null \
   2> ${messages}
@@ -68,22 +68,51 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pgmnoise 0 0  > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise 0 1  > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise 1 0  > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise      > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise 1    > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise 100 -1 > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise -randomseed=-1 100 100  > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise -maxval=-1 100 100  > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise -maxval=0 100 100  > ${test_out} || \
-   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pgmnoise -maxval=$((256 * 256 * 256 * 256)) 10 10 > ${test_out} || \
-   echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pgmramp.test b/test/pgmramp.test
index 3ec73749..50a3cf6d 100755
--- a/test/pgmramp.test
+++ b/test/pgmramp.test
@@ -31,14 +31,17 @@ test_out=${tmpdir}/test_out
 
 for combination in "-lr -tb" "-lr -rectangle" "-rectangle -ellipse"
 do pgmramp $combination 10 10 > ${test_out} || \
-   echo -n "Expected failure: $combination" ; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure: $combination"
+  test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
 done
 
 pgmramp -lr     1 > ${test_out} || \
   echo -n "Expected failure: insufficient parameters"; \
   test -s ${test_out}; echo " "$?
+  rm -f ${test_out}
+
 pgmramp -tb 1 1 1 > ${test_out} || \
   echo -n "Expected failure: excessive parameters"; \
   test -s ${test_out}; echo " "$?
-
-rm ${test_out}
+  rm -f ${test_out}
diff --git a/test/pnmcat.test b/test/pnmcat.test
index 40c29f50..519e01c7 100755
--- a/test/pnmcat.test
+++ b/test/pnmcat.test
@@ -22,50 +22,76 @@ echo "-----------------------------------------------------------" 1>&2
 
 # direction not specified
 pnmcat testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # both directions specified
 pnmcat -topbottom -leftright testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # both pad colors specified
 pnmcat -topbottom -white -black testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # justification parameters overspecified
 pnmcat -lr -jtop -jbottom testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -lr -jtop -jcenter testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -lr -jcenter -jbottom testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -tb -jleft -jright testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -tb -jleft -jcenter testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -tb -jcenter -jright testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # justification parameter in the wrong direction
 pnmcat -lr -jleft    testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -lr -jright   testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 11"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -tb -jtop     testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 12"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 12"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmcat -tb -jbottom  testgrid.pbm testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 13"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 13"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 # more than one input image from standard input
 cat testgrid.pbm | pnmcat -lr - - testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 14"; test -s ${test_out}; echo " "$?
-
-rm -f ${test_out}
+  echo -n "Expected failure 14"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pnmcolormap.test b/test/pnmcolormap.test
index 13be8a44..9ac0ea9e 100755
--- a/test/pnmcolormap.test
+++ b/test/pnmcolormap.test
@@ -3,7 +3,7 @@
 # Also requires:
 
 pnmcolormap -plain -sort 2 testgrid.pbm
-pnmcolormap -plain -sort -square 2 testgrid.pbm 
+pnmcolormap -plain -sort -square 2 testgrid.pbm
 pnmcolormap -plain -sort all testgrid.pbm
 
 echo 1>&2
@@ -15,19 +15,37 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pnmcolormap 0 testimg.ppm   > ${test_out} || \
-  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmcolormap -1 testimg.ppm  > ${test_out} || \
-  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmcolormap 0.1 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmcolormap -center -meancolor 16 testimg.ppm    > ${test_out} || \
-  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmcolormap -center -meanpixel 16 testimg.ppm    > ${test_out} || \
-  echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmcolormap -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmcolormap -spreadbrightness -spreadluminosity 16 \
   testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
-
-rm ${test_out}
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pnmcrop1.test b/test/pnmcrop1.test
index 34c7534a..936cbd95 100755
--- a/test/pnmcrop1.test
+++ b/test/pnmcrop1.test
@@ -74,6 +74,7 @@ for option in "-reportfull -reportsize" \
     do
     echo ${option}
     pnmcrop -reportfull ${option} testgrid.pbm > ${test_out} || \
-        echo -n "Expected failure: " ${option}; test -s ${test_out}; echo " "$?
-        rm ${test_out} 
+        echo -n "Expected failure: " ${option}
+        test -s ${test_out}; echo " "$?
+        rm ${test_out}
     done
diff --git a/test/pnmpsnr.test b/test/pnmpsnr.test
index 7603459b..bdd67883 100755
--- a/test/pnmpsnr.test
+++ b/test/pnmpsnr.test
@@ -36,12 +36,23 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pnmpsnr ${b_pbm} ${w_pbm} ${b_pbm}     > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmpsnr ${b_pbm}                       > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmpsnr ${b_pbm} ${w_pbm} -target1=100 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmpsnr                   -machine     > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${b_pbm} ${w_pbm} ${test_out}
+rm ${b_pbm} ${w_pbm}
diff --git a/test/pnmquant.test b/test/pnmquant.test
index 3a2ef906..07830a3a 100755
--- a/test/pnmquant.test
+++ b/test/pnmquant.test
@@ -7,30 +7,30 @@ echo "Test 1"
 # Count colors in output image.
 
 pnmquant 256 testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' 
+  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}'
 
 pnmquant -center 256 testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' 
+  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}'
 
 pnmquant -spreadbrightness 256 testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}' 
+  awk 'NR==1 {print ($2 <= 256) , ($2 > 256 * 0.95)}'
 
 pnmquant -spreadluminosity 128 testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}' 
+  awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}'
 
 pnmquant -floyd -randomseed=0 128 testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}' 
+  awk 'NR==1 {print ($2 <= 128) , ($2 > 128 * 0.95)}'
 
 pnmquant 64 -meanpixel testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 64) , ($2 > 64 * 0.9)}' 
+  awk 'NR==1 {print ($2 <= 64) , ($2 > 64 * 0.9)}'
 
 pnmquant 16 -meancolor testimg.ppm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 16) , ($2 > 16 * 0.9)}' 
+  awk 'NR==1 {print ($2 <= 16) , ($2 > 16 * 0.9)}'
 
 
 pnmquant 2 testgrid.pbm | ppmhist | \
-  awk 'NR==1 {print ($2 <= 2) , ($2 == 2) }' 
- 
+  awk 'NR==1 {print ($2 <= 2) , ($2 == 2) }'
+
 echo "Test Invalid"
 
 echo 1>&2
@@ -42,20 +42,41 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pnmquant 0 testimg.ppm   > ${test_out} || \
-  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmquant testimg.ppm  > ${test_out} || \
-  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmquant 10.5 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmquant -center -meancolor 16 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmquant -center -meanpixel 16 testimg.ppm    > ${test_out} || \
-  echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmquant -meancolor -meanpixel 16 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmquant -spreadbrightness -spreadluminosity 16 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
-pnmquant -randomseed 1 -norandom 10 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pnmquant -randomseed 1 -norandom 10 testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pnmremap1.test b/test/pnmremap1.test
index 18debcb8..c2b9a6a6 100755
--- a/test/pnmremap1.test
+++ b/test/pnmremap1.test
@@ -33,17 +33,32 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pnmremap -mapfile=/dev/null testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmremap -mapfile=/dev/zero testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmremap testimg.ppm                    > ${test_out} || \
-  echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmremap -fs -nofs testimg.ppm          > ${test_out} || \
-  echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 pnmremap -mapfile=testgrid.pbm -missingcolor=rgb:00/ff/00 testimg.ppm \
  > ${test_out} || \
-  echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
-pnmremap -mapfile=testgrid.pbm -firstisdefault testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+pnmremap -mapfile=testgrid.pbm -firstisdefault testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/pnmtile.test b/test/pnmtile.test
index 11f576bd..80378432 100755
--- a/test/pnmtile.test
+++ b/test/pnmtile.test
@@ -29,15 +29,21 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pnmtile 100 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmtile 100 0 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmtile 0 100 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 pnmtile 100 100 100 testgrid.pbm > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
-
-rm -f ${test_out}
\ No newline at end of file
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/ppmforge-parameters.test b/test/ppmforge-parameters.test
index 39f199ea..342b8242 100755
--- a/test/ppmforge-parameters.test
+++ b/test/ppmforge-parameters.test
@@ -30,18 +30,36 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 ppmforge -night  -dimension=0  > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmforge  -dimension=10  > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmforge  -dimension=-1  > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmforge -clouds -mesh=1.99    > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmforge -clouds -power=0      > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmforge         -ice=-1       > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
-ppmforge         -glaciers=-1  > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+ppmforge         -glaciers=-1  > ${test_out} || \
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/ppmforge.ok b/test/ppmforge.ok
index e4a4c9e2..2f3f9501 100644
--- a/test/ppmforge.ok
+++ b/test/ppmforge.ok
@@ -1 +1,10 @@
-3634219838 196623
+Test 1. Should print: 547829788 196623  (Mersenne Twister)
+547829788 196623
+Test 2.
+match
+Test 3.
+match
+Test 4.
+match
+Test 5.
+match
diff --git a/test/ppmforge.test b/test/ppmforge.test
index 3ebea88c..959eb360 100755
--- a/test/ppmforge.test
+++ b/test/ppmforge.test
@@ -1,9 +1,52 @@
 #! /bin/bash
 # This script tests: ppmforge
-# Also requires:
+# Also requires: pnmpsnr
 
-# Use small x y values to avoid floating point issues.
-
-# Should print: 3634219838 196623 (Glibc)
-#               3262664440 196623 (MAC OS)
+echo "Test 1. Should print: 547829788 196623  (Mersenne Twister)" 
+#               3634219838 196623 (Glibc rand() )
+#               3262664440 196623 (MAC OS rand() )
 ppmforge -night -seed 1 | cksum
+
+tmpdir=${tmpdir:-/tmp}
+test_ppm=${tmpdir}/test.ppm
+
+
+# Target values for following tests were determined by running the
+# ppmforge command pairs 30 times with different seeds, finding
+# the minimum (or "poorest match") for each component and 
+# subtracting 0.01 dB.   As such these are weak tests.
+
+
+echo "Test 2."
+ppmforge -cloud -seed 1 -power 0.75 > ${test_ppm}
+ppmforge -cloud -seed 1 -power 0.74 | \
+  pnmpsnr -rgb -target1=41.15 -target2=41.15 -target3=999 - ${test_ppm}
+
+rm ${test_ppm}
+
+echo "Test 3."
+ppmforge -cloud -seed 1 -dimension 2.15 > ${test_ppm}
+ppmforge -cloud -seed 1 -dimension 2.175 | \
+  pnmpsnr -rgb -target1=43.39 -target2=43.39 -target3=999 - ${test_ppm}
+
+  # Note that there should be no difference for the target3: blue.
+
+
+
+rm ${test_ppm}
+
+echo "Test 4."
+ppmforge -seed 1 -stars 0 -ice 0.01 -power 1.18 -hour 10 >  ${test_ppm}
+ppmforge -seed 1 -stars 0 -ice 0.01 -power 1.22 -hour 10 | \
+  pnmpsnr -target1=27.89 -target2=24.25 -target3=37.87 - ${test_ppm}
+
+rm ${test_ppm}
+
+echo "Test 5."
+ppmforge -seed 1 -stars 0 -ice 0.01 \
+    -inclination 9  -hour 12 -power 200 > ${test_ppm} 
+ppmforge -seed 1 -stars 0 -ice 0.01 \
+    -inclination 10 -hour 12 -power 200 | \
+  pnmpsnr -target1=53.89 -target2=49.38 -target3=65.15 - ${test_ppm}
+
+rm ${test_ppm}
diff --git a/test/ppmhist.test b/test/ppmhist.test
index 1983bd13..a89c95bb 100755
--- a/test/ppmhist.test
+++ b/test/ppmhist.test
@@ -36,10 +36,16 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 ppmhist -hexcolor -float testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmhist -hexcolor -map   testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
-ppmhist -float    -map   testimg.ppm > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+ppmhist -float    -map   testimg.ppm > ${test_out} || \
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/ppmmake.test b/test/ppmmake.test
index f28249c7..61f417ca 100755
--- a/test/ppmmake.test
+++ b/test/ppmmake.test
@@ -19,24 +19,51 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 ppmmake rgb:gg/00/00  2 2  > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake rgb:ff/ff/00  2    > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake rgbi:1.1/0/0  2 2  > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake rgbi:1.0/.5   2 2  > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake rainbow       2 2  > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake               2 2  > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake blue -maxval=0 2 2  > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake blue -maxval=-1 2 2  > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmmake blue -maxval=65536 2 2  > ${test_out} || \
-   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
-RGBDEF=/dev/null ppmmake red 2 2 > ${test_out} || \
-   echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+RGBDEF=/dev/null ppmmake red 2 2 > ${test_out} || \
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/ppmpat.test b/test/ppmpat.test
index 0a6127ca..88fb9fdd 100755
--- a/test/ppmpat.test
+++ b/test/ppmpat.test
@@ -38,70 +38,140 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 ppmpat -g2 -g3 10 10 > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -madras -tartan 10 10 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -poles -squig 10 10 > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -camo -anticamo 10 10 > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -argyle1 -argyle2 10 10 > ${test_out} || \
-   echo -n "Expected failure 5"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 5"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 ppmpat 10 10 > ${test_out} || \
-   echo -n "Expected failure 6"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 6"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -g2 10 > ${test_out} || \
-   echo -n "Expected failure 7"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 7"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -g2 10 10 10 > ${test_out} || \
-   echo -n "Expected failure 8"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 8"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -g2 10 > ${test_out} || \
-   echo -n "Expected failure 9"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 9"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 clist1="-color=rgb:00/00/00"
 clist2="-color=rgb:00/00/00,rgb:00/00/ff"
 clist3="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff"
 clist4="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff,rgb:ff/ff/ff"
 
-# These patterns require exactly 2 colors 
+# These patterns require exactly 2 colors
 ppmpat -gingham2 ${clist1} 10 10 > ${test_out} || \
-   echo -n "Expected failure 10"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 10"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -argyle1  ${clist1} 10 10 > ${test_out} || \
-   echo -n "Expected failure 11"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 11"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -gingham2 ${clist3} 10 10 > ${test_out} || \
-   echo -n "Expected failure 12"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 12"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -argyle1  ${clist3} 10 10 > ${test_out} || \
-   echo -n "Expected failure 13"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 13"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-# These require exactly 3 colors 
+# These require exactly 3 colors
 ppmpat -gingham3 ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 14"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 14"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -argyle2  ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 15"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 15"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -madras   ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 16"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 16"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -tartan   ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 17"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 17"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -gingham3 ${clist4} 10 10 > ${test_out} || \
-   echo -n "Expected failure 18"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 18"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -argyle2  ${clist4} 10 10 > ${test_out} || \
-   echo -n "Expected failure 19"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 19"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -madras   ${clist4} 10 10 > ${test_out} || \
-   echo -n "Expected failure 20"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 20"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -tartan   ${clist4} 10 10 > ${test_out} || \
-   echo -n "Expected failure 21"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 21"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-# These require at least 3 colors 
+# These require at least 3 colors
 ppmpat -squig    ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 22"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 22"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -camo     ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 23"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 23"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
+
 ppmpat -anticamo ${clist2} 10 10 > ${test_out} || \
-   echo -n "Expected failure 24"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 24"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-# The squig pattern has an aspect ratio restriction 
+# The squig pattern has an aspect ratio restriction
 ppmpat -squig ${clist3} 10 250  > ${test_out} || \
-   echo -n "Expected failure 25"; test -s ${test_out}; echo " "$?
-ppmpat -squig ${clist3} 500 20  > ${test_out} || \
-   echo -n "Expected failure 26"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 25"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
-rm ${test_out}
+ppmpat -squig ${clist3} 500 20  > ${test_out} || \
+  echo -n "Expected failure 26"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/ppmwheel.test b/test/ppmwheel.test
index fd401951..f2fa55d9 100755
--- a/test/ppmwheel.test
+++ b/test/ppmwheel.test
@@ -122,15 +122,21 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 ppmwheel 10 -huevalue -huesaturation > ${test_out} || \
-   echo -n "Expected failure 1"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 1"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 ppmwheel 0 > ${test_out} || \
-   echo -n "Expected failure 2"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 2"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 ppmwheel > ${test_out} || \
-   echo -n "Expected failure 3"; test -s ${test_out}; echo " "$?
+  echo -n "Expected failure 3"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
 
 ppmwheel 10 10 > ${test_out} || \
-   echo -n "Expected failure 4"; test -s ${test_out}; echo " "$?
-
-rm -f ${test_out}
\ No newline at end of file
+  echo -n "Expected failure 4"
+  test -s ${test_out}; echo " "$?
+  rm -f {test_out}
diff --git a/test/random-generator.test b/test/random-generator.test
index 88c9d31d..ef204e4b 100755
--- a/test/random-generator.test
+++ b/test/random-generator.test
@@ -2,6 +2,22 @@
 # This script tests: pgmnoise
 # Also requires:
 
+# These tests are for examining the integrity of the random number
+# generator.  There is some overlap between the tests here and tests
+# in pgmnoise.test, but the tests here are better focused for
+# diagnosing problems with the random number generator.
+#
+# Test 1 is for determining the kind of random number generator in
+# use.
+#
+# Test 2 prints random numbers in an output format close to what the
+# test in the original Mersenne Twister code produces.
+#
+# If these tests fail, subsequent tests which depend on random numbers
+# will fail too.  There is no provision (beyond remarks in the script
+# files) for generators other than the Mersenne Twister in those
+# tests.
+
 echo "Test 1: Should produce:"
 
 echo "P2"
@@ -42,9 +58,11 @@ perlPgmProcessorProgram='
 pgmnoise -randomseed=5489 -plain -maxval=65535 10 200 | tee /tmp/z |
   perl -walne "$perlPgmProcessorProgram"
 
+# The above outputs (10 * 200 / 2) = 1000 samples.
+
 #    Method to generate output for Test 2 from original
 #    Mersenne Twister source code
-
+#
 # Download Mersenne Twister code.  See lib/util/randmersenne.c for URL.
 # Edit mt19937ar.c:
 #   In function main() at bottom of file, replace
@@ -64,5 +82,5 @@ pgmnoise -randomseed=5489 -plain -maxval=65535 10 200 | tee /tmp/z |
 # The number of samples must be larger than 624 to ensure proper
 # generation in batches after the first.
 
-
-
+# If you encounter problems, adjust the 200 (rows) above and tweak
+# the code in mt19937ar.c accordingly to produce more random numbers.
diff --git a/version.mk b/version.mk
index f2c01cf8..7e2622ec 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
-NETPBM_MINOR_RELEASE = 94
-NETPBM_POINT_RELEASE = 5
+NETPBM_MINOR_RELEASE = 95
+NETPBM_POINT_RELEASE = 0