[PATCH 1/6] CMD.EXE: [resend] Only search for supplied command as-is if it includes an extension

Jason Edmeades us at edmeades.me.uk
Thu Apr 5 16:47:53 CDT 2007


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. This is the last bug in the activeperl installer (zip version)

Note: Patch also removes 2 whitespaces from the file
---
 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) {
-- 
1.5.0




More information about the wine-patches mailing list