Author: glen                         Date: Fri Mar 27 11:46:07 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- catch errors when infile can't be opened

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

---- Diffs:

================================================================
Index: SOURCES/kernel-track-config-change.awk
diff -u SOURCES/kernel-track-config-change.awk:1.4 
SOURCES/kernel-track-config-change.awk:1.5
--- SOURCES/kernel-track-config-change.awk:1.4  Sun Sep 28 17:02:07 2008
+++ SOURCES/kernel-track-config-change.awk      Fri Mar 27 12:46:01 2009
@@ -1,29 +1,33 @@
 # $Id$
 
 BEGIN {
-       if ( ! infile ) {
+       if (!infile) {
                print "infile= must be specified" > "/dev/stderr"
                exit 1
        }
 
        file = ""
-       while ( getline < infile ) {
+       while ((rc = getline < infile) > 0) {
                name = ""
-               if ( match( $0, /^# CONFIG_[A-Za-z0-9_]+ is not set$/ ) ) {
+               if ( match($0, /^# CONFIG_[A-Za-z0-9_]+ is not set$/)) {
                        name = $2
                        value = "n"
-               } else if ( match( $0, /^CONFIG_[A-Za-z0-9_]+=/ ) ) {
+               } else if (match($0, /^CONFIG_[A-Za-z0-9_]+=/)) {
                        name = value = $1
 
-                       sub( /=.*$/, "", name )
-                       sub( /^[^=]*=/, "", value )
-               } else if ( match( $0, /^# file:/ ) ) {
+                       sub(/=.*$/, "", name)
+                       sub(/^[^=]*=/, "", value)
+               } else if (match($0, /^# file:/)) {
                        file = $3
                }
-               if ( length( name ) ) {
-                       optionArray[ name ] = value
-                       optionFile[ name ] = file
+               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
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/kernel-track-config-change.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