Fix escape char problem.

This commit is contained in:
Eric Andersen 2000-11-30 00:03:57 +00:00
parent 9bd71e8323
commit 8c2d3f46ab
3 changed files with 39 additions and 12 deletions

13
lash.c
View File

@ -797,10 +797,14 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
/* we need to remove whatever \ quoting is still present */
src = dst = prog->argv[argc_l - 1];
while (*src) {
if (*src != '\\')
if (*src == '\\') {
src++;
*dst++ = process_escape_sequence(&src);
} else {
*dst++ = *src;
src++;
}
}
*dst = '\0';
} else if (!rc) {
argcAlloced += (prog->globResult.gl_pathc - i);
@ -812,11 +816,16 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
}else{
src = dst = prog->argv[argc_l - 1];
while (*src) {
if (*src != '\\')
if (*src == '\\') {
src++;
*dst++ = process_escape_sequence(&src);
} else {
*dst++ = *src;
src++;
}
}
*dst = '\0';
prog->globResult.gl_pathc=0;
if (flags==0)
prog->globResult.gl_pathv=NULL;

13
sh.c
View File

@ -797,10 +797,14 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
/* we need to remove whatever \ quoting is still present */
src = dst = prog->argv[argc_l - 1];
while (*src) {
if (*src != '\\')
if (*src == '\\') {
src++;
*dst++ = process_escape_sequence(&src);
} else {
*dst++ = *src;
src++;
}
}
*dst = '\0';
} else if (!rc) {
argcAlloced += (prog->globResult.gl_pathc - i);
@ -812,11 +816,16 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
}else{
src = dst = prog->argv[argc_l - 1];
while (*src) {
if (*src != '\\')
if (*src == '\\') {
src++;
*dst++ = process_escape_sequence(&src);
} else {
*dst++ = *src;
src++;
}
}
*dst = '\0';
prog->globResult.gl_pathc=0;
if (flags==0)
prog->globResult.gl_pathv=NULL;

View File

@ -797,10 +797,14 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
/* we need to remove whatever \ quoting is still present */
src = dst = prog->argv[argc_l - 1];
while (*src) {
if (*src != '\\')
if (*src == '\\') {
src++;
*dst++ = process_escape_sequence(&src);
} else {
*dst++ = *src;
src++;
}
}
*dst = '\0';
} else if (!rc) {
argcAlloced += (prog->globResult.gl_pathc - i);
@ -812,11 +816,16 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
}else{
src = dst = prog->argv[argc_l - 1];
while (*src) {
if (*src != '\\')
if (*src == '\\') {
src++;
*dst++ = process_escape_sequence(&src);
} else {
*dst++ = *src;
src++;
}
}
*dst = '\0';
prog->globResult.gl_pathc=0;
if (flags==0)
prog->globResult.gl_pathv=NULL;