summaryrefslogtreecommitdiff
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 a9f8d84..2db8ea3 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),
const char *opt_n,
const char *opt_p,
const char *opt_t,
- const char *opt_u
+ const char *opt_u,
+ const char *opt_d
)
{
struct pollfd pfd[1];
@@ -237,14 +238,17 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
continue;
}
}
- if (c == '\n')
+ if (opt_d) {
+ if (c == *opt_d)
+ break;
+ } else if (c == '\n')
break;
/* $IFS splitting. NOT done if we run "read"
* without variable names (bash compat).
* Thus, "read" and "read REPLY" are not the same.
*/
- if (argv[0]) {
+ if (!opt_d && argv[0]) {
/* http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05 */
const char *is_ifs = strchr(ifs, c);
if (startword && is_ifs) {