Commit | Line | Data |
25f0751f |
1 | #!/usr/local/bin/perl |
2 | |
3 | use Compress::Raw::Zlib ; |
4 | |
5 | use strict ; |
6 | use warnings ; |
7 | |
8 | binmode STDIN; |
9 | binmode STDOUT; |
10 | |
11 | my $x = new Compress::Raw::Zlib::Inflate |
12 | or die "Cannot create a inflation stream\n" ; |
13 | |
14 | my $input = '' ; |
15 | my $output = '' ; |
16 | my $status ; |
17 | |
18 | while (read(STDIN, $input, 4096)) |
19 | { |
20 | $status = $x->inflate($input, $output) ; |
21 | |
22 | print $output |
23 | if $status == Z_OK or $status == Z_STREAM_END ; |
24 | |
25 | last if $status != Z_OK ; |
26 | } |
27 | |
28 | die "inflation failed\n" |
29 | unless $status == Z_STREAM_END ; |
30 | |