Change 27380 (HEK into the IV union failed to convert the code in the
[p5sagit/p5-mst-13.2.git] / ext / Compress / Zlib / examples / gzcat
CommitLineData
f4c6fd49 1#!/usr/local/bin/perl
2
642e522c 3use IO::Uncompress::Gunzip qw( $GunzipError );
f4c6fd49 4use strict ;
8aa25532 5use warnings ;
f4c6fd49 6
f4c6fd49 7#die "Usage: gzcat file...\n"
8# unless @ARGV ;
9
642e522c 10my $file ;
11my $buffer ;
12my $s;
f4c6fd49 13
14@ARGV = '-' unless @ARGV ;
15
642e522c 16foreach $file (@ARGV) {
17
18 my $gz = new IO::Uncompress::Gunzip $file
19 or die "Cannot open $file: $GunzipError\n" ;
f4c6fd49 20
642e522c 21 print $buffer
22 while ($s = $gz->read($buffer)) > 0 ;
f4c6fd49 23
642e522c 24 die "Error reading from $file: $GunzipError\n"
25 if $s < 0 ;
f4c6fd49 26
642e522c 27 $gz->close() ;
f4c6fd49 28}
642e522c 29