blob: 6b3fe5002accf2c9beec04f328c5921787398835 (
plain)
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
|
# $Id$
BEGIN {
if (!infile) {
print "infile= must be specified" > "/dev/stderr"
exit 1
}
file = ""
while ((rc = getline < infile) > 0) {
name = ""
if ( match($0, /^# CONFIG_[A-Za-z0-9_]+ is not set$/)) {
name = $2
value = "n"
} else if (match($0, /^CONFIG_[A-Za-z0-9_]+=/)) {
name = value = $1
sub(/=.*$/, "", name)
sub(/^[^=]*=/, "", value)
} else if (match($0, /^# file:/)) {
file = $3
}
if (length(name)) {
optionArray[name] = value
optionFile[name] = file
}
}
if (rc == -1) {
printf("Error reading infile='%s'\n", infile) > "/dev/stderr"
exit 1
}
foundErrors = 0
}
{
name = ""
}
/^# CONFIG_[A-Za-z0-9_]+ is not set$/ {
name = $2
value = "n"
}
/^CONFIG_[A-Za-z0-9_]+=/ {
name = value = $1
sub( /=.*$/, "", name )
sub( /^[^=]*=/, "", value )
}
{
if ( ! length( name ) )
next;
orig = optionArray[ name ]
if ( ! orig ) {
#print "Warning: new option " name " with value " value
} else {
if ( value != orig ) {
print "ERROR (" optionFile[ name ] "): " name \
" redefined from `" orig "' to `" value "'" > "/dev/stderr"
foundErrors++
}
}
}
END {
if ( foundErrors ) {
print "There were " foundErrors " errors" > "/dev/stderr"
if ( dieOnError )
exit 1
}
}
|