summaryrefslogtreecommitdiff
path: root/uupacktool.pl
diff options
context:
space:
mode:
authorJos I. Boumans <kane@dwim.org>2007-01-26 15:50:29 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-01-26 14:03:34 +0000
commit404c68920bc89ad702536fbd16b3bceafd287acb (patch)
tree8b2d6501e7972e6d609040bfd988e99849533d42 /uupacktool.pl
parent5909b2ae83b782be73778dd9436dc31be4d39529 (diff)
downloadperl-404c68920bc89ad702536fbd16b3bceafd287acb.tar.gz
Small bugfixes to uupacktool.pl
From: "Jos Boumans" <kane@dwim.org> Message-ID: <16773.80.127.35.68.1169819429.squirrel@webmail.xs4all.nl> p4raw-id: //depot/perl@30010
Diffstat (limited to 'uupacktool.pl')
-rw-r--r--uupacktool.pl9
1 files changed, 6 insertions, 3 deletions
diff --git a/uupacktool.pl b/uupacktool.pl
index 5656cefb0d..9872a9e94e 100644
--- a/uupacktool.pl
+++ b/uupacktool.pl
@@ -5,6 +5,8 @@ use warnings;
use Getopt::Long;
use File::Basename;
+Getopt::Long::Configure('no_ignore_case');
+
our $LastUpdate = -M $0;
sub handle_file {
@@ -27,7 +29,7 @@ sub handle_file {
}
my ($head, $body) = split /__UU__\n/, $str;
die "Can't unpack malformed data in '$file'\n"
- if !$head or !$body;
+ if !$head;
$outstr = unpack 'u', $body;
} else {
@@ -62,7 +64,8 @@ EOFBLURB
open my $outfh, ">", $outfile
or die "Could not open $outfile for writing: $!";
binmode $outfh;
- print $outfh $outstr;
+ ### $outstr might be empty, if the file was empty
+ print $outfh $outstr if $outstr;
close $outfh;
chmod $mode, $outfile;
@@ -156,7 +159,7 @@ Options:
}
my $opts = {};
-GetOptions($opts,'u','p','c','m:s','s','d=s','v','h');
+GetOptions($opts,'u','p','c', 'D', 'm:s','s','d=s','v','h');
die "Can't pack and unpack at the same time!\n", usage()
if $opts->{'u'} && $opts->{'p'};