From fa04f2dc766c76f2caa44a4b8429185dde6a66b0 Mon Sep 17 00:00:00 2001
From: Ron Yorston <rmy@pobox.com>
Date: Sun, 9 Apr 2023 10:48:58 +0100
Subject: ash: remove ASH_IGNORE_CR config option

No further problems with CRLF handling have been reported.  Remove
the configuration option that allowed some recent changes to be
turned off.

Also, prevent some WIN32 code from being included in the POSIX
build.  The faulty code is from commit 64c8f5f3d (ash: add support
for INT trap).

These changes don't alter the default WIN32 build.
---
 shell/shell_common.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

(limited to 'shell/shell_common.c')

diff --git a/shell/shell_common.c b/shell/shell_common.c
index efe8828e4..716d3aebb 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -19,11 +19,7 @@
 #include "libbb.h"
 #include "shell_common.h"
 
-#if !ENABLE_PLATFORM_MINGW32 || ENABLE_ASH_IGNORE_CR
 const char defifsvar[] ALIGN1 = "IFS= \t\n";
-#else
-const char defifsvar[] ALIGN1 = "IFS= \t\n\r";
-#endif
 const char defoptindvar[] ALIGN1 = "OPTIND=1";
 
 /* read builtin */
@@ -261,10 +257,6 @@ shell_builtin_read(struct builtin_read_params *params)
 
 		c = buffer[bufpos];
 #if ENABLE_PLATFORM_MINGW32
-# if !ENABLE_ASH_IGNORE_CR
-		if (c == '\r')
-			continue;
-# else
 		if (c == '\n') {
 			if (backslash == 2 || (bufpos > 0 && buffer[bufpos - 1] == '\r')) {
 				/* We saw either:
@@ -279,11 +271,10 @@ shell_builtin_read(struct builtin_read_params *params)
 			 * process ?? */
 			backslash = 0;
 		}
-# endif
 #endif
 		if (!(read_flags & BUILTIN_READ_RAW)) {
 			if (backslash) {
-#if ENABLE_ASH_IGNORE_CR
+#if ENABLE_PLATFORM_MINGW32
 				if (c == '\r') {
 					/* We have BS CR, keep CR for now, might see LF next */
 					backslash = 2;
-- 
cgit v1.2.3-55-g6feb