Commit 2f5bfc0f authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

cmd.exe: Add prompting and COPYCMD plus /Y support to move.

parent d0a6fe10
......@@ -236,4 +236,5 @@ Zadejte HELP <pkaz> pro podrobnj informace o nkterm z ve uvedench pk
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -253,4 +253,5 @@ obigen Befehle erhalten.\n"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -240,4 +240,5 @@ Enter HELP <command> for further information on any of the above commands\n"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -248,4 +248,5 @@ Introduzca HELP <comando> para ms informacin sobre cualquiera de los comandos\
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -230,4 +230,5 @@ Entrez HELP <commande> pour plus d'informations sur les commandes ci-dessus\n"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -234,4 +234,5 @@ EXIT\t\tCMDI\n\n\
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -232,4 +232,5 @@ HELP <명령>을 치면 그 명령의 상세한 정보를 보여줌\n"
WCMD_NO, "아니오"
WCMD_NOASSOC, "이 파일확장자 %s에 연결된 풀그림이 없습니다. \n"
WCMD_NOFTYPE, "이 파일 형식 '%s'과 연결된 어떠한 명령도 없습니다.'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -233,4 +233,5 @@ type HELP <opdracht> voor meer informatie over bovengenoemde opdrachten\n"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -231,4 +231,5 @@ Skriv HELP <kommando> for mer informasjon om kommandoene ovenfor\n"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -235,4 +235,5 @@ Wpisz HELP <komenda> dla dokadniejszych informacji o komendzie\n"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -440,4 +440,5 @@ Digite HELP <comando> para mais informaes sobre alguns dos comandos acima\n"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -246,4 +246,5 @@ EXIT\t\t CMD\n\n\
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -232,4 +232,5 @@ Enter HELP <command> for further information on any of the above commands\n"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -234,4 +234,5 @@ Yukardaki komutlar hakknda daha fazla bilgi iin HELP <komut> girin\n"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
WCMD_OVERWRITE, "Overwrite"
}
......@@ -783,7 +783,51 @@ void WCMD_move (void) {
SetLastError(ERROR_ACCESS_DENIED);
status = 0;
} else {
status = MoveFile (src, dest);
BOOL ok = TRUE;
/* If destination exists, prompt unless /Y supplied */
if (GetFileAttributesA(dest) != INVALID_FILE_ATTRIBUTES) {
BOOL force = FALSE;
char copycmd[MAXSTRING];
int len;
/* /-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"));
}
/* Prompt if overwriting */
if (!force) {
char question[MAXSTRING];
char overwrite[MAXSTRING];
LoadString (hinst, WCMD_OVERWRITE, overwrite, sizeof(overwrite));
/* Ask for confirmation */
sprintf(question, "%s %s? ", overwrite, dest);
ok = WCMD_ask_confirm(question, TRUE);
/* So delete the destination prior to the move */
if (ok) {
if (!DeleteFile (dest)) {
WCMD_print_error ();
errorlevel = 1;
ok = FALSE;
}
}
}
}
if (ok) {
status = MoveFile (src, dest);
} else {
status = 1; /* Anything other than 0 to prevent error msg below */
}
}
if (!status) {
......
......@@ -179,6 +179,7 @@ extern const char anykey[];
#define WCMD_NO 1003
#define WCMD_NOASSOC 1004
#define WCMD_NOFTYPE 1005
#define WCMD_OVERWRITE 1006
/* msdn specified max for Win XP */
#define MAXSTRING 8192
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment