From f170f7bb33ba60e56d1414bc27ba1a6d2cdf352c Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 10 Dec 2022 17:41:35 -0600 Subject: [PATCH] Update: Remove unnecessary program_name and program_name_long variables. The help printing functions are already per-sub-program-specific. --- level_3/fss_write/c/basic/main.c | 2 -- level_3/fss_write/c/basic/print.c | 4 ++-- level_3/fss_write/c/basic_list/main.c | 2 -- level_3/fss_write/c/basic_list/print.c | 4 ++-- level_3/fss_write/c/embedded_list/main.c | 2 -- level_3/fss_write/c/embedded_list/print.c | 4 ++-- level_3/fss_write/c/extended/main.c | 2 -- level_3/fss_write/c/extended/print.c | 4 ++-- level_3/fss_write/c/extended_list/main.c | 2 -- level_3/fss_write/c/extended_list/print.c | 4 ++-- level_3/fss_write/c/main/common.h | 5 ----- level_3/fss_write/c/main/main.c | 16 ---------------- level_3/fss_write/c/payload/main.c | 2 -- level_3/fss_write/c/payload/print.c | 4 ++-- 14 files changed, 12 insertions(+), 45 deletions(-) diff --git a/level_3/fss_write/c/basic/main.c b/level_3/fss_write/c/basic/main.c index 2037ba2..362b7d5 100644 --- a/level_3/fss_write/c/basic/main.c +++ b/level_3/fss_write/c/basic/main.c @@ -7,8 +7,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fss_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; setting.standard = fss_write_basic_standard_s; - setting.program_name = &fss_write_basic_program_name_s; - setting.program_name_long = &fss_write_basic_program_name_long_s; setting.process_content = &fss_write_basic_process_content; setting.process_help = &fss_write_basic_process_help; setting.process_normal = &fss_write_process_normal; diff --git a/level_3/fss_write/c/basic/print.c b/level_3/fss_write/c/basic/print.c index d34c78b..09d3e55 100644 --- a/level_3/fss_write/c/basic/print.c +++ b/level_3/fss_write/c/basic/print.c @@ -11,13 +11,13 @@ extern "C" { f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, setting->program_name_long ? *setting->program_name_long : fss_write_program_name_long_s, fss_write_program_version_s); + fll_program_print_help_header(print, fss_write_basic_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); f_print_dynamic_raw(f_string_eol_s, print.to); - fll_program_print_help_usage(print, setting->program_name ? *setting->program_name : fss_write_program_name_s, f_string_empty_s); + fll_program_print_help_usage(print, fss_write_basic_program_name_s, f_string_empty_s); fss_write_print_help_pipe(setting, print); diff --git a/level_3/fss_write/c/basic_list/main.c b/level_3/fss_write/c/basic_list/main.c index 3101786..cb51dc0 100644 --- a/level_3/fss_write/c/basic_list/main.c +++ b/level_3/fss_write/c/basic_list/main.c @@ -7,8 +7,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fss_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; setting.standard = fss_write_basic_list_standard_s; - setting.program_name = &fss_write_basic_list_program_name_s; - setting.program_name_long = &fss_write_basic_list_program_name_long_s; setting.process_content = &fss_write_basic_list_process_content; setting.process_help = &fss_write_basic_list_process_help; setting.process_normal = &fss_write_process_normal; diff --git a/level_3/fss_write/c/basic_list/print.c b/level_3/fss_write/c/basic_list/print.c index 2ee5e26..00f0e3b 100644 --- a/level_3/fss_write/c/basic_list/print.c +++ b/level_3/fss_write/c/basic_list/print.c @@ -11,13 +11,13 @@ extern "C" { f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, setting->program_name_long ? *setting->program_name_long : fss_write_program_name_long_s, fss_write_program_version_s); + fll_program_print_help_header(print, fss_write_basic_list_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); f_print_dynamic_raw(f_string_eol_s, print.to); - fll_program_print_help_usage(print, setting->program_name ? *setting->program_name : fss_write_program_name_s, f_string_empty_s); + fll_program_print_help_usage(print, fss_write_basic_list_program_name_s, f_string_empty_s); fss_write_print_help_pipe(setting, print); diff --git a/level_3/fss_write/c/embedded_list/main.c b/level_3/fss_write/c/embedded_list/main.c index bde0b19..60dcd37 100644 --- a/level_3/fss_write/c/embedded_list/main.c +++ b/level_3/fss_write/c/embedded_list/main.c @@ -7,8 +7,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fss_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; setting.standard = fss_write_embedded_list_standard_s; - setting.program_name = &fss_write_embedded_list_program_name_s; - setting.program_name_long = &fss_write_embedded_list_program_name_long_s; setting.process_content = &fss_write_embedded_list_process_content; setting.process_help = &fss_write_embedded_list_process_help; setting.process_normal = &fss_write_process_normal; diff --git a/level_3/fss_write/c/embedded_list/print.c b/level_3/fss_write/c/embedded_list/print.c index a5c338a..d767899 100644 --- a/level_3/fss_write/c/embedded_list/print.c +++ b/level_3/fss_write/c/embedded_list/print.c @@ -11,13 +11,13 @@ extern "C" { f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, setting->program_name_long ? *setting->program_name_long : fss_write_program_name_long_s, fss_write_program_version_s); + fll_program_print_help_header(print, fss_write_embedded_list_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); f_print_dynamic_raw(f_string_eol_s, print.to); - fll_program_print_help_usage(print, setting->program_name ? *setting->program_name : fss_write_program_name_s, f_string_empty_s); + fll_program_print_help_usage(print, fss_write_embedded_list_program_name_s, f_string_empty_s); fss_write_print_help_pipe(setting, print); diff --git a/level_3/fss_write/c/extended/main.c b/level_3/fss_write/c/extended/main.c index 37bfa07..5af6874 100644 --- a/level_3/fss_write/c/extended/main.c +++ b/level_3/fss_write/c/extended/main.c @@ -7,8 +7,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fss_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; setting.standard = fss_write_extended_standard_s; - setting.program_name = &fss_write_extended_program_name_s; - setting.program_name_long = &fss_write_extended_program_name_long_s; setting.process_content = &fss_write_extended_process_content; setting.process_help = &fss_write_extended_process_help; setting.process_normal = &fss_write_process_normal; diff --git a/level_3/fss_write/c/extended/print.c b/level_3/fss_write/c/extended/print.c index 887bd3a..428370a 100644 --- a/level_3/fss_write/c/extended/print.c +++ b/level_3/fss_write/c/extended/print.c @@ -11,13 +11,13 @@ extern "C" { f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, setting->program_name_long ? *setting->program_name_long : fss_write_program_name_long_s, fss_write_program_version_s); + fll_program_print_help_header(print, fss_write_extended_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); f_print_dynamic_raw(f_string_eol_s, print.to); - fll_program_print_help_usage(print, setting->program_name ? *setting->program_name : fss_write_program_name_s, f_string_empty_s); + fll_program_print_help_usage(print, fss_write_extended_program_name_s, f_string_empty_s); fss_write_print_help_pipe(setting, print); diff --git a/level_3/fss_write/c/extended_list/main.c b/level_3/fss_write/c/extended_list/main.c index 33dad7b..b77b74b 100644 --- a/level_3/fss_write/c/extended_list/main.c +++ b/level_3/fss_write/c/extended_list/main.c @@ -7,8 +7,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fss_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; setting.standard = fss_write_extended_list_standard_s; - setting.program_name = &fss_write_extended_list_program_name_s; - setting.program_name_long = &fss_write_extended_list_program_name_long_s; setting.process_content = &fss_write_extended_list_process_content; setting.process_help = &fss_write_extended_list_process_help; setting.process_normal = &fss_write_process_normal; diff --git a/level_3/fss_write/c/extended_list/print.c b/level_3/fss_write/c/extended_list/print.c index 8622e55..f24c56b 100644 --- a/level_3/fss_write/c/extended_list/print.c +++ b/level_3/fss_write/c/extended_list/print.c @@ -11,13 +11,13 @@ extern "C" { f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, setting->program_name_long ? *setting->program_name_long : fss_write_program_name_long_s, fss_write_program_version_s); + fll_program_print_help_header(print, fss_write_extended_list_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); f_print_dynamic_raw(f_string_eol_s, print.to); - fll_program_print_help_usage(print, setting->program_name ? *setting->program_name : fss_write_program_name_s, f_string_empty_s); + fll_program_print_help_usage(print, fss_write_extended_list_program_name_s, f_string_empty_s); fss_write_print_help_pipe(setting, print); diff --git a/level_3/fss_write/c/main/common.h b/level_3/fss_write/c/main/common.h index 03cbe4e..fcccbed 100644 --- a/level_3/fss_write/c/main/common.h +++ b/level_3/fss_write/c/main/common.h @@ -362,9 +362,6 @@ extern "C" { f_string_static_t *content; f_string_statics_t *contents; - const f_string_static_t *program_name; - const f_string_static_t *program_name_long; - void (*process_content)(fll_program_data_t * const main, void * const setting, const bool last); void (*process_help)(fll_program_data_t * const main, void * const setting); void (*process_normal)(fll_program_data_t * const main, void * const setting); @@ -399,8 +396,6 @@ extern "C" { 0, \ 0, \ 0, \ - 0, \ - 0, \ } #endif // _di_fss_write_setting_t_ diff --git a/level_3/fss_write/c/main/main.c b/level_3/fss_write/c/main/main.c index ed9d4ae..367f2cd 100644 --- a/level_3/fss_write/c/main/main.c +++ b/level_3/fss_write/c/main/main.c @@ -13,8 +13,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fll_program_data_t data = fll_program_data_t_initialize; fss_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; - setting.program_name = &fss_write_program_name_s; - setting.program_name_long = &fss_write_program_name_long_s; f_console_parameter_t parameters[] = fss_write_console_parameter_t_initialize; data.parameters.array = parameters; @@ -57,8 +55,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { if (!main || !setting || F_status_is_error(setting->status) || (setting->flag & fss_write_flag_version_e)) return; setting->standard = fss_write_basic_standard_s; - setting->program_name = &fss_write_program_name_s; - setting->program_name_long = &fss_write_program_name_long_s; setting->process_content = &fss_write_basic_process_content; setting->process_help = &fss_write_main_process_help; setting->process_normal = &fss_write_process_normal; @@ -80,8 +76,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0000_s) == F_equal_to) { setting->standard = fss_write_basic_standard_s; - setting->program_name = &fss_write_basic_program_name_s; - setting->program_name_long = &fss_write_basic_program_name_long_s; setting->process_content = &fss_write_basic_process_content; setting->process_help = &fss_write_basic_process_help; setting->process_object = &fss_write_basic_process_object; @@ -96,8 +90,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0001_s) == F_equal_to) { setting->standard = fss_write_extended_standard_s; - setting->program_name = &fss_write_extended_program_name_s; - setting->program_name_long = &fss_write_extended_program_name_long_s; setting->process_content = &fss_write_extended_process_content; setting->process_help = &fss_write_extended_process_help; setting->process_object = &fss_write_extended_process_object; @@ -112,8 +104,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0002_s) == F_equal_to) { setting->standard = fss_write_basic_list_standard_s; - setting->program_name = &fss_write_basic_list_program_name_s; - setting->program_name_long = &fss_write_basic_list_program_name_long_s; setting->process_content = &fss_write_basic_list_process_content; setting->process_help = &fss_write_basic_list_process_help; setting->process_object = &fss_write_basic_list_process_object; @@ -128,8 +118,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0003_s) == F_equal_to) { setting->standard = fss_write_extended_list_standard_s; - setting->program_name = &fss_write_extended_list_program_name_s; - setting->program_name_long = &fss_write_extended_list_program_name_long_s; setting->process_content = &fss_write_extended_list_process_content; setting->process_help = &fss_write_extended_list_process_help; setting->process_object = &fss_write_extended_list_process_object; @@ -144,8 +132,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fl_string_dynamic_compare(argv[index], fss_write_format_code_human_0008_s) == F_equal_to) { setting->standard = fss_write_embedded_list_standard_s; - setting->program_name = &fss_write_embedded_list_program_name_s; - setting->program_name_long = &fss_write_embedded_list_program_name_long_s; setting->process_content = &fss_write_embedded_list_process_content; setting->process_help = &fss_write_embedded_list_process_help; setting->process_object = &fss_write_embedded_list_process_object; @@ -160,8 +146,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fl_string_dynamic_compare(argv[index], fss_write_format_code_human_000e_s) == F_equal_to) { setting->standard = fss_write_payload_standard_s; - setting->program_name = &fss_write_payload_program_name_s; - setting->program_name_long = &fss_write_payload_program_name_long_s; setting->process_content = 0; // Not used by payload. setting->process_help = &fss_write_payload_process_help; setting->process_normal = &fss_write_process_normal; diff --git a/level_3/fss_write/c/payload/main.c b/level_3/fss_write/c/payload/main.c index 7dcb8d4..a6795d5 100644 --- a/level_3/fss_write/c/payload/main.c +++ b/level_3/fss_write/c/payload/main.c @@ -7,8 +7,6 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) { fss_write_setting_t setting = fss_write_setting_t_initialize; setting.state.data = (void *) &data; setting.standard = fss_write_payload_standard_s; - setting.program_name = &fss_write_payload_program_name_s; - setting.program_name_long = &fss_write_payload_program_name_long_s; setting.process_content = 0; // Not used by payload. setting.process_help = &fss_write_payload_process_help; setting.process_normal = &fss_write_process_normal; diff --git a/level_3/fss_write/c/payload/print.c b/level_3/fss_write/c/payload/print.c index 1d1e4d2..925bd05 100644 --- a/level_3/fss_write/c/payload/print.c +++ b/level_3/fss_write/c/payload/print.c @@ -28,13 +28,13 @@ extern "C" { f_print_dynamic_raw(setting->line_first, print.to); - fll_program_print_help_header(print, setting->program_name_long ? *setting->program_name_long : fss_write_program_name_long_s, fss_write_program_version_s); + fll_program_print_help_header(print, fss_write_payload_program_name_long_s, fss_write_program_version_s); fss_write_print_help(setting, print); f_print_dynamic_raw(f_string_eol_s, print.to); - fll_program_print_help_usage(print, setting->program_name ? *setting->program_name : fss_write_program_name_s, f_string_empty_s); + fll_program_print_help_usage(print, fss_write_payload_program_name_s, f_string_empty_s); fss_write_print_help_pipe(setting, print); -- 1.8.3.1