diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-04-28 01:43:45 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-04-28 01:43:45 +0000 |
commit | dbdc0476c3ed226ccba2750b09e25887ba12b2bb (patch) | |
tree | b80cbcdbd9c08008b5b84125180f8a3e9c8a190e /generator/ppmrainbow | |
parent | 7258bf2ba30955d20dc0ba361df7c2de43704f5a (diff) | |
download | netpbm-mirror-dbdc0476c3ed226ccba2750b09e25887ba12b2bb.tar.gz netpbm-mirror-dbdc0476c3ed226ccba2750b09e25887ba12b2bb.tar.xz netpbm-mirror-dbdc0476c3ed226ccba2750b09e25887ba12b2bb.zip |
Release 10.35.63
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@902 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'generator/ppmrainbow')
-rwxr-xr-x | generator/ppmrainbow | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/generator/ppmrainbow b/generator/ppmrainbow index 0effeecf..f98536cd 100755 --- a/generator/ppmrainbow +++ b/generator/ppmrainbow @@ -6,6 +6,13 @@ my ($FALSE, $TRUE) = (0,1); (my $myname = $0) =~ s#\A.*/##; +sub fatal($) { + my ($msg) = @_; + + print(STDERR "$msg\n"); + exit(1); +} + my ($Twid, $Thgt, $tmpdir, $norepeat, $verbose); # set defaults @@ -21,15 +28,16 @@ GetOptions("width=i" => \$Twid, "norepeat!" => \$norepeat, "verbose!" => \$verbose); -die "invalid width and/or height\n" unless $Twid >= 1 && $Thgt >= 1; - +if ($Twid < 1 || $Thgt < 1) { + fatal("invalid width and/or height"); +} my $verboseCommand = $verbose ? "set -x;" : ""; if (@ARGV < 1) { - die("You must specify at least one color as an argument"); + fatal("You must specify at least one color as an argument"); } elsif (@ARGV < 2 && $norepeat) { - die("With the -norepeat option, you must specify at least two colors " . - "as arguments."); + fatal("With the -norepeat option, you must specify at least two colors " . + "as arguments."); } my @colorlist; @@ -57,7 +65,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."); + fatal("pgmramp|pgmtoppm failed."); } $widthRemaining -= $w; $n++; |