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>
#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
#ifdef MKSH_SMALL
@ -271,6 +271,11 @@ change_flag(enum sh_flag f, int what, bool newset)
} else if ((f == FPOSIX || f == FSH) && newval) {
/* Turning on -o posix or -o sh? */
Flag(FBRACEEXPAND) = 0;
/* Turning on -o posix? */
if (f == POSIX) {
/* C locale required for compliance */
UTFMODE = 0;
}
} else if (f == FTALKING) {
/* Changing interactive flag? */
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 $
.\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
@ -76,7 +76,7 @@
.\" with -mandoc, it might implement .Mx itself, but we want to
.\" 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.
.\"
@ -4308,9 +4308,11 @@ Automatically enabled if the basename of the shell invocation begins with
.Dq sh
and this autodetection feature is compiled in
.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
mode, which can be turned back on manually, and
and
.Ic utf8\-mode
flags, which can be turned back on manually, and
.Ic sh
mode (unless both are enabled at the same time).
.It Fl o Ic sh
@ -6640,12 +6642,14 @@ supports only the
locale.
.Nm mksh Ns 's
.Ic utf8\-mode
.Em must
be disabled in POSIX mode, and it
only supports the Unicode BMP (Basic Multilingual Plane) and maps
raw octets into the U+EF80..U+EFFF wide character range; compare
.Sx Arithmetic expressions .
The following
.Tn POSIX
.Nm sh
.Nm sh Ns -compatible
code toggles the
.Ic utf8\-mode
option dependent on the current