From 507f69e4ba5c2cbb0ffe5e59a7ce416aab81941c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Csaba=20Osztrogon=C3=A1c?= Date: Fri, 29 Nov 2019 12:57:32 +0000 Subject: [PATCH] Make REPL option parser handle "-" option properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit REPL could read JS file from standard input when we passed "-" option, but after #1896 "-" became invalid option mistakenly. JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu --- jerry-main/cli.c | 2 +- jerry-main/main-unix.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jerry-main/cli.c b/jerry-main/cli.c index 1f8c878f78..9fbc7a9c0d 100644 --- a/jerry-main/cli.c +++ b/jerry-main/cli.c @@ -112,7 +112,7 @@ cli_consume_option (cli_state_t *state_p) /**< state of the command line option state_p->arg = arg; - if (arg[0] != '-') + if (arg[0] != '-' || (arg[0] == '-' && arg[1] == '\0')) { return CLI_OPT_DEFAULT; } diff --git a/jerry-main/main-unix.c b/jerry-main/main-unix.c index 6bd4ae0b9e..2e84ca78ba 100644 --- a/jerry-main/main-unix.c +++ b/jerry-main/main-unix.c @@ -366,7 +366,7 @@ static const cli_opt_t main_opts[] = CLI_OPT_DEF (.id = OPT_NO_PROMPT, .longopt = "no-prompt", .help = "don't print prompt in REPL mode"), CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = "FILE", - .help = "input JS file(s)") + .help = "input JS file(s) (If file is -, read standard input.)") }; /**