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