Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Jun 2009 17:14:06 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r194977 - head/bin/sh
Message-ID:  <200906251714.n5PHE6Dr058033@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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... */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906251714.n5PHE6Dr058033>