Set the 'not a parameter' flag when we skip initial whitespace.

Otherwise:
    ./sh -c 'x=" "; for a in $x; do echo a${a}a; done'
is processed as a single empty parameter (instead of no parameters).
Should fix the breakage I introdiced in rev 1.75 and PR/34256 and PR/34254
This commit is contained in:
dsl 2006-08-22 18:11:42 +00:00
parent 06cdcd1106
commit c58b829dda

View File

@ -1,4 +1,4 @@
/* $NetBSD: expand.c,v 1.75 2006/08/21 21:30:14 dsl Exp $ */
/* $NetBSD: expand.c,v 1.76 2006/08/22 18:11:42 dsl Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
#else
__RCSID("$NetBSD: expand.c,v 1.75 2006/08/21 21:30:14 dsl Exp $");
__RCSID("$NetBSD: expand.c,v 1.76 2006/08/22 18:11:42 dsl Exp $");
#endif
#endif /* not lint */
@ -988,6 +988,7 @@ ifsbreakup(char *string, struct arglist *arglist)
p++;
continue;
}
had_param_ch = 0;
ifsspc = strchr(" \t\n", *p);
/* Ignore IFS whitespace at start */
@ -996,7 +997,6 @@ ifsbreakup(char *string, struct arglist *arglist)
start = p;
continue;
}
had_param_ch = 0;
}
/* Save this argument... */