~ubuntu-branches/ubuntu/vivid/libarchive-zip-perl/vivid-proposed

« back to all changes in this revision

Viewing changes to examples/unzipAll.pl

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2004-10-30 22:19:15 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20041030221915-gtxn2xoojblyekyh
Tags: 1.14-1
* New upstream version.
  - Fixes: Archive::Zip is fooled by manipulated ZIP directory
    Closes: #277773.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/perl -w
 
2
# Extracts all files from the given zip
 
3
# $Revision: 1.3 $
 
4
# usage:
 
5
#       perl unzipAll.pl [-j] zipfile.zip
 
6
# if -j option given, discards paths.
 
7
#
 
8
use strict;
 
9
 
 
10
use vars qw( $opt_j );
 
11
use Archive::Zip qw(:ERROR_CODES);
 
12
use Getopt::Std;
 
13
 
 
14
$opt_j = 0;
 
15
getopts('j');
 
16
 
 
17
if (@ARGV < 1)
 
18
{
 
19
        die <<EOF
 
20
        usage: perl $0 [-j] zipfile.zip
 
21
        if -j option given, discards paths.
 
22
EOF
 
23
}
 
24
 
 
25
my $zip = Archive::Zip->new();
 
26
my $zipName = shift(@ARGV);
 
27
my $status = $zip->read( $zipName );
 
28
die "Read of $zipName failed\n" if $status != AZ_OK;
 
29
 
 
30
$zip->extractTree();