]>
Commit | Line | Data |
---|---|---|
04b1a10f | 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 ( getline < infile ) { | |
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 | ||
29 | foundErrors = 0 | |
30 | } | |
31 | ||
32 | ||
33 | { | |
34 | name = "" | |
35 | } | |
36 | ||
37 | /^# CONFIG_[A-Za-z0-9_]+ is not set$/ { | |
38 | name = $2 | |
39 | value = "n" | |
40 | } | |
41 | ||
42 | /^CONFIG_[A-Za-z0-9_]+=/ { | |
43 | name = value = $1 | |
44 | ||
45 | sub( /=.*$/, "", name ) | |
46 | sub( /^[^=]*=/, "", value ) | |
47 | } | |
48 | ||
49 | { | |
50 | if ( ! length( name ) ) | |
51 | next; | |
52 | ||
53 | orig = optionArray[ name ] | |
54 | if ( ! orig ) { | |
55 | #print "Warning: new option " name " with value " value | |
56 | } else { | |
57 | if ( value != orig ) { | |
58 | print "ERROR (" optionFile[ name ] "): option " name " redefined from " orig " to " value | |
59 | foundErrors++ | |
60 | } | |
61 | } | |
62 | } | |
63 | ||
64 | END { | |
65 | if ( foundErrors ) { | |
66 | print "There were " foundErrors " errors" | |
67 | if ( dieOnError ) | |
68 | exit 1 | |
69 | } | |
70 | } |