diff options
author | Chet Ramey <chet.ramey@case.edu> | 2011-12-08 20:13:04 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2011-12-08 20:13:04 -0500 |
commit | dfc21851b525db2b6778d20279c589e023e68e5d (patch) | |
tree | 8c5920e69a9392b53dc1a3aed79a011aea6c7eff /subst.c | |
parent | 0527c9035cae5c3fa84393a8eb48ec1582120c7e (diff) | |
download | bash-dfc21851b525db2b6778d20279c589e023e68e5d.tar.gz |
commit bash-20090723 snapshot
Diffstat (limited to 'subst.c')
-rw-r--r-- | subst.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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])) { |