From: Kevin Day Date: Fri, 2 Dec 2022 04:32:41 +0000 (-0600) Subject: Bugfix: The fss_payload_write should not allow "payload" to be something other than... X-Git-Tag: 0.6.2~63 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=e941135137f9381178558d3409f51b67530563cf;p=fll Bugfix: The fss_payload_write should not allow "payload" to be something other than last when specified. --- diff --git a/level_3/fss_payload_write/c/common.c b/level_3/fss_payload_write/c/common.c index 6d321da..50257ee 100644 --- a/level_3/fss_payload_write/c/common.c +++ b/level_3/fss_payload_write/c/common.c @@ -5,6 +5,8 @@ extern "C" { #endif #ifndef _di_fss_payload_write_defines_ + const f_string_static_t fss_payload_write_object_payload_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_object_payload_s, 0, FSS_PAYLOAD_WRITE_object_payload_s_length); + const f_string_static_t fss_payload_write_pipe_content_end_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_pipe_content_end_s, 0, FSS_PAYLOAD_WRITE_pipe_content_end_s_length); const f_string_static_t fss_payload_write_pipe_content_ignore_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_pipe_content_ignore_s, 0, FSS_PAYLOAD_WRITE_pipe_content_ignore_s_length); const f_string_static_t fss_payload_write_pipe_content_start_s = macro_f_string_static_t_initialize(FSS_PAYLOAD_WRITE_pipe_content_start_s, 0, FSS_PAYLOAD_WRITE_pipe_content_start_s_length); diff --git a/level_3/fss_payload_write/c/common.h b/level_3/fss_payload_write/c/common.h index 28f37cf..d949d96 100644 --- a/level_3/fss_payload_write/c/common.h +++ b/level_3/fss_payload_write/c/common.h @@ -65,14 +65,20 @@ extern "C" { #ifndef _di_fss_payload_write_defines_ #define fss_payload_write_signal_check_d 20000 + #define FSS_PAYLOAD_WRITE_object_payload_s "payload" + #define FSS_PAYLOAD_WRITE_pipe_content_end_s "\f" #define FSS_PAYLOAD_WRITE_pipe_content_ignore_s "\v" #define FSS_PAYLOAD_WRITE_pipe_content_start_s "\b" + #define FSS_PAYLOAD_WRITE_object_payload_s_length 7 + #define FSS_PAYLOAD_WRITE_pipe_content_end_s_length 1 #define FSS_PAYLOAD_WRITE_pipe_content_ignore_s_length 1 #define FSS_PAYLOAD_WRITE_pipe_content_start_s_length 1 + extern const f_string_static_t fss_payload_write_object_payload_s; + extern const f_string_static_t fss_payload_write_pipe_content_end_s; extern const f_string_static_t fss_payload_write_pipe_content_ignore_s; extern const f_string_static_t fss_payload_write_pipe_content_start_s; diff --git a/level_3/fss_payload_write/c/fss_payload_write.c b/level_3/fss_payload_write/c/fss_payload_write.c index 04701d9..fe11e24 100644 --- a/level_3/fss_payload_write/c/fss_payload_write.c +++ b/level_3/fss_payload_write/c/fss_payload_write.c @@ -234,6 +234,27 @@ extern "C" { } if (F_status_is_error_not(status)) { + if (main->parameters.array[fss_payload_write_parameter_object_e].locations.used) { + f_array_length_t index = 0; + + for (f_array_length_t i = 0; i < main->parameters.array[fss_payload_write_parameter_object_e].locations.used; ++i) { + + index = main->parameters.array[fss_payload_write_parameter_object_e].locations.array[i] + 1; + + if (fl_string_dynamic_compare(argv[index], fss_payload_write_object_payload_s) == F_equal_to && i + 1 < main->parameters.array[fss_payload_write_parameter_object_e].locations.used) { + if (main->error.verbosity != f_console_verbosity_quiet_e) { + fll_print_format("%r%[%QThe payload may only be specified last.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s); + } + + status = F_status_set_error(F_parameter); + + break; + } + } // for + } + } + + if (F_status_is_error_not(status)) { if (main->parameters.array[fss_payload_write_parameter_content_e].result == f_console_result_additional_e) { f_array_length_t location_object = 0; f_array_length_t location_content = 0; @@ -241,6 +262,7 @@ extern "C" { f_array_length_t location_sub_content = 0; for (f_array_length_t i = 0; i < main->parameters.array[fss_payload_write_parameter_object_e].locations.used; ++i) { + location_object = main->parameters.array[fss_payload_write_parameter_object_e].locations.array[i]; location_content = main->parameters.array[fss_payload_write_parameter_content_e].locations.array[i]; location_sub_object = main->parameters.array[fss_payload_write_parameter_object_e].locations_sub.array[i]; @@ -260,6 +282,7 @@ extern "C" { } status = F_status_set_error(F_parameter); + break; } } // for @@ -348,6 +371,7 @@ extern "C" { } status = F_status_set_error(F_parameter); + break; } } // for