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 a9f8d8413..750adc5d8 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
@@ -209,6 +213,7 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
209 * regardless of SA_RESTART-ness of that signal! 213 * regardless of SA_RESTART-ness of that signal!
210 */ 214 */
211 errno = 0; 215 errno = 0;
216#if !ENABLE_PLATFORM_MINGW32
212 pfd[0].events = POLLIN; 217 pfd[0].events = POLLIN;
213 if (poll(pfd, 1, timeout) <= 0) { 218 if (poll(pfd, 1, timeout) <= 0) {
214 /* timed out, or EINTR */ 219 /* timed out, or EINTR */
@@ -216,6 +221,7 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
216 retval = (const char *)(uintptr_t)1; 221 retval = (const char *)(uintptr_t)1;
217 goto ret; 222 goto ret;
218 } 223 }
224#endif
219 if (read(fd, &buffer[bufpos], 1) != 1) { 225 if (read(fd, &buffer[bufpos], 1) != 1) {
220 err = errno; 226 err = errno;
221 retval = (const char *)(uintptr_t)1; 227 retval = (const char *)(uintptr_t)1;
@@ -223,7 +229,7 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
223 } 229 }
224 230
225 c = buffer[bufpos]; 231 c = buffer[bufpos];
226 if (c == '\0') 232 if (c == '\0' || (ENABLE_PLATFORM_MINGW32 && c == '\r'))
227 continue; 233 continue;
228 if (!(read_flags & BUILTIN_READ_RAW)) { 234 if (!(read_flags & BUILTIN_READ_RAW)) {
229 if (backslash) { 235 if (backslash) {
@@ -298,6 +304,7 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
298 304
299/* ulimit builtin */ 305/* ulimit builtin */
300 306
307#if !ENABLE_PLATFORM_MINGW32
301struct limits { 308struct limits {
302 uint8_t cmd; /* RLIMIT_xxx fit into it */ 309 uint8_t cmd; /* RLIMIT_xxx fit into it */
303 uint8_t factor_shift; /* shift by to get rlim_{cur,max} values */ 310 uint8_t factor_shift; /* shift by to get rlim_{cur,max} values */
@@ -514,3 +521,9 @@ shell_builtin_ulimit(char **argv)
514 521
515 return 0; 522 return 0;
516} 523}
524#else
525int FAST_FUNC shell_builtin_ulimit(char **argv UNUSED_PARAM)
526{
527 return 1;
528}
529#endif