4a31d1
diff -urNp old/converter/other/anytopnm neew/converter/other/anytopnm
4a31d1
--- old/converter/other/anytopnm	2017-09-05 12:58:26.795741945 +0200
4a31d1
+++ neew/converter/other/anytopnm	2017-09-05 13:03:12.985472566 +0200
4a31d1
@@ -537,9 +537,8 @@ else
4a31d1
 
4a31d1
 fi
4a31d1
 
4a31d1
-tempdir=$(mktemp -d "${TMPDIR:-/tmp}/anytopnm.XXXXXXXX") ||
4a31d1
+tempdir=$(mktemp -d -t anytopnm.XXXXXXXX) ||
4a31d1
     ( echo "Could not create temporary file. Exiting." 1>&2; exit 1; ) 
4a31d1
-trap 'rm -rf $tempdir' 0
4a31d1
 
4a31d1
 # Take out all spaces
4a31d1
 # Find the filename extension for last-ditch efforts later
4a31d1
@@ -565,9 +564,17 @@ if [ "$filetype" = "unknown" ]; then
4a31d1
     echo "$progname: unknown file type.  " \
4a31d1
         "'file' says mime type is '$mimeType', " 1>&2
4a31d1
     echo "type description is '$typeDescription'" 1>&2
4a31d1
+    if [ -d "$tempdir" ] ; then
4a31d1
+        rm -rf "$tempdir"
4a31d1
+    fi
4a31d1
+
4a31d1
     exit 1
4a31d1
     fi
4a31d1
 
4a31d1
 convertIt $file $filetype
4a31d1
 
4a31d1
+if [ -d "$tempdir" ] ; then
4a31d1
+    rm -rf "$tempdir"
4a31d1
+fi
4a31d1
+
4a31d1
 exit 0
4a31d1
diff -urNp old/editor/pamstretch-gen neew/editor/pamstretch-gen
4a31d1
--- old/editor/pamstretch-gen	2017-09-05 12:58:26.763741946 +0200
4a31d1
+++ neew/editor/pamstretch-gen	2017-09-05 13:03:12.985472566 +0200
4a31d1
@@ -34,12 +34,10 @@ if [ "$1" = "" ]; then
4a31d1
   exit 1
4a31d1
 fi
4a31d1
 
4a31d1
-tempdir=$(mktemp -d "${TMPDIR:-/tmp}/netpbm.XXXXXXXX") ||
4a31d1
+tempfile=$(mktemp /tmp/pnmig.XXXXXXXX) ||
4a31d1
     ( echo "Could not create temporary file. Exiting." 1>&2; exit 1; ) 
4a31d1
 trap 'rm -rf $tempdir' 0 1 3 15
4a31d1
 
4a31d1
-tempfile=$tempdir/pnmig
4a31d1
-
4a31d1
 if ! cat $2 >$tempfile 2>/dev/null; then
4a31d1
   echo 'pamstretch-gen: error reading file' 1>&2
4a31d1
   exit 1
4a31d1
diff -urNp old/editor/ppmfade neew/editor/ppmfade
4a31d1
--- old/editor/ppmfade	2017-09-05 12:58:26.767741946 +0200
4a31d1
+++ neew/editor/ppmfade	2017-09-05 12:59:14.556731156 +0200
4a31d1
@@ -40,6 +40,7 @@ exec perl -w -x -S -- "$0" "$@"
4a31d1
 #
4a31d1
 ##############################################################################
4a31d1
 use strict;
4a31d1
+use File::Temp "tempdir";
4a31d1
 
4a31d1
 sub doVersionHack($) {
4a31d1
     my ($argvR) = @_;
4a31d1
@@ -149,20 +149,26 @@ if ($first_file ne "undefined") {
4a31d1
 
4a31d1
 print("Frames are " . $width . "W x " . $height . "H\n");
4a31d1
 
4a31d1
+#
4a31d1
+# We create a tmp-directory right here
4a31d1
+#
4a31d1
+my $tmpdir = tempdir("ppmfade.XXXXXX", CLEANUP => 1);
4a31d1
+
4a31d1
+
4a31d1
 if ($first_file eq "undefined") {
4a31d1
     print "Fading from black to ";
4a31d1
-    system("ppmmake \\#000 $width $height >junk1$$.ppm");
4a31d1
+    system("ppmmake \\#000 $width $height >$tmpdir/junk1$$.ppm");
4a31d1
 } else {
4a31d1
     print "Fading from $first_file to ";
4a31d1
-    system("cp", $first_file, "junk1$$.ppm");
4a31d1
+    system("cp", $first_file, "$tmpdir/junk1$$.ppm");
4a31d1
 }
4a31d1
 
4a31d1
 if ($last_file eq "undefined") {
4a31d1
     print "black.\n";
4a31d1
-    system("ppmmake \\#000 $width $height >junk2$$.ppm");
4a31d1
+    system("ppmmake \\#000 $width $height >$tmpdir/junk2$$.ppm");
4a31d1
 } else {
4a31d1
     print "$last_file\n";
4a31d1
-    system("cp", $last_file, "junk2$$.ppm");
4a31d1
+    system("cp", $last_file, "$tmpdir/junk2$$.ppm");
4a31d1
 }
4a31d1
 
4a31d1
 #
4a31d1
@@ -170,14 +176,14 @@ if ($last_file eq "undefined") {
4a31d1
 #
4a31d1
 
4a31d1
 # Here's what our temporary files are:
4a31d1
-#   junk1$$.ppm: The original (fade-from) image
4a31d1
-#   junk2$$.ppm: The target (fade-from) image
4a31d1
-#   junk3$$.ppm: The frame of the fade for the current iteration of the 
4a31d1
-#                the for loop.
4a31d1
-#   junk1a$$.ppm: If the fade involves a ppmmix sequence from one intermediate
4a31d1
-#                 image to another, this is the first frame of that 
4a31d1
-#                 sequence.
4a31d1
-#   junk2a$$.ppm: This is the last frame of the above-mentioned ppmmix sequence
4a31d1
+#   $tmpdir/junk1$$.ppm: The original (fade-from) image
4a31d1
+#   $tmpdir/junk2$$.ppm: The target (fade-from) image
4a31d1
+#   $tmpdir/junk3$$.ppm: The frame of the fade for the current iteration of the 
4a31d1
+#                	 the for loop.
4a31d1
+#   $tmpdir/junk1a$$.ppm: If the fade involves a ppmmix sequence from one intermediate
4a31d1
+#                         image to another, this is the first frame of that 
4a31d1
+#                         sequence.
4a31d1
+#   $tmpdir/junk2a$$.ppm: This is the last frame of the above-mentioned ppmmix sequence
4a31d1
 
4a31d1
 my $i;    # Frame number
4a31d1
 for ($i = 1; $i <= $nframes; $i++) {
4a31d1
@@ -185,147 +191,147 @@ for ($i = 1; $i <= $nframes; $i++) {
4a31d1
     if ($mode eq $SPREAD) {
4a31d1
         if ($i <= 10) {
4a31d1
             my $n = $spline20[$i] * 100;
4a31d1
-            system("ppmspread $n junk1$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmspread $n $tmpdir/junk1$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } elsif ($i <= 20) {
4a31d1
             my $n;
4a31d1
             $n = $spline20[$i] * 100;
4a31d1
-            system("ppmspread $n junk1$$.ppm >junk1a$$.ppm");
4a31d1
+            system("ppmspread $n $tmpdir/junk1$$.ppm >$tmpdir/junk1a$$.ppm");
4a31d1
             $n = (1-$spline20[$i-10]) * 100;
4a31d1
-            system("ppmspread $n junk2$$.ppm >junk2a$$.ppm");
4a31d1
+            system("ppmspread $n $tmpdir/junk2$$.ppm >$tmpdir/junk2a$$.ppm");
4a31d1
             $n = $spline10[$i-10];
4a31d1
-            system("ppmmix $n junk1a$$.ppm junk2a$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk1a$$.ppm $tmpdir/junk2a$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } else {
4a31d1
             my $n = (1-$spline20[$i-10])*100;
4a31d1
-            system("ppmspread $n junk2$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmspread $n $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         }
4a31d1
     } elsif ($mode eq $SHIFT) {
4a31d1
         if ($i <= 10) {
4a31d1
             my $n = $spline20[$i] * 100;
4a31d1
-            system("ppmshift $n junk1$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmshift $n $tmpdir/junk1$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } elsif ($i <= 20) {
4a31d1
             my $n;
4a31d1
             $n = $spline20[$i] * 100;
4a31d1
-            system("ppmshift $n junk1$$.ppm >junk1a$$.ppm");
4a31d1
+            system("ppmshift $n $tmpdir/junk1$$.ppm >$tmpdir/junk1a$$.ppm");
4a31d1
             $n = (1-$spline20[$i-10])*100;
4a31d1
-            system("ppmshift $n junk2$$.ppm >junk2a$$.ppm");
4a31d1
+            system("ppmshift $n $tmpdir/junk2$$.ppm >$tmpdir/junk2a$$.ppm");
4a31d1
             $n = $spline10[$i-10];
4a31d1
-            system("ppmmix $n junk1a$$.ppm junk2a$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk1a$$.ppm $tmpdir/junk2a$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } else {
4a31d1
             my $n = (1-$spline20[$i-10]) * 100;
4a31d1
-            system("ppmshift $n junk2$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmshift $n $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         }
4a31d1
     } elsif ($mode eq $RELIEF) {
4a31d1
         if ($i == 1) {
4a31d1
-            system("ppmrelief junk1$$.ppm >junk1r$$.ppm");
4a31d1
+            system("ppmrelief $tmpdir/junk1$$.ppm >$tmpdir/junk1r$$.ppm");
4a31d1
         }
4a31d1
         if ($i <= 10) {
4a31d1
             my $n = $spline10[$i];
4a31d1
-            system("ppmmix $n junk1$$.ppm junk1r$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk1$$.ppm $tmpdir/junk1r$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } elsif ($i <= 20) {
4a31d1
             my $n = $spline10[$i-10];
4a31d1
-            system("ppmmix $n junk1r$$.ppm junk2r$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk1r$$.ppm $tmpdir/junk2r$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } else {
4a31d1
             my $n = $spline10[$i-20];
4a31d1
-            system("ppmmix $n junk2r$$.ppm junk2$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk2r$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         }
4a31d1
         if ($i == 10) {
4a31d1
-            system("ppmrelief junk2$$.ppm >junk2r$$.ppm");
4a31d1
+            system("ppmrelief $tmpdir/junk2$$.ppm >$tmpdir/junk2r$$.ppm");
4a31d1
         }
4a31d1
     } elsif ($mode eq $OIL) {
4a31d1
         if ($i == 1) {
4a31d1
-            system("ppmtopgm junk1$$.ppm | pgmoil >junko$$.ppm");
4a31d1
-            system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " .
4a31d1
-                   ">junk1o$$.ppm");
4a31d1
+            system("ppmtopgm $tmpdir/junk1$$.ppm | pgmoil >$tmpdir/junko$$.ppm");
4a31d1
+            system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " .
4a31d1
+                   ">$tmpdir/junk1o$$.ppm");
4a31d1
         }
4a31d1
         if ($i <= 10) {
4a31d1
             my $n = $spline10[$i];
4a31d1
-            system("ppmmix $n junk1$$.ppm junk1o$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk1$$.ppm $tmpdir/junk1o$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } elsif ($i <= 20) {
4a31d1
             my $n = $spline10[$i-10];
4a31d1
-            system("ppmmix $n junk1o$$.ppm junk2o$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk1o$$.ppm $tmpdir/junk2o$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } else {
4a31d1
             my $n = $spline10[$i-20];
4a31d1
-            system("ppmmix $n junk2o$$.ppm junk2$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk2o$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         }
4a31d1
         if ($i == 10) {
4a31d1
-            system("ppmtopgm junk2$$.ppm | pgmoil >junko$$.ppm");
4a31d1
-            system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " .
4a31d1
-                   ">junk2o$$.ppm");
4a31d1
+            system("ppmtopgm $tmpdir/junk2$$.ppm | pgmoil >$tmpdir/junko$$.ppm");
4a31d1
+            system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " .
4a31d1
+                   ">$tmpdir/junk2o$$.ppm");
4a31d1
         }
4a31d1
     } elsif ($mode eq $EDGE) {
4a31d1
         if ($i == 1) {
4a31d1
-            system("ppmtopgm junk1$$.ppm | pgmedge >junko$$.ppm");
4a31d1
-            system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " .
4a31d1
-                   ">junk1o$$.ppm");
4a31d1
+            system("ppmtopgm $tmpdir/junk1$$.ppm | pgmedge >$tmpdir/junko$$.ppm");
4a31d1
+            system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " .
4a31d1
+                   ">$tmpdir/junk1o$$.ppm");
4a31d1
         }
4a31d1
         if ($i <= 10) {
4a31d1
             my $n = $spline10[$i];
4a31d1
-            system("ppmmix $n junk1$$.ppm junk1o$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk1$$.ppm $tmpdir/junk1o$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } elsif ($i <= 20) {
4a31d1
             my $n = $spline10[$i-10];
4a31d1
-            system("ppmmix $n junk1o$$.ppm junk2o$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk1o$$.ppm $tmpdir/junk2o$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } else {
4a31d1
             my $n = $spline10[$i-20];
4a31d1
-            system("ppmmix $n junk2o$$.ppm junk2$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk2o$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         }
4a31d1
         if ($i == 10) {
4a31d1
-            system("ppmtopgm junk2$$.ppm | pgmedge >junko$$.ppm");
4a31d1
-            system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " .
4a31d1
-                   ">junk2o$$.ppm");
4a31d1
+            system("ppmtopgm $tmpdir/junk2$$.ppm | pgmedge >$tmpdir/junko$$.ppm");
4a31d1
+            system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " .
4a31d1
+                   ">$tmpdir/junk2o$$.ppm");
4a31d1
         } 
4a31d1
     } elsif ($mode eq $BENTLEY) {
4a31d1
         if ($i == 1) {
4a31d1
-            system("ppmtopgm junk1$$.ppm | pgmbentley >junko$$.ppm");
4a31d1
-            system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " .
4a31d1
-                   ">junk1o$$.ppm");
4a31d1
+            system("ppmtopgm $tmpdir/junk1$$.ppm | pgmbentley >$tmpdir/junko$$.ppm");
4a31d1
+            system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " .
4a31d1
+                   ">$tmpdir/junk1o$$.ppm");
4a31d1
         }
4a31d1
         if ($i <= 10) {
4a31d1
             my $n = $spline10[$i];
4a31d1
-            system("ppmmix $n junk1$$.ppm junk1o$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk1$$.ppm $tmpdir/junk1o$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } elsif ($i <= 20) {
4a31d1
             my $n = $spline10[$i-10];
4a31d1
-            system("ppmmix $n junk1o$$.ppm junk2o$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk1o$$.ppm $tmpdir/junk2o$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } else {
4a31d1
             my $n = $spline10[$i-20];
4a31d1
-            system("ppmmix $n junk2o$$.ppm junk2$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk2o$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         }
4a31d1
         if ($i == 10) {
4a31d1
-            system("ppmtopgm junk2$$.ppm | pgmbentley >junko$$.ppm");
4a31d1
-            system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " .
4a31d1
-                   ">junk2o$$.ppm");
4a31d1
+            system("ppmtopgm $tmpdir/junk2$$.ppm | pgmbentley >$tmpdir/junko$$.ppm");
4a31d1
+            system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " .
4a31d1
+                   ">$tmpdir/junk2o$$.ppm");
4a31d1
         }
4a31d1
     } elsif ($mode eq $BLOCK) {
4a31d1
         if ($i <= 10) {
4a31d1
             my $n = 1 - 1.9*$spline20[$i];
4a31d1
-            system("pamscale $n junk1$$.ppm | " .
4a31d1
-                   "pamscale -width $width -height $height >junk3$$.ppm");
4a31d1
+            system("pamscale $n $tmpdir/junk1$$.ppm | " .
4a31d1
+                   "pamscale -width $width -height $height >$tmpdir/junk3$$.ppm");
4a31d1
         } elsif ($i <= 20) {
4a31d1
             my $n = $spline10[$i-10];
4a31d1
-            system("ppmmix $n junk1a$$.ppm junk2a$$.ppm >junk3$$.ppm");
4a31d1
+            system("ppmmix $n $tmpdir/junk1a$$.ppm $tmpdir/junk2a$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
         } else {
4a31d1
             my $n = 1 - 1.9*$spline20[31-$i];
4a31d1
-            system("pamscale $n junk2$$.ppm | " .
4a31d1
-                   "pamscale -width $width -height $height >junk3$$.ppm");
4a31d1
+            system("pamscale $n $tmpdir/junk2$$.ppm | " .
4a31d1
+                   "pamscale -width $width -height $height >$tmpdir/junk3$$.ppm");
4a31d1
         }
4a31d1
         if ($i == 10) {
4a31d1
-            system("cp", "junk3$$.ppm", "junk1a$$.ppm");
4a31d1
-            system("pamscale $n junk2$$.ppm | " .
4a31d1
-                   "pamscale -width $width -height $height >junk2a$$.ppm");
4a31d1
+            system("cp", "$tmpdir/junk3$$.ppm", "$tmpdir/junk1a$$.ppm");
4a31d1
+            system("pamscale $n $tmpdir/junk2$$.ppm | " .
4a31d1
+                   "pamscale -width $width -height $height >$tmpdir/junk2a$$.ppm");
4a31d1
         }    
4a31d1
     } elsif ($mode eq $MIX) {
4a31d1
         my $fade_factor = sqrt(1/($nframes-$i+1));
4a31d1
-        system("ppmmix $fade_factor junk1$$.ppm junk2$$.ppm >junk3$$.ppm");
4a31d1
+        system("ppmmix $fade_factor $tmpdir/junk1$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
4a31d1
     } else {
4a31d1
         print("Internal error: impossible mode value '$mode'\n");
4a31d1
     }
4a31d1
 
4a31d1
     my $outfile = sprintf("%s.%04d.ppm", $base_name, $i);
4a31d1
-    system("cp", "junk3$$.ppm", $outfile);
4a31d1
+    system("cp", "$tmpdir/junk3$$.ppm", $outfile);
4a31d1
 }
4a31d1
 
4a31d1
 #
4a31d1
 #  Clean up shop.
4a31d1
 #
4a31d1
-system("rm junk*$$.ppm");
4a31d1
+system("rm $tmpdir/junk*$$.ppm");
4a31d1
 
4a31d1
 exit(0);
4a31d1
diff -urNp old/editor/ppmshadow neew/editor/ppmshadow
4a31d1
--- old/editor/ppmshadow	2017-09-05 12:58:26.768741946 +0200
4a31d1
+++ neew/editor/ppmshadow	2017-09-05 13:02:51.480507649 +0200
4a31d1
@@ -171,11 +171,12 @@ my $tmpdir = $ENV{TMPDIR} || "/tmp";
4a31d1
 my $ourtmp;
4a31d1
 
4a31d1
 if ($keeptemp) {
4a31d1
-    $ourtmp = "$tmpdir/ppmshadow$$";
4a31d1
-    mkdir($ourtmp, 0777) or
4a31d1
-        die("Unable to create directory for temporary files '$ourtmp");
4a31d1
+    $ourtmp = chomp($ourtmp = `mktemp -d -t PPMshadow.XXXXXX`);
4a31d1
+    if($? >> 8) {
4a31d1
+        die "Can't create directory for temporary files";
4a31d1
+    }
4a31d1
 } else {
4a31d1
-    $ourtmp = File::Temp::tempdir("$tmpdir/ppmshadowXXXX", UNLINK=>1);
4a31d1
+    $ourtmp = File::Temp::tempdir("$tmpdir/PPMshadow.XXXXXX", UNLINK=>1);
4a31d1
 }
4a31d1
 
4a31d1
 #   Apply defaults for arguments not specified