Author: sparky                       Date: Thu Sep 18 15:02:05 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- die if there are duplicated options in the same file
- reindent

---- Files affected:
SOURCES:
   kernel-config.awk (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: SOURCES/kernel-config.awk
diff -u SOURCES/kernel-config.awk:1.4 SOURCES/kernel-config.awk:1.5
--- SOURCES/kernel-config.awk:1.4       Thu Sep 18 16:45:26 2008
+++ SOURCES/kernel-config.awk   Thu Sep 18 17:01:59 2008
@@ -113,32 +113,42 @@
                }
        }
 
+       # 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"
-               else {
-                       out = option "=" value
+       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 {
-                               warn( "ERROR: Incorrect value: " $0 )
-                               dieLater( 1 )
-                       }
+               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 )
                }
-       
-               print out
-               outputArray[ option ] = fileLine()
        }
+       
+       print out
 }
 
 END {
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/kernel-config.awk?r1=1.4&r2=1.5&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to