??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
#!/usr/bin/perl -w
# This script finishes the job started by config.status by replacing the variables
# of the form ${...} which were inserted into the file(s) by config.status.
# Read all files with a single read statement
$/ = undef;
# List of variables to replace
my %configvars = (
"prefix" => { "value" => '/usr/local/nagios'},
"exec_prefix" => { "value" => '${prefix}'},
);
sub replace_var {
my $filep = shift;
my $cvp = shift;
my $varname = shift;
return if( $cvp->{ $varname}->{ "replaced"});
if( defined( $cvp->{ $varname}->{ "dependency"})) {
if( !$cvp->{ $cvp->{ $varname}->{ "dependency"}}->{ "replaced"}) {
# If a dependency exists and it is not already replaced, replace it
replace_var( $filep, $cvp, $cvp->{ $varname}->{ "dependency"});
}
}
my $replacement = $cvp->{ $varname}->{ "value"};
$$filep =~ s/\${$varname}/$replacement/g;
$cvp->{ $varname}->{ "replaced"} = 1;
}
# Figure out the dependencies.
foreach my $cv ( keys %configvars ) {
if( $configvars{ $cv}->{ "value"} =~ /\${([^}]+)}/) {
my $dependency = $1;
if( exists( $configvars{ $dependency})) {
$configvars{ $dependency}->{ "dependency"} = $cv;
}
$configvars{ $cv}->{ "replaced"} = 0;
}
}
# Process each file
while ($f = shift @ARGV) {
# Read in the file
open( FILE, $f) || die "Unable to open $f for reading";
my $file = ;
close( FILE) || die "Unable to close $f after reading";
# Replace each of the variables we know about
foreach $cv ( keys %configvars ) {
replace_var( \$file, \%configvars, $cv);
}
# Write out the replacements
open( FILE, ">$f") || die "Unable to open $f for writing";
print FILE $file;
close( FILE) || die "Unable to close $f after writing";
}