Skip to content
Snippets Groups Projects
Commit 988e9f76 authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

copied md5cat.pm from sourceforge repository

parent 36efb863
Branches
No related tags found
No related merge requests found
...@@ -28,6 +28,11 @@ use Digest::MD5::File; ...@@ -28,6 +28,11 @@ use Digest::MD5::File;
my $run= 1; my $run= 1;
sub run { $run; } sub run { $run; }
my $mark_count1= 10000;
my $mark_count2= 1000;
my $mark_time= 600; # seconds
my $last_mark= 0; # epoch
sub new sub new
{ {
my $class= shift; my $class= shift;
...@@ -242,7 +247,6 @@ sub check_new_files ...@@ -242,7 +247,6 @@ sub check_new_files
{ {
last FILE if (defined ($limit) && @tmp_2chk >= $limit); last FILE if (defined ($limit) && @tmp_2chk >= $limit);
printf ("%9d items processed\n", $cnt) if ((++$cnt % 10000) == 0);
my $F= $xFLIST->{$fnm}; my $F= $xFLIST->{$fnm};
my $x= $F->{'state'}; my $x= $F->{'state'};
next if ($x eq 'nocheck'); next if ($x eq 'nocheck');
...@@ -266,7 +270,18 @@ sub check_new_files ...@@ -266,7 +270,18 @@ sub check_new_files
{ {
push (@tmp_2chk, $fnm); push (@tmp_2chk, $fnm);
} }
$cnt++;
if (($mark_count1 && ($cnt % $mark_count1) == 0)
|| ($mark_time && time() > $last_mark + $mark_time)
)
{
$last_mark= time();
printf ("%9d items processed\n", $cnt);
}
} }
printf ("%9d files to be checked\n", scalar (@tmp_2chk)); printf ("%9d files to be checked\n", scalar (@tmp_2chk));
if (@tmp_2chk) if (@tmp_2chk)
...@@ -539,8 +554,6 @@ sub digest_md5_list ...@@ -539,8 +554,6 @@ sub digest_md5_list
my $cnt= 0; my $cnt= 0;
MD5: while (my $f= shift (@_)) MD5: while (my $f= shift (@_))
{ {
printf ("%9d items processed\n", $cnt) if ((++$cnt % 10000) == 0);
last MD5 unless ($run); last MD5 unless ($run);
my @st= stat ($f); my @st= stat ($f);
...@@ -553,6 +566,16 @@ sub digest_md5_list ...@@ -553,6 +566,16 @@ sub digest_md5_list
my $md5= Digest::MD5::File::file_md5_hex ($f); my $md5= Digest::MD5::File::file_md5_hex ($f);
printf ("%9d %s %s\n", $st[7], $md5, $f); printf ("%9d %s %s\n", $st[7], $md5, $f);
push (@res, [ $md5, $f, $st[7], $st[9] ]); push (@res, [ $md5, $f, $st[7], $st[9] ]);
$cnt++;
if (($mark_count2 && ($cnt % $mark_count2) == 0)
|| ($mark_time && time() > $last_mark + $mark_time)
)
{
$last_mark= time();
printf ("%9d items processed\n", $cnt);
}
} }
(wantarray) ? @res : \@res; (wantarray) ? @res : \@res;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment