From: Jos I. Boumans Date: Fri, 26 Jan 2007 14:50:29 +0000 (+0100) Subject: Small bugfixes to uupacktool.pl X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=404c68920bc89ad702536fbd16b3bceafd287acb;p=p5sagit%2Fp5-mst-13.2.git Small bugfixes to uupacktool.pl From: "Jos Boumans" Message-ID: <16773.80.127.35.68.1169819429.squirrel@webmail.xs4all.nl> p4raw-id: //depot/perl@30010 --- diff --git a/uupacktool.pl b/uupacktool.pl index 5656cef..9872a9e 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'};