aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 1de989ef3..b63a243c9 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12618,14 +12618,16 @@ readcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
12618 } 12618 }
12619 if (c == '\n') 12619 if (c == '\n')
12620 break; 12620 break;
12621 /* $IFS splitting */
12622/* http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05 */
12621 is_ifs = strchr(ifs, c); 12623 is_ifs = strchr(ifs, c);
12622 if (startword && is_ifs) { 12624 if (startword && is_ifs) {
12623 if (isspace(c)) 12625 if (isspace(c))
12624 continue; 12626 continue;
12625 /* non-space ifs char */ 12627 /* it is a non-space ifs char */
12626 startword--; 12628 startword--;
12627 if (startword == 1) /* first one? */ 12629 if (startword == 1) /* first one? */
12628 continue; 12630 continue; /* yes, it is not next word yet */
12629 } 12631 }
12630 startword = 0; 12632 startword = 0;
12631 if (ap[1] != NULL && is_ifs) { 12633 if (ap[1] != NULL && is_ifs) {
@@ -12634,7 +12636,7 @@ readcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
12634 beg = stackblock(); 12636 beg = stackblock();
12635 setvar(*ap, beg, 0); 12637 setvar(*ap, beg, 0);
12636 ap++; 12638 ap++;
12637 /* can we skip one non-space ifs? (2: yes) */ 12639 /* can we skip one non-space ifs char? (2: yes) */
12638 startword = isspace(c) ? 2 : 1; 12640 startword = isspace(c) ? 2 : 1;
12639 STARTSTACKSTR(p); 12641 STARTSTACKSTR(p);
12640 continue; 12642 continue;