Debian Codegraph @

debian/list-pk3.pl

raw
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use Archive::Zip qw();
7
8 my $in = shift;
9
10 die "usage: ./list-pk3.pl baseoa/pak0.pk3" unless defined $in;
11
12 my $zip = Archive::Zip->new($in);
13
14 if (! defined $zip) {
15 die "unable to open $in";
16 }
17
18 print << "END";
19 # Produced by list-pk3.pl from $in
20 # This file is machine-readable, CRC32 \\t filename; to list files,
21 # use: sed -n -e 's/#.*//; s/.*\\t//p;'
22 # To be compatible, you will need the following files and
23 # checksums (hex) in this order:
24 END
25
26 foreach my $member ($zip->members()) {
27 my $crc;
28 my $filename = $member->fileName();
29
30 if ($member->isDirectory()) {
31 $crc = 'directory';
32 }
33 else {
34 $crc = $member->crc32String();
35 }
36
37 print "$crc\t$filename\n";
38 }
39
40 # Copyright 2010 Simon McVittie <[email protected]>
41 # Copying and distribution of this file, with or without modification, are
42 # permitted in any medium without royalty provided this notice is preserved.
43 # This file is offered as-is, without any warranty.