summaryrefslogtreecommitdiff
path: root/Src/parse.c
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2020-03-19 18:11:39 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2020-03-22 02:23:53 +0000
commitaed0cb4408bffe2da89a25054b22144f616bdffe (patch)
treec9910a0e1ecc87187f3264b31189b098037178d0 /Src/parse.c
parent386d9ac8ff961b8f0333d09511e927ab31011658 (diff)
downloadzsh-aed0cb4408bffe2da89a25054b22144f616bdffe.tar.gz
zsh-aed0cb4408bffe2da89a25054b22144f616bdffe.zip
45583/0009: Add end-of-options guard support to 'function -T'.
Diffstat (limited to 'Src/parse.c')
-rw-r--r--Src/parse.c16
1 files changed, 12 insertions, 4 deletions
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) {