svn commit: r194977 - head/bin/sh
Jilles Tjoelker
jilles at FreeBSD.org
Thu Jun 25 17:14:08 UTC 2009
Author: jilles
Date: Thu Jun 25 17:14:06 2009
New Revision: 194977
URL: http://svn.freebsd.org/changeset/base/194977
Log:
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)
Modified:
head/bin/sh/expand.c
Modified: head/bin/sh/expand.c
==============================================================================
--- head/bin/sh/expand.c Thu Jun 25 17:11:27 2009 (r194976)
+++ head/bin/sh/expand.c Thu Jun 25 17:14:06 2009 (r194977)
@@ -994,12 +994,12 @@ ifsbreakup(char *string, struct 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
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
start = p;
continue;
}
+ had_param_ch = 0;
}
/* Save this argument... */
More information about the svn-src-head
mailing list