1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
--- sendmail-8.12.5/contrib/etrn.pl.mwe Tue Jul 9 11:17:50 2002
+++ sendmail-8.12.5/contrib/etrn.pl Tue Jul 9 11:33:13 2002
@@ -81,12 +81,13 @@
while (<CF>){
if (/^Fw.*$/){ # look for a line starting with "Fw"
$cwfile = $_;
- chop($cwfile);
- $optional = /^Fw-o/;
- $cwfile =~ s,^Fw[^/]*,,; # extract the file name
-
+ chomp($cwfile);
+ ($optional,$cwfile,$comment_delim) = /^Fw(-o)?\s*(\S*)\s*(?:\s%(.*))?$/;
+ if (!$comment_delim) $comment_delim = '[^#]';
+ $comment_delim =~ s/[\\](.)/$1/g; # unescape
if (-r $cwfile) {
- push (@cwfiles, $cwfile);
+ push (@cwfiles, {'file' => $cwfile, 'nocomment' => $comment_delim});
+
} else {
die "$cwfile is not readable" unless $optional;
}
@@ -103,16 +104,16 @@
for $cwfile (@cwfiles) {
$0 = "$av0 - reading $cwfile";
- if (open(CW, "<$cwfile")){
+ if (open(CW, "<$cwfile->{'file'}")){
while (<CW>){
- next if /^\#/;
+ next unless /^$cwfile->{'nocomment'}/;
$thishost = $_;
- chop($thishost);
+ chomp($thishost);
push(@hosts, $thishost) unless $thishost =~ $hostname;
}
close(CW);
} else {
- die "open $cwfile: $!";
+ die "open $cwfile->{'file'}: $!";
}
}
}
|