Fix compilation error due to non-unix style line endings in cmos.layout file while...
authorPatrick Georgi <patrick@georgi-clan.de>
Tue, 10 May 2011 21:42:52 +0000 (21:42 +0000)
committerPatrick Georgi <patrick.georgi@coresystems.de>
Tue, 10 May 2011 21:42:52 +0000 (21:42 +0000)
Windows, Mac and *nix type line endings are now taken care of.

Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Paul Menzel <paulepanter@users.sourceforge.net>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6563 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

util/options/build_opt_tbl.c

index cbba80dcb780c4c8aababd760bd84d1bb6a544da..b89bb4f1d52be4e834d43c284a2430fe96ade93e 100644 (file)
@@ -276,6 +276,7 @@ int main(int argc, char **argv)
        int enum_length;
        int len;
        char buf[16];
+       char val;
 
         for(i=1;i<argc;i++) {
                 if(argv[i][0]!='-') {
@@ -371,8 +372,9 @@ int main(int argc, char **argv)
                }
 
                /* skip commented and blank lines */
-               if(line[0]=='#') continue;
-               if(line[strspn(line," ")]=='\n') continue;
+               val = line[strspn(line," ")];
+               /* takes care of *nix, Mac and Windows line ending formats */
+               if (val=='#' || val=='\n' || val=='\r') continue;
                /* scan in the input data */
                sscanf(line,"%d %d %c %d %s",
                        &ce->bit,&ce->length,&uc,&ce->config_id,&ce->name[0]);