X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FFileZIO.pm;h=4bae50a0ce97572309466fa018ae4e38b8b8c1de;hp=7022896b6c7b2d6dca447fdeafc9358a27951e86;hb=72b87b178ae8dcc10f1ae0f441d13e30d5f1ecf1;hpb=9175f9157f0d54b50ebf11d2036c20f50ffc6d9d diff --git a/lib/BackupPC/FileZIO.pm b/lib/BackupPC/FileZIO.pm index 7022896..4bae50a 100644 --- a/lib/BackupPC/FileZIO.pm +++ b/lib/BackupPC/FileZIO.pm @@ -11,7 +11,7 @@ # Craig Barratt # # COPYRIGHT -# Copyright (C) 2001 Craig Barratt +# Copyright (C) 2001-2003 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 @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.0.0_CVS, released 3 Feb 2003. +# Version 2.1.0_CVS, released 3 Jul 2003. # # See http://backuppc.sourceforge.net. # @@ -99,6 +99,7 @@ sub open } else { open(FH, "<", $fileName) || return; } + binmode(FH); $fh = *FH; } $compLevel = 0 if ( !$CompZlibOK ); @@ -246,6 +247,7 @@ sub write my $n = length($$dataRef); return if ( !$self->{write} ); + print($$dataRef) if ( $self->{writeTeeStdout} ); return 0 if ( $n == 0 ); if ( !$self->{compress} ) { # @@ -303,6 +305,14 @@ sub name return $self->{name}; } +sub writeTeeStdout +{ + my($self, $param) = @_; + + $self->{writeTeeStdout} = $param if ( defined($param) ); + return $self->{writeTeeStdout}; +} + sub close { my($self) = @_; @@ -344,6 +354,7 @@ sub compressCopy my $fh = BackupPC::FileZIO->open($destFileZ, 1, $compress); my $data; if ( defined($fh) && open(LOG, "<", $srcFile) ) { + binmode(LOG); while ( sysread(LOG, $data, 65536) > 0 ) { $fh->write(\$data); }