From d91b999c7b1c8ef25cc5334093a038575e95f415 Mon Sep 17 00:00:00 2001 From: Ray Gardner Date: Sat, 7 Sep 2024 17:00:25 -0600 Subject: [PATCH] Fix field split bug when RS="" and FS is one char Fix bug introduced in previous commit titled "Fix field splitting and split() bugs" --- toys/pending/awk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toys/pending/awk.c b/toys/pending/awk.c index fd7675ec..fd324fad 100644 --- a/toys/pending/awk.c +++ b/toys/pending/awk.c @@ -2766,7 +2766,7 @@ static int splitter(void (*setter)(struct zmap *, int, char *, size_t), struct z // rx_find_FS() returns 0 if found. If nonzero, the field will // be the rest of the record (all of it if first time through). if ((r = rx_find_FS(rx, s, &offs, &end, eflag))) offs = end = strlen(s); - else if (setter == set_field && multiline_null_rs && one_char_fs) { + if (setter == set_field && multiline_null_rs && one_char_fs) { // Contra POSIX, if RS=="" then newline is always also a // field separator only if FS is a single char (see gawk manual) int k = strcspn(s, "\n"); -- 2.39.5