ef860ef581
- fix exit status and error reporting in ppmrainbow
32 lines
1.2 KiB
Diff
32 lines
1.2 KiB
Diff
diff -up netpbm-10.35.60/generator/ppmrainbow.ppmrainbowexit netpbm-10.35.60/generator/ppmrainbow
|
|
--- netpbm-10.35.60/generator/ppmrainbow.ppmrainbowexit 2009-02-15 13:04:35.000000000 +0100
|
|
+++ netpbm-10.35.60/generator/ppmrainbow 2009-02-26 18:48:34.000000000 +0100
|
|
@@ -21,15 +21,16 @@ GetOptions("width=i" => \$Twid,
|
|
"norepeat!" => \$norepeat,
|
|
"verbose!" => \$verbose);
|
|
|
|
+$! = 1;
|
|
die "invalid width and/or height\n" unless $Twid >= 1 && $Thgt >= 1;
|
|
|
|
my $verboseCommand = $verbose ? "set -x;" : "";
|
|
|
|
if (@ARGV < 1) {
|
|
- die("You must specify at least one color as an argument");
|
|
+ die("You must specify at least one color as an argument\n");
|
|
} elsif (@ARGV < 2 && $norepeat) {
|
|
die("With the -norepeat option, you must specify at least two colors " .
|
|
- "as arguments.");
|
|
+ "as arguments.\n");
|
|
}
|
|
|
|
my @colorlist;
|
|
@@ -57,7 +58,7 @@ while (@colorlist >= 2) {
|
|
my $rc = system("$verboseCommand pgmramp -lr $w $Thgt | " .
|
|
"pgmtoppm \"$colorlist[0]-$colorlist[1]\" >$outfile");
|
|
if ($rc != 0) {
|
|
- die("pgmramp|pgmtoppm failed.");
|
|
+ die("pgmramp|pgmtoppm failed.\n");
|
|
}
|
|
$widthRemaining -= $w;
|
|
$n++;
|