| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
use strict ; |
| 4 |
use warnings ; |
| 5 |
|
| 6 |
my ($file, $output, $status) ; |
| 7 |
|
| 8 |
use Compress::Zlib ; |
| 9 |
|
| 10 |
die "Create a decompressor for a pl.gz\nUsage: filtdef file > filtfile\n" |
| 11 |
unless @ARGV == 1; |
| 12 |
|
| 13 |
foreach $file (@ARGV) |
| 14 |
{ |
| 15 |
open (F, "<", $file) or die "Cannot open $file: $!\n" ; |
| 16 |
my $x = deflateInit() |
| 17 |
or die "Cannot create a deflation stream\n" ; |
| 18 |
|
| 19 |
print "use Filter::Decompress;\n" ; |
| 20 |
while (<F>) |
| 21 |
{ |
| 22 |
($output, $status) = $x->deflate($_) ; |
| 23 |
|
| 24 |
$status == Z_OK |
| 25 |
or die "deflation failed\n" ; |
| 26 |
|
| 27 |
print $output ; |
| 28 |
} |
| 29 |
|
| 30 |
($output, $status) = $x->flush() ; |
| 31 |
|
| 32 |
$status == Z_OK |
| 33 |
or die "deflation failed\n" ; |
| 34 |
|
| 35 |
print $output ; |
| 36 |
close F ; |
| 37 |
} |