Commit | Line | Data |
---|---|---|
f4c6fd49 | 1 | #!/usr/local/bin/perl |
2 | ||
642e522c | 3 | use IO::Uncompress::Gunzip qw( $GunzipError ); |
f4c6fd49 | 4 | use strict ; |
8aa25532 | 5 | use warnings ; |
f4c6fd49 | 6 | |
f4c6fd49 | 7 | #die "Usage: gzcat file...\n" |
8 | # unless @ARGV ; | |
9 | ||
642e522c | 10 | my $file ; |
11 | my $buffer ; | |
12 | my $s; | |
f4c6fd49 | 13 | |
14 | @ARGV = '-' unless @ARGV ; | |
15 | ||
642e522c | 16 | foreach $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 |