Jason Edmeades : cmd.exe: Allow = and , to be delimiters.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Sep 12 07:50:46 CDT 2007
Module: wine
Branch: master
Commit: 118f3a6592887bc662e7a3204d41b4443f8fcd01
URL: http://source.winehq.org/git/wine.git/?a=commit;h=118f3a6592887bc662e7a3204d41b4443f8fcd01
Author: Jason Edmeades <jason.edmeades at googlemail.com>
Date: Tue Sep 11 21:43:04 2007 +0100
cmd.exe: Allow = and , to be delimiters.
---
programs/cmd/batch.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c
index 1e60848..37eafb1 100644
--- a/programs/cmd/batch.c
+++ b/programs/cmd/batch.c
@@ -134,7 +134,7 @@ void WCMD_batch (WCHAR *file, WCHAR *command, int called, WCHAR *startLabel, HAN
/*******************************************************************
* WCMD_parameter - extract a parameter from a command line.
*
- * Returns the 'n'th space-delimited parameter on the command line (zero-based).
+ * Returns the 'n'th delimited parameter on the command line (zero-based).
* Parameter is in static storage overwritten on the next call.
* Parameters in quotes (and brackets) are handled.
* Also returns a pointer to the location of the parameter in the command line.
@@ -150,7 +150,7 @@ WCHAR *WCMD_parameter (WCHAR *s, int n, WCHAR **where) {
p = param;
while (TRUE) {
switch (*s) {
- case ' ':
+ case ' ': /* Skip leading spaces */
s++;
break;
case '"':
@@ -176,15 +176,20 @@ WCHAR *WCMD_parameter (WCHAR *s, int n, WCHAR **where) {
default:
/* Only return where if it is for the right parameter */
if (where != NULL && i==n) *where = s;
- while ((*s != '\0') && (*s != ' ')) {
+ while ((*s != '\0') && (*s != ' ') && (*s != ',') && (*s != '=')) {
*p++ = *s++;
}
- if (i == n) {
+ if (i == n && (p!=param)) {
*p = '\0';
return param;
}
+ /* Skip double delimiters, eg. dir a.a,,,,,b.b */
+ if (p != param) {
param[0] = '\0';
i++;
+ } else {
+ s++; /* Skip delimter */
+ }
p = param;
}
}
More information about the wine-cvs
mailing list