our test(1) promises we can do string1 < string2, and
our /bin/test uses mksh... so we pee (literally) on POSIX and don't accept < and > only for [[ ... ]] operator
This commit is contained in:
parent
1b081938fb
commit
7ee8296628
13
check.t
13
check.t
|
@ -1,4 +1,4 @@
|
|||
# $MirOS: src/bin/mksh/check.t,v 1.31 2005/10/08 18:53:09 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.32 2005/10/08 19:30:58 tg Exp $
|
||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||
|
@ -3694,6 +3694,17 @@ expected-stderr:
|
|||
+ /usr/bin/env false
|
||||
expected-exit: 1
|
||||
---
|
||||
name: test-stlt
|
||||
description:
|
||||
Check that test also can handle string1 < string2 etc.
|
||||
stdin:
|
||||
test 2005/10/08 '<' 2005/08/21 && echo ja || echo nein
|
||||
test 2005/08/21 \< 2005/10/08 && echo ja || echo nein
|
||||
expected-stdout:
|
||||
nein
|
||||
ja
|
||||
expected-stderr-pattern: !/unexpected op/
|
||||
---
|
||||
name: version-1
|
||||
description:
|
||||
Check version of shell.
|
||||
|
|
6
exec.c
6
exec.c
|
@ -1,11 +1,11 @@
|
|||
/** $MirOS: src/bin/mksh/exec.c,v 1.8 2005/07/07 22:00:45 tg Exp $ */
|
||||
/** $MirOS: src/bin/mksh/exec.c,v 1.9 2005/10/08 19:30:58 tg Exp $ */
|
||||
/* $OpenBSD: exec.c,v 1.41 2005/03/30 17:16:37 deraadt Exp $ */
|
||||
|
||||
#include "sh.h"
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.8 2005/07/07 22:00:45 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.9 2005/10/08 19:30:58 tg Exp $");
|
||||
|
||||
static int comexec(struct op *, struct tbl *volatile, char **,
|
||||
int volatile);
|
||||
|
@ -1348,7 +1348,7 @@ dbteste_isa(Test_env *te, Test_meta meta)
|
|||
*p == CHAR && q < &buf[sizeof(buf) - 1]; p += 2)
|
||||
*q++ = p[1];
|
||||
*q = '\0';
|
||||
ret = test_isop(te, meta, buf);
|
||||
ret = test_isop(meta, buf);
|
||||
}
|
||||
} else if (meta == TM_END)
|
||||
ret = 0;
|
||||
|
|
21
funcs.c
21
funcs.c
|
@ -1,4 +1,4 @@
|
|||
/** $MirOS: src/bin/mksh/funcs.c,v 1.18 2005/09/12 19:28:18 tg Exp $ */
|
||||
/** $MirOS: src/bin/mksh/funcs.c,v 1.19 2005/10/08 19:30:59 tg Exp $ */
|
||||
/* $OpenBSD: c_ksh.c,v 1.27 2005/03/30 17:16:37 deraadt Exp $ */
|
||||
/* $OpenBSD: c_sh.c,v 1.29 2005/03/30 17:16:37 deraadt Exp $ */
|
||||
/* $OpenBSD: c_test.c,v 1.17 2005/03/30 17:16:37 deraadt Exp $ */
|
||||
|
@ -13,7 +13,7 @@
|
|||
#include <ulimit.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.18 2005/09/12 19:28:18 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.19 2005/10/08 19:30:59 tg Exp $");
|
||||
|
||||
#ifdef USE_PRINTF
|
||||
int c_printf(char **);
|
||||
|
@ -2415,20 +2415,17 @@ c_test(char **wp)
|
|||
*/
|
||||
|
||||
Test_op
|
||||
test_isop(Test_env *te, Test_meta meta, const char *s)
|
||||
test_isop(Test_meta meta, const char *s)
|
||||
{
|
||||
char sc1;
|
||||
const struct t_op *otab;
|
||||
const struct t_op *tbl;
|
||||
|
||||
otab = meta == TM_UNOP ? u_ops : b_ops;
|
||||
tbl = meta == TM_UNOP ? u_ops : b_ops;
|
||||
if (*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)))
|
||||
return otab->op_num;
|
||||
for (; tbl->op_text[0]; tbl++)
|
||||
if (sc1 == tbl->op_text[1] && !strcmp(s, tbl->op_text))
|
||||
return tbl->op_num;
|
||||
}
|
||||
return TO_NONOP;
|
||||
}
|
||||
|
@ -2722,7 +2719,7 @@ ptest_isa(Test_env *te, Test_meta meta)
|
|||
return meta == TM_END;
|
||||
|
||||
if (meta == TM_UNOP || meta == TM_BINOP)
|
||||
ret = test_isop(te, meta, *te->pos.wp);
|
||||
ret = test_isop(meta, *te->pos.wp);
|
||||
else if (meta == TM_END)
|
||||
ret = 0;
|
||||
else
|
||||
|
|
16
mksh.1
16
mksh.1
|
@ -1,4 +1,4 @@
|
|||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.20 2005/10/07 18:36:19 tg Exp $
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.21 2005/10/08 19:30:59 tg Exp $
|
||||
.\" $OpenBSD: ksh.1,v 1.101 2005/08/01 19:29:57 jmc Exp $
|
||||
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
|
||||
.\"
|
||||
|
@ -737,13 +737,6 @@ expressions are patterns (e.g. the comparison
|
|||
.Ic [[ foobar = f*r ]]
|
||||
succeeds).
|
||||
.It
|
||||
There are two additional binary operators,
|
||||
.Ql \*(Lt
|
||||
and
|
||||
.Ql \*(Gt ,
|
||||
which return true if their first string operand is less than, or greater than,
|
||||
their second string operand, respectively.
|
||||
.It
|
||||
The single argument form of
|
||||
.Ic test ,
|
||||
which tests if the argument has a non-zero length, is not valid; explicit
|
||||
|
@ -3466,6 +3459,10 @@ is empty.
|
|||
Strings are equal.
|
||||
.It Ar string No == Ar string
|
||||
Strings are equal.
|
||||
.It Ar string No \*(Gt Ar string
|
||||
First string operand is greater than second string operand.
|
||||
.It Ar string No \*(Lt Ar string
|
||||
First string operand is less than second string operand.
|
||||
.It Ar string No != Ar string
|
||||
Strings are not equal.
|
||||
.It Ar number Fl eq Ar number
|
||||
|
@ -3524,7 +3521,8 @@ or
|
|||
.Sq Fl n .
|
||||
Use tests like
|
||||
.Dq if \&[ x\&"$foo\&" = x"bar" \&]
|
||||
instead.
|
||||
instead, or the double-bracket operator:
|
||||
.Dq if \&[[ $foo = bar \&]]
|
||||
.Pp
|
||||
.It Xo
|
||||
.Ic time
|
||||
|
|
4
sh.h
4
sh.h
|
@ -1,4 +1,4 @@
|
|||
/** $MirOS: src/bin/mksh/sh.h,v 1.17 2005/08/02 12:35:27 tg Exp $ */
|
||||
/** $MirOS: src/bin/mksh/sh.h,v 1.18 2005/10/08 19:31:00 tg Exp $ */
|
||||
/* $OpenBSD: sh.h,v 1.27 2005/03/28 21:33:04 deraadt Exp $ */
|
||||
/* $OpenBSD: shf.h,v 1.5 2005/03/30 17:16:37 deraadt Exp $ */
|
||||
/* $OpenBSD: table.h,v 1.6 2004/12/18 20:55:52 millert Exp $ */
|
||||
|
@ -1257,7 +1257,7 @@ struct test_env {
|
|||
void (*error)(Test_env *, int, const char *);
|
||||
};
|
||||
|
||||
Test_op test_isop(Test_env *, Test_meta, const char *);
|
||||
Test_op test_isop(Test_meta, const char *);
|
||||
int test_eval(Test_env *, Test_op, const char *, const char *, int);
|
||||
int test_parse(Test_env *);
|
||||
|
||||
|
|
6
syn.c
6
syn.c
|
@ -1,9 +1,9 @@
|
|||
/** $MirOS: src/bin/mksh/syn.c,v 1.2 2005/07/04 12:27:28 tg Exp $ */
|
||||
/** $MirOS: src/bin/mksh/syn.c,v 1.3 2005/10/08 19:31:00 tg Exp $ */
|
||||
/* $OpenBSD: syn.c,v 1.22 2005/03/30 17:16:37 deraadt Exp $ */
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.2 2005/07/04 12:27:28 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.3 2005/10/08 19:31:00 tg Exp $");
|
||||
|
||||
struct nesting_state {
|
||||
int start_token; /* token than began nesting (eg, FOR) */
|
||||
|
@ -846,7 +846,7 @@ dbtestp_isa(Test_env *te, Test_meta meta)
|
|||
ret = 1;
|
||||
save = wdcopy(yylval.iop->flag == IOREAD ?
|
||||
db_lthan : db_gthan, ATEMP);
|
||||
} else if (uqword && (ret = test_isop(te, meta, ident)))
|
||||
} else if (uqword && (ret = test_isop(meta, ident)))
|
||||
save = yylval.cp;
|
||||
} else /* meta == TM_END */
|
||||
ret = uqword && strcmp(yylval.cp, db_close) == 0;
|
||||
|
|
Loading…
Reference in New Issue