cmd.exe: Fix parameter parsing returns.
Only return valid values for the location of the parameter if it is
the one requested. Currently returns address when ANY quoted or
bracketed parameter found.
diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c
index 5a854f7..bbc3f83 100644
--- a/programs/cmd/batch.c
+++ b/programs/cmd/batch.c
@@ -147,6 +147,7 @@
static char param[MAX_PATH];
char *p;
+ if (where != NULL) *where = NULL;
p = param;
while (TRUE) {
switch (*s) {
@@ -154,7 +155,7 @@
s++;
break;
case '"':
- if (where != NULL) *where = s;
+ if (where != NULL && i==n) *where = s;
s++;
while ((*s != '\0') && (*s != '"')) {
*p++ = *s++;
@@ -169,7 +170,7 @@
p = param;
break;
case '(':
- if (where != NULL) *where = s;
+ if (where != NULL && i==n) *where = s;
s++;
while ((*s != '\0') && (*s != ')')) {
*p++ = *s++;