]>
Commit | Line | Data |
---|---|---|
9c5a8653 | 1 | # $Id$ |
2 | ||
3 | BEGIN { | |
cac47d45 | 4 | if (!infile) { |
9c5a8653 | 5 | print "infile= must be specified" > "/dev/stderr" |
6 | exit 1 | |
7 | } | |
8 | ||
4772cfa4 | 9 | file = "" |
cac47d45 | 10 | while ((rc = getline < infile) > 0) { |
4772cfa4 | 11 | name = "" |
cac47d45 | 12 | if ( match($0, /^# CONFIG_[A-Za-z0-9_]+ is not set$/)) { |
4772cfa4 | 13 | name = $2 |
14 | value = "n" | |
cac47d45 | 15 | } else if (match($0, /^CONFIG_[A-Za-z0-9_]+=/)) { |
9c5a8653 | 16 | name = value = $1 |
17 | ||
cac47d45 ER |
18 | sub(/=.*$/, "", name) |
19 | sub(/^[^=]*=/, "", value) | |
20 | } else if (match($0, /^# file:/)) { | |
4772cfa4 | 21 | file = $3 |
22 | } | |
cac47d45 ER |
23 | if (length(name)) { |
24 | optionArray[name] = value | |
25 | optionFile[name] = file | |
9c5a8653 | 26 | } |
27 | } | |
cac47d45 ER |
28 | if (rc == -1) { |
29 | printf("Error reading infile='%s'\n", infile) > "/dev/stderr" | |
30 | exit 1 | |
31 | } | |
afcc3b6b | 32 | |
33 | foundErrors = 0 | |
9c5a8653 | 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 ) { | |
6d786af8 | 62 | print "ERROR (" optionFile[ name ] "): " name \ |
63 | " redefined from `" orig "' to `" value "'" > "/dev/stderr" | |
afcc3b6b | 64 | foundErrors++ |
9c5a8653 | 65 | } |
66 | } | |
67 | } | |
68 | ||
69 | END { | |
afcc3b6b | 70 | if ( foundErrors ) { |
6d786af8 | 71 | print "There were " foundErrors " errors" > "/dev/stderr" |
afcc3b6b | 72 | if ( dieOnError ) |
73 | exit 1 | |
74 | } | |
9c5a8653 | 75 | } |