From b79e47a8b3cae1af1715108ab32bd3583f36ee47 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Thu, 5 Jun 2025 20:24:42 -0500 Subject: [PATCH] Update: Use explicitly declared parameters and ensure -v/--verbose are both printed. Printing help for `rmdir` should result in printing both the `-v` and `--verbose` options. Explicitly declare the `version` and `verbose` strings due to the custom nature of them for the `rm` and `rmdir` programs. --- sources/c/program/kevux/tools/remove/rm/enumeration.h | 2 +- sources/c/program/kevux/tools/remove/rm/print.c | 2 +- sources/c/program/kevux/tools/remove/rm/string.c | 1 + sources/c/program/kevux/tools/remove/rm/string.h | 3 +++ sources/c/program/kevux/tools/remove/rmdir/enumeration.h | 10 +++++----- sources/c/program/kevux/tools/remove/rmdir/print.c | 6 ++++-- sources/c/program/kevux/tools/remove/rmdir/string.c | 3 +++ sources/c/program/kevux/tools/remove/rmdir/string.h | 9 +++++++++ 8 files changed, 27 insertions(+), 9 deletions(-) diff --git a/sources/c/program/kevux/tools/remove/rm/enumeration.h b/sources/c/program/kevux/tools/remove/rm/enumeration.h index 4afbef6..5a41628 100644 --- a/sources/c/program/kevux/tools/remove/rm/enumeration.h +++ b/sources/c/program/kevux/tools/remove/rm/enumeration.h @@ -51,7 +51,7 @@ extern "C" { macro_f_console_parameter_t_initialize_5( kt_remove_rm_long_preserve_root_s, 0, f_console_flag_normal_d), \ macro_f_console_parameter_t_initialize_5( kt_remove_rm_long_preserve_root_not_s, 0, f_console_flag_normal_d), \ macro_f_console_parameter_t_initialize_3(kt_remove_rm_short_verbose_s, kt_remove_rm_long_verbose_s, 0, f_console_flag_normal_d), \ - macro_f_console_parameter_t_initialize_5( f_console_standard_long_version_s, 0, f_console_flag_normal_d), \ + macro_f_console_parameter_t_initialize_5( kt_remove_rm_long_version_s, 0, f_console_flag_normal_d), \ macro_f_console_parameter_t_initialize_7( 0, f_console_flag_normal_d | f_console_flag_empty_long_d | f_console_flag_stop_d), \ } diff --git a/sources/c/program/kevux/tools/remove/rm/print.c b/sources/c/program/kevux/tools/remove/rm/print.c index a916a3f..aeaa7bb 100644 --- a/sources/c/program/kevux/tools/remove/rm/print.c +++ b/sources/c/program/kevux/tools/remove/rm/print.c @@ -40,7 +40,7 @@ extern "C" { fll_program_print_help_option(print, kt_remove_short_simulate_s, kt_remove_long_simulate_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Simulate removal rather than actually removing."); fll_program_print_help_option(print, kt_remove_rm_short_verbose_s, kt_remove_rm_long_verbose_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Increase verbosity beyond normal, printing more details."); - fll_program_print_help_option_long(print, f_console_standard_long_version_s, f_console_symbol_long_normal_s, " Print only the program version number and immediately exit."); + fll_program_print_help_option_long(print, kt_remove_rm_long_version_s, f_console_symbol_long_normal_s, " Print only the program version number and immediately exit."); f_print_dynamic_raw(f_string_eol_s, print->to); diff --git a/sources/c/program/kevux/tools/remove/rm/string.c b/sources/c/program/kevux/tools/remove/rm/string.c index 7a890f8..c5f9140 100644 --- a/sources/c/program/kevux/tools/remove/rm/string.c +++ b/sources/c/program/kevux/tools/remove/rm/string.c @@ -22,6 +22,7 @@ extern "C" { const f_string_static_t kt_remove_rm_long_preserve_root_s = macro_f_string_static_t_initialize_1(KT_REMOVE_rm_long_preserve_root_s, 0, KT_REMOVE_rm_long_preserve_root_s_length); const f_string_static_t kt_remove_rm_long_preserve_root_not_s = macro_f_string_static_t_initialize_1(KT_REMOVE_rm_long_preserve_root_not_s, 0, KT_REMOVE_rm_long_preserve_root_not_s_length); const f_string_static_t kt_remove_rm_long_verbose_s = macro_f_string_static_t_initialize_1(KT_REMOVE_rm_long_verbose_s, 0, KT_REMOVE_rm_long_verbose_s_length); + const f_string_static_t kt_remove_rm_long_version_s = macro_f_string_static_t_initialize_1(KT_REMOVE_rm_long_version_s, 0, KT_REMOVE_rm_long_version_s_length); const f_string_static_t kt_remove_rm_static_end_s = macro_f_string_static_t_initialize_1(KT_REMOVE_rm_static_end_s, 0, KT_REMOVE_rm_static_end_s_length); const f_string_static_t kt_remove_rm_static_interactive_always_s = macro_f_string_static_t_initialize_1(KT_REMOVE_rm_static_interactive_always_s, 0, KT_REMOVE_rm_static_interactive_always_s_length); diff --git a/sources/c/program/kevux/tools/remove/rm/string.h b/sources/c/program/kevux/tools/remove/rm/string.h index 26f3b76..c058c65 100644 --- a/sources/c/program/kevux/tools/remove/rm/string.h +++ b/sources/c/program/kevux/tools/remove/rm/string.h @@ -43,6 +43,7 @@ extern "C" { #define KT_REMOVE_rm_long_preserve_root_s "preserve-root" #define KT_REMOVE_rm_long_preserve_root_not_s "no-preserve-root" #define KT_REMOVE_rm_long_verbose_s "verbose" + #define KT_REMOVE_rm_long_version_s "version" #define KT_REMOVE_rm_static_end_s "--" #define KT_REMOVE_rm_static_interactive_always_s "--interactive=always" @@ -63,6 +64,7 @@ extern "C" { #define KT_REMOVE_rm_long_preserve_root_s_length 13 #define KT_REMOVE_rm_long_preserve_root_not_s_length 16 #define KT_REMOVE_rm_long_verbose_s_length 7 + #define KT_REMOVE_rm_long_version_s_length 7 #define KT_REMOVE_rm_static_end_s_length 2 #define KT_REMOVE_rm_static_interactive_always_s_length 20 @@ -83,6 +85,7 @@ extern "C" { extern const f_string_static_t kt_remove_rm_long_preserve_root_s; extern const f_string_static_t kt_remove_rm_long_preserve_root_not_s; extern const f_string_static_t kt_remove_rm_long_verbose_s; + extern const f_string_static_t kt_remove_rm_long_version_s; extern const f_string_static_t kt_remove_rm_static_end_s; extern const f_string_static_t kt_remove_rm_static_interactive_always_s; diff --git a/sources/c/program/kevux/tools/remove/rmdir/enumeration.h b/sources/c/program/kevux/tools/remove/rmdir/enumeration.h index a4aedb5..0e0cf40 100644 --- a/sources/c/program/kevux/tools/remove/rmdir/enumeration.h +++ b/sources/c/program/kevux/tools/remove/rmdir/enumeration.h @@ -32,11 +32,11 @@ extern "C" { { \ macro_fll_program_console_parameter_standard_initialize, \ \ - macro_f_console_parameter_t_initialize_5( kt_remove_rmdir_long_ignore_empty_not_s, 0, f_console_flag_normal_d), \ - macro_f_console_parameter_t_initialize_3(kt_remove_rmdir_short_parents_s, kt_remove_rmdir_long_parents_s, 0, f_console_flag_normal_d), \ - macro_f_console_parameter_t_initialize_3(kt_remove_short_simulate_s, kt_remove_long_simulate_s, 0, f_console_flag_normal_d), \ - macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_normal_d), \ - macro_f_console_parameter_t_initialize_5( f_console_standard_long_version_s, 0, f_console_flag_normal_d), \ + macro_f_console_parameter_t_initialize_5( kt_remove_rmdir_long_ignore_empty_not_s, 0, f_console_flag_normal_d), \ + macro_f_console_parameter_t_initialize_3(kt_remove_rmdir_short_parents_s, kt_remove_rmdir_long_parents_s, 0, f_console_flag_normal_d), \ + macro_f_console_parameter_t_initialize_3(kt_remove_short_simulate_s, kt_remove_long_simulate_s, 0, f_console_flag_normal_d), \ + macro_f_console_parameter_t_initialize_3(kt_remove_rmdir_short_verbose_s, kt_remove_rmdir_long_verbose_s, 0, f_console_flag_normal_d), \ + macro_f_console_parameter_t_initialize_5( kt_remove_rmdir_long_version_s, 0, f_console_flag_normal_d), \ } #define kt_remove_rmdir_total_parameters_d (f_console_parameter_state_type_total_d + 5) diff --git a/sources/c/program/kevux/tools/remove/rmdir/print.c b/sources/c/program/kevux/tools/remove/rmdir/print.c index c73d412..dd2d843 100644 --- a/sources/c/program/kevux/tools/remove/rmdir/print.c +++ b/sources/c/program/kevux/tools/remove/rmdir/print.c @@ -29,8 +29,10 @@ extern "C" { fll_program_print_help_option(print, kt_remove_short_simulate_s, kt_remove_long_simulate_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Simulate removal rather than actually removing."); fll_program_print_help_option_long(print, kt_remove_rmdir_long_ignore_empty_not_s, f_console_symbol_long_normal_s, "Ignore directories that are not empty rather than fail on error."); - fll_program_print_help_option_long(print, f_console_standard_long_verbose_s, f_console_symbol_long_normal_s, " Increase verbosity beyond normal, printing more details."); - fll_program_print_help_option_long(print, f_console_standard_long_version_s, f_console_symbol_long_normal_s, " Print only the program version number and immediately exit."); + + fll_program_print_help_option(print, kt_remove_rmdir_short_verbose_s, kt_remove_rmdir_long_verbose_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Increase verbosity beyond normal, printing more details."); + + fll_program_print_help_option_long(print, kt_remove_rmdir_long_version_s, f_console_symbol_long_normal_s, " Print only the program version number and immediately exit."); f_print_dynamic_raw(f_string_eol_s, print->to); diff --git a/sources/c/program/kevux/tools/remove/rmdir/string.c b/sources/c/program/kevux/tools/remove/rmdir/string.c index d42bc55..e55f1db 100644 --- a/sources/c/program/kevux/tools/remove/rmdir/string.c +++ b/sources/c/program/kevux/tools/remove/rmdir/string.c @@ -11,9 +11,12 @@ extern "C" { #ifndef _di_kt_remove_rmdir_parameter_s_ const f_string_static_t kt_remove_rmdir_short_parents_s = macro_f_string_static_t_initialize_1(KT_REMOVE_rmdir_short_parents_s, 0, KT_REMOVE_rmdir_short_parents_s_length); + const f_string_static_t kt_remove_rmdir_short_verbose_s = macro_f_string_static_t_initialize_1(KT_REMOVE_rmdir_short_verbose_s, 0, KT_REMOVE_rmdir_short_verbose_s_length); const f_string_static_t kt_remove_rmdir_long_ignore_empty_not_s = macro_f_string_static_t_initialize_1(KT_REMOVE_rmdir_long_ignore_empty_not_s, 0, KT_REMOVE_rmdir_long_ignore_empty_not_s_length); const f_string_static_t kt_remove_rmdir_long_parents_s = macro_f_string_static_t_initialize_1(KT_REMOVE_rmdir_long_parents_s, 0, KT_REMOVE_rmdir_long_parents_s_length); + const f_string_static_t kt_remove_rmdir_long_verbose_s = macro_f_string_static_t_initialize_1(KT_REMOVE_rmdir_long_verbose_s, 0, KT_REMOVE_rmdir_long_verbose_s_length); + const f_string_static_t kt_remove_rmdir_long_version_s = macro_f_string_static_t_initialize_1(KT_REMOVE_rmdir_long_version_s, 0, KT_REMOVE_rmdir_long_version_s_length); #endif // _di_kt_remove_rmdir_parameter_s_ #ifdef __cplusplus diff --git a/sources/c/program/kevux/tools/remove/rmdir/string.h b/sources/c/program/kevux/tools/remove/rmdir/string.h index c8fe707..540fc6f 100644 --- a/sources/c/program/kevux/tools/remove/rmdir/string.h +++ b/sources/c/program/kevux/tools/remove/rmdir/string.h @@ -32,19 +32,28 @@ extern "C" { */ #ifndef _di_kt_remove_rmdir_parameter_s_ #define KT_REMOVE_rmdir_short_parents_s "p" + #define KT_REMOVE_rmdir_short_verbose_s "v" #define KT_REMOVE_rmdir_long_ignore_empty_not_s "ignore-fail-on-non-empty" #define KT_REMOVE_rmdir_long_parents_s "parents" + #define KT_REMOVE_rmdir_long_verbose_s "verbose" + #define KT_REMOVE_rmdir_long_version_s "version" #define KT_REMOVE_rmdir_short_parents_s_length 1 + #define KT_REMOVE_rmdir_short_verbose_s_length 1 #define KT_REMOVE_rmdir_long_ignore_empty_not_s_length 24 #define KT_REMOVE_rmdir_long_parents_s_length 7 + #define KT_REMOVE_rmdir_long_verbose_s_length 7 + #define KT_REMOVE_rmdir_long_version_s_length 7 extern const f_string_static_t kt_remove_rmdir_short_parents_s; + extern const f_string_static_t kt_remove_rmdir_short_verbose_s; extern const f_string_static_t kt_remove_rmdir_long_ignore_empty_not_s; extern const f_string_static_t kt_remove_rmdir_long_parents_s; + extern const f_string_static_t kt_remove_rmdir_long_verbose_s; + extern const f_string_static_t kt_remove_rmdir_long_version_s; #endif // _di_kt_remove_rmdir_parameter_s_ #ifdef __cplusplus -- 1.8.3.1