Commit fda7229b authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

cmd.exe: Add prompt for rd /s.

parent f1919c61
......@@ -230,4 +230,8 @@ VER\t\tZobraz verzi CMD\n\
VOL\t\tUke jmenovku disku\n\
EXIT\t\tUkon CMD\n\n\
Zadejte HELP <pkaz> pro podrobnj informace o nkterm z ve uvedench pkaz\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -247,4 +247,8 @@ VOL\t\tZeigt die Bezeichnung eines Laufwerkes an\n\
EXIT\t\tBeendet den CMD\n\n\
Geben Sie HELP <Befehl> ein, damit Sie weitere Informationen für einen der\n\
obigen Befehle erhalten.\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -234,4 +234,8 @@ VER\t\tShow the current version of CMD\n\
VOL\t\tShow the volume label of a disk device\n\
EXIT\t\tClose down CMD\n\n\
Enter HELP <command> for further information on any of the above commands\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -242,4 +242,8 @@ VER\t\tMostrar la versión actual de CMD\n\
VOL\t\tMostrar la etiqueta de volumen de un dispositivo de disco\n\
EXIT\t\tConcluir CMD\n\n\
Introduzca HELP <comando> para más información sobre cualquiera de los comandos\nde arriba\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -224,4 +224,8 @@ VER\t\tAffiche la version de cmd actuellement en mémoire.\n\
VOL\t\tAffiche le nom de volume d'un lecteur de disque\n\
EXIT\t\tQuitte CMD\n\n\
Entrez HELP <commande> pour plus d'informations sur les commandes ci-dessus\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -228,4 +228,8 @@ VER\t\tCMDのバージョンを表示\n\
VOL\t\tディスクデバイスのボリュームラベルを表示\n\
EXIT\t\tCMDを終了\n\n\
上記のコマンドに関する詳細を表示するには HELP <コマンド名> と入力して下さい。\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -219,4 +219,8 @@ VER\t\tCMD 현재 버젼 보여주기\n\
VOL\t\t디스크 장치의 불륨 라벨 보여주기\n\
EXIT\t\tCMD 닫기\n\n\
HELP <명령>을 치면 그 명령의 상세한 정보를 보여줌\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -227,4 +227,8 @@ VER\t\tToon de versie van CMD\n\
VOL\t\tToon het label van een schijf\n\
EXIT\t\tSluit CMD af\n\n\
type HELP <opdracht> voor meer informatie over bovengenoemde opdrachten\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -225,4 +225,8 @@ VER\t\tViser CMDs versjonnummer\n\
VOL\t\tViser volumnavnet til en stasjon\n\
EXIT\t\tAvslutter CMD\n\n\
Skriv «HELP <kommando>» for mer informasjon om kommandoene ovenfor\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -221,4 +221,8 @@ VER\t\tWywietla wersj CMD\n\
VOL\t\tWywietla etykiet dysku\n\
EXIT\t\tWycza CMD\n\n\
Wpisz HELP <komenda> dla dokadniejszych informacji o komendzie\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -434,4 +434,8 @@ VER\t\tMostra a versão atual do CMD\n\
VOL\t\tMostra o rótulo do volume de uma unidade de disco\n\
EXIT\t\tFecha o CMD\n\n\
Digite HELP <comando> para mais informações sobre alguns dos comandos acima\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -225,4 +225,8 @@ VER\t\t WCMD\n\
VOL\t\t \n\
EXIT\t\t WCMD\n\n\
HELP <> .\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -226,4 +226,8 @@ VER\t\tShow the current version of CMD\n\
VOL\t\tShow the volume label of a disk device\n\
EXIT\t\tClose down CMD\n\n\
Enter HELP <command> for further information on any of the above commands\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -228,4 +228,8 @@ VER\t\tGeerli CMD srmn gster\n\
VOL\t\tDisk aygtnn blm etiketini gster\n\
EXIT\t\tCMD'yi kapat\n\n\
Yukardaki komutlar hakknda daha fazla bilgi iin HELP <komut> girin\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}
......@@ -643,8 +643,22 @@ void WCMD_remove_dir (void) {
/* Otherwise use ShFileOp to recursively remove a directory */
} else {
/* Do the delete */
SHFILEOPSTRUCT lpDir;
/* Ask first */
if (strstr (quals, "/Q") == NULL) {
BOOL ok;
char question[MAXSTRING];
/* Ask for confirmation */
sprintf(question, "%s, ", param1);
ok = WCMD_ask_confirm(question);
/* Abort if answer is 'N' */
if (!ok) return;
}
/* Do the delete */
lpDir.hwnd = NULL;
lpDir.pTo = NULL;
lpDir.pFrom = param1;
......@@ -786,7 +800,7 @@ void WCMD_endlocal (void) {
}
LocalFree (old);
FreeEnvironmentStringsW (env);
/* restore old environment */
env = temp->strings;
len = 0;
......@@ -1260,3 +1274,43 @@ void WCMD_exit (void) {
ExitProcess(rc);
}
}
/**************************************************************************
* WCMD_ask_confirm
*
* Issue a message and ask 'Are you sure (Y/N)', waiting on a valid
* answer.
*
* Returns True if Y answer is selected
*
*/
BOOL WCMD_ask_confirm (char *message) {
char msgbuffer[MAXSTRING];
char Ybuffer[MAXSTRING];
char Nbuffer[MAXSTRING];
char answer[MAX_PATH] = "";
DWORD count = 0;
/* Load the translated 'Are you sure', plus valid answers */
LoadString (hinst, WCMD_CONFIRM, msgbuffer, sizeof(msgbuffer));
LoadString (hinst, WCMD_YES, Ybuffer, sizeof(Ybuffer));
LoadString (hinst, WCMD_NO, Nbuffer, sizeof(Nbuffer));
/* Loop waiting on a Y or N */
while (answer[0] != Ybuffer[0] && answer[0] != Nbuffer[0]) {
WCMD_output_asis (message);
WCMD_output_asis (msgbuffer);
WCMD_output_asis (" (");
WCMD_output_asis (Ybuffer);
WCMD_output_asis ("/");
WCMD_output_asis (Nbuffer);
WCMD_output_asis (")?");
ReadFile (GetStdHandle(STD_INPUT_HANDLE), answer, sizeof(answer),
&count, NULL);
answer[0] = toupper(answer[0]);
}
/* Return the answer */
return (answer[0] == Ybuffer[0]);
}
......@@ -80,6 +80,7 @@ char *WCMD_strtrim_leading_spaces (char *string);
void WCMD_strtrim_trailing_spaces (char *string);
void WCMD_opt_s_strip_quotes(char *cmd);
void WCMD_HandleTildaModifiers(char **start, char *forVariable);
BOOL WCMD_ask_confirm (char *message);
/* Data structure to hold context when executing batch files */
......@@ -154,5 +155,10 @@ extern const char newline[];
extern const char version_string[];
extern const char anykey[];
/* Translated messages */
#define WCMD_CONFIRM 1001
#define WCMD_YES 1002
#define WCMD_NO 1003
/* 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