1*cdf0e10cSrcweir: # -*- perl -*- 2*cdf0e10cSrcweireval 'exec perl -wS $0 ${1+"$@"}' 3*cdf0e10cSrcweir if 0; 4*cdf0e10cSrcweir 5*cdf0e10cSrcweiropen(OUTFILE, ">$ARGV[1]"); 6*cdf0e10cSrcweir 7*cdf0e10cSrcweirprint OUTFILE "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; 8*cdf0e10cSrcweirprint OUTFILE "<org.openoffice.Templates>\n"; 9*cdf0e10cSrcweir 10*cdf0e10cSrcweir 11*cdf0e10cSrcweirchdir($ARGV[0]) or die "can't chdir() to $ARGV[0]"; 12*cdf0e10cSrcweir 13*cdf0e10cSrcweiropendir(DIR, "."); 14*cdf0e10cSrcweir 15*cdf0e10cSrcweir@files=readdir(DIR); 16*cdf0e10cSrcweir 17*cdf0e10cSrcweirforeach $file (@files) { 18*cdf0e10cSrcweir if ( $file =~ /\w*\.tpl/ ) { 19*cdf0e10cSrcweir open(INFILE, "<$file") or die "can't open file $file"; 20*cdf0e10cSrcweir while(<INFILE>) { 21*cdf0e10cSrcweir if ( /xml version=/ ) { 22*cdf0e10cSrcweir next; 23*cdf0e10cSrcweir } 24*cdf0e10cSrcweir print OUTFILE; 25*cdf0e10cSrcweir } 26*cdf0e10cSrcweir close(INFILE); 27*cdf0e10cSrcweir } 28*cdf0e10cSrcweir} 29*cdf0e10cSrcweir 30*cdf0e10cSrcweirprint OUTFILE "</org.openoffice.Templates>\n"; 31*cdf0e10cSrcweir 32*cdf0e10cSrcweirclosedir(DIR); 33*cdf0e10cSrcweir 34*cdf0e10cSrcweirclose(OUTFILE); 35