Jason Edmeades : xcopy: Rearrange code to closely match windows ordering.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 2 06:23:15 CDT 2007


Module: wine
Branch: master
Commit: a5cbc372b3dcc519aa7cb538543929d587bea4fa
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a5cbc372b3dcc519aa7cb538543929d587bea4fa

Author: Jason Edmeades <us at edmeades.me.uk>
Date:   Fri Mar 30 19:20:19 2007 +0100

xcopy: Rearrange code to closely match windows ordering.

Effectively work out if we are interested in a file before worrying
about prompting for copy or overwrite.

---

 programs/xcopy/xcopy.c |   86 ++++++++++++++++++++++++------------------------
 1 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/programs/xcopy/xcopy.c b/programs/xcopy/xcopy.c
index b95d748..73d4306 100644
--- a/programs/xcopy/xcopy.c
+++ b/programs/xcopy/xcopy.c
@@ -585,25 +585,6 @@ static int XCOPY_DoCopy(WCHAR *srcstem, WCHAR *srcspec,
                 skipFile = TRUE;
             }
 
-            /* Prompt each file if necessary */
-            if (!skipFile && (flags & OPT_SRCPROMPT)) {
-                DWORD count;
-                char  answer[10];
-                BOOL  answered = FALSE;
-
-                while (!answered) {
-                    printf("%S? (Yes|No)\n", copyFrom);
-                    ReadFile (GetStdHandle(STD_INPUT_HANDLE), answer, sizeof(answer),
-                              &count, NULL);
-
-                    answered = TRUE;
-                    if (toupper(answer[0]) == 'N')
-                        skipFile = TRUE;
-                    else if (toupper(answer[0]) != 'Y')
-                        answered = FALSE;
-                }
-            }
-
             /* See if file exists */
             destAttribs = GetFileAttributesW(copyTo);
             WINE_TRACE("Dest attribs: %d\n", srcAttribs);
@@ -633,6 +614,49 @@ static int XCOPY_DoCopy(WCHAR *srcstem, WCHAR *srcspec,
                 }
             }
 
+            /* See if exclude list provided. Note since filenames are case
+               insensitive, need to uppercase the filename before doing
+               strstr                                                     */
+            if (!skipFile && (flags & OPT_EXCLUDELIST)) {
+                EXCLUDELIST *pos = excludeList;
+                WCHAR copyFromUpper[MAX_PATH];
+
+                /* Uppercase source filename */
+                lstrcpyW(copyFromUpper, copyFrom);
+                CharUpperBuff(copyFromUpper, lstrlenW(copyFromUpper));
+
+                /* Loop through testing each exclude line */
+                while (pos) {
+                    if (wcsstr(copyFromUpper, pos->name) != NULL) {
+                        WINE_TRACE("Skipping file as matches exclude '%s'\n",
+                                   wine_dbgstr_w(pos->name));
+                        skipFile = TRUE;
+                        pos = NULL;
+                    } else {
+                        pos = pos->next;
+                    }
+                }
+            }
+
+            /* Prompt each file if necessary */
+            if (!skipFile && (flags & OPT_SRCPROMPT)) {
+                DWORD count;
+                char  answer[10];
+                BOOL  answered = FALSE;
+
+                while (!answered) {
+                    printf("%S? (Yes|No)\n", copyFrom);
+                    ReadFile (GetStdHandle(STD_INPUT_HANDLE), answer, sizeof(answer),
+                              &count, NULL);
+
+                    answered = TRUE;
+                    if (toupper(answer[0]) == 'N')
+                        skipFile = TRUE;
+                    else if (toupper(answer[0]) != 'Y')
+                        answered = FALSE;
+                }
+            }
+
             if (!skipFile &&
                 destAttribs != INVALID_FILE_ATTRIBUTES && !(flags & OPT_NOPROMPT)) {
                 DWORD count;
@@ -659,30 +683,6 @@ static int XCOPY_DoCopy(WCHAR *srcstem, WCHAR *srcspec,
                 skipFile = TRUE;
             }
 
-            /* See if exclude list provided. Note since filenames are case
-               insensitive, need to uppercase the filename before doing
-               strstr                                                     */
-            if (!skipFile && (flags & OPT_EXCLUDELIST)) {
-                EXCLUDELIST *pos = excludeList;
-                WCHAR copyFromUpper[MAX_PATH];
-
-                /* Uppercase source filename */
-                lstrcpyW(copyFromUpper, copyFrom);
-                CharUpperBuff(copyFromUpper, lstrlenW(copyFromUpper));
-
-                /* Loop through testing each exclude line */
-                while (pos) {
-                    if (wcsstr(copyFromUpper, pos->name) != NULL) {
-                        WINE_TRACE("Skipping file as matches exclude '%s'\n",
-                                   wine_dbgstr_w(pos->name));
-                        skipFile = TRUE;
-                        pos = NULL;
-                    } else {
-                        pos = pos->next;
-                    }
-                }
-            }
-
             /* Output a status message */
             if (!skipFile) {
                 if (flags & OPT_QUIET) {




More information about the wine-cvs mailing list