summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2000-11-30 00:03:57 +0000
committerEric Andersen2000-11-30 00:03:57 +0000
commit8c2d3f46ab4fd7310174a96ca770859dabcf325e (patch)
tree5379c0ce4f90ecb4d0d2a57aaf29130fececdad0
parent9bd71e832343489bd53c5d2b454252614564787f (diff)
downloadbusybox-8c2d3f46ab4fd7310174a96ca770859dabcf325e.zip
busybox-8c2d3f46ab4fd7310174a96ca770859dabcf325e.tar.gz
Fix escape char problem.
-rw-r--r--lash.c17
-rw-r--r--sh.c17
-rw-r--r--shell/lash.c17
3 files changed, 39 insertions, 12 deletions
diff --git a/lash.c b/lash.c
index 7f5b906..87d4fbf 100644
--- a/lash.c
+++ b/lash.c
@@ -797,9 +797,13 @@ 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++;
+ src++;
+ }
}
*dst = '\0';
} else if (!rc) {
@@ -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++;
+ src++;
+ }
}
*dst = '\0';
+
prog->globResult.gl_pathc=0;
if (flags==0)
prog->globResult.gl_pathv=NULL;
diff --git a/sh.c b/sh.c
index 7f5b906..87d4fbf 100644
--- a/sh.c
+++ b/sh.c
@@ -797,9 +797,13 @@ 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++;
+ src++;
+ }
}
*dst = '\0';
} else if (!rc) {
@@ -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++;
+ src++;
+ }
}
*dst = '\0';
+
prog->globResult.gl_pathc=0;
if (flags==0)
prog->globResult.gl_pathv=NULL;
diff --git a/shell/lash.c b/shell/lash.c
index 7f5b906..87d4fbf 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -797,9 +797,13 @@ 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++;
+ src++;
+ }
}
*dst = '\0';
} else if (!rc) {
@@ -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++;
+ src++;
+ }
}
*dst = '\0';
+
prog->globResult.gl_pathc=0;
if (flags==0)
prog->globResult.gl_pathv=NULL;