From 97219dbbad8a1df983301d4ca9667d011ec5fe20 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 8 Sep 2019 17:25:22 -0500 Subject: [PATCH] Cleanup: provide helper structure f_console_parameters This is provided to help shorten the number of parameters passed to functions. --- level_0/f_console/c/console.h | 20 ++++- level_1/fl_console/c/console.c | 92 +++++++++++----------- level_1/fl_console/c/console.h | 9 +-- level_2/fll_program/c/program.c | 8 +- level_2/fll_program/c/program.h | 4 +- level_3/bit_dump/c/bit_dump.c | 7 +- level_3/firewall/c/firewall.c | 7 +- .../fss_basic_list_read/c/fss_basic_list_read.c | 7 +- .../fss_basic_list_write/c/fss_basic_list_write.c | 7 +- level_3/fss_basic_read/c/fss_basic_read.c | 7 +- level_3/fss_basic_write/c/fss_basic_write.c | 7 +- level_3/fss_extended_read/c/fss_extended_read.c | 7 +- level_3/fss_extended_write/c/fss_extended_write.c | 7 +- level_3/fss_status_code/c/fss_status_code.c | 7 +- level_3/init/c/init.c | 5 +- level_3/status_code/c/status_code.c | 7 +- 16 files changed, 136 insertions(+), 72 deletions(-) diff --git a/level_0/f_console/c/console.h b/level_0/f_console/c/console.h index 60409c2..5d393b4 100644 --- a/level_0/f_console/c/console.h +++ b/level_0/f_console/c/console.h @@ -161,17 +161,33 @@ extern "C" { /** * Provide a helper structure for references and processing parameters. * + * The f_console_parameters is designed for passing this to a function as a single argument. + * The "parameters" property is intended to be populated with an aray of f_console_parameter_id whose size is defined by the "used" property. + * This follows the idea of f_string_dynamic and has a "used" instead of length, but because this is not intended to be dynamically allocated there is no "size" property. + */ +#ifndef _di_f_console_parameters_ + typedef struct { + f_console_parameter *parameter; + f_array_length used; + } f_console_parameters; + + #define f_console_parameters_initialize { 0, 0 } +#endif // _di_f_console_parameters_ + +/** + * Provide a helper structure for references and processing standard C main() arguments. + * * The f_console_parameter_id is designed to be used for the enums to represent a any given parameter by the ID. * * The f_console_parameter_ids is designed for passing this to a function as a single argument. - * The "ids" property is intended to be populated with an aray of f_console_parameter_id whose size is defined by the "used" property. + * The "id" property is intended to be populated with an aray of f_console_parameter_id whose size is defined by the "used" property. * This follows the idea of f_string_dynamic and has a "used" instead of length, but because this is not intended to be dynamically allocated there is no "size" property. */ #ifndef _di_f_console_parameter_id_ typedef uint16_t f_console_parameter_id; typedef struct { - f_console_parameter_id *ids; + f_console_parameter_id *id; f_array_length used; } f_console_parameter_ids; diff --git a/level_1/fl_console/c/console.c b/level_1/fl_console/c/console.c index df0419b..0ea8b94 100644 --- a/level_1/fl_console/c/console.c +++ b/level_1/fl_console/c/console.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_fl_console_parameter_process_ - f_return_status fl_console_parameter_process(const f_console_arguments arguments, f_console_parameter parameters[], const f_array_length parameters_total, f_string_lengths *remaining) { + f_return_status fl_console_parameter_process(const f_console_arguments arguments, f_console_parameters parameters, f_string_lengths *remaining) { #ifndef _di_level_1_parameter_checking_ if (remaining == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ @@ -65,10 +65,10 @@ extern "C" { if (needs_additional.used > 0) { parameter_counter = needs_additional.array[0]; - if (parameters[parameter_counter].additional.used >= parameters[parameter_counter].additional.size) { + if (parameters.parameter[parameter_counter].additional.used >= parameters.parameter[parameter_counter].additional.size) { f_status allocation_status = f_none; - f_macro_string_lengths_resize(allocation_status, parameters[parameter_counter].additional, parameters[parameter_counter].additional.size + f_console_default_allocation_step); + f_macro_string_lengths_resize(allocation_status, parameters.parameter[parameter_counter].additional, parameters.parameter[parameter_counter].additional.size + f_console_default_allocation_step); if (f_status_is_error(allocation_status)) { f_macro_string_lengths_delete(status, needs_additional); @@ -76,9 +76,9 @@ extern "C" { } } - parameters[parameter_counter].result = f_console_result_additional; - parameters[parameter_counter].additional.array[parameters[parameter_counter].additional.used] = location; - parameters[parameter_counter].additional.used++; + parameters.parameter[parameter_counter].result = f_console_result_additional; + parameters.parameter[parameter_counter].additional.array[parameters.parameter[parameter_counter].additional.used] = location; + parameters.parameter[parameter_counter].additional.used++; needs_additional.used--; @@ -90,26 +90,26 @@ extern "C" { else if (console_short > f_console_none) { // The sub_location is used on a per increment basis (such as 'tar -xcf', the '-' would have an increment of 1, therefore x, c, and f would all be three separate parameters). while (sub_location < string_length) { - for (parameter_counter = 0; parameter_counter < parameters_total; parameter_counter++) { - if (parameters[parameter_counter].type != console_type) { + for (parameter_counter = 0; parameter_counter < parameters.used; parameter_counter++) { + if (parameters.parameter[parameter_counter].type != console_type) { continue; } if (result == console_short) { - if (parameters[parameter_counter].symbol_short == 0) { + if (parameters.parameter[parameter_counter].symbol_short == 0) { continue; } - if (strncmp(&arguments.argv[location][sub_location], parameters[parameter_counter].symbol_short, increment_by + 1) != 0) { + if (strncmp(&arguments.argv[location][sub_location], parameters.parameter[parameter_counter].symbol_short, increment_by + 1) != 0) { continue; } } else if (result == console_long) { - if (parameters[parameter_counter].symbol_long == 0) { + if (parameters.parameter[parameter_counter].symbol_long == 0) { continue; } - if (strncmp(&arguments.argv[location][sub_location], parameters[parameter_counter].symbol_long, increment_by + 1) != 0) { + if (strncmp(&arguments.argv[location][sub_location], parameters.parameter[parameter_counter].symbol_long, increment_by + 1) != 0) { continue; } } @@ -117,20 +117,20 @@ extern "C" { continue; } - parameters[parameter_counter].result = f_console_result_found; - parameters[parameter_counter].location = location; - parameters[parameter_counter].location_sub = 0; - parameters[parameter_counter].total++; + parameters.parameter[parameter_counter].result = f_console_result_found; + parameters.parameter[parameter_counter].location = location; + parameters.parameter[parameter_counter].location_sub = 0; + parameters.parameter[parameter_counter].total++; if (result == console_short) { - parameters[parameter_counter].location_sub = sub_location; + parameters.parameter[parameter_counter].location_sub = sub_location; } - if (parameters[parameter_counter].has_additional) { - if (needs_additional.used + parameters[parameter_counter].has_additional > needs_additional.size) { + if (parameters.parameter[parameter_counter].has_additional) { + if (needs_additional.used + parameters.parameter[parameter_counter].has_additional > needs_additional.size) { f_status allocation_status = f_none; - f_macro_string_lengths_resize(allocation_status, needs_additional, needs_additional.used + parameters[parameter_counter].has_additional); + f_macro_string_lengths_resize(allocation_status, needs_additional, needs_additional.used + parameters.parameter[parameter_counter].has_additional); if (f_status_is_error(allocation_status)) { f_macro_string_lengths_delete(status, needs_additional); @@ -138,7 +138,7 @@ extern "C" { } } - for (f_array_length additional = 0; additional < parameters[parameter_counter].has_additional; additional++) { + for (f_array_length additional = 0; additional < parameters.parameter[parameter_counter].has_additional; additional++) { needs_additional.array[needs_additional.used] = parameter_counter; needs_additional.used++; } // for @@ -153,29 +153,29 @@ extern "C" { else { found = f_false; - for (parameter_counter = 0; parameter_counter < parameters_total; parameter_counter++) { - if (parameters[parameter_counter].type != f_console_type_other) { + for (parameter_counter = 0; parameter_counter < parameters.used; parameter_counter++) { + if (parameters.parameter[parameter_counter].type != f_console_type_other) { continue; } - if (parameters[parameter_counter].symbol_other == 0) { + if (parameters.parameter[parameter_counter].symbol_other == 0) { continue; } - if (strncmp(arguments.argv[location], parameters[parameter_counter].symbol_other, string_length + 1) != 0) { + if (strncmp(arguments.argv[location], parameters.parameter[parameter_counter].symbol_other, string_length + 1) != 0) { continue; } - parameters[parameter_counter].result = f_console_result_found; - parameters[parameter_counter].location = location; - parameters[parameter_counter].location_sub = 0; - parameters[parameter_counter].total++; + parameters.parameter[parameter_counter].result = f_console_result_found; + parameters.parameter[parameter_counter].location = location; + parameters.parameter[parameter_counter].location_sub = 0; + parameters.parameter[parameter_counter].total++; - if (parameters[parameter_counter].has_additional) { - if (needs_additional.used + parameters[parameter_counter].has_additional > needs_additional.size) { + if (parameters.parameter[parameter_counter].has_additional) { + if (needs_additional.used + parameters.parameter[parameter_counter].has_additional > needs_additional.size) { f_status allocation_status = f_none; - f_macro_string_lengths_resize(allocation_status, needs_additional, needs_additional.used + parameters[parameter_counter].has_additional); + f_macro_string_lengths_resize(allocation_status, needs_additional, needs_additional.used + parameters.parameter[parameter_counter].has_additional); if (f_status_is_error(allocation_status)) { f_macro_string_lengths_delete(status, needs_additional); @@ -183,7 +183,7 @@ extern "C" { } } - for (f_array_length additional = 0; additional < parameters[parameter_counter].has_additional; additional++) { + for (f_array_length additional = 0; additional < parameters.parameter[parameter_counter].has_additional; additional++) { needs_additional.array[needs_additional.used] = parameter_counter; needs_additional.used++; } // for @@ -194,7 +194,7 @@ extern "C" { } // for if (!found) { - // populate list of remaining parameters not associated with anything. + // populate list of remaining parameters.parameter not associated with anything. if (remaining->used >= remaining->size) { f_status allocation_status = f_none; @@ -231,11 +231,11 @@ extern "C" { #endif // _di_fl_console_parameter_process_ #ifndef _di_fl_console_parameter_prioritize_ - f_return_status fl_console_parameter_prioritize(const f_console_parameter parameters[], const f_array_length parameters_total, const f_console_parameter_ids choices, f_console_parameter_id *decision) { + f_return_status fl_console_parameter_prioritize(const f_console_parameters parameters, const f_console_parameter_ids choices, f_console_parameter_id *decision) { #ifndef _di_level_1_parameter_checking_ if (decision == 0) return f_status_set_error(f_invalid_parameter); - if (parameters_total == 0) return f_status_set_error(f_invalid_parameter); - if (choices.ids == 0) return f_status_set_error(f_invalid_parameter); + if (parameters.used == 0) return f_status_set_error(f_invalid_parameter); + if (choices.id == 0) return f_status_set_error(f_invalid_parameter); if (choices.used == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_1_parameter_checking_ @@ -244,17 +244,17 @@ extern "C" { f_console_parameter_id priority = 0; for (f_array_length i = 0; i < choices.used; i++) { - if (choices.ids[i] > parameters_total) return f_status_set_error(f_invalid_parameter); + if (choices.id[i] > parameters.used) return f_status_set_error(f_invalid_parameter); - if (parameters[choices.ids[i]].result == f_console_result_found) { - if (parameters[choices.ids[i]].location > location) { - location = parameters[choices.ids[i]].location; - location_sub = parameters[choices.ids[i]].location_sub; - priority = choices.ids[i]; + if (parameters.parameter[choices.id[i]].result == f_console_result_found) { + if (parameters.parameter[choices.id[i]].location > location) { + location = parameters.parameter[choices.id[i]].location; + location_sub = parameters.parameter[choices.id[i]].location_sub; + priority = choices.id[i]; } - else if (parameters[choices.ids[i]].location == location && parameters[choices.ids[i]].location_sub > location_sub) { - location_sub = parameters[choices.ids[i]].location_sub; - priority = choices.ids[i]; + else if (parameters.parameter[choices.id[i]].location == location && parameters.parameter[choices.id[i]].location_sub > location_sub) { + location_sub = parameters.parameter[choices.id[i]].location_sub; + priority = choices.id[i]; } } } // for diff --git a/level_1/fl_console/c/console.h b/level_1/fl_console/c/console.h index 223d67b..eb2334a 100644 --- a/level_1/fl_console/c/console.h +++ b/level_1/fl_console/c/console.h @@ -52,8 +52,7 @@ extern "C" { * The parameters passed to the process. * @param parameters * The console parameters to look for. - * @param parameters_total - * The used size of the parameters array. + * This will be updated by this function with the results. * @param remaining * A list of remaining parameters not associated with anything. * @@ -64,7 +63,7 @@ extern "C" { * f_reallocation_error (with error bit) on memory reallocation error. */ #ifndef _di_fl_console_parameter_process_ - extern f_return_status fl_console_parameter_process(const f_console_arguments arguments, f_console_parameter parameters[], const f_array_length parameters_total, f_string_lengths *remaining); + extern f_return_status fl_console_parameter_process(const f_console_arguments arguments, f_console_parameters parameters, f_string_lengths *remaining); #endif // _di_fl_console_parameter_process_ /** @@ -81,8 +80,6 @@ extern "C" { * * @param parameters * The parameters to process. - * @param parameters_total - * The used size of the parameters array. * @param choices * An array of numeric ids, each representing a parameter within the parameters variable. * The order does not matter. @@ -96,7 +93,7 @@ extern "C" { * f_invalid_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_console_parameter_prioritize__ - extern f_return_status fl_console_parameter_prioritize(const f_console_parameter parameters[], const f_array_length parameters_total, const f_console_parameter_ids choices, f_console_parameter_id *decision); + extern f_return_status fl_console_parameter_prioritize(const f_console_parameters parameters, const f_console_parameter_ids choices, f_console_parameter_id *decision); #endif // _di_fl_console_parameter_prioritize__ #ifdef __cplusplus diff --git a/level_2/fll_program/c/program.c b/level_2/fll_program/c/program.c index 184ca4b..175af26 100644 --- a/level_2/fll_program/c/program.c +++ b/level_2/fll_program/c/program.c @@ -79,20 +79,20 @@ extern "C" { #endif // _di_fll_program_print_version_ #ifndef _di_fll_program_process_parameters_ - f_return_status fll_program_process_parameters(const f_console_arguments arguments, f_console_parameter parameters[], const f_array_length parameters_total, const f_array_length parameter_no_color, const f_array_length parameter_light, const f_array_length parameter_dark, f_string_lengths *remaining, fl_color_context *context) { + f_return_status fll_program_process_parameters(const f_console_arguments arguments, f_console_parameters parameters, const f_array_length parameter_no_color, const f_array_length parameter_light, const f_array_length parameter_dark, f_string_lengths *remaining, fl_color_context *context) { f_status status = f_none; f_status allocation_status = f_none; - status = fl_console_parameter_process(arguments, parameters, parameters_total, remaining); + status = fl_console_parameter_process(arguments, parameters, remaining); f_console_parameter_ids choices = f_console_parameter_ids_initialize; f_console_parameter_id decision = parameter_dark; f_console_parameter_id ids[3] = { parameter_no_color, parameter_light, parameter_dark}; - choices.ids = ids; + choices.id = ids; choices.used = 3; - fl_console_parameter_prioritize(parameters, parameters_total, choices, &decision); + fl_console_parameter_prioritize(parameters, choices, &decision); // load colors unless told not to. if (decision != parameter_no_color) { diff --git a/level_2/fll_program/c/program.h b/level_2/fll_program/c/program.h index 2a5b865..923aa7c 100644 --- a/level_2/fll_program/c/program.h +++ b/level_2/fll_program/c/program.h @@ -124,8 +124,6 @@ extern "C" { * The parameters passed to the process. * @param parameters * The console parameters to look for. - * @param parameters_total - * The used size of the parameters array. * @param parameter_no_color * The parameter in the parameters array representing the no-color option. * @param parameter_light @@ -144,7 +142,7 @@ extern "C" { * f_reallocation_error (with error bit) on memory reallocation error. */ #ifndef _di_fll_program_process_parameters_ - extern f_return_status fll_program_process_parameters(const f_console_arguments arguments, f_console_parameter parameters[], const f_array_length parameters_total, const f_array_length parameter_no_color, const f_array_length parameter_light, const f_array_length parameter_dark, f_string_lengths *remaining, fl_color_context *context); + extern f_return_status fll_program_process_parameters(const f_console_arguments arguments, f_console_parameters parameters, const f_array_length parameter_no_color, const f_array_length parameter_light, const f_array_length parameter_dark, f_string_lengths *remaining, fl_color_context *context); #endif // _di_fll_program_process_parameters_ #ifdef __cplusplus diff --git a/level_3/bit_dump/c/bit_dump.c b/level_3/bit_dump/c/bit_dump.c index b4a9a39..c3362ae 100644 --- a/level_3/bit_dump/c/bit_dump.c +++ b/level_3/bit_dump/c/bit_dump.c @@ -40,7 +40,12 @@ extern "C" { #ifndef _di_bit_dump_main_ f_return_status bit_dump_main(const f_console_arguments arguments, bit_dump_data *data) { - f_status status = fll_program_process_parameters(arguments, data->parameters, bit_dump_total_parameters, bit_dump_parameter_no_color, bit_dump_parameter_light, bit_dump_parameter_dark, &data->remaining, &data->context); + f_status status = f_none; + + { + f_console_parameters parameters = { data->parameters, bit_dump_total_parameters }; + status = fll_program_process_parameters(arguments, parameters, bit_dump_parameter_no_color, bit_dump_parameter_light, bit_dump_parameter_dark, &data->remaining, &data->context); + } if (f_status_is_error(status)) { bit_dump_delete_data(data); diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 39d4007..7d9fa5b 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -56,7 +56,12 @@ extern "C" { #ifndef _di_firewall_main_ f_return_status firewall_main(const f_console_arguments arguments, firewall_data *data) { - f_status status = fll_program_process_parameters(arguments, data->parameters, firewall_total_parameters, firewall_parameter_no_color, firewall_parameter_light, firewall_parameter_dark, &data->remaining, &data->context); + f_status status = f_none; + + { + f_console_parameters parameters = { data->parameters, firewall_total_parameters }; + status = fll_program_process_parameters(arguments, parameters, firewall_parameter_no_color, firewall_parameter_light, firewall_parameter_dark, &data->remaining, &data->context); + } if (f_status_is_error(status)) { firewall_delete_data(data); diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index f8573df..26e75f3 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -33,7 +33,12 @@ extern "C" { f_return_status fss_basic_list_read_main_process_file(const f_console_arguments arguments, fss_basic_list_read_data *data, const f_string filename, const f_string_length target) __attribute__((visibility ("internal"))); f_return_status fss_basic_list_read_main(const f_console_arguments arguments, fss_basic_list_read_data *data) { - f_status status = fll_program_process_parameters(arguments, data->parameters, fss_basic_list_read_total_parameters, fss_basic_list_read_parameter_no_color, fss_basic_list_read_parameter_light, fss_basic_list_read_parameter_dark, &data->remaining, &data->context); + f_status status = f_none; + + { + f_console_parameters parameters = { data->parameters, fss_basic_list_read_total_parameters }; + status = fll_program_process_parameters(arguments, parameters, fss_basic_list_read_parameter_no_color, fss_basic_list_read_parameter_light, fss_basic_list_read_parameter_dark, &data->remaining, &data->context); + } if (f_status_is_error(status)) { fss_basic_list_read_delete_data(data); diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c index 6428253..4cca4dc 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.c @@ -28,7 +28,12 @@ extern "C" { #ifndef _di_fss_basic_list_write_main_ f_return_status fss_basic_list_write_main(const f_console_arguments arguments, fss_basic_list_write_data *data) { - f_status status = fll_program_process_parameters(arguments, data->parameters, fss_basic_list_write_total_parameters, fss_basic_list_write_parameter_no_color, fss_basic_list_write_parameter_light, fss_basic_list_write_parameter_dark, &data->remaining, &data->context); + f_status status = f_none; + + { + f_console_parameters parameters = { data->parameters, fss_basic_list_write_total_parameters }; + status = fll_program_process_parameters(arguments, parameters, fss_basic_list_write_parameter_no_color, fss_basic_list_write_parameter_light, fss_basic_list_write_parameter_dark, &data->remaining, &data->context); + } if (f_status_is_error(status)) { fss_basic_list_write_delete_data(data); diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index fc73792..611467a 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -31,7 +31,12 @@ extern "C" { f_return_status fss_basic_read_main_process_file(const f_console_arguments arguments, fss_basic_read_data *data, const f_string filename, const f_string_length target) f_gcc_attribute_visibility_internal; f_return_status fss_basic_read_main(const f_console_arguments arguments, fss_basic_read_data *data) { - f_status status = fll_program_process_parameters(arguments, data->parameters, fss_basic_read_total_parameters, fss_basic_read_parameter_no_color, fss_basic_read_parameter_light, fss_basic_read_parameter_dark, &data->remaining, &data->context); + f_status status = f_none; + + { + f_console_parameters parameters = { data->parameters, fss_basic_read_total_parameters }; + status = fll_program_process_parameters(arguments, parameters, fss_basic_read_parameter_no_color, fss_basic_read_parameter_light, fss_basic_read_parameter_dark, &data->remaining, &data->context); + } if (f_status_is_error(status)) { fss_basic_read_delete_data(data); diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c index 966ab7c..3c28a6d 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -28,7 +28,12 @@ extern "C" { #ifndef _di_fss_basic_write_main_ f_return_status fss_basic_write_main(const f_console_arguments arguments, fss_basic_write_data *data) { - f_status status = fll_program_process_parameters(arguments, data->parameters, fss_basic_write_total_parameters, fss_basic_write_parameter_no_color, fss_basic_write_parameter_light, fss_basic_write_parameter_dark, &data->remaining, &data->context); + f_status status = f_none; + + { + f_console_parameters parameters = { data->parameters, fss_basic_write_total_parameters }; + status = fll_program_process_parameters(arguments, parameters, fss_basic_write_parameter_no_color, fss_basic_write_parameter_light, fss_basic_write_parameter_dark, &data->remaining, &data->context); + } if (f_status_is_error(status)) { fss_basic_write_delete_data(data); diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 9e98b04..6ce66f2 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -32,7 +32,12 @@ extern "C" { f_return_status fss_extended_read_main_process_file(const f_console_arguments arguments, fss_extended_read_data *data, const f_string filename, const f_string_length target, const f_string_length select) f_gcc_attribute_visibility_internal; f_return_status fss_extended_read_main(const f_console_arguments arguments, fss_extended_read_data *data) { - f_status status = fll_program_process_parameters(arguments, data->parameters, fss_extended_read_total_parameters, fss_extended_read_parameter_no_color, fss_extended_read_parameter_light, fss_extended_read_parameter_dark, &data->remaining, &data->context); + f_status status = f_none; + + { + f_console_parameters parameters = { data->parameters, fss_extended_read_total_parameters }; + status = fll_program_process_parameters(arguments, parameters, fss_extended_read_parameter_no_color, fss_extended_read_parameter_light, fss_extended_read_parameter_dark, &data->remaining, &data->context); + } if (f_status_is_error(status)) { fss_extended_read_delete_data(data); diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index 226efcb..fcf36ed 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -29,7 +29,12 @@ extern "C" { #ifndef _di_fss_extended_write_main_ f_return_status fss_extended_write_main(const f_console_arguments arguments, fss_extended_write_data *data) { - f_status status = fll_program_process_parameters(arguments, data->parameters, fss_extended_write_total_parameters, fss_extended_write_parameter_no_color, fss_extended_write_parameter_light, fss_extended_write_parameter_dark, &data->remaining, &data->context); + f_status status = f_none; + + { + f_console_parameters parameters = { data->parameters, fss_extended_write_total_parameters }; + status = fll_program_process_parameters(arguments, parameters, fss_extended_write_parameter_no_color, fss_extended_write_parameter_light, fss_extended_write_parameter_dark, &data->remaining, &data->context); + } if (f_status_is_error(status)) { fss_extended_write_delete_data(data); diff --git a/level_3/fss_status_code/c/fss_status_code.c b/level_3/fss_status_code/c/fss_status_code.c index 453ff06..796e04c 100644 --- a/level_3/fss_status_code/c/fss_status_code.c +++ b/level_3/fss_status_code/c/fss_status_code.c @@ -29,7 +29,12 @@ extern "C" { #ifndef _di_fss_status_code_main_ f_return_status fss_status_code_main(const f_console_arguments arguments, fss_status_code_data *data) { - f_status status = fll_program_process_parameters(arguments, data->parameters, fss_status_code_total_parameters, fss_status_code_parameter_no_color, fss_status_code_parameter_light, fss_status_code_parameter_dark, &data->remaining, &data->context); + f_status status = f_none; + + { + f_console_parameters parameters = { data->parameters, fss_status_code_total_parameters }; + status = fll_program_process_parameters(arguments, parameters, fss_status_code_parameter_no_color, fss_status_code_parameter_light, fss_status_code_parameter_dark, &data->remaining, &data->context); + } if (f_status_is_error(status)) { fss_status_code_delete_data(data); diff --git a/level_3/init/c/init.c b/level_3/init/c/init.c index 46c9aac..b841893 100644 --- a/level_3/init/c/init.c +++ b/level_3/init/c/init.c @@ -52,7 +52,10 @@ extern "C" { f_u_short do_socket_file = f_true; f_u_short do_socket_port = f_false; - status = fll_program_process_parameters(arguments, data->parameters, init_total_parameters, init_parameter_no_color, init_parameter_light, init_parameter_dark, &data->remaining, &data->context); + { + f_console_parameters parameters = { data->parameters, init_total_parameters }; + status = fll_program_process_parameters(arguments, parameters, init_parameter_no_color, init_parameter_light, init_parameter_dark, &data->remaining, &data->context); + } if (f_status_is_error(status)) { init_delete_data(data); diff --git a/level_3/status_code/c/status_code.c b/level_3/status_code/c/status_code.c index 1dcf67f..634cba0 100644 --- a/level_3/status_code/c/status_code.c +++ b/level_3/status_code/c/status_code.c @@ -29,7 +29,12 @@ extern "C" { #ifndef _di_status_code_main_ f_return_status status_code_main(const f_console_arguments arguments, status_code_data *data) { - f_status status = fll_program_process_parameters(arguments, data->parameters, status_code_total_parameters, status_code_parameter_no_color, status_code_parameter_light, status_code_parameter_dark, &data->remaining, &data->context); + f_status status = f_none; + + { + f_console_parameters parameters = { data->parameters, status_code_total_parameters }; + status = fll_program_process_parameters(arguments, parameters, status_code_parameter_no_color, status_code_parameter_light, status_code_parameter_dark, &data->remaining, &data->context); + } if (f_status_is_error(status)) { status_code_delete_data(data); -- 1.8.3.1