turn off UTF-8 mode upon entering POSIX mode, for J�rg

This commit is contained in:
tg 2017-08-07 20:49:42 +00:00
parent c203e7c5b2
commit 1854fb9b3d
2 changed files with 15 additions and 6 deletions

7
misc.c
View File

@ -32,7 +32,7 @@
#include <grp.h> #include <grp.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.277 2017/05/05 22:53:30 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/misc.c,v 1.278 2017/08/07 20:49:41 tg Exp $");
#define KSH_CHVT_FLAG #define KSH_CHVT_FLAG
#ifdef MKSH_SMALL #ifdef MKSH_SMALL
@ -271,6 +271,11 @@ change_flag(enum sh_flag f, int what, bool newset)
} else if ((f == FPOSIX || f == FSH) && newval) { } else if ((f == FPOSIX || f == FSH) && newval) {
/* Turning on -o posix or -o sh? */ /* Turning on -o posix or -o sh? */
Flag(FBRACEEXPAND) = 0; Flag(FBRACEEXPAND) = 0;
/* Turning on -o posix? */
if (f == POSIX) {
/* C locale required for compliance */
UTFMODE = 0;
}
} else if (f == FTALKING) { } else if (f == FTALKING) {
/* Changing interactive flag? */ /* Changing interactive flag? */
if ((what == OF_CMDLINE || what == OF_SET) && procpid == kshpid) if ((what == OF_CMDLINE || what == OF_SET) && procpid == kshpid)

14
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.447 2017/05/05 22:45:57 tg Exp $ .\" $MirOS: src/bin/mksh/mksh.1,v 1.448 2017/08/07 20:49:42 tg Exp $
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $ .\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
.\"- .\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
@ -76,7 +76,7 @@
.\" with -mandoc, it might implement .Mx itself, but we want to .\" with -mandoc, it might implement .Mx itself, but we want to
.\" use our own definition. And .Dd must come *first*, always. .\" use our own definition. And .Dd must come *first*, always.
.\" .\"
.Dd $Mdocdate: May 5 2017 $ .Dd $Mdocdate: August 7 2017 $
.\" .\"
.\" Check which macro package we use, and do other -mdoc setup. .\" Check which macro package we use, and do other -mdoc setup.
.\" .\"
@ -4308,9 +4308,11 @@ Automatically enabled if the basename of the shell invocation begins with
.Dq sh .Dq sh
and this autodetection feature is compiled in and this autodetection feature is compiled in
.Pq not in MirBSD . .Pq not in MirBSD .
As a side effect, setting this flag turns off As a side effect, setting this flag turns off the
.Ic braceexpand .Ic braceexpand
mode, which can be turned back on manually, and and
.Ic utf8\-mode
flags, which can be turned back on manually, and
.Ic sh .Ic sh
mode (unless both are enabled at the same time). mode (unless both are enabled at the same time).
.It Fl o Ic sh .It Fl o Ic sh
@ -6640,12 +6642,14 @@ supports only the
locale. locale.
.Nm mksh Ns 's .Nm mksh Ns 's
.Ic utf8\-mode .Ic utf8\-mode
.Em must
be disabled in POSIX mode, and it
only supports the Unicode BMP (Basic Multilingual Plane) and maps only supports the Unicode BMP (Basic Multilingual Plane) and maps
raw octets into the U+EF80..U+EFFF wide character range; compare raw octets into the U+EF80..U+EFFF wide character range; compare
.Sx Arithmetic expressions . .Sx Arithmetic expressions .
The following The following
.Tn POSIX .Tn POSIX
.Nm sh .Nm sh Ns -compatible
code toggles the code toggles the
.Ic utf8\-mode .Ic utf8\-mode
option dependent on the current option dependent on the current