Skip to content

Commit

Permalink
Fix some weirdnesses in the NetBSD IFS code,
Browse files Browse the repository at this point in the history
in particular "$@"$ifschar if the final positional parameter is empty.
With the NetBSD code, adding the $ifschar removes a parameter.

PR:		standards/79067
Approved by:	ed (mentor) (implicit)
  • Loading branch information
jillest committed Jun 25, 2009
1 parent af88b2c commit f19a2f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/sh/expand.c
Expand Up @@ -994,23 +994,23 @@ ifsbreakup(char *string, struct arglist *arglist)
for (ifsp = &ifsfirst; ifsp != NULL; ifsp = ifsp->next) {
p = string + ifsp->begoff;
while (p < string + ifsp->endoff) {
had_param_ch = 1;
q = p;
if (*p == CTLESC)
p++;
if (ifsp->inquotes) {
/* Only NULs (should be from "$@") end args */
had_param_ch = 1;
if (*p != 0) {
p++;
continue;
}
ifsspc = NULL;
} else {
if (!strchr(ifs, *p)) {
had_param_ch = 1;
p++;
continue;
}
had_param_ch = 0;
ifsspc = strchr(" \t\n", *p);

/* Ignore IFS whitespace at start */
Expand All @@ -1019,6 +1019,7 @@ ifsbreakup(char *string, struct arglist *arglist)
start = p;
continue;
}
had_param_ch = 0;
}

/* Save this argument... */
Expand Down

0 comments on commit f19a2f6

Please sign in to comment.