Search
j0ke.net Open Build Service
>
Projects
>
home:jg
>
cronolog
> gzip.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File gzip.patch of Package cronolog (Revision 2)
Currently displaying revision
2
,
show latest
--- cronolog-1.6.2-orig/src/cronosplit.in 1999-12-27 16:52:52.000000000 +0100 +++ cronolog-1.6.2-zlib/src/cronosplit.in 2003-07-05 13:20:03.000000000 +0200 @@ -119,12 +119,16 @@ "debug", \$debug, "verbose", \$verbose, "help", \$print_help, + "zlib", \$zlib, "version", \$print_version) and ($print_help or $print_version or $template)) or $print_help++; $verbose++ if $debug; # --debug implies --verbose +if ($zlib) { + require IO::Zlib; +} # If version number requested, print it and exit @@ -160,6 +164,8 @@ --print-invalid print invalid log-file entries --help print this help, then exit --version print version number, then exit + --zlib use zlib for compression of the + written logfiles EOS exit(0); } @@ -260,8 +266,9 @@ return $handle if defined($handle = $OpenHandles{$file}); # See if we already have too many files opened - - if (($#HandlesInUse + 1) >= $MaxHandles) + # (only if we're not using zlib, reopening a packed file + # wouldn't be a good idea) + if (!$zlib && ($#HandlesInUse + 1) >= $MaxHandles) { local($oldkey) = shift @HandlesInUse; # close the oldest $handle = $OpenHandles{$oldkey}; @@ -275,7 +282,15 @@ make_dirs($file); - if (open($handle, ">>$file")) + my $return; + + if (!$zlib) { + $return = open($handle, ">>$file"); + } else { + $return = $handle = IO::Zlib->new("$file", "wb9"); + } + + if ($return) { push(@HandlesInUse, $file); $OpenHandles{$file} = $handle;