Add the original source packages to maemo, source lenny
[dh-make-perl] / dev / i386 / libio-compress-zlib-perl / libio-compress-zlib-perl-2.012 / examples / gzcat
1 #!/usr/local/bin/perl
2
3 use IO::Uncompress::Gunzip qw( $GunzipError );
4 use strict ;
5 use warnings ;
6
7 #die "Usage: gzcat file...\n"
8 #    unless @ARGV ;
9
10 my $file ;
11 my $buffer ;
12 my $s;
13
14 @ARGV = '-' unless @ARGV ;
15
16 foreach $file (@ARGV) {
17     
18     my $gz = new IO::Uncompress::Gunzip $file
19          or die "Cannot open $file: $GunzipError\n" ;
20
21     print $buffer
22         while ($s = $gz->read($buffer)) > 0 ;
23
24     die "Error reading from $file: $GunzipError\n" 
25         if $s < 0 ;
26     
27     $gz->close() ;
28 }
29