diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
commit | 23ce26f64c34e30951ad9ade2151552ed77e7357 (patch) | |
tree | d73b31a0c2f7c7be4a69f8a8e84e00dd39c432b5 /editor/pnmquantall | |
parent | 1b6e51a266008348ad93ed8b6ac9ec91b5024fea (diff) | |
download | netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.gz netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.xz netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.zip |
promote Advanced to Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@4558 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/pnmquantall')
-rwxr-xr-x | editor/pnmquantall | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/editor/pnmquantall b/editor/pnmquantall index aea6cc84..594e8f7b 100755 --- a/editor/pnmquantall +++ b/editor/pnmquantall @@ -57,11 +57,18 @@ use warnings; use English; use Fcntl; # gets open flags use File::Copy; +use IO::Handle; my $TRUE=1; my $FALSE = 0; +sub pm_message($) { + STDERR->print("pnmquantall: $_[0]\n"); +} + + + sub doVersionHack($) { my ($argvR) = @_; @@ -84,7 +91,7 @@ sub parseArgs($$$$) { if (@argv > 0 && $argv[0] eq "-ext") { if (@argv < 2) { - print STDERR ("-ext requires a value\n"); + pm_message("-ext requires a value"); exit(100); } else { $$extR = $argv[1]; @@ -96,8 +103,8 @@ sub parseArgs($$$$) { } if (@argv < $firstArgPos + 2) { - print STDERR ("Not enough arguments. You need at least the number " . - "of colors and one file name\n"); + pm_message("Not enough arguments. You need at least the number " . + "of colors and one file name"); exit(100); } @@ -110,16 +117,17 @@ sub parseArgs($$$$) { sub tempFile($) { + my ($suffix) = @_; + # We trust Perl's File::Temp to do a better job of creating the temp # file, but it doesn't exist before Perl 5.6.1. if (eval { require File::Temp; 1 }) { return File::Temp::tempfile("pnmquant_XXXX", - SUFFIX=>".pnm", + SUFFIX=>$suffix, DIR=>File::Spec->tmpdir(), UNLINK=>$TRUE); } else { - my ($suffix) = @_; my $fileName; local *file; # For some inexplicable reason, must be local, not my my $i; @@ -137,11 +145,11 @@ sub tempFile($) { sub makeColorMap($$$$) { my ($fileNamesR, $newColorCt, $colorMapFileName, $errorR) = @_; - my $pnmcatCmd = "pnmcat -topbottom -white -jleft @{$fileNamesR}"; + my $pamcatCmd = "pamcat -topbottom -white -jleft @{$fileNamesR}"; my $pnmcolormapCmd = "pnmcolormap $newColorCt"; - my $makeMapCmd = "$pnmcatCmd | $pnmcolormapCmd >$colorMapFileName"; + my $makeMapCmd = "$pamcatCmd | $pnmcolormapCmd >$colorMapFileName"; my $termStatus = system($makeMapCmd); @@ -212,7 +220,7 @@ if (!$progError) { my $exitStatus; if ($progError) { - print STDERR ("Failed. $progError\n"); + pm_message("Failed. $progError"); $exitStatus = 1; } else { $exitStatus = 0; |