Skip to content

Commit

Permalink
remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
pmqs committed Sep 3, 2023
1 parent 14890aa commit 54b89a5
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions test/mkbad
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ sub Read;
my $VERSION = '1.00' ;
my $dry_run ;

GetOptions ("dry-run" => \$dry_run,
"help" => \&Usage)
GetOptions ("dry-run" => \$dry_run)
or Usage("Error in command line arguments\n");

Usage()
Expand All @@ -52,7 +51,7 @@ for my $filename (@ARGV)
unless $sig == ZIP_LOCAL_HDR_SIG ;

# Assume no comment or other trailing data
# The last two things n the file are the Z64 & EOCD records
# The last two things in the file are the Z64 & EOCD records

Seek $filename, $fh, -42 ;

Expand Down Expand Up @@ -95,6 +94,7 @@ for my $filename (@ARGV)
}
else
{
# This line creates the bad zip file
print $fh pack "V", 0 ;
print "Updated '$filename'\n";
}
Expand Down Expand Up @@ -123,26 +123,3 @@ sub Read

return $data;
}

sub Usage
{
print <<'EOM';
Usage: fix-onedrive-zip [--dry-run] file1.zip [file2.zip...]
Fix OneDrive/Windows Zip files larger than 4Gig that have an invalid 'Total
Number of Disks' field in the 'ZIP64 End Central Directory Locator'. The
value in this field should be 1, but OneDrive/Windows sets it to 0. This
makes it difficult to work with these files using standard unzip utilities.
This program changes the 'Total Number of Disks' field value to 1.
See https://github.com/pmqs/Fix-OneDrive-Zip for support.
Copyright (c) 2020 Paul Marquess (pmqs@cpan.org). All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
EOM
exit;
}

0 comments on commit 54b89a5

Please sign in to comment.