From aed0cb4408bffe2da89a25054b22144f616bdffe Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 19 Mar 2020 18:11:39 +0000 Subject: 45583/0009: Add end-of-options guard support to 'function -T'. --- Src/parse.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Src') diff --git a/Src/parse.c b/Src/parse.c index 0342ee1f8..08919b2da 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -1680,10 +1680,18 @@ par_funcdef(int *cmplx) p = ecadd(0); ecadd(0); /* p + 1 */ - if (tok == STRING && tokstr[0] == Dash && - tokstr[1] == 'T' && !tokstr[2]) { - ++do_tracing; - zshlex(); + /* Consume an initial (-T), (--), or (-T --). + * Anything else is a literal function name. + */ + if (tok == STRING && tokstr[0] == Dash) { + if (tokstr[1] == 'T' && !tokstr[2]) { + ++do_tracing; + zshlex(); + } + if (tok == STRING && tokstr[0] == Dash && + tokstr[1] == Dash && !tokstr[2]) { + zshlex(); + } } while (tok == STRING) { -- cgit 1.4.1