Fix escape char problem.
This commit is contained in:
parent
9bd71e8323
commit
8c2d3f46ab
17
lash.c
17
lash.c
@ -797,9 +797,13 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
|
|||||||
/* we need to remove whatever \ quoting is still present */
|
/* we need to remove whatever \ quoting is still present */
|
||||||
src = dst = prog->argv[argc_l - 1];
|
src = dst = prog->argv[argc_l - 1];
|
||||||
while (*src) {
|
while (*src) {
|
||||||
if (*src != '\\')
|
if (*src == '\\') {
|
||||||
|
src++;
|
||||||
|
*dst++ = process_escape_sequence(&src);
|
||||||
|
} else {
|
||||||
*dst++ = *src;
|
*dst++ = *src;
|
||||||
src++;
|
src++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
} else if (!rc) {
|
} else if (!rc) {
|
||||||
@ -812,11 +816,16 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
|
|||||||
}else{
|
}else{
|
||||||
src = dst = prog->argv[argc_l - 1];
|
src = dst = prog->argv[argc_l - 1];
|
||||||
while (*src) {
|
while (*src) {
|
||||||
if (*src != '\\')
|
if (*src == '\\') {
|
||||||
|
src++;
|
||||||
|
*dst++ = process_escape_sequence(&src);
|
||||||
|
} else {
|
||||||
*dst++ = *src;
|
*dst++ = *src;
|
||||||
src++;
|
src++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
|
|
||||||
prog->globResult.gl_pathc=0;
|
prog->globResult.gl_pathc=0;
|
||||||
if (flags==0)
|
if (flags==0)
|
||||||
prog->globResult.gl_pathv=NULL;
|
prog->globResult.gl_pathv=NULL;
|
||||||
|
17
sh.c
17
sh.c
@ -797,9 +797,13 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
|
|||||||
/* we need to remove whatever \ quoting is still present */
|
/* we need to remove whatever \ quoting is still present */
|
||||||
src = dst = prog->argv[argc_l - 1];
|
src = dst = prog->argv[argc_l - 1];
|
||||||
while (*src) {
|
while (*src) {
|
||||||
if (*src != '\\')
|
if (*src == '\\') {
|
||||||
|
src++;
|
||||||
|
*dst++ = process_escape_sequence(&src);
|
||||||
|
} else {
|
||||||
*dst++ = *src;
|
*dst++ = *src;
|
||||||
src++;
|
src++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
} else if (!rc) {
|
} else if (!rc) {
|
||||||
@ -812,11 +816,16 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
|
|||||||
}else{
|
}else{
|
||||||
src = dst = prog->argv[argc_l - 1];
|
src = dst = prog->argv[argc_l - 1];
|
||||||
while (*src) {
|
while (*src) {
|
||||||
if (*src != '\\')
|
if (*src == '\\') {
|
||||||
|
src++;
|
||||||
|
*dst++ = process_escape_sequence(&src);
|
||||||
|
} else {
|
||||||
*dst++ = *src;
|
*dst++ = *src;
|
||||||
src++;
|
src++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
|
|
||||||
prog->globResult.gl_pathc=0;
|
prog->globResult.gl_pathc=0;
|
||||||
if (flags==0)
|
if (flags==0)
|
||||||
prog->globResult.gl_pathv=NULL;
|
prog->globResult.gl_pathv=NULL;
|
||||||
|
17
shell/lash.c
17
shell/lash.c
@ -797,9 +797,13 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
|
|||||||
/* we need to remove whatever \ quoting is still present */
|
/* we need to remove whatever \ quoting is still present */
|
||||||
src = dst = prog->argv[argc_l - 1];
|
src = dst = prog->argv[argc_l - 1];
|
||||||
while (*src) {
|
while (*src) {
|
||||||
if (*src != '\\')
|
if (*src == '\\') {
|
||||||
|
src++;
|
||||||
|
*dst++ = process_escape_sequence(&src);
|
||||||
|
} else {
|
||||||
*dst++ = *src;
|
*dst++ = *src;
|
||||||
src++;
|
src++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
} else if (!rc) {
|
} else if (!rc) {
|
||||||
@ -812,11 +816,16 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
|
|||||||
}else{
|
}else{
|
||||||
src = dst = prog->argv[argc_l - 1];
|
src = dst = prog->argv[argc_l - 1];
|
||||||
while (*src) {
|
while (*src) {
|
||||||
if (*src != '\\')
|
if (*src == '\\') {
|
||||||
|
src++;
|
||||||
|
*dst++ = process_escape_sequence(&src);
|
||||||
|
} else {
|
||||||
*dst++ = *src;
|
*dst++ = *src;
|
||||||
src++;
|
src++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
|
|
||||||
prog->globResult.gl_pathc=0;
|
prog->globResult.gl_pathc=0;
|
||||||
if (flags==0)
|
if (flags==0)
|
||||||
prog->globResult.gl_pathv=NULL;
|
prog->globResult.gl_pathv=NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user