diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2006-09-10 19:11:53 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2006-09-10 19:11:53 +0000 |
commit | 6c887892f9e6261f65767f6fcbeedd27c1137f16 (patch) | |
tree | fc2ec36079a4fd7c95452336f1c2abafe438ee85 | |
parent | 80acfd135cb41dc63b2e037fe8c18bcf46ce929c (diff) | |
download | zsh-6c887892f9e6261f65767f6fcbeedd27c1137f16.tar.gz zsh-6c887892f9e6261f65767f6fcbeedd27c1137f16.tar.xz zsh-6c887892f9e6261f65767f6fcbeedd27c1137f16.zip |
22685: make printf "%d" \"X handle multibyte characters
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Src/builtin.c | 21 |
2 files changed, 21 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog index a3a870af4..447f6cfa4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-09-10 Peter Stephenson <p.w.stephenson@ntlworld.com> + * 22685: Src/builtin.c: printf "%d" \'X should handle multibyte + characters X. + * 22684: Src/builtin.c, Src/math.c, Src/params.c, Src/subst.c, Src/utils.c, Src/zsh.h, Src/Zle/zle_hist.c, Src/Zle/zle_hist.c, Src/Zle/zle_misc.c: rewrite getkeystring() to have something diff --git a/Src/builtin.c b/Src/builtin.c index 979075392..dbe50d13c 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -3938,7 +3938,8 @@ bin_print(char *name, char **args, Options ops, int func) char *b; int l; if (*c == 'b') { - b = getkeystring(metafy(curarg, curlen, META_USEHEAP), &l, + b = getkeystring(metafy(curarg, curlen, META_USEHEAP), + &l, OPT_ISSET(ops,'b') ? GETKEYS_BINDKEY : GETKEYS_PRINTF, &nnl); } else { @@ -4004,11 +4005,25 @@ bin_print(char *name, char **args, Options ops, int func) if (type > 0) { if (curarg && (*curarg == '\'' || *curarg == '"' )) { + convchar_t cc; +#ifdef MULTIBYTE_SUPPORT + if (isset(MULTIBYTE)) { + mb_metacharinit(); + (void)mb_metacharlenconv(metafy(curarg+1, curlen-1, + META_USEHEAP), &cc); + } + else + cc = WEOF; + if (cc == WEOF) + cc = (curlen > 1) ? STOUC(curarg[1]) : 0; +#else + cc = (curlen > 1) ? STOUC(curarg[1]) : 0; +#endif if (type == 2) { - doubleval = STOUC(curarg[1]); + doubleval = cc; print_val(doubleval); } else { - intval = STOUC(curarg[1]); + intval = cc; print_val(intval); } } else { |