Am 08.05.2011 20:01, schrieb Peter Stuge:
if(!strncmp(line[strspn(line," ")],"\r\n",2) continue;
More like: char val=line[strspn(line," ")]; if (val=='#' || val=='\n' || val=='\r') continue;
This has the benefit of handling " # comment" and mac-style newlines, too.
Thanks for all your comments. As Patrick suggested, here is the new patch.
Signed-off by: Vikram Narayanan vikram186@gmail.com Signed-off by: Patrick Georgi patrick@georgi-clan.de --- --- C:/coreboot/util/options/build_opt_tbl.c.orig Sun May 8 22:18:54 2011 +++ C:/coreboot/util/options/build_opt_tbl.c Mon May 9 19:09:32 2011 @@ -276,6 +276,7 @@ int enum_length; int len; char buf[16]; + char val;
for(i=1;i<argc;i++) { if(argv[i][0]!='-') { @@ -371,8 +372,9 @@ }
/* 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]);
- Thanks, Vikram
Am Montag, den 09.05.2011, 19:20 +0530 schrieb Vikram Narayanan:
Am 08.05.2011 20:01, schrieb Peter Stuge:
if(!strncmp(line[strspn(line," ")],"\r\n",2) continue;
More like: char val=line[strspn(line," ")]; if (val=='#' || val=='\n' || val=='\r') continue;
This has the benefit of handling " # comment" and mac-style newlines, too.
Thanks for all your comments. As Patrick suggested, here is the new patch.
A short commit message would have been nice.
Signed-off by: Vikram Narayanan vikram186@gmail.com Signed-off by: Patrick Georgi patrick@georgi-clan.de
--- C:/coreboot/util/options/build_opt_tbl.c.orig Sun May 8 22:18:54 2011 +++ C:/coreboot/util/options/build_opt_tbl.c Mon May 9 19:09:32 2011 @@ -276,6 +276,7 @@ int enum_length; int len; char buf[16];
char val;
for(i=1;i<argc;i++) { if(argv[i][0]!='-') {
@@ -371,8 +372,9 @@ }
/* 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 */
Whoever has commit rights and commits this, please add a space behind the comma.
/* scan in the input data */ sscanf(line,"%d %d %c %d %s", &ce->bit,&ce->length,&uc,&ce->config_id,&ce->name[0]);if (val=='#' || val=='\n' || val=='\r') continue;
Acked-by: Paul Menzel paulepanter@users.sourceforge.net
Thanks,
Paul
On Mon, 2011-05-09 at 18:29 +0200, Paul Menzel wrote:
Am Montag, den 09.05.2011, 19:20 +0530 schrieb Vikram Narayanan:
Am 08.05.2011 20:01, schrieb Peter Stuge:
if(!strncmp(line[strspn(line," ")],"\r\n",2) continue;
More like: char val=line[strspn(line," ")]; if (val=='#' || val=='\n' || val=='\r') continue;
This has the benefit of handling " # comment" and mac-style newlines, too.
Thanks for all your comments. As Patrick suggested, here is the new patch.
A short commit message would have been nice.
This patch fixes the compilation error arising 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: Vikram Narayanan vikram186@gmail.com Signed-off by: Patrick Georgi patrick@georgi-clan.de
--- C:/coreboot/util/options/build_opt_tbl.c.orig Sun May 8 22:18:54 2011 +++ C:/coreboot/util/options/build_opt_tbl.c Mon May 9 19:09:32 2011 @@ -276,6 +276,7 @@ int enum_length; int len; char buf[16];
char val;
for(i=1;i<argc;i++) { if(argv[i][0]!='-') {
@@ -371,8 +372,9 @@ }
/* 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 */
Whoever has commit rights and commits this, please add a space behind the comma.
/* scan in the input data */ sscanf(line,"%d %d %c %d %s", &ce->bit,&ce->length,&uc,&ce->config_id,&ce->name[0]);if (val=='#' || val=='\n' || val=='\r') continue;
Acked-by: Paul Menzel paulepanter@users.sourceforge.net
Thanks, Vikram