diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c index 03ecdafb848..5a854f7eed0 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 500c27e4149..771bcbb58d4 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 f27824ae493..75079f1f522 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 */