Fix compilation error due to non-unix style line endings in cmos.layout file while generating option_table.h.

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
This commit is contained in:
Patrick Georgi 2011-05-10 21:42:52 +00:00 committed by Patrick Georgi
parent f2ed23f45b
commit a8f0f5120b
1 changed files with 4 additions and 2 deletions

View File

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