Jason Edmeades : xcopy: Add support for /N (shortname copy).

Alexandre Julliard julliard at wine.codeweavers.com
Fri Mar 30 06:20:21 CDT 2007


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

Author: Jason Edmeades <us at edmeades.me.uk>
Date:   Thu Mar 29 22:21:04 2007 +0100

xcopy: Add support for /N (shortname copy).

---

 programs/xcopy/xcopy.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/programs/xcopy/xcopy.c b/programs/xcopy/xcopy.c
index 0342d39..281f812 100644
--- a/programs/xcopy/xcopy.c
+++ b/programs/xcopy/xcopy.c
@@ -49,6 +49,7 @@
 #define OPT_PAUSE        0x00000040
 #define OPT_NOCOPY       0x00000080
 #define OPT_NOPROMPT     0x00000100
+#define OPT_SHORTNAME    0x00000200
 
 #define MAXSTRING 8192
 
@@ -151,6 +152,7 @@ int main (int argc, char *argv[])
             case 'W': flags |= OPT_PAUSE;         break;
             case 'T': flags |= OPT_NOCOPY | OPT_RECURSIVE; break;
             case 'Y': flags |= OPT_NOPROMPT;      break;
+            case 'N': flags |= OPT_SHORTNAME;     break;
             case '-': if (toupper(argvW[0][2])=='Y')
                           flags &= ~OPT_NOPROMPT; break;
             default:
@@ -412,11 +414,19 @@ static int XCOPY_DoCopy(WCHAR *srcstem, WCHAR *srcspec,
 
             /* Get the filename information */
             lstrcpyW(copyFrom, srcstem);
-            lstrcatW(copyFrom, finddata->cFileName);
+            if (flags & OPT_SHORTNAME) {
+              lstrcatW(copyFrom, finddata->cAlternateFileName);
+            } else {
+              lstrcatW(copyFrom, finddata->cFileName);
+            }
 
             lstrcpyW(copyTo, deststem);
             if (*destspec == 0x00) {
-                lstrcatW(copyTo, finddata->cFileName);
+                if (flags & OPT_SHORTNAME) {
+                    lstrcatW(copyTo, finddata->cAlternateFileName);
+                } else {
+                    lstrcatW(copyTo, finddata->cFileName);
+                }
             } else {
                 lstrcatW(copyTo, destspec);
             }




More information about the wine-cvs mailing list