]> git.ipfire.org Git - thirdparty/squid.git/blame - scripts/merge-cf.data.pre.pl
SourceFormat merge: removed CVS-Id tags, removed unnecessary extern and SQUIDCEXTERN...
[thirdparty/squid.git] / scripts / merge-cf.data.pre.pl
CommitLineData
ffd3e510 1#!/usr/bin/perl
2#
3# This script reassembles a split configuration file back into a cf.data.pre
4# file.
5
6use strict;
7use IO::File;
8use File::Basename;
9
10my ($path) = ".";
11
12if (defined $ARGV[0]) {
13 $path = dirname($ARGV[0]);
14}
15
16sub filename($)
17{
18 my ($name) = @_;
19 return $path . "/" . $name . ".txt";
20}
21
22my ($in) = new IO::File;
23while(<>) {
24 if (/^NAME: (.*)/) {
25 my (@aliases) = split(/ /, $1);
26 my ($name) = shift @aliases;
27 $in->open(filename($name), "r") || die "Couldn't open ".filename($name).":$!\n";
28 while(<$in>) {
29 print $_;
30 }
31 $in->close();
32 } else {
33 print $_;
34 }
35}
36undef $in;