Dan Kegel : cmd: mkdir: Handle multiple arguments.

Alexandre Julliard julliard at winehq.org
Wed Aug 3 12:48:14 CDT 2011


Module: wine
Branch: master
Commit: 15ce9a5784eb36ad619071a66da8a01395246126
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=15ce9a5784eb36ad619071a66da8a01395246126

Author: Dan Kegel <dank at kegel.com>
Date:   Tue Aug  2 13:02:19 2011 -0700

cmd: mkdir: Handle multiple arguments.

---

 programs/cmd/builtins.c                  |   13 +++++++++++--
 programs/cmd/tests/test_builtins.cmd.exp |    6 +++---
 programs/cmd/wcmd.h                      |    2 +-
 programs/cmd/wcmdmain.c                  |    2 +-
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 49869ba..58050cf 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -523,13 +523,22 @@ static BOOL create_full_path(WCHAR* path)
     return ret;
 }
 
-void WCMD_create_dir (void) {
+void WCMD_create_dir (WCHAR *command) {
+    int   argno = 0;
+    WCHAR *argN = command;
 
     if (param1[0] == 0x00) {
         WCMD_output (WCMD_LoadMessage(WCMD_NOARG));
         return;
     }
-    if (!create_full_path(param1)) WCMD_print_error ();
+    /* Loop through all args */
+    while (TRUE) {
+        WCHAR *thisArg = WCMD_parameter(command, argno++, &argN);
+        if (!argN) break;
+        if (!create_full_path(thisArg)) {
+            WCMD_print_error ();
+        }
+    }
 }
 
 /* Parse the /A options given by the user on the commandline
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index 463b225..8db75a7 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -284,9 +284,9 @@ dir created
 @todo_wine at 1
 @todo_wine at ok, foo\bar created
 foo created
- at todo_wine@bar created
- at todo_wine@foobar created
- at todo_wine@bar\baz created
+bar created
+foobar created
+bar\baz created
 ----------- Testing rmdir -----------
 0
 dir removed
diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h
index 939e404..8ed7a01 100644
--- a/programs/cmd/wcmd.h
+++ b/programs/cmd/wcmd.h
@@ -56,7 +56,7 @@ void WCMD_choice (WCHAR *);
 void WCMD_clear_screen (void);
 void WCMD_color (void);
 void WCMD_copy (void);
-void WCMD_create_dir (void);
+void WCMD_create_dir (WCHAR *);
 BOOL WCMD_delete (WCHAR *);
 void WCMD_directory (WCHAR *);
 void WCMD_echo (const WCHAR *);
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index f3fa129..5dbf74c 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -1472,7 +1472,7 @@ void WCMD_execute (WCHAR *command, WCHAR *redirects,
         break;
       case WCMD_MD:
       case WCMD_MKDIR:
-        WCMD_create_dir ();
+        WCMD_create_dir (p);
 	break;
       case WCMD_MOVE:
         WCMD_move ();




More information about the wine-cvs mailing list