[PATCH] hush.c: compile option: fix -std=c99,gnu99 errors

walter harms wharms at bfs.de
Fri Dec 17 08:28:11 UTC 2010



Am 17.12.2010 04:51, schrieb Macpaul Lin:
> Variable declaration in for loop will cause compile error
> in MinGW and when -std=c99,gnu99 is enabled.
> 
> Signed-off-by: Macpaul Lin <macpaul at andestech.com>
> ---
>  shell/hush.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/shell/hush.c b/shell/hush.c
> index 087636b..afa1795 100644
> --- a/shell/hush.c
> +++ b/shell/hush.c
> @@ -7013,7 +7013,8 @@ static int run_list(struct pipe *pi)
>  
>  #if ENABLE_HUSH_LOOPS
>  	/* Check syntax for "for" */
> -	for (struct pipe *cpipe = pi; cpipe; cpipe = cpipe->next) {
> +	struct pipe *cpipe = NULL;
> +	for (cpipe = pi; cpipe; cpipe = cpipe->next) {
>  		if (cpipe->res_word != RES_FOR && cpipe->res_word != RES_IN)
>  			continue;
>  		/* current word is FOR or IN (BOLD in comments below) */

perhaps that here is better:

struct pipe *cpipe = p1;
 for ( ; cpipe; cpipe = cpipe->next) {

i do not see the rest but if feels that a while() is now better.

re,
 wh


More information about the busybox mailing list