# Common functions for the bacula config file
-# XXX other schedule-level overrides, like pool, storage, etc..
# XXX schedule chooser on IE
do '../web-lib.pl';
open(CONF, $_[0]) || return undef;
local @lines = <CONF>;
close(CONF);
- foreach (@lines) {
+ for(my $i=0; $i<@lines; $i++) {
+ $_ = $lines[$i];
s/\r|\n//g;
s/#.*$//;
if (/^\s*\@(.*\S)/) {
# Just a word by itself .. perhaps start of a section,
# if there is a { on the next line.
local $name = $1;
- local $nextline = <CONF>;
- if ($nextline =~ /^\s*{\s*$/) {
+ local $nextline = $lines[++$i];
+ if ($nextline =~ /^\s*\{\s*$/) {
local $dir = { 'name' => $name,
'parent' => $parent,
'line' => $lnum,
}
$lnum++;
}
- close(CONF);
$config_file_cache{$file} = \@rv;
}
return $config_file_cache{$file};