make [[ -o ‣-U ]] = [[ -o ‣+U ]] = [[ -o ‣utf8-mode ]]
where ‘‣’ is either nothing, ‘!’ or ‘?’ as usual.
This commit is contained in:
parent
6115f5a91c
commit
0611ecad1f
44
check.t
44
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.351 2010/01/01 17:44:06 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.352 2010/01/01 18:01:59 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 $
|
||||
@ -4460,6 +4460,28 @@ stdin:
|
||||
echo 1- $(runtest utf8-mode) =
|
||||
echo 2- $(runtest !utf8-mode) =
|
||||
echo 3- $(runtest ?utf8-mode) =
|
||||
echo = short flags =
|
||||
echo 0y $(if_test -U) =
|
||||
echo 0y $(if_test +U) =
|
||||
echo 0n $(if_test -_) =
|
||||
echo 0n $(if_test -U-) =
|
||||
echo 1= $(runtest -_) =
|
||||
echo 2= $(runtest !-_) =
|
||||
echo 3= $(runtest ?-_) =
|
||||
set +U
|
||||
echo 1+ $(runtest -U) =
|
||||
echo 2+ $(runtest !-U) =
|
||||
echo 3+ $(runtest ?-U) =
|
||||
echo 1+ $(runtest +U) =
|
||||
echo 2+ $(runtest !+U) =
|
||||
echo 3+ $(runtest ?+U) =
|
||||
set -U
|
||||
echo 1- $(runtest -U) =
|
||||
echo 2- $(runtest !-U) =
|
||||
echo 3- $(runtest ?-U) =
|
||||
echo 1- $(runtest +U) =
|
||||
echo 2- $(runtest !+U) =
|
||||
echo 3- $(runtest ?+U) =
|
||||
expected-stdout:
|
||||
0y 0 0 0 0 =
|
||||
0n 1 1 1 1 =
|
||||
@ -4472,6 +4494,26 @@ expected-stdout:
|
||||
1- 0 0 0 =
|
||||
2- 1 1 1 =
|
||||
3- 0 0 0 =
|
||||
= short flags =
|
||||
0y 0 0 0 0 =
|
||||
0y 0 0 0 0 =
|
||||
0n 1 1 1 1 =
|
||||
0n 1 1 1 1 =
|
||||
1= 1 1 1 =
|
||||
2= 1 1 1 =
|
||||
3= 1 1 1 =
|
||||
1+ 1 1 1 =
|
||||
2+ 0 0 0 =
|
||||
3+ 0 0 0 =
|
||||
1+ 1 1 1 =
|
||||
2+ 0 0 0 =
|
||||
3+ 0 0 0 =
|
||||
1- 0 0 0 =
|
||||
2- 1 1 1 =
|
||||
3- 0 0 0 =
|
||||
1- 0 0 0 =
|
||||
2- 1 1 1 =
|
||||
3- 0 0 0 =
|
||||
---
|
||||
name: mkshrc-1
|
||||
description:
|
||||
|
8
misc.c
8
misc.c
@ -29,7 +29,7 @@
|
||||
#include <grp.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.134 2009/12/05 17:43:48 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.135 2010/01/01 18:02:00 tg Exp $");
|
||||
|
||||
unsigned char chtypes[UCHAR_MAX + 1]; /* type bits for unsigned char */
|
||||
|
||||
@ -108,7 +108,11 @@ option(const char *n)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < NELEM(options); i++)
|
||||
if ((n[0] == '-' || n[0] == '+') && n[1] && !n[2]) {
|
||||
for (i = 0; i < NELEM(options); i++)
|
||||
if (options[i].c == n[1])
|
||||
return (i);
|
||||
} else for (i = 0; i < NELEM(options); i++)
|
||||
if (options[i].name && strcmp(options[i].name, n) == 0)
|
||||
return (i);
|
||||
|
||||
|
17
mksh.1
17
mksh.1
@ -1,4 +1,4 @@
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.203 2010/01/01 17:44:08 tg Exp $
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.204 2010/01/01 18:02:01 tg Exp $
|
||||
.\" $OpenBSD: ksh.1,v 1.129 2009/05/28 06:09:06 jmc Exp $
|
||||
.\"-
|
||||
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
@ -3911,7 +3911,8 @@ Enable
|
||||
mode.
|
||||
Automatically enabled if the basename of the shell invocation begins with
|
||||
.Dq sh
|
||||
and this autodetection feature was requested at compilation time.
|
||||
and this autodetection feature was requested at compilation time
|
||||
.Pq not in MirBSD .
|
||||
As a side effect, setting this flag turns off
|
||||
.Ic braceexpand
|
||||
mode, which can be turned back on manually.
|
||||
@ -4061,6 +4062,18 @@ exists).
|
||||
The same can be achieved with [ \-o ?foo ] like in
|
||||
.At
|
||||
.Nm ksh93 .
|
||||
.Ar option
|
||||
can also be the short flag led by either
|
||||
.Ql \-
|
||||
or
|
||||
.Ql +
|
||||
.Pq no logical negation ,
|
||||
for example
|
||||
.Ql \-x
|
||||
or
|
||||
.Ql +x
|
||||
instead of
|
||||
.Ql xtrace .
|
||||
.It Fl p Ar file
|
||||
.Ar file
|
||||
is a named pipe.
|
||||
|
Loading…
x
Reference in New Issue
Block a user