1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-27 04:40:59 +01:00

12719: quoting arrays in vared with real backslashes

This commit is contained in:
Peter Stephenson 2000-08-29 20:27:47 +00:00
parent f4f38507e5
commit 942009eb9f
4 changed files with 23 additions and 10 deletions

View file

@ -839,13 +839,16 @@ bin_vared(char *name, char **args, char *ops, int func)
tptr = tmparr = (char **)zhalloc(sizeof(char *)*(arrlen(arr)+1));
for (aptr = arr; *aptr; aptr++) {
int sepcount = 0;
/* See if this word contains a separator character */
/*
* See if this word contains a separator character
* or backslash
*/
for (t = *aptr; *t; t++) {
if (*t == Meta) {
if (isep(t[1] ^ 32))
sepcount++;
t++;
} else if (isep(*t))
} else if (isep(*t) || *t == '\\')
sepcount++;
}
if (sepcount) {
@ -858,7 +861,7 @@ bin_vared(char *name, char **args, char *ops, int func)
if (isep(t[1] ^ 32))
*nptr++ = '\\';
*nptr++ = *t++;
} else if (isep(*t))
} else if (isep(*t) || *t == '\\')
*nptr++ = '\\';
*nptr++ = *t++;
}