From dfc21851b525db2b6778d20279c589e023e68e5d Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Thu, 8 Dec 2011 20:13:04 -0500 Subject: commit bash-20090723 snapshot --- subst.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'subst.c') diff --git a/subst.c b/subst.c index 589ff1d3..bb73131b 100644 --- a/subst.c +++ b/subst.c @@ -1740,7 +1740,7 @@ split_at_delims (string, slen, delims, sentinel, nwp, cwp) ret = (WORD_LIST *)NULL; - /* Remove sequences of whitspace characters at the start of the string, as + /* Remove sequences of whitespace characters at the start of the string, as long as those characters are delimiters. */ for (i = 0; member (string[i], d) && spctabnl (string[i]); i++) ; @@ -1810,9 +1810,10 @@ split_at_delims (string, slen, delims, sentinel, nwp, cwp) /* Special case for SENTINEL at the end of STRING. If we haven't found the word containing SENTINEL yet, and the index we're looking for is at - the end of STRING, add an additional null argument and set the current - word pointer to that. */ - if (cwp && cw == -1 && sentinel >= slen) + the end of STRING (or past the end of the previously-found token, + possible if the end of the line is composed solely of IFS whitespace) + add an additional null argument and set the current word pointer to that. */ + if (cwp && cw == -1 && (sentinel >= slen || sentinel >= te)) { if (whitespace (string[sentinel - 1])) { -- cgit v1.2.1