27 lines
420 B
Perl
27 lines
420 B
Perl
#!/usr/bin/perl
|
|
|
|
if (scalar(@ARGV) < 1)
|
|
{
|
|
die("Usage: make_config.pl HEATER_NAME");
|
|
}
|
|
my $name = shift @ARGV;
|
|
|
|
Process("heater_v3.things", $name.".things");
|
|
Process("heater_v3.items", $name.".items");
|
|
|
|
sub Process
|
|
{
|
|
my $src = shift;
|
|
my $dst = shift;
|
|
my $fh;
|
|
open($fh, "< ".$src);
|
|
my $ofh;
|
|
open($ofh, "> ".$dst);
|
|
while (<$fh>)
|
|
{
|
|
$_ =~ s/HEATER_NAME/$name/g;
|
|
print($ofh $_);
|
|
}
|
|
close($fh);
|
|
close($ofh);
|
|
} |