]> Kevux Git Server - fll/commitdiff
Bugfix: The fss_payload_write should not allow "payload" to be something other than...
authorKevin Day <thekevinday@gmail.com>
Fri, 2 Dec 2022 04:32:41 +0000 (22:32 -0600)
committerKevin Day <thekevinday@gmail.com>
Fri, 2 Dec 2022 04:32:41 +0000 (22:32 -0600)
level_3/fss_payload_write/c/common.c
level_3/fss_payload_write/c/common.h
level_3/fss_payload_write/c/fss_payload_write.c

index 6d321da50565dd0df4af100c6ef0c91e9b972a85..50257ee0d2e590568923f3e9c9ac116216576faa 100644 (file)
@@ -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);
index 28f37cf22f9456789616a5ff2f559264d72360fc..d949d9699ab85d99541bc3c8b1d9295527395f70 100644 (file)
@@ -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;
index 04701d930cecc76082fc5399b964778e77ea0e8d..fe11e242a97b934b67945bb31749432482ec366b 100644 (file)
@@ -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