summaryrefslogtreecommitdiffstats
path: root/bin/ksh/c_test.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2019-06-19 18:18:22 +0000
committermillert <millert@openbsd.org>2019-06-19 18:18:22 +0000
commit5b199efb7af14d11623972ca1c5b8be5db516d8f (patch)
treef6559a8d0289c2a3bdf1232de5cadb3d811667ff /bin/ksh/c_test.c
parentthe pledge STATLIE code is no longer needed, as discussed with beck. (diff)
downloadwireguard-openbsd-5b199efb7af14d11623972ca1c5b8be5db516d8f.tar.xz
wireguard-openbsd-5b199efb7af14d11623972ca1c5b8be5db516d8f.zip
Allow string greater/less than than operators to work with test aka [.
Previously they were only recognized in [[ ... ]] expressions. This changes sh/ksh to be consistent with test(1) as well as shells like bash and dash. OK jca@ jmc@
Diffstat (limited to 'bin/ksh/c_test.c')
-rw-r--r--bin/ksh/c_test.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/bin/ksh/c_test.c b/bin/ksh/c_test.c
index 911f2bf0404..8422c0936a4 100644
--- a/bin/ksh/c_test.c
+++ b/bin/ksh/c_test.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: c_test.c,v 1.25 2018/04/09 17:53:36 tobias Exp $ */
+/* $OpenBSD: c_test.c,v 1.26 2019/06/19 18:18:22 millert Exp $ */
/*
* test(1); version 7-like -- author Erik Baalbergen
@@ -32,8 +32,7 @@
"-L"|"-h"|"-S"|"-H";
binary-operator ::= "="|"=="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"|
- "-nt"|"-ot"|"-ef"|
- "<"|">" # rules used for [[ .. ]] expressions
+ "-nt"|"-ot"|"-ef"|"<"|">"
;
operand ::= <any thing>
*/
@@ -195,9 +194,7 @@ test_isop(Test_env *te, Test_meta meta, const char *s)
sc1 = s[1];
for (; otab->op_text[0]; otab++)
if (sc1 == otab->op_text[1] &&
- strcmp(s, otab->op_text) == 0 &&
- ((te->flags & TEF_DBRACKET) ||
- (otab->op_num != TO_STLT && otab->op_num != TO_STGT)))
+ strcmp(s, otab->op_text) == 0)
return otab->op_num;
}
return TO_NONOP;