]>
Commit | Line | Data |
---|---|---|
1 | # $Id$ | |
2 | ||
3 | BEGIN { | |
4 | if (!infile) { | |
5 | print "infile= must be specified" > "/dev/stderr" | |
6 | exit 1 | |
7 | } | |
8 | ||
9 | file = "" | |
10 | while ((rc = getline < infile) > 0) { | |
11 | name = "" | |
12 | if ( match($0, /^# CONFIG_[A-Za-z0-9_]+ is not set$/)) { | |
13 | name = $2 | |
14 | value = "n" | |
15 | } else if (match($0, /^CONFIG_[A-Za-z0-9_]+=/)) { | |
16 | name = value = $1 | |
17 | ||
18 | sub(/=.*$/, "", name) | |
19 | sub(/^[^=]*=/, "", value) | |
20 | } else if (match($0, /^# file:/)) { | |
21 | file = $3 | |
22 | } | |
23 | if (length(name)) { | |
24 | optionArray[name] = value | |
25 | optionFile[name] = file | |
26 | } | |
27 | } | |
28 | if (rc == -1) { | |
29 | printf("Error reading infile='%s'\n", infile) > "/dev/stderr" | |
30 | exit 1 | |
31 | } | |
32 | ||
33 | foundErrors = 0 | |
34 | } | |
35 | ||
36 | ||
37 | { | |
38 | name = "" | |
39 | } | |
40 | ||
41 | /^# CONFIG_[A-Za-z0-9_]+ is not set$/ { | |
42 | name = $2 | |
43 | value = "n" | |
44 | } | |
45 | ||
46 | /^CONFIG_[A-Za-z0-9_]+=/ { | |
47 | name = value = $1 | |
48 | ||
49 | sub( /=.*$/, "", name ) | |
50 | sub( /^[^=]*=/, "", value ) | |
51 | } | |
52 | ||
53 | { | |
54 | if ( ! length( name ) ) | |
55 | next; | |
56 | ||
57 | orig = optionArray[ name ] | |
58 | if ( ! orig ) { | |
59 | #print "Warning: new option " name " with value " value | |
60 | } else { | |
61 | if ( value != orig ) { | |
62 | print "ERROR (" optionFile[ name ] "): " name \ | |
63 | " redefined from `" orig "' to `" value "'" > "/dev/stderr" | |
64 | foundErrors++ | |
65 | } | |
66 | } | |
67 | } | |
68 | ||
69 | END { | |
70 | if ( foundErrors ) { | |
71 | print "There were " foundErrors " errors" > "/dev/stderr" | |
72 | if ( dieOnError ) | |
73 | exit 1 | |
74 | } | |
75 | } |