Support /-Y and COPYCMD env. variable by the "copy" builtin
Alexander.Farber at nokia.com
Alexander.Farber at nokia.com
Wed Feb 28 08:20:23 CST 2007
Hello,
please kindly add my small patch for the builtin "copy" command.
Changelog:
cmd: Support /-Y and COPYCMD env. variable by the "copy" builtin
Regards
Alex
---
programs/cmd/builtins.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index a1d1154..4b1df49 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -110,7 +110,8 @@ WIN32_FIND_DATA fd;
HANDLE hff;
BOOL force, status;
static const char overwrite[] = "Overwrite file (Y/N)?";
-char string[8], outpath[MAX_PATH], inpath[MAX_PATH], *infile;
+char string[8], outpath[MAX_PATH], inpath[MAX_PATH], *infile,
copycmd[3];
+DWORD len;
if (param1[0] == 0x00) {
WCMD_output ("Argument missing\n");
@@ -140,7 +141,16 @@ char string[8], outpath[MAX_PATH],
inpath[MAX_PATH], *infile;
FindClose (hff);
}
- force = (strstr (quals, "/Y") != NULL);
+ /* /-Y has the highest priority, then /Y and finally the COPYCMD env.
variable */
+ if (strstr (quals, "/-Y"))
+ force = FALSE;
+ else if (strstr (quals, "/Y"))
+ force = TRUE;
+ else {
+ len = GetEnvironmentVariable ("COPYCMD", copycmd, sizeof(copycmd));
+ force = (len && len < sizeof(copycmd) && ! lstrcmpi (copycmd,
"/Y"));
+ }
+
if (!force) {
hff = FindFirstFile (outpath, &fd);
if (hff != INVALID_HANDLE_VALUE) {
--
1.5.0
More information about the wine-patches
mailing list