diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2006-11-02 18:43:19 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2006-11-02 18:43:19 +0000 |
commit | d8207acddbd1ad5e9339115f7b7bf09820b98c5a (patch) | |
tree | 710aa94ec2ee2d06bedd341d0e546d0301af4c03 /Src/params.c | |
parent | d94e67d6fd182860dca7580edc151315c048f6d7 (diff) | |
download | zsh-d8207acddbd1ad5e9339115f7b7bf09820b98c5a.tar.gz zsh-d8207acddbd1ad5e9339115f7b7bf09820b98c5a.tar.xz zsh-d8207acddbd1ad5e9339115f7b7bf09820b98c5a.zip |
22952: fix some argument delimiters to work with multibyte characters
Diffstat (limited to 'Src/params.c')
-rw-r--r-- | Src/params.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Src/params.c b/Src/params.c index e60c8c740..7d7f0e8e7 100644 --- a/Src/params.c +++ b/Src/params.c @@ -947,7 +947,7 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w, int *prevcharlen, int *nextcharlen) { int hasbeg = 0, word = 0, rev = 0, ind = 0, down = 0, l, i, ishash; - int keymatch = 0, needtok = 0; + int keymatch = 0, needtok = 0, arglen; char *s = *str, *sep = NULL, *t, sav, *d, **ta, **p, *tt, c; zlong num = 1, beg = 0, r = 0; Patprog pprog = NULL; @@ -1004,28 +1004,28 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w, * special interpretation by getindex() of `*' or `@'. */ break; case 'n': - t = get_strarg(++s); + t = get_strarg(++s, &arglen); if (!*t) goto flagerr; sav = *t; *t = '\0'; - num = mathevalarg(s + 1, &d); + num = mathevalarg(s + arglen, &d); if (!num) num = 1; *t = sav; - s = t; + s = t + arglen - 1; break; case 'b': hasbeg = 1; - t = get_strarg(++s); + t = get_strarg(++s, &arglen); if (!*t) goto flagerr; sav = *t; *t = '\0'; - if ((beg = mathevalarg(s + 1, &d)) > 0) + if ((beg = mathevalarg(s + arglen, &d)) > 0) beg--; *t = sav; - s = t; + s = t + arglen - 1; break; case 'p': escapes = 1; @@ -1033,15 +1033,16 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w, case 's': /* This gives the string that separates words * * (for use with the `w' flag). */ - t = get_strarg(++s); + t = get_strarg(++s, &arglen); if (!*t) goto flagerr; sav = *t; *t = '\0'; - sep = escapes ? getkeystring(s + 1, &waste, GETKEYS_SEP, NULL) - : dupstring(s + 1); + s += arglen; + sep = escapes ? getkeystring(s, &waste, GETKEYS_SEP, NULL) + : dupstring(s); *t = sav; - s = t; + s = t + arglen - 1; break; default: flagerr: |