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.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/shell/shell_common.c b/shell/shell_common.c
index a9f8d8413..2db8ea3e2 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -54,7 +54,8 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
54 const char *opt_n, 54 const char *opt_n,
55 const char *opt_p, 55 const char *opt_p,
56 const char *opt_t, 56 const char *opt_t,
57 const char *opt_u 57 const char *opt_u,
58 const char *opt_d
58) 59)
59{ 60{
60 struct pollfd pfd[1]; 61 struct pollfd pfd[1];
@@ -237,14 +238,17 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
237 continue; 238 continue;
238 } 239 }
239 } 240 }
240 if (c == '\n') 241 if (opt_d) {
242 if (c == *opt_d)
243 break;
244 } else if (c == '\n')
241 break; 245 break;
242 246
243 /* $IFS splitting. NOT done if we run "read" 247 /* $IFS splitting. NOT done if we run "read"
244 * without variable names (bash compat). 248 * without variable names (bash compat).
245 * Thus, "read" and "read REPLY" are not the same. 249 * Thus, "read" and "read REPLY" are not the same.
246 */ 250 */
247 if (argv[0]) { 251 if (!opt_d && argv[0]) {
248/* http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05 */ 252/* http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05 */
249 const char *is_ifs = strchr(ifs, c); 253 const char *is_ifs = strchr(ifs, c);
250 if (startword && is_ifs) { 254 if (startword && is_ifs) {