]> git.pld-linux.org Git - packages/kernel.git/commitdiff
- die if there are duplicated options in the same file
authorsparky <sparky@pld-linux.org>
Thu, 18 Sep 2008 15:01:59 +0000 (15:01 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- reindent

Changed files:
    kernel-config.awk -> 1.5

kernel-config.awk

index 30cc398a931b76971f21746f04ec4ec026374bdc..0184cd0b688725f73a9c72f4b560d64704e1cfc4 100644 (file)
@@ -113,32 +113,42 @@ function dieLater( code ) {
                }
        }
 
+       # completely ignore lines with no value
+       if ( length( value ) == 0 )
+               next
+
+       fileOption = FILENAME "/" option
+       if ( fileOption in outputByFile ) {
+               warn( "ERROR: " option " already defined in this file at line " outputByFile[ fileOption ] )
+               dieLater( 2 )
+               next
+       } else
+               outputByFile[ fileOption ] = FNR
+
        if ( option in outputArray ) {
-               warn( option " already defined in: " outputArray[ option ] )
+               warn( "Warning: " option " already defined in: " outputArray[ option ] )
                next
-       }
+       } else
+               outputArray[ option ] = fileLine()
 
-       if ( length( value ) ) {
-               if ( value == "n" )
-                       out = "# " option " is not set"
+       if ( value == "n" )
+               out = "# " option " is not set"
+       else {
+               out = option "=" value
+
+               if ( value == "y" || value == "m" )
+                       ; # OK
+               else if ( value ~ /^"[^"]*"$/ )
+                       ; # OK
+               else if ( value ~ /^-?[0-9]+$/ || value ~ /^0x[0-9A-Fa-f]+$/ )
+                       ; # OK
                else {
-                       out = option "=" value
-
-                       if ( value == "y" || value == "m" )
-                               ; # OK
-                       else if ( value ~ /^"[^"]*"$/ )
-                               ; # OK
-                       else if ( value ~ /^-?[0-9]+$/ || value ~ /^0x[0-9A-Fa-f]+$/ )
-                               ; # OK
-                       else {
-                               warn( "ERROR: Incorrect value: " $0 )
-                               dieLater( 1 )
-                       }
+                       warn( "ERROR: Incorrect value: " $0 )
+                       dieLater( 1 )
                }
-       
-               print out
-               outputArray[ option ] = fileLine()
        }
+       
+       print out
 }
 
 END {
This page took 2.056753 seconds and 4 git commands to generate.