ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/scripts/crc
Revision: 24
Committed: Tue Jul 26 21:46:39 2011 UTC (8 years, 1 month ago) by gpertea
File size: 885 byte(s)
Log Message:
Line File contents
1 #!/usr/bin/perl
2 use strict;
3 use lib qw( blib/lib lib );
4 use Archive::Zip;
5 use FileHandle;
6 my $totalFiles = scalar(@ARGV);
7 foreach my $file (@ARGV)
8 {
9 if (-d $file)
10 {
11 warn "$0: ${file}: Is a directory\n";
12 next;
13 }
14
15 my $fh;
16 if ($file eq '-') {
17 $fh = *STDIN;
18 }
19 else {
20 $fh = FileHandle->new();
21 if (! $fh->open($file, 'r'))
22 {
23 warn "$0: $!\n";
24 next;
25 }
26 }
27 binmode($fh);
28 my $buffer;
29 my $bytesRead;
30 my $crc = 0;
31 while ($bytesRead = $fh->read($buffer, 32768))
32 {
33 $crc = Archive::Zip::computeCRC32($buffer, $crc);
34 }
35 printf("%08x", $crc);
36 print("\t$file") if ($totalFiles > 1);
37 print("\n");
38 }

Properties

Name Value
svn:executable *