aboutsummaryrefslogtreecommitdiff
path: root/shell/shell_common.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-02-10 12:54:03 +0000
committerRon Yorston <rmy@pobox.com>2023-02-10 13:21:02 +0000
commitd9916c6344c806696554115baa764eea09ca5f08 (patch)
treea25f6f4aaf4e91915b615af7e4bbc09bd68f6ac9 /shell/shell_common.c
parent4b894b60ae377ee2a04ae209c14bb1e714ecf6f4 (diff)
downloadbusybox-w32-d9916c6344c806696554115baa764eea09ca5f08.tar.gz
busybox-w32-d9916c6344c806696554115baa764eea09ca5f08.tar.bz2
busybox-w32-d9916c6344c806696554115baa764eea09ca5f08.zip
ash: remove CRs from CRLF during field splitting
Commit e371e46fa0 (shell: add \r to IFS) added '\r' to the IFS variable so field splitting would remove carriage returns. Rather than change IFS, remove CRs preceding LFs in regions being scanned for field splitting before IFS is applied. This prevents free-standing CRs from being removed. Costs 112-120 bytes. (GitHub issue #285)
Diffstat (limited to 'shell/shell_common.c')
-rw-r--r--shell/shell_common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 399d5e684..c0dd32fb4 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -19,7 +19,7 @@
19#include "libbb.h" 19#include "libbb.h"
20#include "shell_common.h" 20#include "shell_common.h"
21 21
22#if !ENABLE_PLATFORM_MINGW32 22#if !ENABLE_PLATFORM_MINGW32 || ENABLE_ASH_IGNORE_CR
23const char defifsvar[] ALIGN1 = "IFS= \t\n"; 23const char defifsvar[] ALIGN1 = "IFS= \t\n";
24#else 24#else
25const char defifsvar[] ALIGN1 = "IFS= \t\n\r"; 25const char defifsvar[] ALIGN1 = "IFS= \t\n\r";