diff options
author | Peter Stephenson <pws@zsh.org> | 2016-11-15 18:01:32 +0000 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2016-11-15 18:01:32 +0000 |
commit | 921b39ac6b25dbfcc477fc7db4ed1c5c3ffb778c (patch) | |
tree | 47a0b6481316082d3899ad190e444db0d89e698d /Src/subst.c | |
parent | e9dbfa8046e0da6dbb37340df9d3c95f410a713b (diff) | |
download | zsh-921b39ac6b25dbfcc477fc7db4ed1c5c3ffb778c.tar.gz zsh-921b39ac6b25dbfcc477fc7db4ed1c5c3ffb778c.tar.xz zsh-921b39ac6b25dbfcc477fc7db4ed1c5c3ffb778c.zip |
39949: Special case for "-" in directory names.
It can be sh-tokenized to Dash to allow for appearing in ranges after substitution, so needs to be turned back to "-" in that case.
Diffstat (limited to 'Src/subst.c')
-rw-r--r-- | Src/subst.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Src/subst.c b/Src/subst.c index 447177409..c7c552257 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -684,19 +684,19 @@ filesubstr(char **namptr, int assign) *namptr = dyncat(ds, ptr); return 1; } else if ((ptr = itype_end(str+1, IUSER, 0)) != str+1) { /* ~foo */ - char *hom, save; + char *untok, *hom; - save = *ptr; - if (!isend(save)) + if (!isend(*ptr)) return 0; - *ptr = 0; - if (!(hom = getnameddir(++str))) { + untok = dupstring(++str); + untok[ptr-str] = 0; + untokenize(untok); + + if (!(hom = getnameddir(untok))) { if (isset(NOMATCH) && isset(EXECOPT)) - zerr("no such user or named directory: %s", str); - *ptr = save; + zerr("no such user or named directory: %s", untok); return 0; } - *ptr = save; *namptr = dyncat(hom, ptr); return 1; } |