about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/gif-roundtrip.test72
-rwxr-xr-xtest/gif-transparent1.test2
-rwxr-xr-xtest/pamarith.test84
-rwxr-xr-xtest/pamchannel.test6
-rwxr-xr-xtest/pamcrater.test8
-rwxr-xr-xtest/pamcut.test30
-rwxr-xr-xtest/pamdepth.test4
-rwxr-xr-xtest/pamditherbw.test24
-rwxr-xr-xtest/pamenlarge-pbm.test8
-rwxr-xr-xtest/pamfile.test6
-rwxr-xr-xtest/pamfind.test8
-rwxr-xr-xtest/pamfix.test6
-rwxr-xr-xtest/pamfunc.test48
-rwxr-xr-xtest/pamgauss.test10
-rwxr-xr-xtest/pamhue.test6
-rwxr-xr-xtest/pamrecolor.test14
-rwxr-xr-xtest/pamrestack.test10
-rwxr-xr-xtest/pamscale-reportonly.test12
-rwxr-xr-xtest/pamseq.test8
-rwxr-xr-xtest/pamshuffle.test6
-rwxr-xr-xtest/pamsumm.test8
-rwxr-xr-xtest/pamundice.test24
-rwxr-xr-xtest/pbmclean.test2
-rwxr-xr-xtest/pbmmake.test16
-rwxr-xr-xtest/pbmnoise-parameters.test50
-rwxr-xr-xtest/pbmpage.test6
-rwxr-xr-xtest/pbmpscale.test6
-rwxr-xr-xtest/pbmtext-utf8.test18
-rwxr-xr-xtest/pbmtext.test28
-rwxr-xr-xtest/pbmtopgm.test8
-rwxr-xr-xtest/pbmupc.test18
-rwxr-xr-xtest/pgmhist.test8
-rwxr-xr-xtest/pgmmake.test16
-rwxr-xr-xtest/pgmnoise-parameters.test10
-rwxr-xr-xtest/pgmnoise.test22
-rwxr-xr-xtest/pgmramp.test6
-rwxr-xr-xtest/pgmtoppm.test24
-rwxr-xr-xtest/pnmcat.test28
-rwxr-xr-xtest/pnmcolormap.test14
-rwxr-xr-xtest/pnmcrop1.test2
-rwxr-xr-xtest/pnmcrop3.test4
-rwxr-xr-xtest/pnmpsnr.test8
-rwxr-xr-xtest/pnmquant.test16
-rwxr-xr-xtest/pnmremap1.test12
-rwxr-xr-xtest/pnmtile.test8
-rwxr-xr-xtest/ppmforge-parameters.test14
-rwxr-xr-xtest/ppmhist.test6
-rwxr-xr-xtest/ppmmake.test20
-rwxr-xr-xtest/ppmpat.test52
-rwxr-xr-xtest/ppmtoapplevol.test6
-rwxr-xr-xtest/ppmwheel.test10
-rw-r--r--test/stdin-ppm2.ok2
-rwxr-xr-xtest/stdin-ppm2.test12
-rw-r--r--test/stdin-ppm3.ok2
-rwxr-xr-xtest/stdin-ppm3.test18
55 files changed, 433 insertions, 443 deletions
diff --git a/test/gif-roundtrip.test b/test/gif-roundtrip.test
index a30be1aa..13ff595e 100755
--- a/test/gif-roundtrip.test
+++ b/test/gif-roundtrip.test
@@ -10,40 +10,40 @@ tmpdir=${tmpdir:-/tmp}
 
 echo "Test 1. Should print 1926073387 101484"
 
-rose_ppm=${tmpdir}/rose.ppm
+test_ppm=${tmpdir}/testimg.ppm
 
-cp testimg.ppm ${rose_ppm} &&
-ppmtorgb3 ${rose_ppm}
+cp testimg.ppm ${tmpdir} &&
+ppmtorgb3 ${test_ppm}
 
-rose_red=${tmpdir}/rose.red
-rose_grn=${tmpdir}/rose.grn
-rose_blu=${tmpdir}/rose.blu
+test_red=${tmpdir}/testimg.red
+test_grn=${tmpdir}/testimg.grn
+test_blu=${tmpdir}/testimg.blu
 out_red=${tmpdir}/out.red
 out_grn=${tmpdir}/out.grn
 #out_blu=${tmpdir}/out.blu
 
-pamtogif ${rose_red} | giftopnm > ${out_red} &&
-pamtogif ${rose_grn} | giftopnm > ${out_grn} &&
-pamtogif ${rose_blu} | giftopnm | \
+pamtogif ${test_red} | giftopnm > ${out_red} &&
+pamtogif ${test_grn} | giftopnm > ${out_grn} &&
+pamtogif ${test_blu} | giftopnm | \
   rgb3toppm ${out_red} ${out_grn} - | \
   cksum
 
-rm ${rose_ppm} ${rose_grn} ${rose_blu} ${out_red} ${out_grn}
+rm ${test_ppm} ${test_grn} ${test_blu} ${out_red} ${out_grn}
 
 echo "Test 2. Should produce 1571496937 33838 six times"
 
-rose_gif=${tmpdir}/rose.gif
+test_gif=${tmpdir}/testimg.gif
 
-cat ${rose_red} | cksum
-pamtogif ${rose_red} | giftopnm | cksum
-pamtogif -interlace ${rose_red} | giftopnm | cksum
-pamtogif -noclear ${rose_red} | giftopnm | cksum
-pamtogif -sort ${rose_red} | tee ${rose_gif} | \
+cat ${test_red} | cksum
+pamtogif ${test_red} | giftopnm | cksum
+pamtogif -interlace ${test_red} | giftopnm | cksum
+pamtogif -noclear ${test_red} | giftopnm | cksum
+pamtogif -sort ${test_red} | tee ${test_gif} | \
   giftopnm | cksum
-echo "junk" >> ${rose_gif} && \
-  giftopnm -image=1 -quitearly ${rose_gif} | cksum
+echo "junk" >> ${test_gif} && \
+  giftopnm -image=1 -quitearly ${test_gif} | cksum
 
-rm  ${rose_gif} ${rose_red}
+rm  ${test_gif} ${test_red}
 
 echo "Test 3. Should produce 281226646 481 six times"
 # maze.pbm is too small for -noclear to take effect 
@@ -78,7 +78,7 @@ echo ""
 echo "Test 5. Should produce: N : 0 0 0 0 : 0 , N : 0 0 0 0 : 0"
 echo "(N=238, 239, 240, 241, 255, 256, 257, 4030, 4031, 4097)"
 
-rose_pgm=${tmpdir}/rose.pgm
+test_pgm=${tmpdir}/testimg.pgm
 
 # The following awk scripts produce a PGM file with no repeated
 # sequences.  Obviously this cannot be compressed at all; the codes
@@ -114,14 +114,14 @@ awk -v maxval=${maxval} 'BEGIN \
 
 for size in 238 239 240 241 255 256 257
   do
-  pamcut -height=${size} ${test257_pgm} > ${rose_pgm} &&
-  pamtogif -verbose ${rose_pgm} | giftopnm | pamdepth ${maxval} | \
-    cmp - ${rose_pgm}
-  echo -n ${size} ":" ${PIPESTATUS[@]} ":" $? ", "
-  pamtogif -nolzw -verbose ${rose_pgm} | giftopnm | pamdepth ${maxval} | \
-    cmp - ${rose_pgm}
-  echo ${size} ":" ${PIPESTATUS[@]} ":" $?
-  rm ${rose_pgm}
+  pamcut -height=${size} ${test257_pgm} > ${test_pgm} &&
+  pamtogif -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \
+    cmp - ${test_pgm}
+  printf "${size} : ${PIPESTATUS[*]} : $? , "
+  pamtogif -nolzw -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \
+    cmp - ${test_pgm}
+  printf "${size} : ${PIPESTATUS[*]} : $?\n"
+  rm ${test_pgm}
   done 
 
 rm ${test257_pgm}
@@ -144,16 +144,16 @@ awk -v maxval=${maxval} 'BEGIN \
 
 for size in 4030 4031 4097
   do
-  pamcut -height ${size} ${test4097_pgm} > ${rose_pgm} &&
-  pamtogif -verbose ${rose_pgm} | giftopnm | pamdepth ${maxval} | \
-    cmp - ${rose_pgm}
+  pamcut -height ${size} ${test4097_pgm} > ${test_pgm} &&
+  pamtogif -verbose ${test_pgm} | giftopnm | pamdepth ${maxval} | \
+    cmp - ${test_pgm}
   # pamdepth ${maxval} is necessary because
   # giftopnm output is maxval 255
-  echo -n ${size} ":" ${PIPESTATUS[@]} ":" $? ", "
-  pamtogif -nolzw ${rose_pgm} | giftopnm | pamdepth ${maxval} | \
-    cmp - ${rose_pgm}
-  echo ${size} ":" ${PIPESTATUS[@]} ":" $?
-  rm ${rose_pgm}
+  printf "${size} : ${PIPESTATUS[*]} : $? , "
+  pamtogif -nolzw ${test_pgm} | giftopnm | pamdepth ${maxval} | \
+    cmp - ${test_pgm}
+  printf "${size} : ${PIPESTATUS[*]} : $?\n"
+  rm ${test_pgm}
   done 
 
 rm ${test4097_pgm}
diff --git a/test/gif-transparent1.test b/test/gif-transparent1.test
index c2da5468..74496787 100755
--- a/test/gif-transparent1.test
+++ b/test/gif-transparent1.test
@@ -52,7 +52,7 @@ i=1
 for test_pnm in ${argyle_ppm} ${gingham_ppm} ${madras_ppm} \
 			      ${alpha0_pbm} ${alpha1_pbm}
   do
-  echo -n "Image $i: "; i=$((i+1));
+  printf "Image $i: "; i=$((i+1));
   pamtogif ${test_pnm} | giftopnm | tee ${out_pnm} | \
     cmp -s - ${test_pnm}; result=$?
 
diff --git a/test/pamarith.test b/test/pamarith.test
index 9c95db80..4b37f1e4 100755
--- a/test/pamarith.test
+++ b/test/pamarith.test
@@ -127,80 +127,80 @@ test_out=${tmpdir}/test_out
 # multiple functions
 
 pamarith -add -subtract testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -multiply -divide testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -difference -minimum testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -maximum -mean testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -compare -and testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -compare -equal testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 6"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -or -nand testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 7"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -nor -xor testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 8"
+  printf "Expected failure 8"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -shiftleft -shiftright testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 9"
+  printf "Expected failure 9"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # -add does not take a value
 
 pamarith -add=1 testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 10"
+  printf "Expected failure 10"
  test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # No function
 
 pamarith -plain testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 11"
+  printf "Expected failure 11"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 12"
+  printf "Expected failure 12"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # Just one input image file
 
 pamarith -add testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 13"
+  printf "Expected failure 13"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # No input image file
 
 pamarith -add > ${test_out} || \
-  echo -n "Expected failure 14"
+  printf "Expected failure 14"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
@@ -208,48 +208,48 @@ pamarith -add > ${test_out} || \
 
 pamchannel -infile testimg.ppm 0 1 | \
   pamarith -add testimg.ppm - > ${test_out} || \
-  echo -n "Expected failure 15"
+  printf "Expected failure 15"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # Input images with different x/y dimensions
 
 pamarith -add testimg.ppm testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 16"
+  printf "Expected failure 16"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamenlarge -xscale=2 testgrid.pbm | \
   pamarith -add testgrid.pbm - > ${test_out} || \
-  echo -n "Expected failure 17"
+  printf "Expected failure 17"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamenlarge -yscale=3 testgrid.pbm | \
   pamarith -add testgrid.pbm - > ${test_out} || \
-  echo -n "Expected failure 18"
+  printf "Expected failure 18"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # Invalid usage of -closeness
 
 pamarith -equal -closeness=100.1 testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 19"
+  printf "Expected failure 19"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -equal -closeness=-10 testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 20"
+  printf "Expected failure 20"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -closeness -equal testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 21"
+  printf "Expected failure 21"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -compare -closeness=10 testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 22"
+  printf "Expected failure 22"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
@@ -267,64 +267,64 @@ pgmmake -maxval=8191 1.0 3 1 > ${input5_pgm}
 # Bit string functions - Maxval must match
 
 pamarith -and ${input3_pgm} ${input5_pgm} > ${test_out} || \
-  echo -n "Expected failure 23"
+  printf "Expected failure 23"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -or ${input3_pgm} ${input5_pgm} > ${test_out} || \
-  echo -n "Expected failure 24"
+  printf "Expected failure 24"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -nand ${input3_pgm} ${input5_pgm} > ${test_out} || \
-  echo -n "Expected failure 25"
+  printf "Expected failure 25"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -nor ${input3_pgm} ${input5_pgm} > ${test_out} || \
-  echo -n "Expected failure 26"
+  printf "Expected failure 26"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -xor ${input3_pgm} ${input5_pgm} > ${test_out} || \
-  echo -n "Expected failure 27"
+  printf "Expected failure 27"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # Bit string functions - Maxval must be 2^n -1
 
 pamarith -and ${input4_pgm} ${input4_pgm} > ${test_out} || \
-  echo -n "Expected failure 28"
+  printf "Expected failure 28"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -or ${input4_pgm} ${input4_pgm} > ${test_out} || \
-  echo -n "Expected failure 29"
+  printf "Expected failure 29"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -nand ${input4_pgm} ${input4_pgm} > ${test_out} || \
-  echo -n "Expected failure 30"
+  printf "Expected failure 30"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -nor ${input4_pgm} ${input4_pgm} > ${test_out} || \
-  echo -n "Expected failure 31"
+  printf "Expected failure 31"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -xor ${input4_pgm} ${input4_pgm} > ${test_out} || \
-  echo -n "Expected failure 32"
+  printf "Expected failure 32"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -shiftleft ${input4_pgm} ${input4_pgm} > ${test_out} || \
-  echo -n "Expected failure 33"
+  printf "Expected failure 33"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -shiftright ${input4_pgm} ${input4_pgm} > ${test_out} || \
-  echo -n "Expected failure 34"
+  printf "Expected failure 34"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
@@ -335,32 +335,32 @@ rm ${input3_pgm} ${input4_pgm} ${input5_pgm}
 # three or more inputs.
 
 pamarith -subtract testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 35"
+  printf "Expected failure 35"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -divide testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 36"
+  printf "Expected failure 36"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -compare testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 37"
+  printf "Expected failure 37"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -difference testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 38"
+  printf "Expected failure 38"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -shiftleft testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 39"
+  printf "Expected failure 39"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -shiftright testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 40"
+  printf "Expected failure 40"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
@@ -368,11 +368,11 @@ pamarith -shiftright testimg.ppm testimg.ppm testimg.ppm > ${test_out} || \
 # These two cases should be removed once improvements are made.
 
 pamarith -equal testgrid.pbm testgrid.pbm testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 41"
+  printf "Expected failure 41"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamarith -mean testgrid.pbm  testgrid.pbm testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 42"
+  printf "Expected failure 42"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamchannel.test b/test/pamchannel.test
index f72725ee..f2662706 100755
--- a/test/pamchannel.test
+++ b/test/pamchannel.test
@@ -42,17 +42,17 @@ test_out=${tmpdir}/test_out
 echo "Test Invalid"
 
 pamchannel  -infile testgrid.pbm 1 > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamchannel  -infile testimg.ppm 3 > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "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"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
diff --git a/test/pamcrater.test b/test/pamcrater.test
index 61414480..e0c98afb 100755
--- a/test/pamcrater.test
+++ b/test/pamcrater.test
@@ -64,21 +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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamcrater -height 0 > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamcrater -number 0 > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "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"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamcut.test b/test/pamcut.test
index 2299b4bc..a489635a 100755
--- a/test/pamcut.test
+++ b/test/pamcut.test
@@ -56,79 +56,79 @@ echo "-----------------------------------------------------------" 1>&2
 
 # overspecification
 pamcut -left=1 -right=1 -width=14 testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "Expected failure 12"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamcut 5 4 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 13"
+  printf "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"
+  printf "Expected failure 14"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamdepth.test b/test/pamdepth.test
index 86f6c952..7ff73f41 100755
--- a/test/pamdepth.test
+++ b/test/pamdepth.test
@@ -30,11 +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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamdepth 65536 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamditherbw.test b/test/pamditherbw.test
index 3f37f117..be560089 100755
--- a/test/pamditherbw.test
+++ b/test/pamditherbw.test
@@ -47,62 +47,62 @@ 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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamditherbw -floyd -atkinson    ${test_red} > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamditherbw -dither8  -cluster3 ${test_red} > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamditherbw -cluster3 -cluster4 ${test_red} > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamditherbw -cluster3 -cluster8 ${test_red} > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamditherbw -cluster4 -cluster8 ${test_red} > ${test_out} || \
-  echo -n "Expected failure 6"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamditherbw -hilbert -threshold ${test_red} > ${test_out} || \
-  echo -n "Expected failure 7"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamditherbw -clump=8            ${test_red} > ${test_out} || \
-  echo -n "Expected failure 8"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "Expected failure 12"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
diff --git a/test/pamenlarge-pbm.test b/test/pamenlarge-pbm.test
index fbb2eced..bea740c6 100755
--- a/test/pamenlarge-pbm.test
+++ b/test/pamenlarge-pbm.test
@@ -18,7 +18,8 @@ LC_ALL=C awk 'BEGIN { print "P4";         # header
 # Test 1.
 echo "test 1"
  
-for xs in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 # for xs in `seq 23`
+for xs in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
+  # for xs in `seq 23`
   do
   pamenlarge -xscale=${xs} ${complete256_pbm} | cksum
   done
@@ -26,7 +27,8 @@ for xs in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 # for xs i
 # Test 2.
 echo "test 2"
 
-for xs1 in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  # for xs in `seq 15`
+for xs1 in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+  # for xs1 in `seq 15`
   do
   xs2=$((30-${xs1}))
   pamenlarge -xscale=${xs1} ${complete256_pbm} | \
@@ -52,7 +54,7 @@ for width in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  # for width in `seq 16`
   done
  
   for xscale in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  # for xscale in `seq 16`
-    do echo -n ${xscale} " "
+    do printf "%d  " ${xscale}
     for width in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  # for width in `seq 16` 
       do pamenlarge -xscale=${xscale} ${test3_pbm}.${width} ; done | cksum
       #
diff --git a/test/pamfile.test b/test/pamfile.test
index a0a5c65b..260d0b27 100755
--- a/test/pamfile.test
+++ b/test/pamfile.test
@@ -31,16 +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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfile -count -machine testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 head -n1 testimg.ppm | pamfile > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamfind.test b/test/pamfind.test
index 87ef5f9f..9165fbdf 100755
--- a/test/pamfind.test
+++ b/test/pamfind.test
@@ -44,21 +44,21 @@ echo "-----------------------------------------------------------" 1>&2
 echo "Test Invalid"
 
 pamfind -color=black -target=1,1,1 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "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"
+  printf "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"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfind testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamfix.test b/test/pamfix.test
index 89d3beb6..a18cae10 100755
--- a/test/pamfix.test
+++ b/test/pamfix.test
@@ -54,16 +54,16 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 printf "P2\n3 2\n7\n0 1 2\n6 7 8\n" | pamfix -change -clip > ${test_out} || \
-  echo -n "Expected failure 1";
+  printf "Expected failure 1";
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 printf "P1\n5 5\n" | pamfix -truncate -plain > ${test_out} || \
-  echo -n "Expected failure 2";
+  printf "Expected failure 2";
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 printf "P2\n3 3\255\n" | pamfix -truncate -plain > ${test_out} || \
-  echo -n "Expected failure 3";
+  printf "Expected failure 3";
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamfunc.test b/test/pamfunc.test
index 0d1a4f3c..fe142be7 100755
--- a/test/pamfunc.test
+++ b/test/pamfunc.test
@@ -93,121 +93,121 @@ echo "Test Invalid"
 test_out=${tmpdir}/test_out
 
 pamfunc -multiplier testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -multiplier=-1 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -divisor testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -divisor=-20 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -adder testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -adder 0.5 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 6"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -subtractor testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 7"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -subtractor 0.1 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 8"
+  printf "Expected failure 8"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -multiplier=1 -divisor=2 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 9"
+  printf "Expected failure 9"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -adder=2 -subtractor=3 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 10"
+  printf "Expected failure 10"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -min testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 11"
+  printf "Expected failure 11"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -max testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 12"
+  printf "Expected failure 12"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -andmask testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 13"
+  printf "Expected failure 13"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -ormask testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 14"
+  printf "Expected failure 14"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -xormask testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 15"
+  printf "Expected failure 15"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -not 1 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 16"
+  printf "Expected failure 16"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -min=1 -max=2 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 17"
+  printf "Expected failure 17"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -andmask=1 -ormask=0 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 18"
+  printf "Expected failure 18"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -andmask=0xffff testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 19"
+  printf "Expected failure 19"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -shiftleft testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 20"
+  printf "Expected failure 20"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -shiftright testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 21"
+  printf "Expected failure 21"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -changemaxval testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 22"
+  printf "Expected failure 22"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -shiftleft=1 -shiftright=1 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 23"
+  printf "Expected failure 23"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamfunc -multiplier=0.5 -changemaxval=65535 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 24"
+  printf "Expected failure 24"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamgauss.test b/test/pamgauss.test
index 6c3eff78..9400e928 100755
--- a/test/pamgauss.test
+++ b/test/pamgauss.test
@@ -28,26 +28,26 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pamgauss 3 3               > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamgauss 3 3   -sigma=0    > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "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"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamgauss 3     -sigma=0.5  > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamgauss 3 3 3 -sigma=0.5  > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamhue.test b/test/pamhue.test
index cd5430a8..5979e414 100755
--- a/test/pamhue.test
+++ b/test/pamhue.test
@@ -16,7 +16,7 @@ pamseq -tupletype=RGB 3 1 | pamdepth 255 | pamhue -huechange=60 | \
 
 echo "Test 3"
 # pamhue has no effect on monotone images
-# Should print 0 0 : 0 twice
+# Should print 281226646 481 twice
 
 pamhue -huechange=45  maze.pbm | cmp -s - maze.pbm
   echo ${PIPESTATUS[@]} ":" $?
@@ -25,7 +25,7 @@ pamhue -huechange=180 maze.pbm | cmp -s - maze.pbm
 
 echo "Test 4"
 # spinning the color wheel by multiples of 360 leaves the image unchanged
-# Should print 0 0 : 0 twice
+# Should print 1926073387 101484 twice
 
 pamhue -huechange=0 testimg.ppm   | cmp -s - testimg.ppm
   echo ${PIPESTATUS[@]} ":" $?
@@ -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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamrecolor.test b/test/pamrecolor.test
index 0ba35b66..a5fecc1f 100755
--- a/test/pamrecolor.test
+++ b/test/pamrecolor.test
@@ -1,6 +1,6 @@
 #! /bin/sh
 # This script tests: pamrecolor
-# Also requires: pgmmake
+# Also requires: ppmtopgm pgmmake
 
 tmpdir=${tmpdir:-/tmp}
 base_pgm=${tmpdir}/base.pgm
@@ -28,34 +28,34 @@ echo "-----------------------------------------------------------" 1>&2
 
 pamrecolor --targetcolor=rgb:00/11/22 \
            --colorfile=${base1_pgm} testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "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"
+  printf "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"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamrecolor --targetcolor=vague testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "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"
+  printf "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"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
diff --git a/test/pamrestack.test b/test/pamrestack.test
index 17e42e30..2ebee49f 100755
--- a/test/pamrestack.test
+++ b/test/pamrestack.test
@@ -64,28 +64,28 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamrestack testgrid.pbm maze.pbm > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamrestack -abort \
   -width=$((pixels * 2 + 1 )) maze.pbm > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamrestack -crop \
   -width=$((pixels * 2 + 1)) maze.pbm > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamrestack -width=0 maze.pbm > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamrestack -width maze.pbm > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamscale-reportonly.test b/test/pamscale-reportonly.test
index f65bcb93..924fb7c2 100755
--- a/test/pamscale-reportonly.test
+++ b/test/pamscale-reportonly.test
@@ -31,36 +31,36 @@ echo "-----------------------------------------------------------" 1>&2
 
 pamscale -reportonly -xsize=640 -ysize=400 -xscale=2 testimg.ppm > \
   ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamseq.test b/test/pamseq.test
index 3fe0fc31..ce3d4995 100755
--- a/test/pamseq.test
+++ b/test/pamseq.test
@@ -17,17 +17,17 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pamseq 1 > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamseq 0 255 > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamseq 3 0   > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
@@ -37,6 +37,6 @@ c256=${c64}${c64}${c64}${c64}
 # Tupletype string length=256
 
 pamseq -tupletype="${c256}" 3 15 > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamshuffle.test b/test/pamshuffle.test
index 5582ce3b..2941a9bc 100755
--- a/test/pamshuffle.test
+++ b/test/pamshuffle.test
@@ -52,16 +52,16 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pamshuffle testimg.ppm testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamshuffle -randomseed -column testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamshuffle -randomseed=null testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamsumm.test b/test/pamsumm.test
index fb15c0c4..f482911a 100755
--- a/test/pamsumm.test
+++ b/test/pamsumm.test
@@ -35,21 +35,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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamsumm -sum -max  testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamsumm -mean -max testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pamsumm            testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pamundice.test b/test/pamundice.test
index 14b43dfb..604fe1b8 100755
--- a/test/pamundice.test
+++ b/test/pamundice.test
@@ -123,63 +123,63 @@ echo "-----------------------------------------------------------" 1>&2
 
 # No input file pattern specified
 pamundice -down=5 -across=2 > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "Expected failure 8"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # -hoverlap too large
 pamundice -down=5 -across=2 -hoverlap=$((${mw}+1)) \
   ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
-  echo -n "Expected failure 9"
+  printf "Expected failure 9"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # -voverlap too large
 pamundice -down=5 -across=2 -voverlap=$((${mh}+1)) \
   ${fname_stem}_"%1d"_"%1a".pbm > ${test_out} || \
-  echo -n "Expected failure 10"
+  printf "Expected failure 10"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
@@ -188,14 +188,14 @@ for i in 0 1 2 3 4 5 6 7 8 9
   do
   mktemp -u XXXXXXXXXX.${i} || echo ":::::::::::"${i}":::::::::::"
   done | pamundice -down=5 -across=2 -listfile=- > ${test_out} || \
-  echo -n "Expected failure 11"
+  printf "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"
+  printf "Expected failure 12"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
diff --git a/test/pbmclean.test b/test/pbmclean.test
index 7c0c4d6d..5eba68e0 100755
--- a/test/pbmclean.test
+++ b/test/pbmclean.test
@@ -46,7 +46,7 @@ echo "-----------------------------------------------------------" 1>&2
 
 # overspecification
 pbmclean -black -white -min=1 -extended testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
diff --git a/test/pbmmake.test b/test/pbmmake.test
index c3691b80..1d1c682b 100755
--- a/test/pbmmake.test
+++ b/test/pbmmake.test
@@ -33,41 +33,41 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pbmmake -b -w -plain 1 1 > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "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"
+  printf "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"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmmake -white -plain   > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmmake -white -plain 1 > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmmake -white -plain 1 0 > ${test_out} || \
-  echo -n "Expected failure 6"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmmake -white -plain 0 1 > ${test_out} || \
-  echo -n "Expected failure 7"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmmake -white -plain 1 1 1 > ${test_out} || \
-  echo -n "Expected failure 8"
+  printf "Expected failure 8"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pbmnoise-parameters.test b/test/pbmnoise-parameters.test
index e467bfd5..17d2c76b 100755
--- a/test/pbmnoise-parameters.test
+++ b/test/pbmnoise-parameters.test
@@ -13,130 +13,130 @@ test_out=${tmpdir}/test_out
 # Invalid -ratio arguments
 
 pbmnoise -ratio       100 100 > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio 0     1  100 > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio=1.1   100 100 > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
   
 pbmnoise -ratio=-1    100 100 > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio=half  100 100 > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio=0/1/1 100 100 > ${test_out} || \
-  echo -n "Expected failure 6"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio=-1/2  100 100 > ${test_out} || \
-  echo -n "Expected failure 7"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio=1/0   100 100 > ${test_out} || \
-  echo -n "Expected failure 8"
+  printf "Expected failure 8"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio=/2    100 100 > ${test_out} || \
-  echo -n "Expected failure 9"
+  printf "Expected failure 9"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio=4/2   100 100 > ${test_out} || \
-  echo -n "Expected failure 10"
+  printf "Expected failure 10"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio=6/    100 100 > ${test_out} || \
-  echo -n "Expected failure 11"
+  printf "Expected failure 11"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio=1.0/2.0 100 100 > ${test_out} || \
-  echo -n "Expected failure 12"
+  printf "Expected failure 12"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # denominator must be power of 2  
 pbmnoise -ratio=3/9   100 100 > ${test_out} || \
-  echo -n "Expected failure 13"
+  printf "Expected failure 13"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio=a/2   100 100 > ${test_out} || \
-  echo -n "Expected failure 14"
+  printf "Expected failure 14"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 
 pbmnoise -ratio=2/a  100 100 > ${test_out} || \
-        echo -n "Expected failure 15"
+        printf "Expected failure 15"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio=1/-2  100 100 > ${test_out} || \
-        echo -n "Expected failure 16"
+        printf "Expected failure 16"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # Denominator must be 65536 or less
 pbmnoise -ratio=1/65537 100 100 > ${test_out} || \
-  echo -n "Expected failure 17"
+  printf "Expected failure 17"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -ratio=1/131072 100 100 > ${test_out} || \
-  echo -n "Expected failure 17"
+  printf "Expected failure 17"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -endian=large 100 100 > ${test_out} || \
-  echo -n "Expected failure 18"
+  printf "Expected failure 18"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -randomseed 100 100 > ${test_out} || \
-  echo -n "Expected failure 19"
+  printf "Expected failure 19"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -randomseed=-1 100 100 > ${test_out} || \
-  echo -n "Expected failure 20"
+  printf "Expected failure 20"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise -randomseed=0.1 100 100 > ${test_out} || \
-  echo -n "Expected failure 21"
+  printf "Expected failure 21"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise > ${test_out} || \
-  echo -n "Expected failure 22"
+  printf "Expected failure 22"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise 100 > ${test_out} || \
-  echo -n "Expected failure 23"
+  printf "Expected failure 23"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmnoise 100 200 300 > ${test_out} || \
-  echo -n "Expected failure 24"
+  printf "Expected failure 24"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
diff --git a/test/pbmpage.test b/test/pbmpage.test
index 2805ec97..4f15452d 100755
--- a/test/pbmpage.test
+++ b/test/pbmpage.test
@@ -20,16 +20,16 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pbmpage -a3 1 > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmpage 0 > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmpage 4 > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pbmpscale.test b/test/pbmpscale.test
index 9c38bb2e..efa5bfb5 100755
--- a/test/pbmpscale.test
+++ b/test/pbmpscale.test
@@ -36,16 +36,16 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pbmpscale testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmpscale 0 testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmpscale 2 3 testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "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 0677d161..9203607f 100755
--- a/test/pbmtext-utf8.test
+++ b/test/pbmtext-utf8.test
@@ -135,20 +135,20 @@ echo "Test input text which exceeds length limit" 1>&2
 echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
-echo -n "z" >> ${long_txt}
+printf "z" >> ${long_txt}
 cat ${long_txt} | wc -c | tr -d ' '
 
 cat ${long_txt} | \
   LC_ALL=${locale_for_test} \
   pbmtext -nomargins -builtin fixed -wchar > ${test_out} || \
-  echo -n "Expected failure 1";
+  printf "Expected failure 1";
   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";
+  printf "Expected failure 2";
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
@@ -169,41 +169,41 @@ 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}
-  echo -n "6-1:" ${PIPESTATUS[@]} ":" $?
+  printf "6-1: ${PIPESTATUS[*]} : $?"
   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}
-  echo -n "6-2:" ${PIPESTATUS[@]} ":" $?
+  printf "6-2: ${PIPESTATUS[*]} : $?"
   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}
-  echo -n "6-3:" ${PIPESTATUS[@]} ":" $?
+  printf "6-3: ${PIPESTATUS[*]} : $?"
   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}
-  echo -n "6-4:" ${PIPESTATUS[@]} ":" $?
+  printf "6-4: ${PIPESTATUS[*]} : $?"
   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}
-  echo -n "6-5:" ${PIPESTATUS[@]} ":" $?
+  printf "6-5: ${PIPESTATUS[*]} : $?"
   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}
-  echo -n "6-6:" ${PIPESTATUS[@]} ":" $?
+  printf "6-6: ${PIPESTATUS[*]} : $?"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pbmtext.test b/test/pbmtext.test
index b82b0771..247f76c5 100755
--- a/test/pbmtext.test
+++ b/test/pbmtext.test
@@ -10,13 +10,13 @@ echo "Test 1"
 # Should print 3898818212 967 twice
 
 pbmtext UNIX Philosophy: Do one thing and do it well. | cksum
-echo -n "UNIX Philosophy: Do one thing and do it well." | pbmtext | cksum
+printf "UNIX Philosophy: Do one thing and do it well." | pbmtext | cksum
 
 # Should print 2506052117 1354 twice
 
 pbmtext -builtin fixed \
     For truth is always strange. Stranger than fiction. Lord Byron | cksum
-echo -n "For truth is always strange. Stranger than fiction. Lord Byron" | \
+printf "For truth is always strange. Stranger than fiction. Lord Byron" | \
     pbmtext -builtin fixed | cksum
 
 
@@ -112,42 +112,42 @@ echo "Test 6 Invalid"
 test_out=${tmpdir}/test_out
 
 pbmtext -font=testgrid.pbm foo > ${test_out} || \
-  echo -n "Expected failure 1";
+  printf "Expected failure 1";
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmtext -font=testimg.ppm  foo > ${test_out} || \
-  echo -n "Expected failure 2";
+  printf "Expected failure 2";
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmtext -builtin=void      foo > ${test_out} || \
-  echo -n "Expected failure 3";
+  printf "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";
+  printf "Expected failure 4";
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmtext -dry-run    -text-dump  foo > ${test_out} || \
-  echo -n "Expected failure 5";
+  printf "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";
+  printf "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";
+  printf "Expected failure 7";
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmtext -wchar foo > ${test_out} || \
-  echo -n "Expected failure 8";
+  printf "Expected failure 8";
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
@@ -168,7 +168,7 @@ cat ${long_txt} | pbmtext -nomargins -builtin fixed  | cksum
 
 echo "Test 8 Invalid"
 
-echo -n "z" >> ${long_txt}
+printf "z" >> ${long_txt}
 awk '{print "text length:", length($0)}' ${long_txt}
 
 echo 1>&2
@@ -177,18 +177,18 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pbmtext -nomargins -builtin fixed `cat ${long_txt}` > ${test_out}  || \
-  echo -n "Expected failure 1";
+  printf "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";
+  printf "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";
+  printf "Expected failure 3";
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
diff --git a/test/pbmtopgm.test b/test/pbmtopgm.test
index 46c04705..02f2bb21 100755
--- a/test/pbmtopgm.test
+++ b/test/pbmtopgm.test
@@ -18,21 +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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmtopgm 0 9 testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmtopgm 15 5 testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmtopgm 5 17 testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pbmupc.test b/test/pbmupc.test
index 8d726de5..f8343dd7 100755
--- a/test/pbmupc.test
+++ b/test/pbmupc.test
@@ -20,46 +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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmupc -s1   72890 00011     > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmupc -s1 0 72890           > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmupc -s1 10 72890 00011    > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmupc -s1 0 172890 00011    > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmupc -s1 0   2890 00011    > ${test_out} || \
-  echo -n "Expected failure 6"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmupc -s1 0 72890 100011    > ${test_out} || \
-  echo -n "Expected failure 7"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmupc -s1 0 72890   0011    > ${test_out} || \
-  echo -n "Expected failure 8"
+  printf "Expected failure 8"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pbmupc -s1 0 72890 100011 1  > ${test_out} || \
-  echo -n "Expected failure 9"
+  printf "Expected failure 9"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pgmhist.test b/test/pgmhist.test
index 83f3c52e..c141627d 100755
--- a/test/pgmhist.test
+++ b/test/pgmhist.test
@@ -35,21 +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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmhist -median   -decile   testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmhist -quartile -decile   testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmhist testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pgmmake.test b/test/pgmmake.test
index 84c03778..3c96d99e 100755
--- a/test/pgmmake.test
+++ b/test/pgmmake.test
@@ -19,41 +19,41 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pgmmake 100  5 5 > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmmake 1.01 5 5 > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmmake .5   5   > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmmake .5       > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmmake -maxval=5        5 5 > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "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"
+  printf "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"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmmake -maxval=65536 .5 5 5 > ${test_out} || \
-  echo -n "Expected failure 8"
+  printf "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 2615c8e8..c5e6ada5 100755
--- a/test/pgmnoise-parameters.test
+++ b/test/pgmnoise-parameters.test
@@ -11,26 +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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmnoise 100 -randomseed=1 > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmnoise 100 0 -randomseed=1 > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmnoise 0 100 -randomseed=1 > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "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"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pgmnoise.test b/test/pgmnoise.test
index 45374793..6141121a 100755
--- a/test/pgmnoise.test
+++ b/test/pgmnoise.test
@@ -29,7 +29,7 @@ echo "Test 4."
 for maxval in  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \
                30 31 32 254 255 256 65534 65535
   do
-  echo -n ${maxval} " "
+  printf "%d  " ${maxval}
   pgmnoise -maxval=${maxval} -randomseed=1 -plain ${maxval} 10 | \
     pamvalidate | pamfile
   done
@@ -78,51 +78,51 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 pgmnoise 0 0  > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmnoise 0 1  > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmnoise 1 0  > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmnoise      > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmnoise 1    > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmnoise 100 -1 > ${test_out} || \
-  echo -n "Expected failure 6"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmnoise -randomseed=-1 100 100  > ${test_out} || \
-  echo -n "Expected failure 7"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmnoise -maxval=-1 100 100  > ${test_out} || \
-  echo -n "Expected failure 8"
+  printf "Expected failure 8"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmnoise -maxval=0 100 100  > ${test_out} || \
-  echo -n "Expected failure 9"
+  printf "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"
+  printf "Expected failure 10"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pgmramp.test b/test/pgmramp.test
index c3b0ad1c..b4dbb3cd 100755
--- a/test/pgmramp.test
+++ b/test/pgmramp.test
@@ -31,17 +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"
+  printf "Expected failure: $combination"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 done
 
 pgmramp -lr     1 > ${test_out} || \
-  echo -n "Expected failure: insufficient parameters"; \
+  printf "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"; \
+  printf "Expected failure: excessive parameters"; \
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pgmtoppm.test b/test/pgmtoppm.test
index d98418b8..36f63de7 100755
--- a/test/pgmtoppm.test
+++ b/test/pgmtoppm.test
@@ -66,73 +66,73 @@ echo "-----------------------------------------------------------" 1>&2
 
 pgmtoppm white testimg.ppm > \
   ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmtoppm -map=/dev/null testgrid.pbm > \
   ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmtoppm black white testgrid.pbm > \
   ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmtoppm hwite testgrid.pbm > \
   ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmtoppm off-color testgrid.pbm > \
   ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmtoppm rgb-255:7/7/7 testgrid.pbm > \
   ${test_out} || \
-  echo -n "Expected failure 6"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmtoppm -black=black -white=white white testgrid.pbm > \
   ${test_out} || \
-  echo -n "Expected failure 7"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmtoppm -black=rgb:0/0/0 -map=${palette_ppm} testgrid.pbm > \
   ${test_out} || \
-  echo -n "Expected failure 8"
+  printf "Expected failure 8"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmtoppm -white=rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \
   ${test_out} || \
-  echo -n "Expected failure 9"
+  printf "Expected failure 9"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmtoppm rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \
   ${test_out} || \
-  echo -n "Expected failure 10"
+  printf "Expected failure 10"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pgmtoppm rgb:00/00/00-rgb:ff/ff/ff -map=${palette_ppm} testgrid.pbm > \
   ${test_out} || \
-  echo -n "Expected failure 11"
+  printf "Expected failure 11"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 #pgmtoppm rgb-255:7/7/7 testgrid.pbm > \
 #  ${test_out} || \
-#  echo -n "Expected failure 12"
+#  printf "Expected failure 12"
 #  test -s ${test_out}; echo " "$?
 #  rm -f ${test_out}
 
diff --git a/test/pnmcat.test b/test/pnmcat.test
index 173aa608..58ae2642 100755
--- a/test/pnmcat.test
+++ b/test/pnmcat.test
@@ -95,76 +95,76 @@ echo "-----------------------------------------------------------" 1>&2
 
 # direction not specified
 pnmcat testgrid.pbm testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "Expected failure 14"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pnmcolormap.test b/test/pnmcolormap.test
index 089e0d1e..1a7ec266 100755
--- a/test/pnmcolormap.test
+++ b/test/pnmcolormap.test
@@ -15,37 +15,37 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pnmcolormap 0 testimg.ppm   > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pnmcolormap -1 testimg.ppm  > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pnmcolormap 0.1 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pnmcrop1.test b/test/pnmcrop1.test
index 00d5ee80..3c86efd7 100755
--- a/test/pnmcrop1.test
+++ b/test/pnmcrop1.test
@@ -78,7 +78,7 @@ for option in "-reportfull -reportsize" \
               "-bg-color=black -closeness=101"
     do
     pnmcrop -reportfull ${option} testgrid.pbm > ${test_out} || \
-        echo -n "Expected failure: " ${option}
+        printf "Expected failure:  %s" "${option}"
         test -s ${test_out}; echo " "$?
         rm ${test_out}
     done
diff --git a/test/pnmcrop3.test b/test/pnmcrop3.test
index 04cf6f52..1e8da345 100755
--- a/test/pnmcrop3.test
+++ b/test/pnmcrop3.test
@@ -68,12 +68,12 @@ echo "Error messages should appear below the line." 1>&2
 echo "--------------------------------------------" 1>&2
 
 pnmcrop -borderfile=${border_ppm} ${test_pbm} > ${test_out} || \
-        echo -n "Expected failure 1";
+        printf "Expected failure 1";
         test -s ${test_out}; echo " "$?
         rm ${test_out}
 
 pnmcrop -borderfile=${border_pbm} ${test_ppm} > ${test_out} || \
-        echo -n "Expected failure 2";
+        printf "Expected failure 2";
         test -s ${test_out}; echo " "$?
         rm ${test_out}
 
diff --git a/test/pnmpsnr.test b/test/pnmpsnr.test
index 3223f86d..ae6ba3cc 100755
--- a/test/pnmpsnr.test
+++ b/test/pnmpsnr.test
@@ -36,22 +36,22 @@ 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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pnmpsnr ${b_pbm}                       > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "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"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pnmpsnr                   -machine     > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
diff --git a/test/pnmquant.test b/test/pnmquant.test
index 100fb52e..cbe69f5c 100755
--- a/test/pnmquant.test
+++ b/test/pnmquant.test
@@ -42,41 +42,41 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pnmquant 0 testimg.ppm   > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pnmquant testimg.ppm  > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pnmquant 10.5 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pnmquant -randomseed 1 -norandom 10 testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 8"
+  printf "Expected failure 8"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pnmremap1.test b/test/pnmremap1.test
index fcd382a7..8626c50f 100755
--- a/test/pnmremap1.test
+++ b/test/pnmremap1.test
@@ -33,32 +33,32 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pnmremap -mapfile=/dev/null testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "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"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pnmremap testimg.ppm                    > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pnmremap -fs -nofs testimg.ppm          > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "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"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pnmremap -mapfile=testgrid.pbm -firstisdefault testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 6"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/pnmtile.test b/test/pnmtile.test
index b9597467..fd126078 100755
--- a/test/pnmtile.test
+++ b/test/pnmtile.test
@@ -29,21 +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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pnmtile 100 0 testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 pnmtile 0 100 testgrid.pbm > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "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"
+  printf "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 83758213..e5822673 100755
--- a/test/ppmforge-parameters.test
+++ b/test/ppmforge-parameters.test
@@ -30,36 +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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmforge  -dimension=10  > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmforge  -dimension=-1  > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmforge -clouds -mesh=1.99    > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmforge -clouds -power=0      > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmforge         -ice=-1       > ${test_out} || \
-  echo -n "Expected failure 6"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmforge         -glaciers=-1  > ${test_out} || \
-  echo -n "Expected failure 7"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/ppmhist.test b/test/ppmhist.test
index 34eb0ea0..8c2eedbc 100755
--- a/test/ppmhist.test
+++ b/test/ppmhist.test
@@ -36,16 +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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmhist -hexcolor -map   testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmhist -float    -map   testimg.ppm > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/ppmmake.test b/test/ppmmake.test
index 714573b2..30eb596a 100755
--- a/test/ppmmake.test
+++ b/test/ppmmake.test
@@ -19,51 +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"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmmake rainbow       2 2  > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmmake               2 2  > ${test_out} || \
-  echo -n "Expected failure 6"
+  printf "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"
+  printf "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"
+  printf "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"
+  printf "Expected failure 9"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 RGBDEF=/dev/null ppmmake red 2 2 > ${test_out} || \
-  echo -n "Expected failure 10"
+  printf "Expected failure 10"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/ppmpat.test b/test/ppmpat.test
index 8f00b9f5..ced2e64a 100755
--- a/test/ppmpat.test
+++ b/test/ppmpat.test
@@ -50,47 +50,47 @@ 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"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -madras -tartan 10 10 > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -poles -squig 10 10 > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -camo -anticamo 10 10 > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -argyle1 -argyle2 10 10 > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat 10 10 > ${test_out} || \
-  echo -n "Expected failure 6"
+  printf "Expected failure 6"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -g2 10 > ${test_out} || \
-  echo -n "Expected failure 7"
+  printf "Expected failure 7"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -g2 10 10 10 > ${test_out} || \
-  echo -n "Expected failure 8"
+  printf "Expected failure 8"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -g2 10 > ${test_out} || \
-  echo -n "Expected failure 9"
+  printf "Expected failure 9"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
@@ -101,89 +101,89 @@ clist4="-color=rgb:00/00/00,rgb:00/00/ff,rgb:00/ff/ff,rgb:ff/ff/ff"
 
 # These patterns require exactly 2 colors
 ppmpat -gingham2 ${clist1} 10 10 > ${test_out} || \
-  echo -n "Expected failure 10"
+  printf "Expected failure 10"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -argyle1  ${clist1} 10 10 > ${test_out} || \
-  echo -n "Expected failure 11"
+  printf "Expected failure 11"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -gingham2 ${clist3} 10 10 > ${test_out} || \
-  echo -n "Expected failure 12"
+  printf "Expected failure 12"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -argyle1  ${clist3} 10 10 > ${test_out} || \
-  echo -n "Expected failure 13"
+  printf "Expected failure 13"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # These require exactly 3 colors
 ppmpat -gingham3 ${clist2} 10 10 > ${test_out} || \
-  echo -n "Expected failure 14"
+  printf "Expected failure 14"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -argyle2  ${clist2} 10 10 > ${test_out} || \
-  echo -n "Expected failure 15"
+  printf "Expected failure 15"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -madras   ${clist2} 10 10 > ${test_out} || \
-  echo -n "Expected failure 16"
+  printf "Expected failure 16"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -tartan   ${clist2} 10 10 > ${test_out} || \
-  echo -n "Expected failure 17"
+  printf "Expected failure 17"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -gingham3 ${clist4} 10 10 > ${test_out} || \
-  echo -n "Expected failure 18"
+  printf "Expected failure 18"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -argyle2  ${clist4} 10 10 > ${test_out} || \
-  echo -n "Expected failure 19"
+  printf "Expected failure 19"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -madras   ${clist4} 10 10 > ${test_out} || \
-  echo -n "Expected failure 20"
+  printf "Expected failure 20"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -tartan   ${clist4} 10 10 > ${test_out} || \
-  echo -n "Expected failure 21"
+  printf "Expected failure 21"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # These require at least 3 colors
 ppmpat -squig    ${clist2} 10 10 > ${test_out} || \
-  echo -n "Expected failure 22"
+  printf "Expected failure 22"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -camo     ${clist2} 10 10 > ${test_out} || \
-  echo -n "Expected failure 23"
+  printf "Expected failure 23"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -anticamo ${clist2} 10 10 > ${test_out} || \
-  echo -n "Expected failure 24"
+  printf "Expected failure 24"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 # The squig pattern has an aspect ratio restriction
 ppmpat -squig ${clist3} 10 250  > ${test_out} || \
-  echo -n "Expected failure 25"
+  printf "Expected failure 25"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmpat -squig ${clist3} 500 20  > ${test_out} || \
-  echo -n "Expected failure 26"
+  printf "Expected failure 26"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/ppmtoapplevol.test b/test/ppmtoapplevol.test
index 6b109251..4964ede8 100755
--- a/test/ppmtoapplevol.test
+++ b/test/ppmtoapplevol.test
@@ -15,16 +15,16 @@ tmpdir=${tmpdir:-/tmp}
 test_out=${tmpdir}/test_out
 
 pbmmake 10 11 | ppmtoapplevol > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
  
 pbmmake 10 13 | ppmtoapplevol > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
  
 pbmmake 256 12 | ppmtoapplevol > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/ppmwheel.test b/test/ppmwheel.test
index fc390f26..c6583f97 100755
--- a/test/ppmwheel.test
+++ b/test/ppmwheel.test
@@ -122,26 +122,26 @@ echo "Error messages should appear below the line." 1>&2
 echo "-----------------------------------------------------------" 1>&2
 
 ppmwheel 10 -huevalue -huesaturation > ${test_out} || \
-  echo -n "Expected failure 1"
+  printf "Expected failure 1"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmwheel 0 > ${test_out} || \
-  echo -n "Expected failure 2"
+  printf "Expected failure 2"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmwheel 3 > ${test_out} || \
-  echo -n "Expected failure 3"
+  printf "Expected failure 3"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmwheel > ${test_out} || \
-  echo -n "Expected failure 4"
+  printf "Expected failure 4"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
 
 ppmwheel 10 10 > ${test_out} || \
-  echo -n "Expected failure 5"
+  printf "Expected failure 5"
   test -s ${test_out}; echo " "$?
   rm -f ${test_out}
diff --git a/test/stdin-ppm2.ok b/test/stdin-ppm2.ok
index e3fb4219..e1335bfb 100644
--- a/test/stdin-ppm2.ok
+++ b/test/stdin-ppm2.ok
@@ -1,11 +1,11 @@
 ppmtoacad: 0 0 0 0
 ppmtoapplevol: 0 0 0 0
 ppmtoascii: 0 0 0 0
+ppmtoicr -windowname testimage: 0 0 0 0
 ppmtolj: 0 0 0 0
 ppmtomitsu: 0 0 0 0
 ppmtopgm: 0 0 0 0
 ppmtopuzz: 0 0 0 0
 ppmtosixel: 0 0 0 0
 ppmtoterm: 0 0 0 0
-ppmtoicr: 0 0 0 0
 ppmtoyuvsplit: 0 0 0 0
diff --git a/test/stdin-ppm2.test b/test/stdin-ppm2.test
index 81b3954e..e43b6d4c 100755
--- a/test/stdin-ppm2.test
+++ b/test/stdin-ppm2.test
@@ -17,6 +17,7 @@ for testprog in  \
         ppmtoacad \
         ppmtoapplevol \
         ppmtoascii \
+        "ppmtoicr -windowname testimage" \
         ppmtolj \
         ppmtomitsu \
         ppmtopgm \
@@ -34,17 +35,6 @@ for testprog in  \
 
 rm ${test_ppm}
 
-testprog=ppmtoicr
-
-# File name embedded in output; "untitled" if no name
-
-  ${testprog} testgrid.pbm > ${out1};     status1=$?
-  ${testprog} < testgrid.pbm > ${out2};   status2=$?
-  test -s ${out1};                        status3=$?
-  sed 's/untitled/testgrid.pbm/g' ${out2} | cmp -s ${out1} -
-  echo ${testprog}": "${status1} ${status2} ${status3} $?
-  rm ${out1} ${out2}
-
 testprog=ppmtoyuvsplit
 
 # Produces three output files
diff --git a/test/stdin-ppm3.ok b/test/stdin-ppm3.ok
index f7ba5623..42932e92 100644
--- a/test/stdin-ppm3.ok
+++ b/test/stdin-ppm3.ok
@@ -16,5 +16,5 @@ ppmtopj: 0 0 0 0
 pjtoppm: 0 0 0 0
 ppmtospu: 0 0 0 0
 sputoppm: 0 0 0 0
-ppmtoxpm: 0 0 0 0
+ppmtoxpm -name small: 0 0 0 0
 xpmtoppm: 0 0 0 0
diff --git a/test/stdin-ppm3.test b/test/stdin-ppm3.test
index 605b535b..064e3e22 100755
--- a/test/stdin-ppm3.test
+++ b/test/stdin-ppm3.test
@@ -1,4 +1,4 @@
-#! /bin/sh
+o#! /bin/sh
 # This script tests: ppmtobmp bmptopnm
 # This script tests: ppmtoilbm ilbmtoppm
 # This script tests: ppmtoleaf leaftoppm
@@ -33,26 +33,24 @@ for fmt in \
         pj \
         spu \
         xpm
-  do
-  testprog1="ppmto"${fmt}
+do
+  if [ ${fmt} = "xpm" ]
+    then testprog1="ppmto${fmt} -name small";
+  else 	 testprog1="ppmto${fmt}";
+  fi
   if [ ${fmt} = "bmp" ]
     then testprog2=${fmt}"topnm";
-  else testprog2=${fmt}"toppm";
+  else   testprog2=${fmt}"toppm";
   fi
 
   if [ ${fmt} = "spu" ]
     then test_ppm=${large_ppm};
-  else test_ppm=${small_ppm};
+  else   test_ppm=${small_ppm};
   fi
 
   ${testprog1} ${test_ppm} > ${out1};    status1=$?
   ${testprog1} < ${test_ppm} > ${out2};  status2=$?
   test -s ${out1};                       status3=$?
-  if [ ${fmt} = "xpm" ]
-    then
-    sed -i '/^static char/s/static char .* = {/static char file/' \
-	    ${out1} ${out2};
-  fi
   cmp -s ${out1} ${out2}
   echo ${testprog1}": "${status1} ${status2} ${status3} $?
   rm ${out2}