From 31eb5b82db0f1ec4a7d444fe2d53e2327f1cdd02 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 14 Apr 2021 01:37:19 -0500 Subject: Fix $IFS: skip trailing whitespace after first non-whitespace separator. --- toys/pending/sh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'toys') diff --git a/toys/pending/sh.c b/toys/pending/sh.c index 0ccaa792..02277fe0 100644 --- a/toys/pending/sh.c +++ b/toys/pending/sh.c @@ -1779,9 +1779,10 @@ barf: } // Skip trailing seperator (combining whitespace) + kk = 0; while ((jj = utf8chr(ss, TT.ff->ifs, &ll))) { + if (!iswspace(jj) && kk++) break; ss += ll; - if (!iswspace(jj)) break; } } while (*(ifs = ss)); } while (!(mm == aa.c)); -- cgit v1.2.3