cmd.exe: Add prompt for rd /s.

This commit is contained in:
Jason Edmeades 2007-02-27 23:18:57 +00:00 committed by Alexandre Julliard
parent f1919c6106
commit fda7229b50
16 changed files with 118 additions and 2 deletions

View File

@ -230,4 +230,8 @@ VER\t\tZobraz
VOL\t\tUkáže jmenovku disku\n\
EXIT\t\tUkončí CMD\n\n\
Zadejte HELP <příkaz> pro podrobnější informace o některém z výše uvedených příkazů\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -242,4 +242,8 @@ VER\t\tMostrar la versi
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"
}

View File

@ -224,4 +224,8 @@ VER\t\tAffiche la version de cmd actuellement en m
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"
}

View File

@ -228,4 +228,8 @@ VER\t\tCMD
VOL\t\tディスクデバイスのボリュームラベルを表示\n\
EXIT\t\tCMDを終了\n\n\
上記のコマンドに関する詳細を表示するには HELP <コマンド名> と入力して下さい。\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}

View File

@ -219,4 +219,8 @@ VER\t\tCMD
VOL\t\t디스크 장치의 불륨 라벨 보여주기\n\
EXIT\t\tCMD 닫기\n\n\
HELP <명령>을 치면 그 명령의 상세한 정보를 보여줌\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -221,4 +221,8 @@ VER\t\tWy
VOL\t\tWyświetla etykietę dysku\n\
EXIT\t\tWyłącza CMD\n\n\
Wpisz HELP <komenda> dla dokładniejszych informacji o komendzie\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}

View File

@ -434,4 +434,8 @@ VER\t\tMostra a vers
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"
}

View File

@ -225,4 +225,8 @@ VER\t\t
VOL\t\tПоказать метку тома дискового устройства\n\
EXIT\t\tВыйти из WCMD\n\n\
Выполните HELP <команда> для дополнительной информации по перечисленным выше командам.\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}

View File

@ -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"
}

View File

@ -228,4 +228,8 @@ VER\t\tGe
VOL\t\tDisk aygıtının bölüm etiketini göster\n\
EXIT\t\tCMD'yi kapat\n\n\
Yukarıdaki komutlar hakkında daha fazla bilgi için HELP <komut> girin\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
}

View File

@ -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]);
}

View File

@ -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