2 #============================================================= -*-perl-*-
4 # BackupPC_zcat: uncompress files to stdout
8 # Usage: BackupPC_zcat [files...]
10 # BackupPC_zcat is a command-line utility for uncompressing BackupPC
14 # Craig Barratt <cbarratt@users.sourceforge.net>
17 # Copyright (C) 2001-2009 Craig Barratt
19 # This program is free software; you can redistribute it and/or modify
20 # it under the terms of the GNU General Public License as published by
21 # the Free Software Foundation; either version 2 of the License, or
22 # (at your option) any later version.
24 # This program is distributed in the hope that it will be useful,
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 # GNU General Public License for more details.
29 # You should have received a copy of the GNU General Public License
30 # along with this program; if not, write to the Free Software
31 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #========================================================================
35 # Version 3.2.0, released 31 Jul 2010.
37 # See http://backuppc.sourceforge.net.
39 #========================================================================
44 use lib "/usr/local/BackupPC/lib";
46 use BackupPC::FileZIO;
50 my($fh, $fileName) = @_;
53 while ( ($r = $fh->read(\$data, 65536)) > 0 ) {
57 print(STDERR "$0: can't uncompress $fileName\n");
67 if ( defined(my $fh = BackupPC::FileZIO->open($ARGV[0], 0, 1)) ) {
68 $ret ||= zcat($fh, $ARGV[0]);
70 print(STDERR "$0: can't open $ARGV[0]\n");
77 my $fh = BackupPC::FileZIO->open(*STDIN, 0, 1);
78 $ret ||= zcat($fh, "stdin");