From: Kevin Day Date: Sat, 31 Mar 2012 23:38:04 +0000 (-0500) Subject: Update: redesign parameters for fss write functions to be more consistent with fss... X-Git-Tag: 0.3.0~30 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=d52a8b42fb96eb9c865209e0e146911c4c265b43;p=fll Update: redesign parameters for fss write functions to be more consistent with fss read functions The fss read functions all take -o or --object to signify that an object is being processed. Do the same with the write functions. --- 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 19a29c1..d87790c 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 @@ -62,18 +62,18 @@ extern "C"{ printf("\n"); printf("\n %s", f_console_symbol_short_enable); - fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_type); + fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_object); printf(", %s", f_console_symbol_long_enable); - fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_long_type); - printf(" Specify a what to write: object or content."); + fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_long_object); + printf(" Write an object instead of content."); printf("\n %s", f_console_symbol_short_enable); - fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_output); + fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_file); printf(", %s", f_console_symbol_long_enable); - fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_long_output); - printf(" Specify a file to send output to."); + fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_long_file); + printf(" Specify a file to send output to."); printf("\n %s", f_console_symbol_short_enable); fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_string); @@ -145,19 +145,13 @@ extern "C"{ fss_basic_list_write_print_help(*data); } else if (data->parameters[fss_basic_list_write_parameter_version].result == f_console_result_found) { fss_basic_list_write_print_version(*data); - } else if (data->parameters[fss_basic_list_write_parameter_type].result == f_console_result_additional) { + } else { f_array_length counter = f_array_length_initialize; - f_max_u_short type = 0; + f_bool object = (data->parameters[fss_basic_list_write_parameter_object].result == f_console_result_found); f_dynamic_string buffer = f_dynamic_string_initialize; f_string_location location = f_string_location_initialize; - if (strncmp("object", argv[data->parameters[fss_basic_list_write_parameter_type].additional.array[0]], 7) == 0) { - type = fss_basic_list_write_type_object; - } else if (strncmp("content", argv[data->parameters[fss_basic_list_write_parameter_type].additional.array[0]], 8) == 0) { - type = fss_basic_list_write_type_content; - } - if (data->process_pipe) { f_file file = f_file_initialize; f_dynamic_string input = f_dynamic_string_initialize; @@ -187,13 +181,13 @@ extern "C"{ location.start = 0; location.stop = input.used - 1; - if (type == fss_basic_list_write_type_object) { + if (object) { status = fl_fss_basic_list_object_write(input, &location, &buffer); if (f_macro_test_for_no_data_errors(status)) { return status; } - } else if (type == fss_basic_list_write_type_content) { + } else { status = fl_fss_basic_list_content_write(input, &location, &buffer); if (f_macro_test_for_no_data_errors(status)) { @@ -211,13 +205,13 @@ extern "C"{ location.start = 0; location.stop = input.used - 1; - if (type == fss_basic_list_write_type_object) { + if (object) { status = fl_fss_basic_list_object_write(input, &location, &buffer); if (f_macro_test_for_no_data_errors(status)) { return status; } - } else if (type == fss_basic_list_write_type_content) { + } else { status = fl_fss_basic_list_content_write(input, &location, &buffer); if (f_macro_test_for_no_data_errors(status)) { @@ -228,11 +222,11 @@ extern "C"{ status = f_none; } - if (data->parameters[fss_basic_list_write_parameter_output].result == f_console_result_additional) { + if (data->parameters[fss_basic_list_write_parameter_file].result == f_console_result_additional) { f_file output = f_file_initialize; output.mode = f_file_write_append; - status = f_file_open(&output, argv[data->parameters[fss_basic_list_write_parameter_output].additional.array[0]]); + status = f_file_open(&output, argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]); if (status != f_none) { f_file_close(&output); @@ -240,11 +234,11 @@ extern "C"{ if (status == f_invalid_parameter) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()"); } else if (status == f_file_not_found) { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to find the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_output].additional.array[0]]); + fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to find the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]); } else if (status == f_file_open_error) { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to open the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_output].additional.array[0]]); + fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to open the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]); } else if (status == f_file_descriptor_error) { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: File descriptor error while trying to open the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_output].additional.array[0]]); + fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: File descriptor error while trying to open the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]); } else { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling f_file_open()", status); } @@ -260,7 +254,7 @@ extern "C"{ if (status == f_invalid_parameter) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_write()"); } else if (status == f_file_write_error) { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to write to the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_output].additional.array[0]]); + fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to write to the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]); } else { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_file_write()", status); } @@ -271,9 +265,6 @@ extern "C"{ } else { f_print_dynamic_string(f_standard_output, buffer); } - } else { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: you must specify the type to write: object, content, or both."); - status = f_invalid_parameter; } fss_basic_list_write_delete_data(data); diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.h b/level_3/fss_basic_list_write/c/fss_basic_list_write.h index 91605d6..2274b7e 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.h +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.h @@ -48,12 +48,12 @@ extern "C"{ #endif // _di_fss_basic_list_write_name_ #ifndef _di_fss_basic_list_write_defines_ - #define fss_basic_list_write_short_type "t" - #define fss_basic_list_write_short_output "o" + #define fss_basic_list_write_short_object "o" + #define fss_basic_list_write_short_file "f" #define fss_basic_list_write_short_string "s" - #define fss_basic_list_write_long_type "type" - #define fss_basic_list_write_long_output "output" + #define fss_basic_list_write_long_object "object" + #define fss_basic_list_write_long_file "file" #define fss_basic_list_write_long_string "string" enum { @@ -62,24 +62,19 @@ extern "C"{ fss_basic_list_write_parameter_no_color, fss_basic_list_write_parameter_version, - fss_basic_list_write_parameter_type, - fss_basic_list_write_parameter_output, + fss_basic_list_write_parameter_object, + fss_basic_list_write_parameter_file, fss_basic_list_write_parameter_string, }; - enum { - fss_basic_list_write_type_object = 1, - fss_basic_list_write_type_content, - }; - #define f_console_parameter_initialize_fss_basic_list_write \ { \ f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_false, f_console_type_normal, 0), \ f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_false, f_console_type_inverse, 0), \ f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_false, f_console_type_inverse, 0), \ f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_false, f_console_type_normal, 0), \ - f_console_parameter_initialize(fss_basic_list_write_short_type, fss_basic_list_write_long_type, 0, 0, f_true, f_console_type_normal, 0), \ - f_console_parameter_initialize(fss_basic_list_write_short_output, fss_basic_list_write_long_output, 0, 0, f_true, f_console_type_normal, 0), \ + f_console_parameter_initialize(fss_basic_list_write_short_object, fss_basic_list_write_long_object, 0, 0, f_false, f_console_type_normal, 0), \ + f_console_parameter_initialize(fss_basic_list_write_short_file, fss_basic_list_write_long_file, 0, 0, f_true, f_console_type_normal, 0), \ f_console_parameter_initialize(fss_basic_list_write_short_string, fss_basic_list_write_long_string, 0, 0, f_true, f_console_type_normal, 0), \ } 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 b420d94..28aabf6 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -62,18 +62,18 @@ extern "C"{ printf("\n"); printf("\n %s", f_console_symbol_short_enable); - fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_type); + fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_object); printf(", %s", f_console_symbol_long_enable); - fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_long_type); - printf(" Specify a what to write: object or content."); + fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_long_object); + printf(" Write an object instead of content."); printf("\n %s", f_console_symbol_short_enable); - fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_output); + fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_file); printf(", %s", f_console_symbol_long_enable); - fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_long_output); - printf(" Specify a file to send output to."); + fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_long_file); + printf(" Specify a file to send output to."); printf("\n %s", f_console_symbol_short_enable); fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_string); @@ -145,19 +145,13 @@ extern "C"{ fss_basic_write_print_help(*data); } else if (data->parameters[fss_basic_write_parameter_version].result == f_console_result_found) { fss_basic_write_print_version(*data); - } else if (data->parameters[fss_basic_write_parameter_type].result == f_console_result_additional) { + } else { f_array_length counter = f_array_length_initialize; - f_max_u_short type = 0; + f_bool object = (data->parameters[fss_basic_write_parameter_object].result == f_console_result_found); f_dynamic_string buffer = f_dynamic_string_initialize; f_string_location location = f_string_location_initialize; - if (strncmp("object", argv[data->parameters[fss_basic_write_parameter_type].additional.array[0]], 7) == 0) { - type = fss_basic_write_type_object; - } else if (strncmp("content", argv[data->parameters[fss_basic_write_parameter_type].additional.array[0]], 8) == 0) { - type = fss_basic_write_type_content; - } - if (data->process_pipe) { f_file file = f_file_initialize; f_dynamic_string input = f_dynamic_string_initialize; @@ -187,13 +181,13 @@ extern "C"{ location.start = 0; location.stop = input.used - 1; - if (type == fss_basic_write_type_object) { + if (object) { status = fl_fss_basic_object_write(input, &location, &buffer); if (f_macro_test_for_no_data_errors(status)) { return status; } - } else if (type == fss_basic_write_type_content) { + } else { status = fl_fss_basic_content_write(input, &location, &buffer); if (f_macro_test_for_no_data_errors(status)) { @@ -211,13 +205,13 @@ extern "C"{ location.start = 0; location.stop = input.used - 1; - if (type == fss_basic_write_type_object) { + if (object) { status = fl_fss_basic_object_write(input, &location, &buffer); if (f_macro_test_for_no_data_errors(status)) { return status; } - } else if (type == fss_basic_write_type_content) { + } else { status = fl_fss_basic_content_write(input, &location, &buffer); if (f_macro_test_for_no_data_errors(status)) { @@ -228,11 +222,11 @@ extern "C"{ status = f_none; } - if (data->parameters[fss_basic_write_parameter_output].result == f_console_result_additional) { + if (data->parameters[fss_basic_write_parameter_file].result == f_console_result_additional) { f_file output = f_file_initialize; output.mode = f_file_write_append; - status = f_file_open(&output, argv[data->parameters[fss_basic_write_parameter_output].additional.array[0]]); + status = f_file_open(&output, argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]); if (status != f_none) { f_file_close(&output); @@ -240,11 +234,11 @@ extern "C"{ if (status == f_invalid_parameter) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()"); } else if (status == f_file_not_found) { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to find the file '%s'", argv[data->parameters[fss_basic_write_parameter_output].additional.array[0]]); + fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to find the file '%s'", argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]); } else if (status == f_file_open_error) { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to open the file '%s'", argv[data->parameters[fss_basic_write_parameter_output].additional.array[0]]); + fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to open the file '%s'", argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]); } else if (status == f_file_descriptor_error) { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: File descriptor error while trying to open the file '%s'", argv[data->parameters[fss_basic_write_parameter_output].additional.array[0]]); + fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: File descriptor error while trying to open the file '%s'", argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]); } else { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling f_file_open()", status); } @@ -260,7 +254,7 @@ extern "C"{ if (status == f_invalid_parameter) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_write()"); } else if (status == f_file_write_error) { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to write to the file '%s'", argv[data->parameters[fss_basic_write_parameter_output].additional.array[0]]); + fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to write to the file '%s'", argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]); } else { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_file_write()", status); } @@ -271,9 +265,6 @@ extern "C"{ } else { f_print_dynamic_string(f_standard_output, buffer); } - } else { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: you must specify the type to write: object, content, or both."); - status = f_invalid_parameter; } fss_basic_write_delete_data(data); diff --git a/level_3/fss_basic_write/c/fss_basic_write.h b/level_3/fss_basic_write/c/fss_basic_write.h index 705f6f5..9c5402f 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.h +++ b/level_3/fss_basic_write/c/fss_basic_write.h @@ -48,12 +48,12 @@ extern "C"{ #endif // _di_fss_basic_write_name_ #ifndef _di_fss_basic_write_defines_ - #define fss_basic_write_short_type "t" - #define fss_basic_write_short_output "o" + #define fss_basic_write_short_object "o" + #define fss_basic_write_short_file "f" #define fss_basic_write_short_string "s" - #define fss_basic_write_long_type "type" - #define fss_basic_write_long_output "output" + #define fss_basic_write_long_object "object" + #define fss_basic_write_long_file "file" #define fss_basic_write_long_string "string" enum { @@ -62,24 +62,19 @@ extern "C"{ fss_basic_write_parameter_no_color, fss_basic_write_parameter_version, - fss_basic_write_parameter_type, - fss_basic_write_parameter_output, + fss_basic_write_parameter_object, + fss_basic_write_parameter_file, fss_basic_write_parameter_string, }; - enum { - fss_basic_write_type_object = 1, - fss_basic_write_type_content, - }; - #define f_console_parameter_initialize_fss_basic_write \ { \ f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_false, f_console_type_normal, 0), \ f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_false, f_console_type_inverse, 0), \ f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_false, f_console_type_inverse, 0), \ f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_false, f_console_type_normal, 0), \ - f_console_parameter_initialize(fss_basic_write_short_type, fss_basic_write_long_type, 0, 0, f_true, f_console_type_normal, 0), \ - f_console_parameter_initialize(fss_basic_write_short_output, fss_basic_write_long_output, 0, 0, f_true, f_console_type_normal, 0), \ + f_console_parameter_initialize(fss_basic_write_short_object, fss_basic_write_long_object, 0, 0, f_false, f_console_type_normal, 0), \ + f_console_parameter_initialize(fss_basic_write_short_file, fss_basic_write_long_file, 0, 0, f_true, f_console_type_normal, 0), \ f_console_parameter_initialize(fss_basic_write_short_string, fss_basic_write_long_string, 0, 0, f_true, f_console_type_normal, 0), \ } 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 c0ab863..5d02034 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -62,18 +62,18 @@ extern "C"{ printf("\n"); printf("\n %s", f_console_symbol_short_enable); - fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_type); + fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_object); printf(", %s", f_console_symbol_long_enable); - fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_long_type); - printf(" Specify a what to write: object or content."); + fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_long_object); + printf(" Write an object instead of content."); printf("\n %s", f_console_symbol_short_enable); - fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_output); + fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_file); printf(", %s", f_console_symbol_long_enable); - fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_long_output); - printf(" Specify a file to send output to."); + fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_long_file); + printf(" Specify a file to send output to."); printf("\n %s", f_console_symbol_short_enable); fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_string); @@ -152,19 +152,13 @@ extern "C"{ fss_extended_write_print_help(*data); } else if (data->parameters[fss_extended_write_parameter_version].result == f_console_result_found) { fss_extended_write_print_version(*data); - } else if (data->parameters[fss_extended_write_parameter_type].result == f_console_result_additional) { + } else { f_array_length counter = f_array_length_initialize; - f_max_u_short type = 0; + f_bool object = (data->parameters[fss_extended_write_parameter_object].result == f_console_result_found); f_dynamic_string buffer = f_dynamic_string_initialize; f_string_location location = f_string_location_initialize; - if (strncmp("object", argv[data->parameters[fss_extended_write_parameter_type].additional.array[0]], 7) == 0) { - type = fss_extended_write_type_object; - } else if (strncmp("content", argv[data->parameters[fss_extended_write_parameter_type].additional.array[0]], 8) == 0) { - type = fss_extended_write_type_content; - } - if (data->process_pipe) { f_file file = f_file_initialize; f_dynamic_string input = f_dynamic_string_initialize; @@ -194,13 +188,13 @@ extern "C"{ location.start = 0; location.stop = input.used - 1; - if (type == fss_extended_write_type_object) { + if (object) { status = fl_fss_extended_object_write(input, &location, &buffer); if (f_macro_test_for_no_data_errors(status)) { return status; } - } else if (type == fss_extended_write_type_content) { + } else { status = fl_fss_extended_content_write(input, &location, &buffer); if (f_macro_test_for_no_data_errors(status)) { @@ -225,7 +219,7 @@ extern "C"{ } else if (data->parameters[fss_extended_write_parameter_string].result == f_console_result_additional) { f_dynamic_string input = f_dynamic_string_initialize; - if (type == fss_extended_write_type_object) { + if (object) { input.string = argv[data->parameters[fss_extended_write_parameter_string].additional.array[0]]; input.used = strlen(input.string); @@ -237,7 +231,7 @@ extern "C"{ if (f_macro_test_for_no_data_errors(status)) { return status; } - } else if (type == fss_extended_write_type_content) { + } else { f_string_length i = 0; while (i < data->parameters[fss_extended_write_parameter_string].additional.used) { @@ -273,11 +267,11 @@ extern "C"{ status = f_none; } - if (data->parameters[fss_extended_write_parameter_output].result == f_console_result_additional) { + if (data->parameters[fss_extended_write_parameter_file].result == f_console_result_additional) { f_file output = f_file_initialize; output.mode = f_file_write_append; - status = f_file_open(&output, argv[data->parameters[fss_extended_write_parameter_output].additional.array[0]]); + status = f_file_open(&output, argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]); if (status != f_none) { f_file_close(&output); @@ -285,11 +279,11 @@ extern "C"{ if (status == f_invalid_parameter) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()"); } else if (status == f_file_not_found) { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to find the file '%s'", argv[data->parameters[fss_extended_write_parameter_output].additional.array[0]]); + fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to find the file '%s'", argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]); } else if (status == f_file_open_error) { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to open the file '%s'", argv[data->parameters[fss_extended_write_parameter_output].additional.array[0]]); + fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to open the file '%s'", argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]); } else if (status == f_file_descriptor_error) { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: File descriptor error while trying to open the file '%s'", argv[data->parameters[fss_extended_write_parameter_output].additional.array[0]]); + fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: File descriptor error while trying to open the file '%s'", argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]); } else { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling f_file_open()", status); } @@ -305,7 +299,7 @@ extern "C"{ if (status == f_invalid_parameter) { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_write()"); } else if (status == f_file_write_error) { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to write to the file '%s'", argv[data->parameters[fss_extended_write_parameter_output].additional.array[0]]); + fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to write to the file '%s'", argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]); } else { fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_file_write()", status); } @@ -316,9 +310,6 @@ extern "C"{ } else { f_print_dynamic_string(f_standard_output, buffer); } - } else { - fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: you must specify the type to write: object, content, or both."); - status = f_invalid_parameter; } fss_extended_write_delete_data(data); diff --git a/level_3/fss_extended_write/c/fss_extended_write.h b/level_3/fss_extended_write/c/fss_extended_write.h index 5c9adee..ea14489 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.h +++ b/level_3/fss_extended_write/c/fss_extended_write.h @@ -48,13 +48,13 @@ extern "C"{ #endif // _di_fss_extended_write_name_ #ifndef _di_fss_extended_write_defines_ - #define fss_extended_write_short_type "t" - #define fss_extended_write_short_output "o" + #define fss_extended_write_short_object "o" + #define fss_extended_write_short_file "f" #define fss_extended_write_short_string "s" #define fss_extended_write_short_partial "p" - #define fss_extended_write_long_type "type" - #define fss_extended_write_long_output "output" + #define fss_extended_write_long_object "object" + #define fss_extended_write_long_file "file" #define fss_extended_write_long_string "string" #define fss_extended_write_long_partial "partial" @@ -64,25 +64,20 @@ extern "C"{ fss_extended_write_parameter_no_color, fss_extended_write_parameter_version, - fss_extended_write_parameter_type, - fss_extended_write_parameter_output, + fss_extended_write_parameter_object, + fss_extended_write_parameter_file, fss_extended_write_parameter_string, fss_extended_write_parameter_partial, }; - enum { - fss_extended_write_type_object = 1, - fss_extended_write_type_content, - }; - #define f_console_parameter_initialize_fss_extended_write \ { \ f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_false, f_console_type_normal, 0), \ f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_false, f_console_type_inverse, 0), \ f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_false, f_console_type_inverse, 0), \ f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_false, f_console_type_normal, 0), \ - f_console_parameter_initialize(fss_extended_write_short_type, fss_extended_write_long_type, 0, 0, f_true, f_console_type_normal, 0), \ - f_console_parameter_initialize(fss_extended_write_short_output, fss_extended_write_long_output, 0, 0, f_true, f_console_type_normal, 0), \ + f_console_parameter_initialize(fss_extended_write_short_object, fss_extended_write_long_object, 0, 0, f_false, f_console_type_normal, 0), \ + f_console_parameter_initialize(fss_extended_write_short_file, fss_extended_write_long_file, 0, 0, f_true, f_console_type_normal, 0), \ f_console_parameter_initialize(fss_extended_write_short_string, fss_extended_write_long_string, 0, 0, f_true, f_console_type_normal, 0), \ f_console_parameter_initialize(fss_extended_write_short_partial, fss_extended_write_long_partial, 0, 0, f_false, f_console_type_normal, 0), \ }