File: filtinf

package info (click to toggle)
libcompress-raw-zlib-perl 2.213-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,148 kB
  • sloc: ansic: 6,992; perl: 2,934; makefile: 11
file content (29 lines) | stat: -rwxr-xr-x 503 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/local/bin/perl

use Compress::Raw::Zlib ;

use strict ;
use warnings ;

binmode STDIN;
binmode STDOUT;

my $x = new Compress::Raw::Zlib::Inflate
   or die "Cannot create a inflation stream\n" ;

my $input = '' ;
my $output = '' ;
my $status ;

while (read(STDIN, $input, 4096))
{
    $status = $x->inflate($input, $output) ;

    print $output
        if $status == Z_OK or $status == Z_STREAM_END ;

    last if $status != Z_OK ;
}

die "inflation failed\n"
    unless $status == Z_STREAM_END ;