aboutsummaryrefslogtreecommitdiff
path: root/shell/shell_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/shell_common.c')
-rw-r--r--shell/shell_common.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 98d862744..5a5b1780d 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -20,7 +20,11 @@
20#include "shell_common.h" 20#include "shell_common.h"
21#include <sys/resource.h> /* getrlimit */ 21#include <sys/resource.h> /* getrlimit */
22 22
23#if !ENABLE_PLATFORM_MINGW32
23const char defifsvar[] ALIGN1 = "IFS= \t\n"; 24const char defifsvar[] ALIGN1 = "IFS= \t\n";
25#else
26const char defifsvar[] ALIGN1 = "IFS= \t\n\r";
27#endif
24const char defoptindvar[] ALIGN1 = "OPTIND=1"; 28const char defoptindvar[] ALIGN1 = "OPTIND=1";
25 29
26 30
@@ -187,6 +191,7 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
187 * regardless of SA_RESTART-ness of that signal! 191 * regardless of SA_RESTART-ness of that signal!
188 */ 192 */
189 errno = 0; 193 errno = 0;
194#if !ENABLE_PLATFORM_MINGW32
190 pfd[0].fd = fd; 195 pfd[0].fd = fd;
191 pfd[0].events = POLLIN; 196 pfd[0].events = POLLIN;
192 if (poll(pfd, 1, timeout) != 1) { 197 if (poll(pfd, 1, timeout) != 1) {
@@ -195,6 +200,7 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
195 retval = (const char *)(uintptr_t)1; 200 retval = (const char *)(uintptr_t)1;
196 goto ret; 201 goto ret;
197 } 202 }
203#endif
198 if (read(fd, &buffer[bufpos], 1) != 1) { 204 if (read(fd, &buffer[bufpos], 1) != 1) {
199 err = errno; 205 err = errno;
200 retval = (const char *)(uintptr_t)1; 206 retval = (const char *)(uintptr_t)1;
@@ -202,7 +208,7 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
202 } 208 }
203 209
204 c = buffer[bufpos]; 210 c = buffer[bufpos];
205 if (c == '\0') 211 if (c == '\0' || (ENABLE_PLATFORM_MINGW32 && c == '\r'))
206 continue; 212 continue;
207 if (backslash) { 213 if (backslash) {
208 backslash = 0; 214 backslash = 0;
@@ -274,6 +280,7 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
274 280
275/* ulimit builtin */ 281/* ulimit builtin */
276 282
283#if !ENABLE_PLATFORM_MINGW32
277struct limits { 284struct limits {
278 uint8_t cmd; /* RLIMIT_xxx fit into it */ 285 uint8_t cmd; /* RLIMIT_xxx fit into it */
279 uint8_t factor_shift; /* shift by to get rlim_{cur,max} values */ 286 uint8_t factor_shift; /* shift by to get rlim_{cur,max} values */
@@ -498,3 +505,9 @@ shell_builtin_ulimit(char **argv)
498 505
499 return 0; 506 return 0;
500} 507}
508#else
509int FAST_FUNC shell_builtin_ulimit(char **argv UNUSED_PARAM)
510{
511 return 1;
512}
513#endif