#!/usr/bin/perl @patches=@ARGV; if ($#patches==-1) { opendir(PATCHES, "patches") || die("Couldn't open patches: $!\n"); @patches=grep(/^\d+-\d+.tar.Z$/, readdir(PATCHES)); closedir(PATCHES); } for (@patches) { my $file="patches/$_"; my $patch=$_; $patch=~s/\.tar\.Z$//; print "Extracting $file\n"; system("tar", "-xzf", "$file", "$patch/README.$patch", "$patch/*/pkginfo")==0 || warn("tar exited with non-zero exit status\n"); }