From 309c674ed779b65e3628384b9661b9208a2d3171 Mon Sep 17 00:00:00 2001 From: tg Date: Sun, 20 Apr 2008 00:24:26 +0000 Subject: [PATCH] mostly revert 100480A853206FB56FA and parse utf-8 lead bytes ourselves --- check.t | 15 ++++++++------- expr.c | 7 +------ mksh.1 | 5 ++--- sh.h | 4 ++-- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/check.t b/check.t index 910dfb4..c37a5b2 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.180 2008/04/20 00:11:29 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.181 2008/04/20 00:24:25 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 $ @@ -7,7 +7,7 @@ # http://www.research.att.com/~gsf/public/ifs.sh expected-stdout: - @(#)MIRBSD KSH R33 2008/04/19 + @(#)MIRBSD KSH R33 2008/04/20 description: Check version of shell. category: pdksh @@ -4822,14 +4822,15 @@ stdin: while IFS= read -r line; do line=$line$nl while [[ -n $line ]]; do - if (( ${#line} > 2 )) && let wc="1#${line::3}"; then - n=3 - elif (( ${#line} > 1 )) && let wc="1#${line::2}"; then + (( hv = 1#${line::1} & 0xFF )) + if (( hv < 0xC2 )); then + n=1 + elif (( hv < 0xE0 )); then n=2 else - wc=1#${line::1} - n=1 + n=3 fi + wc=1#${line::n} if (( (wc < 32) || \ ((wc > 126) && (wc < 160)) )); then dch=. diff --git a/expr.c b/expr.c index 4dfb12d..e9ab4c3 100644 --- a/expr.c +++ b/expr.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.16 2008/04/19 23:49:58 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.17 2008/04/20 00:24:25 tg Exp $"); /* The order of these enums is constrained by the order of opinfo[] */ enum token { @@ -478,11 +478,6 @@ exprtoken(Expr_state *es) } else if (c == '1' && cp[1] == '#') { utf_cptradj(cp + 2, &cp); tvar = str_nsave(es->tokp, cp - es->tokp, ATEMP); - if (*cp) { - *tvar = '\0'; /* produce an artificial error */ - while (*cp) /* and skip until end of expr */ - ++cp; - } goto process_tvar; } else if (ksh_isdigit(c)) { while (c != '_' && (ksh_isalnux(c) || c == '#')) diff --git a/mksh.1 b/mksh.1 index 72c610a..122eda5 100644 --- a/mksh.1 +++ b/mksh.1 @@ -1,4 +1,4 @@ -.\" $MirOS: src/bin/mksh/mksh.1,v 1.119 2008/04/19 23:49:59 tg Exp $ +.\" $MirOS: src/bin/mksh/mksh.1,v 1.120 2008/04/20 00:24:25 tg Exp $ .\" $OpenBSD: ksh.1,v 1.121 2008/03/21 12:51:19 millert Exp $ .\"- .\" Try to make GNU groff and AT&T nroff more compatible @@ -30,7 +30,7 @@ .el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 .. .\"- -.Dd $Mdocdate: April 19 2008 $ +.Dd $Mdocdate: April 20 2008 $ .Dt MKSH 1 .Os MirBSD .Sh NAME @@ -2118,7 +2118,6 @@ transparent) ASCII or Unicode codepoints, depending on the shell's flag (current setting). In Unicode mode, raw octets are mapped into the range EF80..EFFF, which is in the PUA and has been assigned by CSUR for this use. -Base 1 integers can only be the last part of an assignment. .Pp The operators are evaluated as follows: .Bl -tag -width Ds -offset indent diff --git a/sh.h b/sh.h index f6aab52..3ea2a3d 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.208 2008/04/20 00:03:50 tg Exp $" -#define MKSH_VERSION "R33 2008/04/19" +#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.209 2008/04/20 00:24:26 tg Exp $" +#define MKSH_VERSION "R33 2008/04/20" #if HAVE_SYS_PARAM_H #include