summaryrefslogtreecommitdiffstats
path: root/Src
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2025-11-24 22:19:07 +0100
committerOliver Kiddle <opk@zsh.org>2025-11-24 22:19:07 +0100
commitf51fed9ddad1861023ed12cbae129b5ca15fac20 (patch)
treee8aad2133a7ea1b70642408da5c175b9d961054d /Src
parent54094: handle rust coreutils in completions (diff)
downloadzsh-f51fed9ddad1861023ed12cbae129b5ca15fac20.tar
zsh-f51fed9ddad1861023ed12cbae129b5ca15fac20.tar.gz
zsh-f51fed9ddad1861023ed12cbae129b5ca15fac20.tar.bz2
zsh-f51fed9ddad1861023ed12cbae129b5ca15fac20.tar.lz
zsh-f51fed9ddad1861023ed12cbae129b5ca15fac20.tar.xz
zsh-f51fed9ddad1861023ed12cbae129b5ca15fac20.tar.zst
zsh-f51fed9ddad1861023ed12cbae129b5ca15fac20.zip
54103: support > and < comparisons via the test builtin
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c4
-rw-r--r--Src/parse.c8
2 files changed, 12 insertions, 0 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 1c0eb331e..ba2fe1cdf 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -7243,6 +7243,10 @@ testlex(void)
tok = INPAR;
else if (!strcmp(*testargs, ")"))
tok = OUTPAR;
+ else if (!strcmp(*testargs, "<"))
+ tok = INANG;
+ else if (!strcmp(*testargs, ">"))
+ tok = OUTANG;
else
tok = STRING;
testargs++;
diff --git a/Src/parse.c b/Src/parse.c
index 0ba7c701c..ab708a279 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2495,6 +2495,8 @@ par_cond_2(void)
/* three arguments: if the second argument is a binary operator, *
* perform that binary test on the first and the third argument */
if (!strcmp(*testargs, "=") ||
+ !strcmp(*testargs, "<") ||
+ !strcmp(*testargs, ">") ||
!strcmp(*testargs, "==") ||
!strcmp(*testargs, "!=") ||
(IS_DASH(**testargs) && get_cond_num(*testargs + 1) >= 0)) {
@@ -2661,6 +2663,12 @@ par_cond_triple(char *a, char *b, char *c)
ecstr(a);
ecstr(c);
ecadd(ecnpats++);
+ } else if ((t0 = (b[0] == '>' || b[0] == Outang) ||
+ b[0] == '<' || b[0] == Inang) && !b[1]) {
+ ecadd(WCB_COND(t0 ? COND_STRGTR : COND_STRLT, 0));
+ ecstr(a);
+ ecstr(c);
+ ecadd(ecnpats++);
} else if ((b[0] == Equals || b[0] == '=') &&
(b[1] == Equals || b[1] == '=') && !b[2]) {
ecadd(WCB_COND(COND_STRDEQ, 0));