Jason Edmeades : cmd.exe: Support unquoted directories in CD command.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Mar 8 07:17:06 CST 2007
Module: wine
Branch: master
Commit: eb6d084fd66be7b38aec8a9762a9eb35997e577e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=eb6d084fd66be7b38aec8a9762a9eb35997e577e
Author: Jason Edmeades <us at edmeades.me.uk>
Date: Thu Mar 8 00:42:33 2007 +0000
cmd.exe: Support unquoted directories in CD command.
---
programs/cmd/builtins.c | 19 ++++++++++++++++---
programs/cmd/wcmd.h | 2 +-
programs/cmd/wcmdmain.c | 2 +-
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 5420d91..665e13d 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -1046,18 +1046,31 @@ void WCMD_setshow_attrib (void) {
* Set/Show the current default directory
*/
-void WCMD_setshow_default (void) {
+void WCMD_setshow_default (char *command) {
BOOL status;
char string[1024];
+ char *pos;
- if (strlen(param1) == 0) {
+ WINE_TRACE("Request change to directory '%s'\n", command);
+ if (strlen(command) == 0) {
GetCurrentDirectory (sizeof(string), string);
strcat (string, "\n");
WCMD_output (string);
}
else {
- status = SetCurrentDirectory (param1);
+ /* Remove any double quotes, which may be in the
+ middle, eg. cd "C:\Program Files"\Microsoft is ok */
+ pos = string;
+ while (*command) {
+ if (*command != '"') *pos++ = *command;
+ command++;
+ }
+ *pos = 0x00;
+
+ /* Change to that directory */
+ WINE_TRACE("Really changing to directory '%s'\n", string);
+ status = SetCurrentDirectory (string);
if (!status) {
WCMD_print_error ();
return;
diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h
index 173a79c..af5b247 100644
--- a/programs/cmd/wcmd.h
+++ b/programs/cmd/wcmd.h
@@ -63,7 +63,7 @@ void WCMD_run_program (char *command, int called);
void WCMD_setlocal (const char *command);
void WCMD_setshow_attrib (void);
void WCMD_setshow_date (void);
-void WCMD_setshow_default (void);
+void WCMD_setshow_default (char *command);
void WCMD_setshow_env (char *command);
void WCMD_setshow_path (char *command);
void WCMD_setshow_prompt (void);
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index c8a7943..8fc23d6 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -543,7 +543,7 @@ void WCMD_process_command (char *command)
break;
case WCMD_CD:
case WCMD_CHDIR:
- WCMD_setshow_default ();
+ WCMD_setshow_default (p);
break;
case WCMD_CLS:
WCMD_clear_screen ();
More information about the wine-cvs
mailing list