From 15ce9a5784eb36ad619071a66da8a01395246126 Mon Sep 17 00:00:00 2001 From: Dan Kegel Date: Tue, 2 Aug 2011 13:02:19 -0700 Subject: [PATCH] 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 49869ba7ae6..58050cf06fe 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 463b225231f..8db75a7e895 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@1 @todo_wine@ok, foo\bar created foo created -@todo_wine@bar created -@todo_wine@foobar created -@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 939e4048317..8ed7a017b40 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 f3fa129a4b2..5dbf74cfd32 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 ();