diff options
author | Paul Ackersviller <packersv@users.sourceforge.net> | 2007-05-08 03:19:36 +0000 |
---|---|---|
committer | Paul Ackersviller <packersv@users.sourceforge.net> | 2007-05-08 03:19:36 +0000 |
commit | 8895a0fa942f69d698a6aefe19f4928ab808a54b (patch) | |
tree | 830b87707adc236b7b808505d1a61338b0a2661e /Src | |
parent | 18e408f3de019ddbd97ab87adf28dbfedc636812 (diff) | |
download | zsh-8895a0fa942f69d698a6aefe19f4928ab808a54b.tar.gz zsh-8895a0fa942f69d698a6aefe19f4928ab808a54b.tar.xz zsh-8895a0fa942f69d698a6aefe19f4928ab808a54b.zip |
Merge trunk revisions 1.{79,80,81} for 21509 and two unposted.
Diffstat (limited to 'Src')
-rw-r--r-- | Src/utils.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/Src/utils.c b/Src/utils.c index 66585f10e..d2250f465 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -3493,21 +3493,22 @@ ucs4toutf8(char *dest, unsigned int wval) /* * Decode a key string, turning it into the literal characters. - * The length is returned in len. - * fromwhere determines how the processing works. + * The length is (usually) returned in *len. + * fromwhere determines how the processing works: * 0: Don't handle keystring, just print-like escapes. - * Expects misc to be present. - * 1: Handle Emacs-like \C-X arguments etc., but not ^X - * Expects misc to be present. + * If a \c escape is seen, *misc is set to 1. + * 1: Handle Emacs-like \C-X arguments etc., but not ^X. + * If a \c escape is seen, *misc is set to 1. * 2: Handle ^X as well as emacs-like keys; don't handle \c - * for no newlines. - * 3: As 1, but don't handle \c. + * (the misc arg is not used). + * 3: As 1, but don't handle \c (the misc arg is not used). * 4: Do $'...' quoting. Overwrites the existing string instead of * zhalloc'ing. If \uNNNN ever generates multi-byte chars longer * than 6 bytes, will need to adjust this to re-allocate memory. - * 5: As 2, but \- is special. Expects misc to be defined. - * 6: As 2, but parses only one character and returns end-pointer - * and parsed character in *misc + * 5: As 2, but \- is special. If \- is seen, *misc is set to 1. + * 6: As 2, but parses only one character: returns a pointer to the + * next character and puts the parsed character into *misc (the + * len arg is not used). */ /**/ @@ -3573,6 +3574,7 @@ getkeystring(char *s, int *len, int fromwhere, int *misc) *t++ = '\\', s--; continue; } + /* FALL THROUGH */ case 'e': *t++ = '\033'; break; @@ -3604,8 +3606,11 @@ getkeystring(char *s, int *len, int fromwhere, int *misc) case 'c': if (fromwhere < 2) { *misc = 1; - break; + *t = '\0'; + *len = t - buf; + return buf; } + goto def; case 'u': case 'U': wval = 0; |