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