aboutsummaryrefslogtreecommitdiff
path: root/bin/sh
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2009-06-25 17:14:06 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2009-06-25 17:14:06 +0000
commitf19a2f6c574ce3dc437d9998a879ad65e8666c5d (patch)
tree43928ba04416ee048bfb20eb98c99d6bbfa712a2 /bin/sh
parentaf88b2c276b039a10a68eb4482c4b9ea24e23378 (diff)
downloadsrc-f19a2f6c574ce3dc437d9998a879ad65e8666c5d.tar.gz
src-f19a2f6c574ce3dc437d9998a879ad65e8666c5d.zip
Fix some weirdnesses in the NetBSD IFS code,
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)
Notes
Notes: svn path=/head/; revision=194977
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/expand.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index ac77e8a8054e..700fa0a9f910 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -994,12 +994,12 @@ 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;
@@ -1007,10 +1007,10 @@ ifsbreakup(char *string, struct arglist *arglist)
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 */
@@ -1019,6 +1019,7 @@ ifsbreakup(char *string, struct arglist *arglist)
start = p;
continue;
}
+ had_param_ch = 0;
}
/* Save this argument... */