Rein Klazes : wcmd: CALL should search the current PATH.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 6 07:26:11 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 8c540ba67491df795d2e842607053970d62182b9
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=8c540ba67491df795d2e842607053970d62182b9

Author: Rein Klazes <wijn at wanadoo.nl>
Date:   Mon Feb  6 14:11:40 2006 +0100

wcmd: CALL should search the current PATH.

---

 programs/wcmd/batch.c    |    2 +-
 programs/wcmd/wcmd.h     |    2 +-
 programs/wcmd/wcmdmain.c |   17 ++++++++++-------
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/programs/wcmd/batch.c b/programs/wcmd/batch.c
index 4751076..eb8b9c2 100644
--- a/programs/wcmd/batch.c
+++ b/programs/wcmd/batch.c
@@ -69,7 +69,7 @@ BATCH_CONTEXT *prev_context;
     h = CreateFile (string, GENERIC_READ, FILE_SHARE_READ,
                     NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
     if (h != INVALID_HANDLE_VALUE) {
-      WCMD_run_program (command);
+      WCMD_run_program (command, 0);
     } else {
       SetLastError (ERROR_FILE_NOT_FOUND);
       WCMD_print_error ();
diff --git a/programs/wcmd/wcmd.h b/programs/wcmd/wcmd.h
index 31843c4..d191cf1 100644
--- a/programs/wcmd/wcmd.h
+++ b/programs/wcmd/wcmd.h
@@ -53,7 +53,7 @@ void WCMD_process_command (char *command
 int  WCMD_read_console (char *string, int str_len);
 void WCMD_remove_dir (void);
 void WCMD_rename (void);
-void WCMD_run_program (char *command);
+void WCMD_run_program (char *command, int called);
 void WCMD_setlocal (const char *command);
 void WCMD_setshow_attrib (void);
 void WCMD_setshow_date (void);
diff --git a/programs/wcmd/wcmdmain.c b/programs/wcmd/wcmdmain.c
index 0f61c29..a0fc4ec 100644
--- a/programs/wcmd/wcmdmain.c
+++ b/programs/wcmd/wcmdmain.c
@@ -359,7 +359,7 @@ void WCMD_process_command (char *command
         WCMD_setshow_attrib ();
         break;
       case WCMD_CALL:
-        WCMD_batch (param1, p, 1);
+        WCMD_run_program (p, 1);
         break;
       case WCMD_CD:
       case WCMD_CHDIR:
@@ -462,7 +462,7 @@ void WCMD_process_command (char *command
       case WCMD_EXIT:
         ExitProcess (0);
       default:
-        WCMD_run_program (whichcmd);
+        WCMD_run_program (whichcmd, 0);
     }
     HeapFree( GetProcessHeap(), 0, cmd );
     if (old_stdin != INVALID_HANDLE_VALUE) {
@@ -532,11 +532,14 @@ static void init_msvcrt_io_block(STARTUP
  *
  *	Execute a command line as an external program. If no extension given then
  *	precedence is given to .BAT files. Must allow recursion.
+ *	
+ *	called is 1 if the program was invoked with a CALL command - removed
+ *	from command -. It is only used for batch programs.
  *
  *	FIXME: Case sensitivity in suffixes!
  */
 
-void WCMD_run_program (char *command) {
+void WCMD_run_program (char *command, int called) {
 
 STARTUPINFO st;
 PROCESS_INFORMATION pe;
@@ -555,14 +558,14 @@ char filetorun[MAX_PATH];
     if (!ext || !strcasecmp( ext, ".bat"))
     {
       if (SearchPath (NULL, param1, ".bat", sizeof(filetorun), filetorun, NULL)) {
-        WCMD_batch (filetorun, command, 0);
+        WCMD_batch (filetorun, command, called);
         return;
       }
     }
     if (!ext || !strcasecmp( ext, ".cmd"))
     {
       if (SearchPath (NULL, param1, ".cmd", sizeof(filetorun), filetorun, NULL)) {
-        WCMD_batch (filetorun, command, 0);
+        WCMD_batch (filetorun, command, called);
         return;
       }
     }
@@ -571,7 +574,7 @@ char filetorun[MAX_PATH];
     char *ext = strrchr( param1, '.' );
     if (ext && (!strcasecmp( ext, ".bat" ) || !strcasecmp( ext, ".cmd" )))
     {
-      WCMD_batch (param1, command, 0);
+      WCMD_batch (param1, command, called);
       return;
     }
 
@@ -584,7 +587,7 @@ char filetorun[MAX_PATH];
                       NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
       if (h != INVALID_HANDLE_VALUE) {
         CloseHandle (h);
-        WCMD_batch (param1, command, 0);
+        WCMD_batch (param1, command, called);
         return;
       }
     }




More information about the wine-cvs mailing list