+moreutils (0.32) UNRELEASED; urgency=low
+
+ * zrun: Can be linked to zsomeprog to run the equivilant of zrun someprog.
+ Closes: #411623 (Stefan Fritsch)
+ * zrun: Add support for lzma and lzo. (Stefan Fritsch)
+
+ -- Joey Hess <joeyh@debian.org> Sat, 27 Sep 2008 18:03:48 -0400
+
moreutils (0.31) unstable; urgency=low
* pee.1: Document difference with tee in stdout.
This is a quick way to run a command that does not itself support
compressed files, without manually uncompressing the files.
+The following compression types are supported: gz bz2 Z lzma lzo
+
+If zrun is linked to some name beginning with z, like zprog, and the link is
+executed, this is equivalent to executing "zrun prog".
+
=head1 BUGS
Modifications to the uncompressed temporary file are not fed back into the
use File::Spec;
use File::Temp qw{tempfile};
-my $program = shift;
+my $program;
-if (! @ARGV) {
- die "Usage: zrun <command> <args>\n";
+if ($0 =~ m{(?:^|/)z([^/]+)$}) {
+ $program = $1;
+ if (! @ARGV) {
+ die "Usage: z$1 <args>\nEquivalent to: zrun $1 <args>\n";
+ }
+}
+else {
+ $program = shift;
+ if (! @ARGV) {
+ die "Usage: zrun <command> <args>\n";
+ }
}
my @argument;
my %child;
foreach my $argument (@ARGV) {
- if ($argument =~ m{^(.*/)?([^/]*)\.(gz|Z|bz2)$}s) {
+ if ($argument =~ m{^(.*/)?([^/]*)\.(gz|Z|bz2|lzo|lzma)$}s) {
my $suffix = "-$2";
- my @preprocess = $3 eq "bz2" ? qw(bzip2 -d -c) : qw(gzip -d -c);
+ my @preprocess = $3 eq "bz2" ? qw(bzip2 -d -c) :
+ $3 eq "lzo" ? qw(lzop -d -c) :
+ $3 eq "lzma" ? qw(lzma -d -c) : qw(gzip -d -c);
my ($fh, $tmpname) = tempfile(SUFFIX => $suffix,
DIR => File::Spec->tmpdir, UNLINK => 1)