summaryrefslogtreecommitdiff
path: root/subst.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2011-12-08 20:13:04 -0500
committerChet Ramey <chet.ramey@case.edu>2011-12-08 20:13:04 -0500
commitdfc21851b525db2b6778d20279c589e023e68e5d (patch)
tree8c5920e69a9392b53dc1a3aed79a011aea6c7eff /subst.c
parent0527c9035cae5c3fa84393a8eb48ec1582120c7e (diff)
downloadbash-dfc21851b525db2b6778d20279c589e023e68e5d.tar.gz
commit bash-20090723 snapshot
Diffstat (limited to 'subst.c')
-rw-r--r--subst.c9
1 files changed, 5 insertions, 4 deletions
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]))
{