]>
Commit | Line | Data |
---|---|---|
ffd3e510 | 1 | #!/usr/bin/perl |
2 | # | |
3 | # This script reassembles a split configuration file back into a cf.data.pre | |
4 | # file. | |
5 | ||
6 | use strict; | |
7 | use IO::File; | |
8 | use File::Basename; | |
9 | ||
10 | my ($path) = "."; | |
11 | ||
12 | if (defined $ARGV[0]) { | |
13 | $path = dirname($ARGV[0]); | |
14 | } | |
15 | ||
16 | sub filename($) | |
17 | { | |
18 | my ($name) = @_; | |
19 | return $path . "/" . $name . ".txt"; | |
20 | } | |
21 | ||
22 | my ($in) = new IO::File; | |
23 | while(<>) { | |
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 | } | |
36 | undef $in; |