version 1.3, 2004/07/23 18:19:13
|
version 1.5, 2004/11/18 20:15:09
|
Line 15
|
Line 15
|
# Place, Suite 330, Boston, MA 02111-1307 USA |
# Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
use strict; |
use strict; |
|
use sigtrap qw(die normal-signals); |
|
|
# MPIWG libraries |
# MPIWG libraries |
use lib '/usr/local/mpiwg/scripts'; |
use lib '/usr/local/mpiwg/scripts'; |
Line 23 use MPIWGlib;
|
Line 24 use MPIWGlib;
|
|
|
$| = 1; # unblock IO |
$| = 1; # unblock IO |
|
|
my $version = "V0.9.2 (ROC 22.4.2004)"; |
my $version = "V0.9.3 (ROC 18.11.2004)"; |
|
|
$debug = 0; |
$debug = 0; |
|
|
Line 129 sub findfile {
|
Line 130 sub findfile {
|
return; |
return; |
} |
} |
|
|
|
# |
|
# $p = cleanpath($path, $startslash). |
|
# |
|
# returns a pathname with trailing and starting slash removed (if |
|
# $startslash is true the starting slash is not removed) |
|
# |
|
sub cleanpath { |
|
my ($path, $startslash) = @_; |
|
|
|
if ($path =~ /^(\/)*(.*?)\/*$/) { |
|
if ($startslash) { |
|
return $1 . $2; |
|
} else { |
|
return $2; |
|
} |
|
} |
|
return $path; |
|
} |
|
|
# |
# |
# ($basename, $extension) = splitfn($filename) |
# ($basename, $extension) = splitfn($filename) |
Line 156 sub mmkdir {
|
Line 175 sub mmkdir {
|
# does the directory already exist? |
# does the directory already exist? |
if (-d $dirname) { |
if (-d $dirname) { |
chmod $dir_perm, $dirname or do { |
chmod $dir_perm, $dirname or do { |
logger('ERROR', "unable to change permission on $dirname!"); |
logger('WARNING', "unable to change permission on $dirname!"); |
return 0; |
|
}; |
}; |
return 1; |
return 1; |
} |
} |
Line 189 sub mmkdir {
|
Line 207 sub mmkdir {
|
# |
# |
sub identify { |
sub identify { |
my ($filepath) = @_; |
my ($filepath) = @_; |
my $pictype; |
my $pictype = ""; |
my $picwidth; |
my $picwidth = 0; |
my $picheight; |
my $picheight = 0; |
my $bitdepth = 0; |
my $bitdepth = 0; |
# use quickident first |
# use quickident first |
$pictype = quickident($filepath); |
$pictype = quickident($filepath); |
Line 202 sub identify {
|
Line 220 sub identify {
|
while (<IDENT>) { |
while (<IDENT>) { |
chomp; |
chomp; |
if (/Image Width:\s*(\d+)\s*Image Length:\s*(\d+)/) { |
if (/Image Width:\s*(\d+)\s*Image Length:\s*(\d+)/) { |
$picwidth = $1; |
$picwidth = $1 if ($1 > $picwidth); |
$picheight = $2; |
$picheight = $2 if ($2 > $picheight); |
next; |
next; |
} |
} |
if (/Bits\/Sample:\s*(\d+)/) { |
if (/Bits\/Sample:\s*(\d+)/) { |
$bitdepth = $1; |
$bitdepth = $1 if ($1 > $bitdepth); |
next; |
next; |
} |
} |
} |
} |
if ($picwidth) { |
if ($picwidth) { |
logger('DEBUG', "TIFF $1 x $2"); |
logger('DEBUG', "TIFF $picwidth x $picheight"); |
return ($pictype, $picwidth, $picheight, $bitdepth); |
return ($pictype, $picwidth, $picheight, $bitdepth); |
} |
} |
} |
} |
Line 792 checksoft();
|
Line 810 checksoft();
|
my $args = parseargs(); |
my $args = parseargs(); |
|
|
# source dir |
# source dir |
my $srcdir = $$args{'src'}; |
my $srcdir = cleanpath($$args{'src'}, 1); |
|
|
# destination dir |
# destination dir |
my $destdir = $$args{'dest'}; |
my $destdir = cleanpath($$args{'dest'}, 1); |
|
|
# working dir |
# working dir |
my $workdir = $$args{'dir'}; |
my $workdir = cleanpath($$args{'dir'}); |
|
|
# destination size |
# destination size |
if ($$args{'scaleby'}) { |
if ($$args{'scaleby'}) { |