[wcmd] Make start a built-in command
Daniel R. Kegel
dank at alumni.caltech.edu
Sat Jan 21 22:20:17 CST 2006
Signed-off-by: dank at kegel.com
Changelog:
programs/wcmd - make start a built-in command (pr 1370)
Index: programs/wcmd/builtins.c
===================================================================
RCS file: /home/wine/wine/programs/wcmd/builtins.c,v
retrieving revision 1.34
diff -u -r1.34 builtins.c
--- programs/wcmd/builtins.c 16 Jan 2006 20:41:31 -0000 1.34
+++ programs/wcmd/builtins.c 22 Jan 2006 04:12:45 -0000
@@ -988,6 +988,41 @@
}
/****************************************************************************
+ * WCMD_start
+ *
+ * In Win9x, start is C:\windows\command\start.exe, and that dir is in the PATH.
+ * Wine's start.exe was written back when we used to default to win9x, so that worked.
+ * In WinXP, start is a builtin, and that dir isn't in the PATH,
+ * so batch files that try to use start no longer work.
+ * (This is bug 1370.)
+ * As an interim measure, make start a builtin that just forwards to the
+ * external command.
+ *
+ * Argument is the part of the command after the word 'start'.
+ */
+
+void WCMD_start (const char *command) {
+ char *new_cmd;
+ char windir[MAX_PATH];
+ char externalstart[MAX_PATH];
+ int newsize;
+
+ /* Construct path to our implementation of start */
+ GetWindowsDirectory(windir, sizeof(windir));
+ wsprintf(externalstart, "%s\\command\\start.exe", windir);
+
+ /* Rewrite command to use our start */
+ newsize = strlen(command) + strlen(externalstart) + 1;
+ new_cmd = (char *) LocalAlloc (LMEM_FIXED | LMEM_ZEROINIT, newsize);
+ wsprintf(new_cmd, "%s %s", externalstart, command);
+ WCMD_output("Running ");
+ WCMD_output(new_cmd);
+ WCMD_output("\n");
+ WCMD_run_program (new_cmd);
+ LocalFree ((HANDLE)new_cmd);
+}
+
+/****************************************************************************
* WCMD_title
*
* Set the console title
Index: programs/wcmd/wcmd.h
===================================================================
RCS file: /home/wine/wine/programs/wcmd/wcmd.h,v
retrieving revision 1.15
diff -u -r1.15 wcmd.h
--- programs/wcmd/wcmd.h 4 May 2004 04:13:05 -0000 1.15
+++ programs/wcmd/wcmd.h 22 Jan 2006 04:12:45 -0000
@@ -64,6 +64,7 @@
void WCMD_setshow_time (void);
void WCMD_shift (void);
void WCMD_show_prompt (void);
+void WCMD_start (const char *);
void WCMD_title (char *);
void WCMD_type (void);
void WCMD_verify (char *command);
@@ -135,8 +136,10 @@
#define WCMD_ENDLOCAL 36
#define WCMD_SETLOCAL 37
+#define WCMD_START 38
+
/* Must be last in list */
-#define WCMD_EXIT 38
+#define WCMD_EXIT 39
/* Some standard messages */
extern const char nyi[];
Index: programs/wcmd/wcmdmain.c
===================================================================
RCS file: /home/wine/wine/programs/wcmd/wcmdmain.c,v
retrieving revision 1.50
diff -u -r1.50 wcmdmain.c
--- programs/wcmd/wcmdmain.c 2 Dec 2005 10:30:04 -0000 1.50
+++ programs/wcmd/wcmdmain.c 22 Jan 2006 04:12:46 -0000
@@ -26,19 +26,20 @@
#include "wcmd.h"
+/* Caution: must exactly match the order of the WCMD_* defines in wcmd.h */
const char * const inbuilt[] = {"ATTRIB", "CALL", "CD", "CHDIR", "CLS", "COPY", "CTTY",
"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",
- "ENDLOCAL", "SETLOCAL", "EXIT" };
+ "ENDLOCAL", "SETLOCAL", "START", "EXIT" };
HINSTANCE hinst;
DWORD errorlevel;
int echo_mode = 1, verify_mode = 0;
const char nyi[] = "Not Yet Implemented\n\n";
const char newline[] = "\n";
-const char version_string[] = "WCMD Version 0.17\n\n";
+const char version_string[] = "WCMD Version 0.18\n\n";
const char anykey[] = "Press Return key to continue: ";
char quals[MAX_PATH], param1[MAX_PATH], param2[MAX_PATH];
BATCH_CONTEXT *context = NULL;
@@ -440,6 +441,9 @@
case WCMD_SHIFT:
WCMD_shift ();
break;
+ case WCMD_START:
+ WCMD_start (&whichcmd[count]);
+ break;
case WCMD_TIME:
WCMD_setshow_time ();
break;
More information about the wine-patches
mailing list