git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13998 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West
2009-06-27 00:35:05 +00:00
parent f22fb723db
commit 87e6e63ebb
4 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
#!/usr/bin/perl -w
use strict;
=head1 NAME
combineconf.pl - expand #include PIs in a freeswitch conf file
=head1 SYNOPSIS
# cd conf
# ../scripts/combineconf.pl freeswitch.xml > freeswitch_combined.xml
=head1 DESCRIPTION
This is recursive, and will take multiple input files on the command line.
You need to run it from the working directory that the relative include paths
except to be resolved from.
=head1 AUTHOR
Mark D. Anderson (mda@discerning.com)
Released under same terms as Perl, or alternatively the MPL.
=cut
use IO::File;
sub filter_file {
my ($f) = @_;
my $fh = $f eq '-' ? \*STDIN : IO::File->new($f, 'r');
die "ERROR: Can't open $f: $!\n" unless $fh;
while(<$fh>) {
if (m/<!--#include\s+"(.*?)"/) {
filter_file($1);
}
else {print;}
}
undef $fh;
}
sub main {
die "Usage: $0 file1 ...\nCombined output goes to stdout. Use '-' as the filename to use stdin." unless @ARGV;
for(@ARGV) {
filter_file($_);
}
}
main();