cmd: fixing an issue with extra whitespaces after cd parameter

Nowres Rafid nowres.rafed at gmail.com
Thu Aug 11 10:01:55 CDT 2011


---
 programs/cmd/builtins.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 09c166f..1de1987 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -2101,15 +2101,21 @@ void WCMD_setshow_default (WCHAR *command) {
     WCMD_output (cwd);
   }
   else {
+    pos = string;
     /* 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;
 
+    /* Remove any whitespace at the end of command
+    This was because "cd .. " wasn't working */
+    pos--;
+    while ( *pos == ' ' || *pos == '\t' )
+        *pos-- = 0x00;
+
     /* Search for appropriate directory */
     WINE_TRACE("Looking for directory '%s'\n", wine_dbgstr_w(string));
     hff = FindFirstFileW(string, &fd);
-- 
1.7.4.1


--=-lgfghIitlnwpkdcxZ050--




More information about the wine-patches mailing list