Module: wine Branch: master Commit: b573f68b36187190166bee3d0a42243b006f6bd5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b573f68b36187190166bee3d0a...
Author: Jason Edmeades us@edmeades.me.uk Date: Thu Apr 5 22:47:53 2007 +0100
cmd.exe: Only search for supplied command as-is if it includes an extension.
Files with no extensions cannot be run as-is. This enables a directory with 'fred' and 'fred.bat' to correctly run fred.bat if just fred is executed.
---
programs/cmd/wcmdmain.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 2b5644a..4a2d239 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -34,7 +34,7 @@ const char * const inbuilt[] = {"ATTRIB", "CALL", "CD", "CHDIR", "CLS", "COPY", "DATE", "DEL", "DIR", "ECHO", "ERASE", "FOR", "GOTO", "HELP", "IF", "LABEL", "MD", "MKDIR", "MOVE", "PATH", "PAUSE", "PROMPT", "REM", "REN", "RENAME", "RD", "RMDIR", "SET", "SHIFT", - "TIME", "TITLE", "TYPE", "VERIFY", "VER", "VOL", + "TIME", "TITLE", "TYPE", "VERIFY", "VER", "VOL", "ENDLOCAL", "SETLOCAL", "PUSHD", "POPD", "ASSOC", "COLOR", "FTYPE", "EXIT" };
@@ -877,8 +877,11 @@ void WCMD_run_program (char *command, int called) { strcat(thisDir, stemofsearch); pos = &thisDir[strlen(thisDir)]; /* Pos = end of name */
- if (GetFileAttributes(thisDir) != INVALID_FILE_ATTRIBUTES) { - found = TRUE; + /* 1. If extension supplied, see if that file exists */ + if (extensionsupplied) { + if (GetFileAttributes(thisDir) != INVALID_FILE_ATTRIBUTES) { + found = TRUE; + } }
/* 2. Any .* matches? */ @@ -1227,7 +1230,7 @@ void WCMD_output_asis (const char *message) { if (paged_mode) { do { if ((ptr = strchr(message, '\n')) != NULL) ptr++; - WriteFile (GetStdHandle(STD_OUTPUT_HANDLE), message, + WriteFile (GetStdHandle(STD_OUTPUT_HANDLE), message, (ptr) ? ptr - message : lstrlen(message), &count, NULL); if (ptr) { if (++line_count >= max_height - 1) {