diff options
-rw-r--r-- | configs/make32_defconfig | 1 | ||||
-rw-r--r-- | configs/make64_defconfig | 1 | ||||
-rw-r--r-- | configs/mingw32_defconfig | 1 | ||||
-rw-r--r-- | configs/mingw64_defconfig | 1 | ||||
-rw-r--r-- | shell/ash.c | 28 | ||||
-rw-r--r-- | shell/shell_common.c | 11 |
6 files changed, 10 insertions, 33 deletions
diff --git a/configs/make32_defconfig b/configs/make32_defconfig index 354c2eb87..bafb6a63a 100644 --- a/configs/make32_defconfig +++ b/configs/make32_defconfig | |||
@@ -1158,7 +1158,6 @@ CONFIG_ASH_GETOPTS=y | |||
1158 | CONFIG_ASH_CMDCMD=y | 1158 | CONFIG_ASH_CMDCMD=y |
1159 | CONFIG_ASH_NOCONSOLE=y | 1159 | CONFIG_ASH_NOCONSOLE=y |
1160 | CONFIG_ASH_NOCASEGLOB=y | 1160 | CONFIG_ASH_NOCASEGLOB=y |
1161 | CONFIG_ASH_IGNORE_CR=y | ||
1162 | # CONFIG_CTTYHACK is not set | 1161 | # CONFIG_CTTYHACK is not set |
1163 | # CONFIG_HUSH is not set | 1162 | # CONFIG_HUSH is not set |
1164 | # CONFIG_SHELL_HUSH is not set | 1163 | # CONFIG_SHELL_HUSH is not set |
diff --git a/configs/make64_defconfig b/configs/make64_defconfig index 6564603c8..441c23b5a 100644 --- a/configs/make64_defconfig +++ b/configs/make64_defconfig | |||
@@ -1158,7 +1158,6 @@ CONFIG_ASH_GETOPTS=y | |||
1158 | CONFIG_ASH_CMDCMD=y | 1158 | CONFIG_ASH_CMDCMD=y |
1159 | CONFIG_ASH_NOCONSOLE=y | 1159 | CONFIG_ASH_NOCONSOLE=y |
1160 | CONFIG_ASH_NOCASEGLOB=y | 1160 | CONFIG_ASH_NOCASEGLOB=y |
1161 | CONFIG_ASH_IGNORE_CR=y | ||
1162 | # CONFIG_CTTYHACK is not set | 1161 | # CONFIG_CTTYHACK is not set |
1163 | # CONFIG_HUSH is not set | 1162 | # CONFIG_HUSH is not set |
1164 | # CONFIG_SHELL_HUSH is not set | 1163 | # CONFIG_SHELL_HUSH is not set |
diff --git a/configs/mingw32_defconfig b/configs/mingw32_defconfig index 4918b2f4f..16a7fd2d1 100644 --- a/configs/mingw32_defconfig +++ b/configs/mingw32_defconfig | |||
@@ -1170,7 +1170,6 @@ CONFIG_ASH_GETOPTS=y | |||
1170 | CONFIG_ASH_CMDCMD=y | 1170 | CONFIG_ASH_CMDCMD=y |
1171 | CONFIG_ASH_NOCONSOLE=y | 1171 | CONFIG_ASH_NOCONSOLE=y |
1172 | CONFIG_ASH_NOCASEGLOB=y | 1172 | CONFIG_ASH_NOCASEGLOB=y |
1173 | CONFIG_ASH_IGNORE_CR=y | ||
1174 | # CONFIG_CTTYHACK is not set | 1173 | # CONFIG_CTTYHACK is not set |
1175 | # CONFIG_HUSH is not set | 1174 | # CONFIG_HUSH is not set |
1176 | # CONFIG_SHELL_HUSH is not set | 1175 | # CONFIG_SHELL_HUSH is not set |
diff --git a/configs/mingw64_defconfig b/configs/mingw64_defconfig index 96e407644..96a5bdb0e 100644 --- a/configs/mingw64_defconfig +++ b/configs/mingw64_defconfig | |||
@@ -1170,7 +1170,6 @@ CONFIG_ASH_GETOPTS=y | |||
1170 | CONFIG_ASH_CMDCMD=y | 1170 | CONFIG_ASH_CMDCMD=y |
1171 | CONFIG_ASH_NOCONSOLE=y | 1171 | CONFIG_ASH_NOCONSOLE=y |
1172 | CONFIG_ASH_NOCASEGLOB=y | 1172 | CONFIG_ASH_NOCASEGLOB=y |
1173 | CONFIG_ASH_IGNORE_CR=y | ||
1174 | # CONFIG_CTTYHACK is not set | 1173 | # CONFIG_CTTYHACK is not set |
1175 | # CONFIG_HUSH is not set | 1174 | # CONFIG_HUSH is not set |
1176 | # CONFIG_SHELL_HUSH is not set | 1175 | # CONFIG_SHELL_HUSH is not set |
diff --git a/shell/ash.c b/shell/ash.c index 77670ebb4..51bf95377 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -192,16 +192,6 @@ | |||
192 | //config: Enable support for the 'nocaseglob' option, which allows | 192 | //config: Enable support for the 'nocaseglob' option, which allows |
193 | //config: case-insensitive filename globbing. | 193 | //config: case-insensitive filename globbing. |
194 | //config: | 194 | //config: |
195 | //config:config ASH_IGNORE_CR | ||
196 | //config: bool "Ignore CR in CRLF line endings" | ||
197 | //config: default y | ||
198 | //config: depends on (ASH || SH_IS_ASH || BASH_IS_ASH) && PLATFORM_MINGW32 | ||
199 | //config: help | ||
200 | //config: Allow CRs to be ignored when they appear in CRLF line endings | ||
201 | //config: but not in other circumstances. This isn't a general-purpose | ||
202 | //config: option: it only covers certain new cases which are under test. | ||
203 | //config: Enabled by default. May be removed in future. | ||
204 | //config: | ||
205 | //config:endif # ash options | 195 | //config:endif # ash options |
206 | 196 | ||
207 | //applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP)) | 197 | //applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP)) |
@@ -6807,7 +6797,7 @@ ifsbreakup(char *string, struct arglist *arglist) | |||
6807 | const char *ifs, *realifs; | 6797 | const char *ifs, *realifs; |
6808 | int ifsspc; | 6798 | int ifsspc; |
6809 | int nulonly; | 6799 | int nulonly; |
6810 | #if ENABLE_ASH_IGNORE_CR | 6800 | #if ENABLE_PLATFORM_MINGW32 |
6811 | int lshift = 0; | 6801 | int lshift = 0; |
6812 | #endif | 6802 | #endif |
6813 | 6803 | ||
@@ -6820,13 +6810,13 @@ ifsbreakup(char *string, struct arglist *arglist) | |||
6820 | do { | 6810 | do { |
6821 | int afternul; | 6811 | int afternul; |
6822 | 6812 | ||
6823 | #if ENABLE_ASH_IGNORE_CR | 6813 | #if ENABLE_PLATFORM_MINGW32 |
6824 | /* Adjust region offsets for left-shifted string. */ | 6814 | /* Adjust region offsets for left-shifted string. */ |
6825 | ifsp->begoff -= lshift; | 6815 | ifsp->begoff -= lshift; |
6826 | ifsp->endoff -= lshift; | 6816 | ifsp->endoff -= lshift; |
6827 | #endif | 6817 | #endif |
6828 | p = string + ifsp->begoff; | 6818 | p = string + ifsp->begoff; |
6829 | #if ENABLE_ASH_IGNORE_CR | 6819 | #if ENABLE_PLATFORM_MINGW32 |
6830 | if (ifsp->endoff > ifsp->begoff + 1) { | 6820 | if (ifsp->endoff > ifsp->begoff + 1) { |
6831 | /* Transform CRLF to LF. Skip regions having zero or | 6821 | /* Transform CRLF to LF. Skip regions having zero or |
6832 | * one characters: they can't contain CRLF. If the | 6822 | * one characters: they can't contain CRLF. If the |
@@ -11788,7 +11778,7 @@ static void popstring(void) | |||
11788 | INT_ON; | 11778 | INT_ON; |
11789 | } | 11779 | } |
11790 | 11780 | ||
11791 | #if ENABLE_ASH_IGNORE_CR | 11781 | #if ENABLE_PLATFORM_MINGW32 |
11792 | /* | 11782 | /* |
11793 | * Wrapper around nonblock_immune_read() to remove CRs, but only from | 11783 | * Wrapper around nonblock_immune_read() to remove CRs, but only from |
11794 | * CRLF pairs. The tricky part is handling a CR at the end of the buffer. | 11784 | * CRLF pairs. The tricky part is handling a CR at the end of the buffer. |
@@ -11846,7 +11836,7 @@ preadfd(void) | |||
11846 | #if ENABLE_FEATURE_EDITING | 11836 | #if ENABLE_FEATURE_EDITING |
11847 | /* retry: */ | 11837 | /* retry: */ |
11848 | if (!iflag || g_parsefile->pf_fd != STDIN_FILENO) | 11838 | if (!iflag || g_parsefile->pf_fd != STDIN_FILENO) |
11849 | #if ENABLE_ASH_IGNORE_CR | 11839 | #if ENABLE_PLATFORM_MINGW32 |
11850 | nr = nonblock_immune_wrapper(g_parsefile, buf, IBUFSIZ - 1); | 11840 | nr = nonblock_immune_wrapper(g_parsefile, buf, IBUFSIZ - 1); |
11851 | #else | 11841 | #else |
11852 | nr = nonblock_immune_read(g_parsefile->pf_fd, buf, IBUFSIZ - 1); | 11842 | nr = nonblock_immune_read(g_parsefile->pf_fd, buf, IBUFSIZ - 1); |
@@ -11932,7 +11922,7 @@ preadfd(void) | |||
11932 | } | 11922 | } |
11933 | } | 11923 | } |
11934 | #else | 11924 | #else |
11935 | # if ENABLE_ASH_IGNORE_CR | 11925 | # if ENABLE_PLATFORM_MINGW32 |
11936 | nr = nonblock_immune_wrapper(g_parsefile, buf, IBUFSIZ - 1); | 11926 | nr = nonblock_immune_wrapper(g_parsefile, buf, IBUFSIZ - 1); |
11937 | # else | 11927 | # else |
11938 | nr = nonblock_immune_read(g_parsefile->pf_fd, buf, IBUFSIZ - 1); | 11928 | nr = nonblock_immune_read(g_parsefile->pf_fd, buf, IBUFSIZ - 1); |
@@ -12007,9 +11997,7 @@ preadbuffer(void) | |||
12007 | more--; | 11997 | more--; |
12008 | 11998 | ||
12009 | c = *q; | 11999 | c = *q; |
12010 | /* Remove CR from input buffer as an alternative to ASH_IGNORE_CR. */ | 12000 | if (c == '\0') { |
12011 | if (c == '\0' || (c == '\r' && | ||
12012 | ENABLE_PLATFORM_MINGW32 && !ENABLE_ASH_IGNORE_CR)) { | ||
12013 | memmove(q, q + 1, more); | 12001 | memmove(q, q + 1, more); |
12014 | } else { | 12002 | } else { |
12015 | q++; | 12003 | q++; |
@@ -15160,7 +15148,9 @@ trapcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
15160 | next: | 15148 | next: |
15161 | ap++; | 15149 | ap++; |
15162 | } | 15150 | } |
15151 | #if ENABLE_PLATFORM_MINGW32 | ||
15163 | may_have_traps = trap[SIGINT] && trap[SIGINT][0] != '\0'; | 15152 | may_have_traps = trap[SIGINT] && trap[SIGINT][0] != '\0'; |
15153 | #endif | ||
15164 | return exitcode; | 15154 | return exitcode; |
15165 | } | 15155 | } |
15166 | 15156 | ||
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 @@ | |||
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 || ENABLE_ASH_IGNORE_CR | ||
23 | const char defifsvar[] ALIGN1 = "IFS= \t\n"; | 22 | const char defifsvar[] ALIGN1 = "IFS= \t\n"; |
24 | #else | ||
25 | const char defifsvar[] ALIGN1 = "IFS= \t\n\r"; | ||
26 | #endif | ||
27 | const char defoptindvar[] ALIGN1 = "OPTIND=1"; | 23 | const char defoptindvar[] ALIGN1 = "OPTIND=1"; |
28 | 24 | ||
29 | /* read builtin */ | 25 | /* read builtin */ |
@@ -261,10 +257,6 @@ shell_builtin_read(struct builtin_read_params *params) | |||
261 | 257 | ||
262 | c = buffer[bufpos]; | 258 | c = buffer[bufpos]; |
263 | #if ENABLE_PLATFORM_MINGW32 | 259 | #if ENABLE_PLATFORM_MINGW32 |
264 | # if !ENABLE_ASH_IGNORE_CR | ||
265 | if (c == '\r') | ||
266 | continue; | ||
267 | # else | ||
268 | if (c == '\n') { | 260 | if (c == '\n') { |
269 | if (backslash == 2 || (bufpos > 0 && buffer[bufpos - 1] == '\r')) { | 261 | if (backslash == 2 || (bufpos > 0 && buffer[bufpos - 1] == '\r')) { |
270 | /* We saw either: | 262 | /* We saw either: |
@@ -279,11 +271,10 @@ shell_builtin_read(struct builtin_read_params *params) | |||
279 | * process ?? */ | 271 | * process ?? */ |
280 | backslash = 0; | 272 | backslash = 0; |
281 | } | 273 | } |
282 | # endif | ||
283 | #endif | 274 | #endif |
284 | if (!(read_flags & BUILTIN_READ_RAW)) { | 275 | if (!(read_flags & BUILTIN_READ_RAW)) { |
285 | if (backslash) { | 276 | if (backslash) { |
286 | #if ENABLE_ASH_IGNORE_CR | 277 | #if ENABLE_PLATFORM_MINGW32 |
287 | if (c == '\r') { | 278 | if (c == '\r') { |
288 | /* We have BS CR, keep CR for now, might see LF next */ | 279 | /* We have BS CR, keep CR for now, might see LF next */ |
289 | backslash = 2; | 280 | backslash = 2; |