cmd: %* expands to first non-whitespace delimiter of first arg.

This commit is contained in:
Jason Edmeades 2012-10-13 22:24:35 +01:00 committed by Alexandre Julliard
parent 4236c2007d
commit f45f75ca7d
3 changed files with 23 additions and 3 deletions

View File

@ -251,6 +251,16 @@ call tell;1;;2
if errorlevel 2 echo error %ErrorLevel%
call tell "p "1 p" "2
call tell p"1 p";2
echo --------- Testing delimiters and parameter passing --------------
echo @echo 0:%%0,1:%%1,2:%%2,All:'%%*'> tell.bat
call;tell 1 2
call tell 1 2
==call==tell==1==2
call tell(1234)
call tell(12(34)
call tell(12;34)
echo --------- Finished --------------
del tell.bat say*.*
exit
:setError

View File

@ -122,3 +122,11 @@ THIS FAILS: cmd ignoreme/c say one
1:1,2:2@space@
1:"p@space@"1,2:p"@space@"2@space@
1:p"1@space@p",2:2@space@
--------- Testing delimiters and parameter passing --------------
0:tell,1:1,2:2,All:'1 2'@or_broken@0:tell,1:1,2:2,All:' 1 2'
0:tell,1:1,2:2,All:'1 2'@or_broken@0:tell,1:1,2:2,All:' 1 2'
0:tell,1:1,2:2,All:'==1==2'
@todo_wine@0:tell,1:(1234),2:,All:'(1234)'
@todo_wine@0:tell,1:(12(34),2:,All:'(12(34)'
@todo_wine@0:tell,1:(12,2:34),All:'(12;34)'
@todo_wine@--------- Finished --------------

View File

@ -843,10 +843,12 @@ static void handleExpansion(WCHAR *cmd, BOOL justFors,
/* Replace use of %* if in batch program*/
} else if (!justFors && context && *(p+1)=='*') {
WCHAR *startOfParms = NULL;
WCMD_parameter(context -> command, 1, &startOfParms, NULL, TRUE);
if (startOfParms != NULL)
WCMD_parameter(context -> command, 0, NULL, &startOfParms, TRUE);
if (startOfParms != NULL) {
startOfParms++; /* Skip to first delimiter then skip whitespace */
while (*startOfParms==' ' || *startOfParms == '\t') startOfParms++;
WCMD_strsubstW(p, p+2, startOfParms, -1);
else
} else
WCMD_strsubstW(p, p+2, NULL, 0);
} else if (forVariable &&