xref: /aoo41x/main/officecfg/util/template.gen (revision 45ef6fe1)
1cdf0e10cSrcweir: # -*- perl -*-
2*45ef6fe1SAndrew Rist###############################################################
3*45ef6fe1SAndrew Rist#
4*45ef6fe1SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
5*45ef6fe1SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
6*45ef6fe1SAndrew Rist#  distributed with this work for additional information
7*45ef6fe1SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
8*45ef6fe1SAndrew Rist#  to you under the Apache License, Version 2.0 (the
9*45ef6fe1SAndrew Rist#  "License"); you may not use this file except in compliance
10*45ef6fe1SAndrew Rist#  with the License.  You may obtain a copy of the License at
11*45ef6fe1SAndrew Rist#
12*45ef6fe1SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
13*45ef6fe1SAndrew Rist#
14*45ef6fe1SAndrew Rist#  Unless required by applicable law or agreed to in writing,
15*45ef6fe1SAndrew Rist#  software distributed under the License is distributed on an
16*45ef6fe1SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17*45ef6fe1SAndrew Rist#  KIND, either express or implied.  See the License for the
18*45ef6fe1SAndrew Rist#  specific language governing permissions and limitations
19*45ef6fe1SAndrew Rist#  under the License.
20*45ef6fe1SAndrew Rist#
21*45ef6fe1SAndrew Rist###############################################################
22cdf0e10cSrcweireval 'exec perl -wS $0 ${1+"$@"}'
23cdf0e10cSrcweir	if 0;
24cdf0e10cSrcweir
25cdf0e10cSrcweiropen(OUTFILE, ">$ARGV[1]");
26cdf0e10cSrcweir
27cdf0e10cSrcweirprint OUTFILE "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
28cdf0e10cSrcweirprint OUTFILE "<org.openoffice.Templates>\n";
29cdf0e10cSrcweir
30cdf0e10cSrcweir
31cdf0e10cSrcweirchdir($ARGV[0]) or die "can't chdir() to $ARGV[0]";
32cdf0e10cSrcweir
33cdf0e10cSrcweiropendir(DIR, ".");
34cdf0e10cSrcweir
35cdf0e10cSrcweir@files=readdir(DIR);
36cdf0e10cSrcweir
37cdf0e10cSrcweirforeach $file (@files) {
38cdf0e10cSrcweir	if ( $file =~ /\w*\.tpl/ ) {
39cdf0e10cSrcweir		open(INFILE, "<$file") or die "can't open file $file";
40cdf0e10cSrcweir		while(<INFILE>) {
41cdf0e10cSrcweir			if ( /xml version=/ ) {
42cdf0e10cSrcweir				next;
43cdf0e10cSrcweir			}
44cdf0e10cSrcweir			print OUTFILE;
45cdf0e10cSrcweir		}
46cdf0e10cSrcweir		close(INFILE);
47cdf0e10cSrcweir	}
48cdf0e10cSrcweir}
49cdf0e10cSrcweir
50cdf0e10cSrcweirprint OUTFILE "</org.openoffice.Templates>\n";
51cdf0e10cSrcweir
52cdf0e10cSrcweirclosedir(DIR);
53cdf0e10cSrcweir
54cdf0e10cSrcweirclose(OUTFILE);
55