Commit 409368eb authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

cmd.exe: Prompt during del *.* and del *.

parent fda7229b
...@@ -230,8 +230,8 @@ char *p; ...@@ -230,8 +230,8 @@ char *p;
return p; return p;
} }
/* _splitpath - copied from winefile as no obvious way to use it otherwise */ /* WCMD_splitpath - copied from winefile as no obvious way to use it otherwise */
void _splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext) void WCMD_splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext)
{ {
const CHAR* end; /* end of processed string */ const CHAR* end; /* end of processed string */
const CHAR* p; /* search pointer */ const CHAR* p; /* search pointer */
...@@ -528,7 +528,7 @@ void WCMD_HandleTildaModifiers(char **start, char *forVariable) { ...@@ -528,7 +528,7 @@ void WCMD_HandleTildaModifiers(char **start, char *forVariable) {
if (finaloutput[0] != 0x00) strcat(finaloutput, " "); if (finaloutput[0] != 0x00) strcat(finaloutput, " ");
/* Split into components */ /* Split into components */
_splitpath(fullfilename, drive, dir, fname, ext); WCMD_splitpath(fullfilename, drive, dir, fname, ext);
/* 5. Handle 'd' : Drive Letter */ /* 5. Handle 'd' : Drive Letter */
if (memchr(firstModifier, 'd', modifierLen) != NULL) { if (memchr(firstModifier, 'd', modifierLen) != NULL) {
......
...@@ -237,6 +237,35 @@ char *p; ...@@ -237,6 +237,35 @@ char *p;
WCMD_output ("Argument missing\n"); WCMD_output ("Argument missing\n");
return; return;
} }
/* If filename part of parameter is * or *.*, prompt unless
/Q supplied. */
if (strstr (quals, "/Q") == NULL) {
char drive[10];
char dir[MAX_PATH];
char fname[MAX_PATH];
char ext[MAX_PATH];
/* Convert path into actual directory spec */
GetFullPathName (param1, sizeof(fpath), fpath, NULL);
WCMD_splitpath(fpath, drive, dir, fname, ext);
/* Only prompt for * and *.*, not *a, a*, *.a* etc */
if ((strcmp(fname, "*") == 0) &&
(*ext == 0x00 || (strcmp(ext, ".*") == 0))) {
BOOL ok;
char question[MAXSTRING];
/* Ask for confirmation */
sprintf(question, "%s, ", fpath);
ok = WCMD_ask_confirm(question);
/* Abort if answer is 'N' */
if (!ok) return;
}
}
hff = FindFirstFile (param1, &fd); hff = FindFirstFile (param1, &fd);
if (hff == INVALID_HANDLE_VALUE) { if (hff == INVALID_HANDLE_VALUE) {
WCMD_output ("%s :File Not Found\n",param1); WCMD_output ("%s :File Not Found\n",param1);
......
...@@ -82,6 +82,7 @@ void WCMD_opt_s_strip_quotes(char *cmd); ...@@ -82,6 +82,7 @@ void WCMD_opt_s_strip_quotes(char *cmd);
void WCMD_HandleTildaModifiers(char **start, char *forVariable); void WCMD_HandleTildaModifiers(char **start, char *forVariable);
BOOL WCMD_ask_confirm (char *message); BOOL WCMD_ask_confirm (char *message);
void WCMD_splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext);
/* Data structure to hold context when executing batch files */ /* Data structure to hold context when executing batch files */
......
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