BackupPC_poolCntPrint (BackupPC-4.3.2) | : | BackupPC_poolCntPrint (BackupPC-4.4.0) | ||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
# This program is distributed in the hope that it will be useful, | # This program is distributed in the hope that it will be useful, | |||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
# GNU General Public License for more details. | # GNU General Public License for more details. | |||
# | # | |||
# You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | |||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
# | # | |||
# Version 4.3.2, released 17 Feb 2020. | # Version 4.4.0, released 20 Jun 2020. | |||
# | # | |||
# See http://backuppc.sourceforge.net. | # See http://backuppc.sourceforge.net. | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
use strict; | use strict; | |||
no utf8; | no utf8; | |||
use lib "__INSTALLDIR__/lib"; | use lib "__INSTALLDIR__/lib"; | |||
use BackupPC::Lib; | use BackupPC::Lib; | |||
use BackupPC::XS; | use BackupPC::XS; | |||
use Data::Dumper; | use Data::Dumper; | |||
die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); | die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); | |||
my $TopDir = $bpc->TopDir(); | my $TopDir = $bpc->TopDir(); | |||
my $BinDir = $bpc->BinDir(); | my $BinDir = $bpc->BinDir(); | |||
my %Conf = $bpc->Conf(); | my %Conf = $bpc->Conf(); | |||
my $s = $bpc->{storage}; | my $s = $bpc->{storage}; | |||
my $digest; | my $digest; | |||
if ( @ARGV == 0 ) { | if ( @ARGV == 0 ) { | |||
print STDERR "Usage: $0 [poolCntFilePath|hexDigest]...\n"; | print STDERR "Usage: $0 [poolCntFilePath|hexDigest]...\n"; | |||
exit(1); | exit(1); | |||
} | } | |||
while ( my $poolCntFile = shift(@ARGV) ) { | while ( my $poolCntFile = shift(@ARGV) ) { | |||
if ( !-f $poolCntFile ) { | if ( !-f $poolCntFile ) { | |||
if ( $poolCntFile =~ /^[\da-f]{16,}$/i ) { | if ( $poolCntFile =~ /^[\da-f]{16,}$/i ) { | |||
# | # | |||
# Print a specific digest count instead | # Print a specific digest count instead | |||
# | # | |||
$digest = pack("H*", $poolCntFile); | $digest = pack("H*", $poolCntFile); | |||
$poolCntFile = sprintf("%s/%02x/poolCnt", | $poolCntFile = sprintf("%s/%02x/poolCnt", | |||
$Conf{CompressLevel} ? $bpc->{CPoolDir} : $bpc | $Conf{CompressLevel} ? $bpc->{CPoolDir} : $bpc->{PoolDir}, | |||
->{PoolDir}, | vec($digest, 0, 8) & 0xfe); | |||
vec($digest, 0, 8) & 0xfe); | ||||
} | } | |||
if ( !-f $poolCntFile ) { | if ( !-f $poolCntFile ) { | |||
print STDERR "$poolCntFile does not exist\n"; | print STDERR "$poolCntFile does not exist\n"; | |||
exit(1); | exit(1); | |||
} | } | |||
} | } | |||
my $count = BackupPC::XS::PoolRefCnt::new(); | my $count = BackupPC::XS::PoolRefCnt::new(); | |||
if ( $count->read($poolCntFile) ) { | if ( $count->read($poolCntFile) ) { | |||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added |