[coreboot] [PATCH] Fixes the build error while generating option_table.h

Peter Stuge peter at stuge.se
Sun May 8 20:01:14 CEST 2011


Vikram Narayanan wrote:
> I found that the line endings in the file cmos.layout are the one
> that is causing issues.

Good find.


> (Think I have opened the file in windows.)

Please be careful.


> A little change in the code can make the user happy and he doesn't
> need to worry about the line endings. (If this isn't a good idea,
> may be we can give the user a more intuitive error. something like
> "please check your line endings". If you want it this way, I will
> post the patch for that too). Please share your views.

I think it's a good idea to accept \r\n in addition to \n, but..


> +++ a/util/options/build_opt_tbl.c	Sun May  8 22:34:34 2011
> @@ -372,7 +372,7 @@
>  
>  		/* skip commented and blank lines */
>  		if(line[0]=='#') continue;
> -		if(line[strspn(line," ")]=='\n') continue;
> +		if(line[0]=='\n' || line[0]=='\r') continue;

..your patch changes the semantics in another way; with your patch a
line containing only space will no longer be treated the same way by
the program. I don't think this is so good. Maybe:

if(!strncmp(line[strspn(line," ")],"\r\n",2) continue;


//Peter




More information about the coreboot mailing list