X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=bin%2FBackupPC_zcat;h=21e5b95b8bf8ebe9234e7921a58bcfbde09dbb37;hp=d162e2fe44698dea9ca4e2e5edd32663932a33bf;hb=5b79f9a3c01bca16dd4d211e76fc53daa549e421;hpb=2c14784ad71874ec850d189060fe63d6eb9eba95 diff --git a/bin/BackupPC_zcat b/bin/BackupPC_zcat index d162e2f..21e5b95 100755 --- a/bin/BackupPC_zcat +++ b/bin/BackupPC_zcat @@ -14,7 +14,7 @@ # Craig Barratt # # COPYRIGHT -# Copyright (C) 2001-2003 Craig Barratt +# Copyright (C) 2001-2007 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 @@ -32,7 +32,7 @@ # #======================================================================== # -# Version 2.1.0_CVS, released 8 Feb 2004. +# Version 3.1.0, released 25 Nov 2007. # # See http://backuppc.sourceforge.net. # @@ -48,28 +48,33 @@ use BackupPC::FileZIO; sub zcat { my($fh, $fileName) = @_; - my($data, $r); + 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)) ) { - zcat($fh, $ARGV[0]); + $ret ||= zcat($fh, $ARGV[0]); } else { print(STDERR "$0: can't open $ARGV[0]\n"); - exit(1); + $ret = 1; + last; } shift @ARGV; } } else { my $fh = BackupPC::FileZIO->open(*STDIN, 0, 1); - zcat($fh, "stdin"); + $ret ||= zcat($fh, "stdin"); } +exit($ret);