line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#-*-perl-*- |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# $Id: parse_config,v 7.1 2004/01/13 19:01:45 wpm Exp $ |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# (c) 2003-2004 Morgan Stanley and Co. |
6
|
|
|
|
|
|
|
# See ..../src/LICENSE for terms of distribution. |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Parse our config file to get the parameters we need for the tests |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# NOTE: this is used ONLY for the installation procedures, and not in |
12
|
|
|
|
|
|
|
# the production code itself. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
package AFS::Command::Tests; |
15
|
|
|
|
|
|
|
|
16
|
8
|
|
|
8
|
|
201706
|
use vars qw(%Config); |
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
3467
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $config = "/no/such/path"; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
foreach my $relpath ( qw( . .. ../.. ../../.. ) ) { |
21
|
|
|
|
|
|
|
next unless -f "$relpath/CONFIG"; |
22
|
|
|
|
|
|
|
$config = "$relpath/CONFIG"; |
23
|
|
|
|
|
|
|
last; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
die "Unable to locate CONFIG file\n" unless -f $config; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
open(CONFIG,"$config") or |
29
|
|
|
|
|
|
|
die "Unable to open CONFIG file: $ERRNO\n"; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
while ( ) { |
32
|
|
|
|
|
|
|
next if /^\#/; |
33
|
|
|
|
|
|
|
next unless ($key,$value) = /^(\w+)\s*=\s*(.*)\s*$/; |
34
|
|
|
|
|
|
|
if ( $ENV{$key} ) { |
35
|
|
|
|
|
|
|
#print "Environment variable '$key' overrides CONFIG definition\n"; |
36
|
|
|
|
|
|
|
$Config{$key} = $ENV{$key}; |
37
|
|
|
|
|
|
|
} else { |
38
|
|
|
|
|
|
|
$Config{$key} = $value; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
close(CONFIG) or |
43
|
|
|
|
|
|
|
die "Unable to close CONFIG file: $ERRNO\n"; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
foreach my $key ( keys %ENV ) { |
46
|
|
|
|
|
|
|
next unless $key =~ /^AFS_COMMAND/; |
47
|
|
|
|
|
|
|
$Config{$key} = $ENV{$key}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |