Newer
Older
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
$top = $ARGV[0];
unlink("tmp");
open(OUT,">tmp") or die "$! opening tmp";
@files =();
push(@files,"$top/config/RELEASE");
foreach $file (@files)
{
if (-r "$file")
{
open(IN, "$file") or die "Cannot open $file\n";
while ($line = <IN>)
{
next if ( $line =~ /\s*#/ );
chomp($line);
$_ = $line;
#test for "include" command
($prefix,$macro,$post) = /(.*)\s* \s*\$\((.*)\)(.*)/;
if ($prefix eq "include")
{
if ($macro eq "")
{
#true if no macro is present
#the following looks for
#prefix = post
($prefix,$post) = /(.*)\s* \s*(.*)/;
}
else
{
$base = $applications{$macro};
if ($base eq "")
{
#print "error: $macro was not previously defined\n";
}
else
{
$post = $base . $post;
}
}
push(@files,"$post")
}
else
{
#the following looks for
#prefix = $(macro)post
($prefix,$macro,$post) = /(.*)\s*=\s*\$\((.*)\)(.*)/;
if ($macro eq "")
{
#true ifno macro is present
#the following looks for
#prefix = post
($prefix,$post) = /(.*)\s*=\s*(.*)/;
}
else
{
$base = $applications{$macro};
if ($base eq "")
{
print "error: $macro was not previously defined\n";
}
else
{
$post = $base . $post;
}
}
$applications{$prefix} = $post;
$app = lc($prefix);
if ( -d "$post")
{
#check that directory exists
print OUT "setenv $app $post\n";
}
}
}
close IN;
}
}
close OUT;