diff --git a/check.t b/check.t index 8781f9b..65f55b9 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.73 2006/11/10 06:18:05 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.74 2006/11/12 10:44:41 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 $ @@ -6,6 +6,15 @@ # You may also want to test IFS with the script at # http://www.research.att.com/~gsf/public/ifs.sh +expected-stdout: + @(#)MIRBSD KSH R29 2006/11/12 +description: + Check version of shell. +category: pdksh +stdin: + echo $KSH_VERSION +name: KSH_VERSION +--- name: alias-1 description: Check that recursion is detected/avoided in aliases. @@ -3878,12 +3887,3 @@ stdin: expected-stdout: <0hall0 > < 0hall0> <00000hall0> <0000 hallo> --- -name: version-1 -description: - Check version of shell. -category: pdksh -stdin: - echo $KSH_VERSION -expected-stdout: - @(#)MIRBSD KSH R29 2006/11/10 ---- diff --git a/main.c b/main.c index a3c289c..17eff50 100644 --- a/main.c +++ b/main.c @@ -13,7 +13,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.59 2006/11/10 06:53:26 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.60 2006/11/12 10:44:41 tg Exp $"); extern char **environ; @@ -147,18 +147,6 @@ main(int argc, char *argv[]) /* setstr can't fail here */ setstr(vp, def_path, KSH_RETURN_ERROR); - -#if HAVE_SETLOCALE_CTYPE - /* Check if we're in an UTF-8 locale */ - cc = setlocale(LC_CTYPE, ""); -#if HAVE_LANGINFO_CODESET - if (strcasestr(cc, "UTF-8") && strcasestr(cc, "utf8")) - cc = nl_langinfo(CODESET); -#endif - if (!strcasestr(cc, "UTF-8") || !strcasestr(cc, "utf8")) - Flag(FUTFHACK) = 1; -#endif - /* Turn on nohup by default for now - will change to off * by default once people are aware of its existence * (at&t ksh does not have a nohup option - it always sends @@ -281,8 +269,21 @@ main(int argc, char *argv[]) Flag(FMONITOR) = 0; j_init(i); /* Do this after j_init(), as tty_fd is not initialized 'til then */ - if (Flag(FTALKING)) + if (Flag(FTALKING)) { +#if HAVE_SETLOCALE_CTYPE + /* Check if we're in a UTF-8 locale */ + if (!Flag(FUTFHACK)) { + cc = setlocale(LC_CTYPE, ""); +#if HAVE_LANGINFO_CODESET + if (strcasestr(cc, "UTF-8") && strcasestr(cc, "utf8")) + cc = nl_langinfo(CODESET); +#endif + Flag(FUTFHACK) = !(strcasestr(cc, "UTF-8") && + strcasestr(cc, "utf8")); + } +#endif x_init(); + } l = e->loc; l->argv = &argv[argi - 1]; diff --git a/mksh.1 b/mksh.1 index 6827592..278d304 100644 --- a/mksh.1 +++ b/mksh.1 @@ -1,7 +1,7 @@ -.\" $MirOS: src/bin/mksh/mksh.1,v 1.65 2006/11/10 05:23:12 tg Exp $ +.\" $MirOS: src/bin/mksh/mksh.1,v 1.66 2006/11/12 10:44:42 tg Exp $ .\" $OpenBSD: ksh.1,v 1.116 2006/07/26 10:13:25 jmc Exp $ .\" -.Dd November 10, 2006 +.Dd November 12, 2006 .Dt MKSH 1 .Os MirBSD .Sh NAME @@ -3266,7 +3266,7 @@ is used). .It Fl U \(*Ba Ic utf8-hack Enable an experimental UTF-8 hack for the .Sx Emacs editing mode . -This is enabled automatically if your system supports +This is enabled automatically for interactive shells if your system supports .Fn setlocale LC_CTYPE \&"" and optionally .Fn nl_langinfo CODESET , diff --git a/sh.h b/sh.h index 9fb0329..79cf138 100644 --- a/sh.h +++ b/sh.h @@ -8,8 +8,8 @@ /* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */ /* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */ -#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.80 2006/11/10 07:52:03 tg Exp $" -#define MKSH_VERSION "R29 2006/11/10" +#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.81 2006/11/12 10:44:42 tg Exp $" +#define MKSH_VERSION "R29 2006/11/12" #if HAVE_SYS_PARAM_H #include