Author: sparky                       Date: Thu Sep 18 13:23:21 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- check value correctness and exit with non zero if any error

---- Files affected:
SOURCES:
   kernel-config.awk (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: SOURCES/kernel-config.awk
diff -u SOURCES/kernel-config.awk:1.2 SOURCES/kernel-config.awk:1.3
--- SOURCES/kernel-config.awk:1.2       Thu Sep 18 15:00:25 2008
+++ SOURCES/kernel-config.awk   Thu Sep 18 15:23:15 2008
@@ -12,8 +12,6 @@
 # - Przemysław Iskra <[EMAIL PROTECTED]>
 # 
 # TODO:
-#  - check value correctness, should allow only:
-#    y, m, n, -[0-9]+, 0x[0-9A-Fa-f]+, ".*"
 #  - smarter arch split, there could be strings with spaces
 #    ( kernel-config.py does not suppoty it either )
 #  - use as many warnings as possible, we want our configs to be clean
@@ -49,6 +47,12 @@
                print "arch= must be specified" > "/dev/stderr"
                exit 1
        }
+       shouldDie = 0
+}
+
+function dieLater( code ) {
+       if ( shouldDie < code )
+               shouldDie = code
 }
 
 # convert special case:
@@ -102,8 +106,20 @@
        if ( length( value ) ) {
                if ( value == "n" )
                        out = "# " option " is not set"
-               else
+               else {
                        out = option "=" value
+
+                       if ( value == "y" || value == "m" )
+                               ;
+                       else if ( value ~ /^"[^"]*"$/ )
+                               ;
+                       else if ( value ~ /^-?[0-9]+$/ || value ~ 
/^0x[0-9A-Fa-f]+$/ )
+                               ;
+                       else {
+                               warn( "ERROR: Incorrect value: " $0 )
+                               dieLater( 1 )
+                       }
+               }
        
                print out
                outputArray[ option ] = fileLine()
@@ -111,4 +127,5 @@
 }
 
 END {
+       exit shouldDie
 }
================================================================

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

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

Reply via email to