xref: /aoo41x/main/sysui/desktop/macosx/list_icons.pl (revision cdf0e10c)
1:
2eval 'exec perl -wS $0 ${1+"$@"}'
3    if 0;
4
5#*************************************************************************
6#
7# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8#
9# Copyright 2000, 2010 Oracle and/or its affiliates.
10#
11# OpenOffice.org - a multi-platform office productivity suite
12#
13# This file is part of OpenOffice.org.
14#
15# OpenOffice.org is free software: you can redistribute it and/or modify
16# it under the terms of the GNU Lesser General Public License version 3
17# only, as published by the Free Software Foundation.
18#
19# OpenOffice.org is distributed in the hope that it will be useful,
20# but WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22# GNU Lesser General Public License version 3 for more details
23# (a copy is included in the LICENSE file that accompanied this code).
24#
25# You should have received a copy of the GNU Lesser General Public License
26# version 3 along with OpenOffice.org.  If not, see
27# <http://www.openoffice.org/license.html>
28# for a copy of the LGPLv3 License.
29#
30#*************************************************************************
31
32use warnings;
33use strict 'vars';
34
35# package all .icns if XML::Parser module is not installed
36eval 'use XML::Parser;'; if ( $@ ) { print '*.icns'; exit 0; };
37
38my $valuetype = "none";
39my $key = "none";
40
41#
42# XML handlers
43#
44
45sub start_handler {
46  my ($parser,$element,%attributes) = @_;
47  $valuetype = "$element";
48}
49
50sub char_handler {
51  my ($parser,$string) = @_;
52  if ( $key eq "CFBundleTypeIconFile" || $key eq "CFBundleIconFile" ) {
53    $string =~ s/^\s+//;
54    $string =~ s/\s+$//;
55    print "$string " if length($string) > 0;
56  }
57  $key = "$string" if $valuetype eq "key";
58}
59
60sub default_handler {
61  my ($parser,$string) = @_;
62}
63
64sub end_handler {
65  my ($parser,$element) = @_;
66
67  $key = "none" if $valuetype ne "key";
68  $valuetype = "none";
69}
70
71#
72# main
73#
74
75my $parser = new XML::Parser(ErrorContext => 2,
76                             Namespaces => 1);
77
78$parser->setHandlers( Start => \&start_handler,
79                      End => \&end_handler,
80                      Char => \&char_handler,
81                      Default => \&default_handler);
82$parser->parse(STDIN);
83
84print "\n";
85