summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-06-25 17:14:06 +0000
committerjilles <jilles@FreeBSD.org>2009-06-25 17:14:06 +0000
commit7dc0587c35464689686b26643e8af38320f76e39 (patch)
tree43928ba04416ee048bfb20eb98c99d6bbfa712a2 /bin
parentfb327076f995be83ea80fd801c141d2168db157d (diff)
downloadFreeBSD-src-7dc0587c35464689686b26643e8af38320f76e39.zip
FreeBSD-src-7dc0587c35464689686b26643e8af38320f76e39.tar.gz
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)
Diffstat (limited to 'bin')
-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 ac77e8a..700fa0a 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... */
OpenPOWER on IntegriCloud