2012-09-14 08:19:47 +02:00
|
|
|
Index: editor/pnmindex.csh
|
|
|
|
===================================================================
|
|
|
|
--- editor/pnmindex.csh.orig
|
2007-01-16 00:26:51 +01:00
|
|
|
+++ editor/pnmindex.csh
|
2012-09-14 08:19:47 +02:00
|
|
|
@@ -85,7 +85,7 @@ if ( $#argv == 0 ) then
|
2007-01-16 00:26:51 +01:00
|
|
|
goto usage
|
|
|
|
endif
|
|
|
|
|
|
|
|
-set tmpfile=/tmp/pi.tmp.$$
|
|
|
|
+set tmpfile=.pi.tmp.$$
|
|
|
|
rm -f $tmpfile
|
|
|
|
set maxformat=PBM
|
|
|
|
|
2012-09-14 08:19:47 +02:00
|
|
|
Index: generator/ppmrainbow
|
|
|
|
===================================================================
|
|
|
|
--- generator/ppmrainbow.orig
|
|
|
|
+++ generator/ppmrainbow
|
2013-09-11 09:57:29 +02:00
|
|
|
@@ -25,6 +25,7 @@ exec perl -w -x -S -- "$0" "$@"
|
|
|
|
#!/usr/bin/perl
|
2012-09-14 08:19:47 +02:00
|
|
|
use strict;
|
|
|
|
use Getopt::Long;
|
|
|
|
+use File::Temp qw{tempfile tempdir};
|
2007-01-16 00:26:51 +01:00
|
|
|
|
2012-09-14 08:19:47 +02:00
|
|
|
my ($FALSE, $TRUE) = (0,1);
|
2007-01-16 00:26:51 +01:00
|
|
|
|
2013-09-11 09:57:29 +02:00
|
|
|
@@ -71,31 +72,25 @@ if (!$norepeat) {
|
2007-01-16 00:26:51 +01:00
|
|
|
push @colorlist, $ARGV[0];
|
|
|
|
}
|
|
|
|
|
2012-09-14 08:19:47 +02:00
|
|
|
-my $ourtmp = "$tmpdir/ppmrainbow$$";
|
|
|
|
-mkdir($ourtmp, 0777) or
|
|
|
|
- die("Unable to create directory for temporary files '$ourtmp");
|
|
|
|
-
|
|
|
|
-
|
|
|
|
+my $ourtmp = tempdir("ppmrainbow.XXXX", DIR => $tmpdir, CLEANUP => 1);
|
2007-01-16 00:26:51 +01:00
|
|
|
my $widthRemaining;
|
2012-09-14 08:19:47 +02:00
|
|
|
-my $n;
|
|
|
|
my @outlist;
|
2007-01-16 00:26:51 +01:00
|
|
|
|
2012-09-14 08:19:47 +02:00
|
|
|
-$n = 0;
|
|
|
|
$widthRemaining = $Twid;
|
|
|
|
@outlist = ();
|
|
|
|
|
|
|
|
while (@colorlist >= 2) {
|
|
|
|
- my $outfile = sprintf("%s/file.%03u.ppm", $ourtmp, $n);
|
|
|
|
+ (my $tmpfh, my $outfile) = tempfile("file.XXXXXXXX", DIR => "$ourtmp", SUFFIX => '.ppm');
|
|
|
|
push(@outlist, $outfile);
|
|
|
|
|
|
|
|
my $w = int(($widthRemaining-1)/(@colorlist-1))+1;
|
|
|
|
- my $rc = system("$verboseCommand pgmramp -lr $w $Thgt | " .
|
|
|
|
- "pgmtoppm \"$colorlist[0]-$colorlist[1]\" >$outfile");
|
|
|
|
- if ($rc != 0) {
|
|
|
|
+ my $content = qx{$verboseCommand pgmramp -lr $w $Thgt |
|
|
|
|
+ pgmtoppm "$colorlist[0]-$colorlist[1]"};
|
|
|
|
+ if (! "$content") {
|
|
|
|
fatal("pgmramp|pgmtoppm failed.");
|
|
|
|
}
|
|
|
|
+ print $tmpfh $content;
|
|
|
|
$widthRemaining -= $w;
|
|
|
|
- $n++;
|
|
|
|
shift @colorlist;
|
2007-01-16 00:26:51 +01:00
|
|
|
}
|
2012-09-14 08:19:47 +02:00
|
|
|
|