Oops, here's the file I meant to include in the last message.
#!/usr/bin/perl
#============================================================= -*-perl-*-
#
# BackupPC_zcat: uncompress files to stdout
#
# DESCRIPTION
#
# Usage: BackupPC_zcat [files...]
#
# BackupPC_zcat is a command-line utility for uncompressing BackupPC
# compressed files.
#
# AUTHOR
# Craig Barratt <cbarratt AT users.sourceforge DOT net>
#
# COPYRIGHT
# Copyright (C) 2001-2013 Craig Barratt
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#========================================================================
#
# Version 3.3.0, released 14 Apr 2013.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
no utf8;
use lib "/usr/share/backuppc/lib";
use Compress::Zlib;
use BackupPC::FileZIO;
sub zcat
{
my($fh, $fileName) = @_;
my($data, $r, $ret);
while ( ($r = $fh->read(\$data, 65536)) > 0 ) {
print($data);
}
if ( $r < 0 ) {
print(STDERR "$0: can't uncompress $fileName\n");
$ret = 1;
}
$fh->close();
return $ret;
}
my $ret = 0;
if ( @ARGV ) {
while ( @ARGV ) {
if ( defined(my $fh = BackupPC::FileZIO->open($ARGV[0], 0, 1)) ) {
$ret ||= zcat($fh, $ARGV[0]);
} else {
print(STDERR "$0: can't open $ARGV[0]\n");
$ret = 1;
last;
}
shift @ARGV;
}
} else {
my $fh = BackupPC::FileZIO->open(*STDIN, 0, 1);
$ret ||= zcat($fh, "stdin");
}
exit($ret);
--
Carl Soderstrom
Systems Administrator
Real-Time Enterprises
www.real-time.com
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
|