From: Florian Eder Subject: [PATCH 10/41] robocopy: add argument output Message-Id: <20210906145518.346132-10-others.meder@gmail.com> Date: Mon, 6 Sep 2021 14:54:47 +0000 In-Reply-To: <20210906145518.346132-1-others.meder@gmail.com> References: <20210906145518.346132-1-others.meder@gmail.com> Signed-off-by: Florian Eder --- programs/robocopy/main.c | 30 ++++++++++++++++++++++++++++++ programs/robocopy/robocopy.h | 1 + programs/robocopy/robocopy.rc | 1 + 3 files changed, 32 insertions(+) diff --git a/programs/robocopy/main.c b/programs/robocopy/main.c index fe550134508..18bfe1b13f6 100644 --- a/programs/robocopy/main.c +++ b/programs/robocopy/main.c @@ -358,9 +358,36 @@ static BOOL perform_copy(void) return TRUE; } +static WCHAR *get_option_string(void) +{ + WCHAR *string, temp_string[512]; + memset(temp_string, 0, sizeof(temp_string)); + + /* If no files set, display *.* */ + if (options.files->size == 0) + wcscat(temp_string, L"*.* "); + + /* Subdirectories */ + if (options.copy_subdirectories) + wcscat(temp_string, L"/S "); + + /* Max Subdirectory Depth */ + if (options.user_limited_subdirectories_depth) + swprintf(temp_string + wcslen(temp_string), ARRAY_SIZE(temp_string) - wcslen(temp_string), + L"/LEV:%u ", options.max_subdirectories_depth); + + /* Empty Subdirectories */ + if (options.copy_empty_subdirectories) + wcscat(temp_string, L"/E "); + + string = wcsdup(temp_string); + return string; +} + static void print_header(void) { UINT i; + WCHAR *options_string; output_message(STRING_HEADER); @@ -373,6 +400,9 @@ static void print_header(void) output_message(STRING_FILES, options.files->array[0]); for (i = 1; i < options.files->size; i++) output_message(STRING_ADDITIONAL_INFO, options.files->array[i]); + + options_string = get_option_string(); + if (options_string != NULL) output_message(STRING_OPTIONS, options_string); } int __cdecl wmain(int argc, WCHAR *argv[]) diff --git a/programs/robocopy/robocopy.h b/programs/robocopy/robocopy.h index 57797c7df69..96901dfb597 100644 --- a/programs/robocopy/robocopy.h +++ b/programs/robocopy/robocopy.h @@ -47,6 +47,7 @@ struct robocopy_options { #define STRING_DESTINATION 1004 #define STRING_FILES 1005 #define STRING_ADDITIONAL_INFO 1008 +#define STRING_OPTIONS 1009 #define STRING_ERROR_READ_DIRECTORY 1011 #define STRING_ERROR_WRITE_DIRECTORY 1012 #define STRING_ERROR_WRITE_FILE 1014 diff --git a/programs/robocopy/robocopy.rc b/programs/robocopy/robocopy.rc index 45d7bdacd69..519deca3a4d 100644 --- a/programs/robocopy/robocopy.rc +++ b/programs/robocopy/robocopy.rc @@ -30,6 +30,7 @@ STRINGTABLE STRING_DESTINATION, " Destination: %1\n\n" STRING_FILES, " Files: %1\n" STRING_ADDITIONAL_INFO, " %1\n" + STRING_OPTIONS, "\n Options: %1\n\n" STRING_ERROR_READ_DIRECTORY, "[%1] Error %2 (%3) occurred reading directory \"%4\":\n%5\n" STRING_ERROR_WRITE_DIRECTORY, "[%1] Error %2 (%3) occurred writing directory \"%4\":\n%5\n" STRING_ERROR_WRITE_FILE, "[%1] Error %2 (%3) occurred writing file \"%4\":\n%5\n" -- 2.32.0