From 336fa45fa7dd5f693166ebfea8bda96aee96c5f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Csaba=20Osztrogon=C3=A1c?= Date: Fri, 29 Nov 2019 14:52:54 +0100 Subject: [PATCH] Make REPL option parser handle "-" option properly (#3384) 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 1f8c878f7..9fbc7a9c0 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 6bd4ae0b9..2e84ca78b 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.)") }; /**