Jason Edmeades : cmd.exe: for loop by default only matches files.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 18 08:05:19 CDT 2007
Module: wine
Branch: master
Commit: 196fb10c327241f3a27a96faa44e149160395c85
URL: http://source.winehq.org/git/wine.git/?a=commit;h=196fb10c327241f3a27a96faa44e149160395c85
Author: Jason Edmeades <jason.edmeades at googlemail.com>
Date: Fri Jun 15 20:59:29 2007 +0100
cmd.exe: for loop by default only matches files.
---
programs/cmd/builtins.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index a764228..2a075c5 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -593,6 +593,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
WCHAR variable[4];
WCHAR *firstCmd;
int thisDepth;
+ BOOL isDirs = FALSE;
/* Check:
the first line includes the % variable name as first parm
@@ -667,10 +668,15 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
hff = FindFirstFile (item, &fd);
if (hff != INVALID_HANDLE_VALUE) {
do {
- thisCmdStart = cmdStart;
- WINE_TRACE("Processing FOR filename %s\n", wine_dbgstr_w(fd.cFileName));
- WCMD_part_execute (&thisCmdStart, firstCmd, variable,
- fd.cFileName, FALSE, TRUE);
+ BOOL isDirectory = (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+ if ((isDirs && isDirectory) ||
+ (!isDirs && !isDirectory))
+ {
+ thisCmdStart = cmdStart;
+ WINE_TRACE("Processing FOR filename %s\n", wine_dbgstr_w(fd.cFileName));
+ WCMD_part_execute (&thisCmdStart, firstCmd, variable,
+ fd.cFileName, FALSE, TRUE);
+ }
} while (FindNextFile(hff, &fd) != 0);
FindClose (hff);
More information about the wine-cvs
mailing list