Jason Edmeades : xcopy: Add support for COPYCMD override and fix /-y.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Mar 30 06:20:20 CDT 2007
Module: wine
Branch: master
Commit: 30fcdd9f07c4cf9860089e75e87236bc96cfafc9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=30fcdd9f07c4cf9860089e75e87236bc96cfafc9
Author: Jason Edmeades <us at edmeades.me.uk>
Date: Thu Mar 29 22:21:03 2007 +0100
xcopy: Add support for COPYCMD override and fix /-y.
---
programs/xcopy/xcopy.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/programs/xcopy/xcopy.c b/programs/xcopy/xcopy.c
index 25995f2..0342d39 100644
--- a/programs/xcopy/xcopy.c
+++ b/programs/xcopy/xcopy.c
@@ -50,6 +50,8 @@
#define OPT_NOCOPY 0x00000080
#define OPT_NOPROMPT 0x00000100
+#define MAXSTRING 8192
+
WINE_DEFAULT_DEBUG_CHANNEL(xcopy);
/* Prototypes */
@@ -91,8 +93,13 @@ int main (int argc, char *argv[])
WCHAR sourcespec[MAX_PATH] = {0}; /* Filespec of source */
WCHAR destinationstem[MAX_PATH] = {0}; /* Stem of destination */
WCHAR destinationspec[MAX_PATH] = {0}; /* Filespec of destination */
+ WCHAR copyCmd[MAXSTRING]; /* COPYCMD env var */
DWORD flags = 0; /* Option flags */
LPWSTR *argvW = NULL;
+ const WCHAR PROMPTSTR1[] = {'/', 'Y', 0};
+ const WCHAR PROMPTSTR2[] = {'/', 'y', 0};
+ const WCHAR COPYCMD[] = {'C', 'O', 'P', 'Y', 'C', 'M', 'D', 0};
+
/*
* Parse the command line
*/
@@ -106,6 +113,14 @@ int main (int argc, char *argv[])
return RC_INITERROR;
}
+ /* Preinitialize flags based on COPYCMD */
+ if (GetEnvironmentVariable(COPYCMD, copyCmd, MAXSTRING)) {
+ if (wcsstr(copyCmd, PROMPTSTR1) != NULL ||
+ wcsstr(copyCmd, PROMPTSTR2) != NULL) {
+ flags |= OPT_NOPROMPT;
+ }
+ }
+
/* Skip first arg, which is the program name */
argvW++;
@@ -136,7 +151,8 @@ 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 '-': if (argvW[0][2]=='Y') flags &= ~OPT_NOPROMPT; break;
+ case '-': if (toupper(argvW[0][2])=='Y')
+ flags &= ~OPT_NOPROMPT; break;
default:
WINE_FIXME("Unhandled parameter '%s'\n", wine_dbgstr_w(*argvW));
}
More information about the wine-cvs
mailing list