diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2007-12-17 17:11:29 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2007-12-17 17:11:29 +0000 |
commit | 20607774dc14faaa514623ef2a2f666911aa8b66 (patch) | |
tree | 2eb3a6a5f542522aec9a21876c2ee683cc42bf3f /Src/builtin.c | |
parent | 1ac4f6a77f5dd7d57b01f8bcfa422f17613dfc37 (diff) | |
download | zsh-20607774dc14faaa514623ef2a2f666911aa8b66.tar.gz zsh-20607774dc14faaa514623ef2a2f666911aa8b66.tar.xz zsh-20607774dc14faaa514623ef2a2f666911aa8b66.zip |
24275: fixes for multibyte characters on Solaris
Diffstat (limited to 'Src/builtin.c')
-rw-r--r-- | Src/builtin.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Src/builtin.c b/Src/builtin.c index 7bd4c6d83..8ded1c131 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -4927,7 +4927,7 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func)) break; } *bptr = (char) val; -#ifdef MULTIBYTE_SUPPORT +#ifdef MULTIBYTE_SUPPORT if (isset(MULTIBYTE)) { ret = mbrlen(bptr++, 1, &mbs); if (ret == MB_INVALID) @@ -4954,8 +4954,8 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func)) eof = 1; break; } - -#ifdef MULTIBYTE_SUPPORT + +#ifdef MULTIBYTE_SUPPORT if (isset(MULTIBYTE)) { while (val > 0) { ret = mbrlen(bptr, val, &mbs); @@ -4970,6 +4970,10 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func)) } else if (ret == 0) /* handle null as normal char */ ret = 1; + else if (ret > val) { + /* Some mbrlen()s return the full char len */ + ret = val; + } nchars--; val -= ret; bptr += ret; |