From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- programs/cmd/tests/test_builtins.cmd | 1 - programs/cmd/tests/test_builtins.cmd.exp | 3 +-- programs/cmd/wcmdmain.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 8107735dbb3..9a673a40467 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -2448,7 +2448,6 @@ rem Testing limits (max number of contiguous variables, limit at 127) (for /f "tokens=1-31" %%A in ("a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z") do echo U=%%U V=%%V W=%%W X=%%X Y=%%Y Z=%%Z ^[=%%^[ ^=%%^\ ^]=%%^] ^^=%%^^ _=%%_ `=%%` A=%%A a=%%a) || echo failure (for /f "tokens=1-32" %%A in ("a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z") do echo U=%%U V=%%V W=%%W X=%%X Y=%%Y Z=%%Z ^[=%%^[ ^=%%^\ ^]=%%^] ^^=%%^^ _=%%_ `=%%` A=%%A a=%%a) || echo failure %%A for /f "tokens=1-20" %%} in ("a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z") do echo ^}=%%^} ^~=%%^~ -echo ---- temp rem Show negative ranges have no effect for /f "tokens=1-3,5" %%i in ("a b c d e f g") do echo h=%%h i=%%i j=%%j k=%%k l=%%l m=%%m o=%%o for /f "tokens=3-1,5" %%i in ("a b c d e f g") do echo h=%%h i=%%i j=%%j k=%%k l=%%l m=%%m o=%%o diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 2796acc94f5..4875e1db507 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1603,8 +1603,7 @@ u=a v=b w=c x=d y=e z=f A=%A a=%a U=a V=b W=c X=d Y=e Z=f [=g =h ]=i ^=j _=k `=l A=%A a=m U=u V=v W=w X=x Y=y Z=z [=A =B ]=C ^=D _=E `=%` A=a a=%a @todo_wine@failure %A -@todo_wine@}=a ~=b ----- temp +}=a ~=b h=%h i=a j=b k=c l=e m=%m o=%o@or_broken@h=%h i=a j=b k=c l=e m= o=%o h=%h i=e j=%j k=%k l=%l m=%m o=%o h=%h i=a j=b k=c l=d e f g m=%m n=%n o=%o@or_broken@h=%h i=a j=b k=c l=d e f g m= n=%n o=%o diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index eb38d0ffd17..f87796f4d8a 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -747,7 +747,7 @@ static void handleExpansion(WCHAR *cmd, BOOL atExecute) { if (context) WCMD_strsubstW(p, p + 1, NULL, 0); if (!context || startchar == L'%') p++; /* Replace %~ modifications if in batch program */ - } else if (*(p+1) == '~') { + } else if (p[1] == L'~' && p[2] && !iswspace(p[2])) { WCMD_HandleTildeModifiers(&p, atExecute); p++;