Module: wine Branch: master Commit: 409368eb4c9be42ddb7c4299bfa0ae008e323408 URL: http://source.winehq.org/git/wine.git/?a=commit;h=409368eb4c9be42ddb7c4299bf...
Author: Jason Edmeades us@edmeades.me.uk Date: Tue Feb 27 23:19:24 2007 +0000
cmd.exe: Prompt during del *.* and del *.
---
programs/cmd/batch.c | 6 +++--- programs/cmd/builtins.c | 29 +++++++++++++++++++++++++++++ programs/cmd/wcmd.h | 1 + 3 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c index 03ecdaf..5a854f7 100644 --- a/programs/cmd/batch.c +++ b/programs/cmd/batch.c @@ -230,8 +230,8 @@ char *p; return p; }
-/* _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) +/* WCMD_splitpath - copied from winefile as no obvious way to use it otherwise */ +void WCMD_splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext) { const CHAR* end; /* end of processed string */ const CHAR* p; /* search pointer */ @@ -528,7 +528,7 @@ void WCMD_HandleTildaModifiers(char **start, char *forVariable) { if (finaloutput[0] != 0x00) strcat(finaloutput, " ");
/* Split into components */ - _splitpath(fullfilename, drive, dir, fname, ext); + WCMD_splitpath(fullfilename, drive, dir, fname, ext);
/* 5. Handle 'd' : Drive Letter */ if (memchr(firstModifier, 'd', modifierLen) != NULL) { diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 500c27e..771bcbb 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -237,6 +237,35 @@ char *p; WCMD_output ("Argument missing\n"); 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); if (hff == INVALID_HANDLE_VALUE) { WCMD_output ("%s :File Not Found\n",param1); diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h index f27824a..75079f1 100644 --- a/programs/cmd/wcmd.h +++ b/programs/cmd/wcmd.h @@ -82,6 +82,7 @@ void WCMD_opt_s_strip_quotes(char *cmd); void WCMD_HandleTildaModifiers(char **start, char *forVariable); 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 */