diff --git a/check.t b/check.t index d8475ad..a87959e 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.711 2015/10/13 21:39:53 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.712 2015/10/24 19:46:07 tg Exp $ # -*- mode: sh -*- #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, @@ -30,7 +30,7 @@ # (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date expected-stdout: - @(#)MIRBSD KSH R51 2015/10/09 + @(#)MIRBSD KSH R51 2015/10/24 description: Check version of shell. stdin: @@ -39,7 +39,7 @@ name: KSH_VERSION category: shell:legacy-no --- expected-stdout: - @(#)LEGACY KSH R51 2015/10/09 + @(#)LEGACY KSH R51 2015/10/24 description: Check version of legacy shell. stdin: @@ -8538,13 +8538,36 @@ expected-stdout: 0 1 --- +name: varexpand-funny-chars +description: + Check some characters + XXX \uEF80 is asymmetric, possibly buggy so we don’t check this +stdin: + x=$'<\x00>'; typeset -p x + x=$'<\x01>'; typeset -p x + x=$'<\u0000>'; typeset -p x + x=$'<\u0001>'; typeset -p x +expected-stdout: + typeset x='<' + typeset x=$'<\001>' + typeset x='<' + typeset x=$'<\001>' +--- name: print-funny-chars description: Check print builtin's capability to output designated characters stdin: print '<\0144\0344\xDB\u00DB\u20AC\uDB\x40>' + print '<\x00>' + print '<\x01>' + print '<\u0000>' + print '<\u0001>' expected-stdout: + <> + <> + <> + <> --- name: print-bksl-c description: diff --git a/funcs.c b/funcs.c index 614eadc..16fcb0f 100644 --- a/funcs.c +++ b/funcs.c @@ -38,7 +38,7 @@ #endif #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.286 2015/10/09 21:36:55 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.287 2015/10/24 19:46:09 tg Exp $"); #if HAVE_KILLPG /* @@ -431,8 +431,10 @@ c_print(const char **wp) char ts[4]; ts[utf_wctomb(ts, c - 0x100)] = 0; - for (c = 0; ts[c]; ++c) + c = 0; + do { Xput(xs, xp, ts[c]); + } while (ts[++c]); continue; } } diff --git a/lex.c b/lex.c index b0cfc26..740265a 100644 --- a/lex.c +++ b/lex.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.212 2015/10/09 19:29:48 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.213 2015/10/24 19:46:10 tg Exp $"); /* * states while lexing word @@ -601,10 +601,11 @@ yylex(int cf) } else { cz = utf_wctomb(ts, c2 - 0x100); ts[cz] = 0; - for (cz = 0; ts[cz]; ++cz) { + cz = 0; + do { *wp++ = QCHAR; *wp++ = ts[cz]; - } + } while (ts[++cz]); } } } else if (!statep->ls_bool) {