updates, cleanups, and clarifications to the sample conf files. Uses more of the preprocessor variables for simplicity. FSBUILD-2 from Mark D. Anderson. Thanks Mark.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5034 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2007-04-28 19:27:17 +00:00
parent 7db63e84db
commit 48ca4cc864
7 changed files with 172 additions and 43 deletions
+49
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();