diff -r 7c4a911dc066 -r 541af5ee3ed9 sbsv1/abld/genutil/listzip.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sbsv1/abld/genutil/listzip.pl Wed Aug 18 17:23:33 2010 +0300 @@ -0,0 +1,71 @@ +#!/usr/bin/perl +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# e32toolp/genutil/listzip.pl +# Utility for listing the contents of a zip file. +# Syntax: +# perl listzip.pl +# This command will print all files in the . Each file name is prefixed by +# and is printed on a separate line. +# +# + +# Version +my $MajorVersion = 1; +my $MinorVersion = 1; +my $PatchVersion = 0; + +sub _print_usage_and_die(); +sub _print_err_and_die(@); + +sub main(@) +{ + my ($prefix, $zipf, @junk) = @_; + + _print_usage_and_die() if (!$prefix || !$zipf || @junk); + + _print_err_and_die("$prefix is not a directory.") unless -d $prefix; + _print_err_and_die("$zipf doesn't exist.") unless -f $zipf; + + my @raw_data = qx/unzip -l $zipf/; + + for (@raw_data) + { + if ($_ =~ /^\s*\d+\s+\d\d[-|\/|\.]\d\d[-|\/|\.]\d\d\s+\d\d:\d\d\s+(.*)/) + { + my $line = "${prefix}/$1"; + $line =~ s/\//\\/g if($^O =~ /^MSWin32$/i); + # don't print directories under the tags + if (!($line =~ /[\\|\/]$/)) { + print "$line\n"; + } + } + } +} + +sub _print_usage_and_die() +{ + print "LISTZIP zip files process tool V$MajorVersion.$MinorVersion.$PatchVersion\nusage: listzip.pl \n"; + exit 2; +} + +sub _print_err_and_die(@) +{ + print "listzip.pl: error: @_\n"; + exit 1; +} + +main(@ARGV); + +