]> Kevux Git Server - kevux-tools/commitdiff
Update: Remove the ++first and ++last parameters and relating logic.
authorKevin Day <Kevin@kevux.org>
Wed, 31 Jul 2024 00:25:17 +0000 (19:25 -0500)
committerKevin Day <Kevin@kevux.org>
Wed, 31 Jul 2024 00:31:03 +0000 (19:31 -0500)
sources/c/remove/main/common.c
sources/c/remove/main/common/enumeration.h
sources/c/remove/main/remove.c
sources/c/tacocat/main/common.c
sources/c/tacocat/main/common/define.h
sources/c/tacocat/main/common/enumeration.h
sources/c/tacocat/main/tacocat.c

index c12ade3e2188f627e38d7c155923cbedab16515f..357b4496ba0db0bf06ee1b2f5707d7479b017626 100644 (file)
@@ -58,10 +58,6 @@ extern "C" {
     main->setting.state.step_small = kt_remove_allocation_small_d;
 
     if (F_status_is_error(main->setting.state.status)) {
-      if ((main->setting.flag & kt_remove_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
-        fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
-      }
-
       kt_remove_print_error(&main->program.error, macro_kt_remove_f(f_console_parameter_process));
 
       return;
@@ -81,10 +77,6 @@ extern "C" {
         main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program);
 
         if (F_status_is_error(main->setting.state.status)) {
-          if ((main->setting.flag & kt_remove_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
-            fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
-          }
-
           kt_remove_print_error(&main->program.error, macro_kt_remove_f(fll_program_parameter_process_context));
 
           return;
@@ -102,10 +94,6 @@ extern "C" {
         main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program);
 
         if (F_status_is_error(main->setting.state.status)) {
-          if ((main->setting.flag & kt_remove_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
-            fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
-          }
-
           kt_remove_print_error(&main->program.error, macro_kt_remove_f(fll_program_parameter_process_verbosity));
 
           return;
index e4093a6906d53e4fd40e8e412f0360b2f4237dfa..e95a23c2637faa6d9cc05cecba0b0d7c2da843ae 100644 (file)
@@ -43,8 +43,6 @@ extern "C" {
  *   - link:                   Remove by file type: link.
  *   - mode:                   Remove by mode.
  *   - option_used:            This gets set when when certain options are specified to toggle the default match detection boolean during removal of each file.
- *   - print_first:            When set, print new line to message output on program begin after loading settings.
- *   - print_last:             When set, print new line to message output on program end.
  *   - prompt_all:             Operate in interactive mode, prompting for every file.
  *   - prompt_follow:          Operate in interactive mode: prompting for every link that is being followed.
  *   - prompt_never:           Do not operate in interactive mode.
@@ -86,23 +84,21 @@ extern "C" {
     kt_remove_main_flag_link_e                   = 0x80000,
     kt_remove_main_flag_mode_e                   = 0x100000,
     kt_remove_main_flag_option_used_e            = 0x200000,
-    kt_remove_main_flag_print_first_e            = 0x400000,
-    kt_remove_main_flag_print_last_e             = 0x800000,
-    kt_remove_main_flag_prompt_all_e             = 0x1000000,
-    kt_remove_main_flag_prompt_follow_e          = 0x2000000,
-    kt_remove_main_flag_prompt_never_e           = 0x4000000,
-    kt_remove_main_flag_prompt_once_e            = 0x8000000,
-    kt_remove_main_flag_recurse_e                = 0x10000000,
-    kt_remove_main_flag_regular_e                = 0x20000000,
-    kt_remove_main_flag_same_e                   = 0x40000000,
-    kt_remove_main_flag_simulate_e               = 0x80000000,
-    kt_remove_main_flag_socket_e                 = 0x100000000,
-    kt_remove_main_flag_tree_e                   = 0x200000000,
-    kt_remove_main_flag_updated_e                = 0x400000000,
-    kt_remove_main_flag_user_e                   = 0x800000000,
-    kt_remove_main_flag_utc_e                    = 0x1000000000,
-    kt_remove_main_flag_version_e                = 0x2000000000,
-    kt_remove_main_flag_version_copyright_help_e = 0x2000008008,
+    kt_remove_main_flag_prompt_all_e             = 0x400000,
+    kt_remove_main_flag_prompt_follow_e          = 0x800000,
+    kt_remove_main_flag_prompt_never_e           = 0x1000000,
+    kt_remove_main_flag_prompt_once_e            = 0x2000000,
+    kt_remove_main_flag_recurse_e                = 0x4000000,
+    kt_remove_main_flag_regular_e                = 0x8000000,
+    kt_remove_main_flag_same_e                   = 0x10000000,
+    kt_remove_main_flag_simulate_e               = 0x20000000,
+    kt_remove_main_flag_socket_e                 = 0x40000000,
+    kt_remove_main_flag_tree_e                   = 0x80000000,
+    kt_remove_main_flag_updated_e                = 0x100000000,
+    kt_remove_main_flag_user_e                   = 0x200000000,
+    kt_remove_main_flag_utc_e                    = 0x400000000,
+    kt_remove_main_flag_version_e                = 0x800000000,
+    kt_remove_main_flag_version_copyright_help_e = 0x800008008,
   }; // enum
 #endif // _di_kt_remove_flag_e_
 
@@ -293,7 +289,7 @@ extern "C" {
       macro_f_console_parameter_t_initialize_5(                             kt_remove_long_utc_s,       0, f_console_flag_normal_e), \
     }
 
-  #define kt_remove_total_parameters_d 38
+  #define kt_remove_total_parameters_d (f_console_parameter_state_type_total_d + 25)
 #endif // _di_kt_remove_parameter_e_
 
 /**
index 104d67cde7e10cf92cfcbbc112bb893ece1f5614..1cc00e5912f85e341bf472ad3a12df804d053d73 100644 (file)
@@ -7,19 +7,7 @@ extern "C" {
 #ifndef _di_kt_remove_main_
   void kt_remove_main(kt_remove_main_t * const main) {
 
-    if (!main) return;
-
-    if (F_status_is_error(main->setting.state.status)) {
-      if ((main->setting.flag & kt_remove_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
-        fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
-      }
-
-      return;
-    }
-
-    if ((main->setting.flag & kt_remove_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
-      fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
-    }
+    if (!main || F_status_is_error(main->setting.state.status)) return;
 
     main->setting.state.status = F_okay;
 
@@ -36,10 +24,6 @@ extern "C" {
         fll_program_print_copyright(&main->program.message, fll_program_copyright_year_author_s);
       }
 
-      if ((main->setting.flag & kt_remove_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
-        fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
-      }
-
       return;
     }
 
@@ -55,10 +39,6 @@ extern "C" {
     if (main->setting.state.status == F_status_set_error(F_interrupt)) {
       fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
     }
-
-    if ((main->setting.flag & kt_remove_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
-      fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
-    }
   }
 #endif // _di_kt_remove_main_
 
index dc8f04b90c1af8d1632ba979912f23646f5996b1..3f3df3ec9a22ded42182095d414a12463eb820b5 100644 (file)
@@ -16,7 +16,6 @@ extern "C" {
     main->setting.state.step_small = kt_tacocat_allocation_small_d;
 
     if (F_status_is_error(main->setting.state.status)) {
-      macro_setting_load_print_first();
       kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(f_console_parameter_process));
 
       return;
@@ -36,8 +35,6 @@ extern "C" {
         main->setting.state.status = fll_program_parameter_process_context(choices, modes, F_true, &main->program);
 
         if (F_status_is_error(main->setting.state.status)) {
-          macro_setting_load_print_first();
-
           kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(fll_program_parameter_process_context));
 
           return;
@@ -55,8 +52,6 @@ extern "C" {
         main->setting.state.status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, &main->program);
 
         if (F_status_is_error(main->setting.state.status)) {
-          macro_setting_load_print_first();
-
           kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(fll_program_parameter_process_verbosity));
 
           return;
@@ -90,8 +85,6 @@ extern "C" {
     if (main->program.parameters.array[kt_tacocat_parameter_resolve_e].result & f_console_result_found_e) {
       main->setting.state.status = F_status_set_error(F_parameter);
 
-      macro_setting_load_print_first();
-
       fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, kt_tacocat_long_resolve_s);
     }
     else if (main->program.parameters.array[kt_tacocat_parameter_resolve_e].result & f_console_result_value_e) {
@@ -108,8 +101,6 @@ extern "C" {
       else {
         main->setting.state.status = F_status_set_error(F_parameter);
 
-        macro_setting_load_print_first();
-
         kt_tacocat_print_error_parameter_value_resolve_unknown(&main->program.error, main->program.parameters.arguments.array[index]);
       }
     }
@@ -131,7 +122,6 @@ extern "C" {
       main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->program.parameters.arguments.array[index], &number);
 
       if (F_status_is_error(main->setting.state.status)) {
-        macro_setting_load_print_first();
         kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(fl_conversion_dynamic_to_unsigned_detect));
 
         return;
@@ -154,8 +144,6 @@ extern "C" {
     else if (main->program.parameters.array[kt_tacocat_parameter_interval_e].result & f_console_result_found_e) {
       main->setting.state.status = F_status_set_error(F_parameter);
 
-      macro_setting_load_print_first();
-
       fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, kt_tacocat_long_interval_s);
 
       return;
@@ -169,7 +157,6 @@ extern "C" {
       main->setting.state.status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, main->program.parameters.arguments.array[index], &number);
 
       if (F_status_is_error(main->setting.state.status)) {
-        macro_setting_load_print_first();
         kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(fl_conversion_dynamic_to_unsigned_detect));
 
         return;
@@ -202,8 +189,6 @@ extern "C" {
     else if (main->program.parameters.array[kt_tacocat_parameter_max_buffer_e].result & f_console_result_found_e) {
       main->setting.state.status = F_status_set_error(F_parameter);
 
-      macro_setting_load_print_first();
-
       fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, kt_tacocat_long_max_buffer_s);
 
       return;
@@ -287,10 +272,6 @@ extern "C" {
         if (main->program.parameters.array[parameters[i]].values.used % 2) {
           main->setting.state.status = F_status_set_error(F_parameter);
 
-          if ((main->setting.flag & kt_tacocat_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
-            fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
-          }
-
           fll_program_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, longs[i], kt_tacocat_two_s);
 
           if (F_status_is_error_not(failed)) {
@@ -411,8 +392,6 @@ extern "C" {
               kt_tacocat_setting_load_address_port_extract(main, range_ip, &address, &port);
 
               if (F_status_is_error(main->setting.state.status)) {
-                macro_setting_load_print_first();
-
                 if (F_status_set_fine(main->setting.state.status) == F_parameter) {
                   kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(kt_tacocat_setting_load_address_port_extract));
                 }
@@ -454,8 +433,6 @@ extern "C" {
                 if (main->setting.state.status == F_data_not || !host.h_addr_list || !host.h_addr_list[0]) {
                   main->setting.state.status = F_status_set_error(F_parameter);
 
-                  macro_setting_load_print_first();
-
                   // @todo provide network-specific error messages for when no hosts are returned.
                   kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(f_network_from_ip_name));
 
@@ -495,8 +472,6 @@ extern "C" {
                 if (main->setting.state.status == F_data_not || !host.h_addr_list || !host.h_addr_list[0]) {
                   main->setting.state.status = F_status_set_error(F_parameter);
 
-                  macro_setting_load_print_first();
-
                   // @todo provide network-specific error messages for when no hosts are returned.
                   kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(f_network_from_ip_name));
 
@@ -538,8 +513,6 @@ extern "C" {
           else {
             main->setting.state.status = F_status_set_error(F_parameter);
 
-            macro_setting_load_print_first();
-
             fll_program_print_error_parameter_empty_value(&main->program.error, f_console_symbol_long_normal_s, longs[i]);
 
             if (F_status_is_error_not(failed)) {
@@ -589,8 +562,6 @@ extern "C" {
           else {
             main->setting.state.status = F_status_set_error(F_parameter);
 
-            macro_setting_load_print_first();
-
             fll_program_print_error_parameter_empty_value(&main->program.error, f_console_symbol_long_normal_s, longs[i]);
 
             if (F_status_is_error_not(failed)) {
@@ -607,8 +578,6 @@ extern "C" {
         main->setting.flag &= ~flags[i];
         main->setting.state.status = F_status_set_error(F_parameter);
 
-        macro_setting_load_print_first();
-
         fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, longs[i]);
 
         if (F_status_is_error_not(failed)) {
index d24146605187e1d581bcb29f66a420737f66304f..97365a125fe5e4e783765b279b28b1558f9d3ceb 100644 (file)
@@ -103,9 +103,6 @@ extern "C" {
 /**
  * The program macros.
  *
- * macro_setting_load_print_first:
- *   Intended to be used to simplify the code in kt_tacocat_setting_load() and make it more readable.
- *
  * macro_setting_load_handle_send_receive_error_continue_1:
  *   Intended to be used to simplify the code in kt_tacocat_setting_load_send_receive() and make it more readable.
  *   This is for the basic error that calls kt_tacocat_print_error() when printing.
@@ -126,15 +123,8 @@ extern "C" {
  * @todo document all macros.
  */
 #ifndef _di_kt_tacocat_macros_d_
-  #define macro_setting_load_print_first() \
-    if ((main->setting.flag & kt_tacocat_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) { \
-      fll_print_dynamic_raw(f_string_eol_s, main->program.message.to); \
-    }
-
   #define macro_setting_load_handle_send_receive_error_continue_1(method) \
     if (F_status_is_error(main->setting.state.status)) { \
-      macro_setting_load_print_first(); \
-      \
       kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(method)); \
       \
       if (F_status_is_error_not(failed)) { \
@@ -146,8 +136,6 @@ extern "C" {
 
   #define macro_setting_load_handle_send_receive_error_continue_2(method) \
     if (F_status_is_error(main->setting.state.status)) { \
-      macro_setting_load_print_first(); \
-      \
       kt_tacocat_print_error(&main->program.error, macro_kt_tacocat_f(method)); \
       \
       if (F_status_is_error_not(failed)) { \
@@ -161,8 +149,6 @@ extern "C" {
 
   #define macro_setting_load_handle_send_receive_error_file_continue_1(method, name, operation, type) \
     if (F_status_is_error(main->setting.state.status)) { \
-      macro_setting_load_print_first(); \
-      \
       kt_tacocat_print_error_file(&main->program.error, macro_kt_tacocat_f(method), name, operation, type); \
       \
       if (F_status_is_error_not(failed)) { \
index e77e2a7c0e3bb8c44608e5fe497b66d3185c1912..12eef9b4664c11b370f61fd1e8843f71092ed272 100644 (file)
@@ -22,8 +22,6 @@ extern "C" {
  * kt_tacocat_main_flag_*_e:
  *   - none:                   No flags set.
  *   - copyright:              Print copyright.
- *   - print_first:            When set, print new line to message output on program begin after loading settings.
- *   - print_last:             When set, print new line to message output on program end.
  *   - max_buffer:             When set, a maximum buffer on receive is enforced.
  *   - receive:                The address or socket to receive from is specified.
  *   - resolve_classic:        Follow the classic Domain Name Resolution method.
@@ -50,15 +48,13 @@ extern "C" {
     kt_tacocat_main_flag_copyright_e              = 0x1,
     kt_tacocat_main_flag_help_e                   = 0x2,
     kt_tacocat_main_flag_max_buffer_e             = 0x4,
-    kt_tacocat_main_flag_print_first_e            = 0x8,
-    kt_tacocat_main_flag_print_last_e             = 0x10,
-    kt_tacocat_main_flag_receive_e                = 0x20,
-    kt_tacocat_main_flag_resolve_classic_e        = 0x40,
-    kt_tacocat_main_flag_resolve_kevux_e          = 0x80,
-    kt_tacocat_main_flag_resolve_e                = 0x100,
-    kt_tacocat_main_flag_send_e                   = 0x200,
-    kt_tacocat_main_flag_version_e                = 0x400,
-    kt_tacocat_main_flag_version_copyright_help_e = 0x403,
+    kt_tacocat_main_flag_receive_e                = 0x8,
+    kt_tacocat_main_flag_resolve_classic_e        = 0x10,
+    kt_tacocat_main_flag_resolve_kevux_e          = 0x20,
+    kt_tacocat_main_flag_resolve_e                = 0x40,
+    kt_tacocat_main_flag_send_e                   = 0x80,
+    kt_tacocat_main_flag_version_e                = 0x100,
+    kt_tacocat_main_flag_version_copyright_help_e = 0x103,
   }; // enum
 #endif // _di_kt_tacocat_main_flag_e_
 
@@ -97,7 +93,7 @@ extern "C" {
       macro_f_console_parameter_t_initialize_3(kt_tacocat_short_send_s, kt_tacocat_long_send_s, 2, f_console_flag_normal_e), \
     }
 
-  #define kt_tacocat_parameter_total_d 18
+  #define kt_tacocat_parameter_total_d  (f_console_parameter_state_type_total_d + 5)
 #endif // _di_kt_tacocat_parameter_e_
 
 /**
index ec1cb01593cc2b836b0456701d2a672c3aa76ec0..ce2bb0f45b5050c2f45c09ebd28138449fd94c33 100644 (file)
@@ -9,15 +9,7 @@ extern "C" {
 
     if (!main) return;
 
-    if (F_status_is_error(main->setting.state.status)) {
-      if ((main->setting.flag & kt_tacocat_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
-        fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
-      }
-
-      return;
-    }
-
-    macro_setting_load_print_first();
+    if (F_status_is_error(main->setting.state.status)) return;
 
     main->setting.state.status = F_okay;
 
@@ -32,10 +24,6 @@ extern "C" {
         fll_program_print_copyright(&main->program.message, fll_program_copyright_year_author_s);
       }
 
-      if ((main->setting.flag & kt_tacocat_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
-        fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
-      }
-
       return;
     }
 
@@ -69,10 +57,6 @@ extern "C" {
     if (main->setting.state.status == F_status_set_error(F_interrupt)) {
       fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
     }
-
-    if ((main->setting.flag & kt_tacocat_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
-      fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
-    }
   }
 #endif // _di_kt_tacocat_main_