]> Kevux Git Server - kevux-tools/commitdiff
Progress: Continue working on completing the remove program.
authorKevin Day <Kevin@kevux.org>
Mon, 21 Apr 2025 03:18:08 +0000 (22:18 -0500)
committerKevin Day <Kevin@kevux.org>
Mon, 21 Apr 2025 03:18:08 +0000 (22:18 -0500)
Update to the latest FLL changes.
The FLL changes include parameter processing changes to support the `--` parameter as a stop processing parameters option.
Enable this and remove the manual process that was previously performed.

Add the root path check.
Make sure a parameter exists in the `remove` program to toggle this behavior.

A lot of the simulate and directory recursion behavior is now dead code due to the recent recursion changes.
Remove the dead code and simplify the parameters.

Update the unit tests.
I noticed some situations in the unit tests that could be improved to be more accurate and correct.
An `@fixme` has been added to accomplish this.

40 files changed:
data/build/stand_alone/configs/remove-config.h
sources/c/program/kevux/tools/remove/main/common.c
sources/c/program/kevux/tools/remove/main/common.h
sources/c/program/kevux/tools/remove/main/common/define.h
sources/c/program/kevux/tools/remove/main/common/enumeration.h
sources/c/program/kevux/tools/remove/main/common/print.c
sources/c/program/kevux/tools/remove/main/common/print.h
sources/c/program/kevux/tools/remove/main/common/string.c
sources/c/program/kevux/tools/remove/main/common/string.h
sources/c/program/kevux/tools/remove/main/operate.c
sources/c/program/kevux/tools/remove/main/preprocess.c
sources/c/program/kevux/tools/remove/main/preprocess.h
sources/c/program/kevux/tools/remove/main/print/error.c
sources/c/program/kevux/tools/remove/main/print/error.h
sources/c/program/kevux/tools/remove/main/print/message.c
sources/c/program/kevux/tools/remove/main/print/simulate.c
sources/c/program/kevux/tools/remove/main/print/simulate.h
sources/c/program/kevux/tools/remove/rm/enumeration.h
sources/c/program/kevux/tools/remove/rm/rm.c
sources/c/program/kevux/tools/remove/rmdir/enumeration.h
sources/c/program/kevux/tools/remove/rmdir/rmdir.c
sources/c/program/kevux/tools/remove/unlink/enumeration.h
sources/c/program/kevux/tools/remove/unlink/unlink.c
sources/c/program/kevux/tools/tacocat/main/common.c
sources/c/program/kevux/tools/tacocat/main/common/enumeration.h
sources/c/program/kevux/tools/tacocat/main/send.c
tests/unit/remove/c/mock-remove.c
tests/unit/remove/c/mock-remove.h
tests/unit/remove/c/test-remove-date_accessed.c
tests/unit/remove/c/test-remove-date_changed.c
tests/unit/remove/c/test-remove-date_updated.c
tests/unit/remove/c/test-remove-directory_no_args.c
tests/unit/remove/c/test-remove-directory_recurse_simple.c
tests/unit/remove/c/test-remove-epochtime.c
tests/unit/remove/c/test-remove-file_mode.c
tests/unit/remove/c/test-remove-file_type.c
tests/unit/remove/c/test-remove-group.c
tests/unit/remove/c/test-remove-time.c
tests/unit/remove/c/test-remove-unix.c
tests/unit/remove/c/test-remove-user.c

index a3224d0b3c4c35d9555c735299863671bdb37f04..b5110cb8b3176ae1f333160def9ccf6640513f27 100644 (file)
 #define _di_f_compare_utf_utf_string_dynamic_partial_trim_
 //#define _di_f_console_arguments_t_
 #define _di_f_console_environment_process_
-//#define _di_f_console_flag_e_
+//#define _di_f_console_flag_d_
 //#define _di_f_console_flag_t_
 #define _di_f_console_identify_
 //#define _di_f_console_length_size_d_
 //#define _di_f_console_parameters_delete_
 #define _di_f_console_parameters_destroy_
 //#define _di_f_console_parameters_t_
-//#define _di_f_console_result_e_
+//#define _di_f_console_result_d_
 //#define _di_f_console_result_t_
 //#define _di_f_console_standard_long_copyright_s_
 //#define _di_f_console_standard_long_dark_s_
 #define _di_f_date_t_
 #define _di_f_directory_at_d_
 //#define _di_f_directory_back_s_
-#define _di_f_directory_close_
+//#define _di_f_directory_stream_close_
 //#define _di_f_directory_compare_call_t_
 #define _di_f_directory_create_
 #define _di_f_directory_create_at_
 #define _di_f_directory_recurse_doss_t_
 //#define _di_f_directory_remove_
 #define _di_f_directory_remove_custom_
+//#define _di_f_directory_stream_close_
+//#define _di_f_directory_stream_open_
+#define _di_f_directory_stream_open_id_
+//#define _di_f_directory_stream_read_
+#define _di_f_directory_stream_rewind_
+#define _di_f_directory_stream_seek_
+#define _di_f_directory_stream_tell_
 //#define _di_f_directory_s_
 #define _di_f_directory_status_delete_
 #define _di_f_directory_status_destroy_
 #define _di_f_string_constant_t_
 #define _di_f_string_dynamic_append_
 //#define _di_f_string_dynamic_append_assure_
-#define _di_f_string_dynamic_append_assure_nulless_
+//#define _di_f_string_dynamic_append_assure_nulless_
 //#define _di_f_string_dynamic_append_nulless_
 #define _di_f_string_dynamic_mash_
 #define _di_f_string_dynamic_mash_nulless_
index be56022a934690fb84529d79d29ad85c88c0bd3e..061bdb6a695c86625272c8941128c574ce34108d 100644 (file)
@@ -20,19 +20,19 @@ extern "C" {
 
     uint8_t j = 0;
 
-    if (main->program.parameters.array[kt_remove_parameter_block_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_block_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_block_d | kt_remove_main_flag_option_type_d | kt_remove_main_flag_option_used_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_character_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_character_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_character_d | kt_remove_main_flag_option_type_d | kt_remove_main_flag_option_used_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_different_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_different_e].result & f_console_result_found_d) {
       main->setting.flag &= ~kt_remove_main_flag_same_d;
       main->setting.flag |= kt_remove_main_flag_different_d | kt_remove_main_flag_option_used_d;
 
-      if (main->program.parameters.array[kt_remove_parameter_same_e].result & f_console_result_found_e) {
+      if (main->program.parameters.array[kt_remove_parameter_same_e].result & f_console_result_found_d) {
         index = main->program.parameters.array[kt_remove_parameter_different_e].locations.used;
         index2 = main->program.parameters.array[kt_remove_parameter_same_e].locations.used;
 
@@ -42,19 +42,19 @@ extern "C" {
         }
       }
     }
-    else if (main->program.parameters.array[kt_remove_parameter_same_e].result & f_console_result_found_e) {
+    else if (main->program.parameters.array[kt_remove_parameter_same_e].result & f_console_result_found_d) {
       main->setting.flag &= ~kt_remove_main_flag_different_d;
       main->setting.flag |= kt_remove_main_flag_same_d | kt_remove_main_flag_option_used_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_fifo_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_fifo_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_fifo_d | kt_remove_main_flag_option_type_d | kt_remove_main_flag_option_used_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_follow_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_follow_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_follow_d;
 
-      if (main->program.parameters.array[kt_remove_parameter_stay_e].result & f_console_result_found_e) {
+      if (main->program.parameters.array[kt_remove_parameter_stay_e].result & f_console_result_found_d) {
         index = main->program.parameters.array[kt_remove_parameter_follow_e].locations.used;
         index2 = main->program.parameters.array[kt_remove_parameter_stay_e].locations.used;
 
@@ -63,46 +63,50 @@ extern "C" {
         }
       }
     }
-    else if (main->program.parameters.array[kt_remove_parameter_stay_e].result & f_console_result_found_e) {
+    else if (main->program.parameters.array[kt_remove_parameter_stay_e].result & f_console_result_found_d) {
       main->setting.flag &= ~kt_remove_main_flag_follow_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_directory_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_directory_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_directory_d | kt_remove_main_flag_option_type_d | kt_remove_main_flag_option_used_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_force_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_force_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_force_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_link_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_link_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_link_d | kt_remove_main_flag_option_type_d | kt_remove_main_flag_option_used_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_recurse_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_recurse_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_recurse_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_regular_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_regular_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_regular_d | kt_remove_main_flag_option_type_d | kt_remove_main_flag_option_used_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_simulate_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_simulate_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_simulate_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_socket_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_socket_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_socket_d | kt_remove_main_flag_option_type_d | kt_remove_main_flag_option_used_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_tree_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_tree_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_tree_d;
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_unknown_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_unknown_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_unknown_d | kt_remove_main_flag_option_type_d | kt_remove_main_flag_option_used_d;
     }
 
+    if (main->program.parameters.array[kt_remove_parameter_allow_root_e].result & f_console_result_found_d) {
+      main->setting.flag |= kt_remove_main_flag_root_d;
+    }
+
     {
       f_console_parameter_t * const parameters[] = {
         &main->program.parameters.array[kt_remove_parameter_accessed_e],
@@ -130,9 +134,9 @@ extern "C" {
 
       for (uint8_t p = 0; p < 3; ++p) {
 
-        if (!(parameters[p]->result & f_console_result_found_e)) continue;
+        if (!(parameters[p]->result & f_console_result_found_d)) continue;
 
-        if (parameters[p]->result & f_console_result_value_e) {
+        if (parameters[p]->result & f_console_result_value_d) {
           total_locations = parameters[p]->locations.used;
           total_arguments = parameters[p]->values.used;
 
@@ -235,8 +239,8 @@ extern "C" {
       } // for
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_empty_e].result & f_console_result_found_e) {
-      if (main->program.parameters.array[kt_remove_parameter_empty_e].result & f_console_result_value_e) {
+    if (main->program.parameters.array[kt_remove_parameter_empty_e].result & f_console_result_found_d) {
+      if (main->program.parameters.array[kt_remove_parameter_empty_e].result & f_console_result_value_d) {
         total_arguments = main->program.parameters.array[kt_remove_parameter_empty_e].values.used;
 
         if (main->program.parameters.array[kt_remove_parameter_empty_e].locations.used != total_arguments) {
@@ -283,8 +287,8 @@ extern "C" {
     kt_remove_setting_load_id(main, &main->program.parameters.array[kt_remove_parameter_group_e], &main->setting.groups, kt_remove_long_group_s, kt_remove_main_flag_group_d, F_false);
     if (F_status_is_error(main->setting.state.status)) return;
 
-    if (main->program.parameters.array[kt_remove_parameter_mode_e].result & f_console_result_found_e) {
-      if (main->program.parameters.array[kt_remove_parameter_mode_e].result & f_console_result_value_e) {
+    if (main->program.parameters.array[kt_remove_parameter_mode_e].result & f_console_result_found_d) {
+      if (main->program.parameters.array[kt_remove_parameter_mode_e].result & f_console_result_value_d) {
         total_locations = main->program.parameters.array[kt_remove_parameter_mode_e].locations.used;
         total_arguments = main->program.parameters.array[kt_remove_parameter_mode_e].values.used;
 
@@ -373,8 +377,8 @@ extern "C" {
     kt_remove_setting_load_id(main, &main->program.parameters.array[kt_remove_parameter_user_e], &main->setting.users, kt_remove_long_user_s, kt_remove_main_flag_user_d, F_true);
     if (F_status_is_error(main->setting.state.status)) return;
 
-    if (main->program.parameters.array[kt_remove_parameter_prompt_e].result & f_console_result_found_e) {
-      if (main->program.parameters.array[kt_remove_parameter_prompt_e].result & f_console_result_value_e) {
+    if (main->program.parameters.array[kt_remove_parameter_prompt_e].result & f_console_result_found_d) {
+      if (main->program.parameters.array[kt_remove_parameter_prompt_e].result & f_console_result_value_d) {
         total_arguments = main->program.parameters.array[kt_remove_parameter_prompt_e].values.used;
 
         if (main->program.parameters.array[kt_remove_parameter_prompt_e].locations.used != total_arguments) {
@@ -418,8 +422,8 @@ extern "C" {
       }
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_remember_e].result & f_console_result_found_e) {
-      if (main->program.parameters.array[kt_remove_parameter_remember_e].result & f_console_result_value_e) {
+    if (main->program.parameters.array[kt_remove_parameter_remember_e].result & f_console_result_found_d) {
+      if (main->program.parameters.array[kt_remove_parameter_remember_e].result & f_console_result_value_d) {
         total_arguments = main->program.parameters.array[kt_remove_parameter_remember_e].values.used;
 
         if (main->program.parameters.array[kt_remove_parameter_remember_e].locations.used != total_arguments) {
@@ -455,11 +459,11 @@ extern "C" {
       }
     }
 
-    if (main->program.parameters.array[kt_remove_parameter_utc_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_parameter_utc_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_utc_d;
 
       // Use the right most parameter when both --utc and --local are passed.
-      if (main->program.parameters.array[kt_remove_parameter_local_e].result & f_console_result_found_e) {
+      if (main->program.parameters.array[kt_remove_parameter_local_e].result & f_console_result_found_d) {
         index = main->program.parameters.array[kt_remove_parameter_local_e].locations.array[main->program.parameters.array[kt_remove_parameter_local_e].locations.used];
         index2 = main->program.parameters.array[kt_remove_parameter_utc_e].locations.array[main->program.parameters.array[kt_remove_parameter_utc_e].locations.used];
 
@@ -468,35 +472,11 @@ extern "C" {
         }
       }
     }
-    else if (main->program.parameters.array[kt_remove_parameter_local_e].result & f_console_result_found_e) {
+    else if (main->program.parameters.array[kt_remove_parameter_local_e].result & f_console_result_found_d) {
       main->setting.flag &= ~kt_remove_main_flag_utc_d;
     }
 
-    // Load all remaining files as static strings (setting size to 0).
-    if (main->program.parameters.remaining.used) {
-      main->setting.state.status = f_memory_array_increase_by(main->program.parameters.remaining.used, sizeof(f_string_dynamic_t), (void **) &main->setting.files.array, &main->setting.files.used, &main->setting.files.size);
-
-      if (F_status_is_error(main->setting.state.status)) {
-        kt_remove_print_error(&main->program.error, macro_kt_remove_f(f_memory_array_increase_by));
-
-        return;
-      }
-
-      for (i = 0; i < main->program.parameters.remaining.used; ++i, ++main->setting.files.used) {
-
-        index = main->program.parameters.remaining.array[i];
-
-        main->setting.files.array[main->setting.files.used].used = 0;
-
-        fl_path_clean(main->program.parameters.arguments.array[index], &main->setting.files.array[main->setting.files.used]);
-
-        if (F_status_is_error(main->setting.state.status)) {
-          kt_remove_print_error_file(&main->program.error, macro_kt_remove_f(fl_path_clean), main->program.parameters.arguments.array[index], f_file_operation_process_s, fll_error_file_type_path_e);
-
-          return;
-        }
-      } // for
-    }
+    kt_remove_setting_load_remaining(arguments, main);
   }
 #endif // _di_kt_remove_setting_load_
 
@@ -513,8 +493,8 @@ extern "C" {
       return;
     }
 
-    if (parameter->result & f_console_result_found_e) {
-      if (parameter->result & f_console_result_value_e) {
+    if (parameter->result & f_console_result_found_d) {
+      if (parameter->result & f_console_result_value_d) {
         const f_number_unsigned_t total_arguments = parameter->values.used;
 
         if (parameter->locations.used != total_arguments) {
@@ -561,6 +541,42 @@ extern "C" {
   }
 #endif // _di_kt_remove_setting_load_id_
 
+#ifndef _di_kt_remove_setting_load_remaining_
+  void kt_remove_setting_load_remaining(const f_console_arguments_t arguments, kt_remove_main_t * const main) {
+
+    if (!main || F_status_is_error(main->setting.state.status)) return;
+
+    if (main->program.parameters.remaining.used) {
+      main->setting.state.status = f_memory_array_increase_by(main->program.parameters.remaining.used, sizeof(f_string_dynamic_t), (void **) &main->setting.files.array, &main->setting.files.used, &main->setting.files.size);
+
+      if (F_status_is_error(main->setting.state.status)) {
+        kt_remove_print_error(&main->program.error, macro_kt_remove_f(f_memory_array_increase_by));
+
+        return;
+      }
+
+      f_number_unsigned_t index = 0;
+
+      for (f_number_unsigned_t i = 0; i < main->program.parameters.remaining.used; ++i, ++main->setting.files.used) {
+
+        index = main->program.parameters.remaining.array[i];
+
+        main->setting.files.array[main->setting.files.used].used = 0;
+
+        fl_path_clean(main->program.parameters.arguments.array[index], &main->setting.files.array[main->setting.files.used]);
+
+        if (F_status_is_error(main->setting.state.status)) {
+          kt_remove_print_error_file(&main->program.error, macro_kt_remove_f(fl_path_clean), main->program.parameters.arguments.array[index], f_file_operation_process_s, fll_error_file_type_path_e);
+
+          return;
+        }
+      } // for
+    }
+
+    main->setting.state.status = F_okay;
+  }
+#endif // _di_kt_remove_setting_load_remaining_
+
 #ifndef _di_kt_remove_setting_load_standard_
   void kt_remove_setting_load_standard(const f_console_arguments_t arguments, kt_remove_main_t * const main) {
 
@@ -618,15 +634,15 @@ extern "C" {
 
     main->setting.flag &= ~kt_remove_main_flag_version_copyright_help_d;
 
-    if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_help_d;
     }
 
-    if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_version_d;
     }
 
-    if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_copyright_d;
     }
   }
index 3cf4ba51a3f9b8bacdca798a983b53953ffbaa55..34f783d327993082f7a8a36dc80598ed8a457a24 100644 (file)
@@ -89,6 +89,31 @@ extern "C" {
 #endif // _di_kt_remove_setting_load_id_
 
 /**
+ * Load all remaining files as static strings (setting size to 0).
+ *
+ * This prints error messages as appropriate.
+ *
+ * @param arguments
+ *   The parameters passed to the process (often referred to as command line arguments).
+ * @param main
+ *   The main program and settings data.
+ *
+ *   Must not be NULL.
+ *
+ *   This alters setting.status:
+ *     F_okay on success.
+ *
+ *     Errors (with error bit) from: f_memory_array_increase_by().
+ *     Errors (with error bit) from: fl_path_clean().
+ *
+ * @see f_memory_array_increase_by()
+ * @see fl_path_clean()
+ */
+#ifndef _di_kt_remove_setting_load_remaining_
+  extern void kt_remove_setting_load_remaining(const f_console_arguments_t arguments, kt_remove_main_t * const main);
+#endif // _di_kt_remove_setting_load_remaining_
+
+/**
  * Perform the standard program setting load process, specifically handling the FLL standard parameters.
  *
  * This prints error messages as appropriate.
index 97a7e2384ce6281e2bf9aa8e439aa33b070a35e9..6b95d8a9b59df34e9a215c5bebee7869b7f8efcf 100644 (file)
@@ -81,24 +81,16 @@ extern "C" {
  * Flags associated with performing an operation on a file.
  *
  * kt_remove_flag_simulate_*_d:
- *   - none:              No flags set, simulate disabled, no "is" value.
- *   - directory:         Simulate directory, not recursing.
- *   - directory_any:     Helper used to represent the directory, directory_not, and directory_recurse bits.
- *   - directory_not:     Simulate non-directory, not recursing.
- *   - directory_recurse: Simulate directory, recursing.
- *   - is_a:              Print simulate message related to "is a ".
- *   - is_a_file:         Helper used to print both simulate messages related to "is a " and "a file".
- *   - is_file:           Print simulate message related to "a file".
+ *   - none:      No flags set, simulate disabled, no "is" value.
+ *   - is_a:      Print simulate message related to "is a ".
+ *   - is_a_file: Helper used to print both simulate messages related to "is a " and "a file".
+ *   - is_file:   Print simulate message related to "a file".
  */
 #ifndef _di_kt_remove_flag_file_simulate_d_
-  #define kt_remove_flag_simulate_none_d              0x0
-  #define kt_remove_flag_simulate_directory_d         0x1
-  #define kt_remove_flag_simulate_directory_any_d     0x7
-  #define kt_remove_flag_simulate_directory_not_d     0x2
-  #define kt_remove_flag_simulate_directory_recurse_d 0x4
-  #define kt_remove_flag_simulate_is_a_d              0x8
-  #define kt_remove_flag_simulate_is_a_file_d         0x18
-  #define kt_remove_flag_simulate_is_file_d           0x10
+  #define kt_remove_flag_simulate_none_d      0x0
+  #define kt_remove_flag_simulate_is_a_d      0x1
+  #define kt_remove_flag_simulate_is_a_file_d 0x3
+  #define kt_remove_flag_simulate_is_file_d   0x2
 #endif // _di_kt_remove_flag_file_code_d_
 
 /**
index 3387966e44fcddbde5e7f4ce06565f768a9ffc57..a0289c25aaa576d3acdfb232ba943bda1a5c755f 100644 (file)
@@ -22,6 +22,7 @@ extern "C" {
 #ifndef _di_kt_remove_parameter_e_
   enum {
     kt_remove_parameter_accessed_e = f_console_standard_parameter_last_e,
+    kt_remove_parameter_allow_root_e,
     kt_remove_parameter_block_e,
     kt_remove_parameter_changed_e,
     kt_remove_parameter_character_e,
@@ -54,36 +55,37 @@ extern "C" {
     { \
       macro_fll_program_console_parameter_standard_initialize, \
       \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_accessed_s,  kt_remove_long_accessed_s,  2, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_block_s,     kt_remove_long_block_s,     0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_changed_s,   kt_remove_long_changed_s,   2, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_character_s, kt_remove_long_character_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_different_s, kt_remove_long_different_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_directory_s, kt_remove_long_directory_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_empty_s,     kt_remove_long_empty_s,     1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_fifo_s,      kt_remove_long_fifo_s,      0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_follow_s,    kt_remove_long_follow_s,    0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_force_s,     kt_remove_long_force_s,     0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_group_s,     kt_remove_long_group_s,     1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_link_s,      kt_remove_long_link_s,      0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_5(                             kt_remove_long_local_s,     0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_mode_s,      kt_remove_long_mode_s,      2, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_prompt_s,    kt_remove_long_prompt_s,    1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_recurse_s,   kt_remove_long_recurse_s,   0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_regular_s,   kt_remove_long_regular_s,   0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_5(                             kt_remove_long_remember_s,  1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_same_s,      kt_remove_long_same_s,      0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_simulate_s,  kt_remove_long_simulate_s,  0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_socket_s,    kt_remove_long_socket_s,    0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_stay_s,      kt_remove_long_stay_s,      0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_tree_s,      kt_remove_long_tree_s,      0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_updated_s,   kt_remove_long_updated_s,   2, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_user_s,      kt_remove_long_user_s,      1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_5(                             kt_remove_long_unknown_s,   0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_5(                             kt_remove_long_utc_s,       0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_accessed_s,   kt_remove_long_accessed_s,   2, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_5(                              kt_remove_long_allow_root_s, 0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_block_s,      kt_remove_long_block_s,      0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_changed_s,    kt_remove_long_changed_s,    2, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_character_s,  kt_remove_long_character_s,  0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_different_s,  kt_remove_long_different_s,  0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_directory_s,  kt_remove_long_directory_s,  0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_empty_s,      kt_remove_long_empty_s,      1, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_fifo_s,       kt_remove_long_fifo_s,       0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_follow_s,     kt_remove_long_follow_s,     0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_force_s,      kt_remove_long_force_s,      0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_group_s,      kt_remove_long_group_s,      1, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_link_s,       kt_remove_long_link_s,       0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_5(                              kt_remove_long_local_s,      0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_mode_s,       kt_remove_long_mode_s,       2, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_prompt_s,     kt_remove_long_prompt_s,     1, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_recurse_s,    kt_remove_long_recurse_s,    0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_regular_s,    kt_remove_long_regular_s,    0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_5(                              kt_remove_long_remember_s,   1, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_same_s,       kt_remove_long_same_s,       0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_simulate_s,   kt_remove_long_simulate_s,   0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_socket_s,     kt_remove_long_socket_s,     0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_stay_s,       kt_remove_long_stay_s,       0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_tree_s,       kt_remove_long_tree_s,       0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_updated_s,    kt_remove_long_updated_s,    2, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_user_s,       kt_remove_long_user_s,       1, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_5(                              kt_remove_long_unknown_s,    0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_5(                              kt_remove_long_utc_s,        0, f_console_flag_normal_d), \
     }
 
-  #define kt_remove_total_parameters_d (f_console_parameter_state_type_total_d + 27)
+  #define kt_remove_total_parameters_d (f_console_parameter_state_type_total_d + 28)
 #endif // _di_kt_remove_parameter_e_
 
 #ifdef __cplusplus
index 0a0c84bcd33f3f455cd80408b3b343ecb654c018..60b247d65de93e9c93dfc4a307e189a26451aef9 100644 (file)
@@ -10,6 +10,7 @@ extern "C" {
     "f_console_parameter_process",
     "f_directory_remove",
     "f_file_exists",
+    "f_file_link_read",
     "f_file_mode_from_string",
     "f_file_mode_to_mode",
     "f_file_poll",
@@ -25,8 +26,8 @@ extern "C" {
     "f_utf_is_whitespace",
     "fl_conversion_dynamic_partial_to_unsigned_detect",
     "fl_conversion_dynamic_to_unsigned_detect",
+    "fl_directory_do",
     "fl_path_clean",
-    "fl_recurse_do",
     "fll_program_parameter_process_context",
     "fll_program_parameter_process_empty",
     "fll_program_parameter_process_verbosity",
index d8bda1e68bed8edd9664a6ef281dd25f23358b0a..b410ddd9a5838221d617a733d01ff42b2fefa35c 100644 (file)
@@ -43,6 +43,7 @@ extern "C" {
     kt_remove_f_f_console_parameter_process_e,
     kt_remove_f_f_directory_remove_e,
     kt_remove_f_f_file_exists_e,
+    kt_remove_f_f_file_link_read_e,
     kt_remove_f_f_file_mode_from_string_e,
     kt_remove_f_f_file_mode_to_mode_e,
     kt_remove_f_f_file_poll_e,
@@ -58,8 +59,8 @@ extern "C" {
     kt_remove_f_f_utf_is_whitespace_e,
     kt_remove_f_fl_conversion_dynamic_partial_to_unsigned_detect_e,
     kt_remove_f_fl_conversion_dynamic_to_unsigned_detect_e,
+    kt_remove_f_fl_directory_do_e,
     kt_remove_f_fl_path_clean_e,
-    kt_remove_f_fl_recurse_do_e,
     kt_remove_f_fll_program_parameter_process_context_e,
     kt_remove_f_fll_program_parameter_process_empty_e,
     kt_remove_f_fll_program_parameter_process_verbosity_e,
index ca81329d0f80fbec184fde84883c7f00b9adc34b..75a81cff20b7ead5e9424667a1d6067ccf1506d0 100644 (file)
@@ -23,6 +23,7 @@ extern "C" {
   const f_string_static_t kt_remove_never_s = macro_f_string_static_t_initialize_1(KT_REMOVE_never_s, 0, KT_REMOVE_never_s_length);
   const f_string_static_t kt_remove_no_s = macro_f_string_static_t_initialize_1(KT_REMOVE_no_s, 0, KT_REMOVE_no_s_length);
   const f_string_static_t kt_remove_not_s = macro_f_string_static_t_initialize_1(KT_REMOVE_not_s, 0, KT_REMOVE_not_s_length);
+  const f_string_static_t kt_remove_not_allowed_s = macro_f_string_static_t_initialize_1(KT_REMOVE_not_allowed_s, 0, KT_REMOVE_not_allowed_s_length);
   const f_string_static_t kt_remove_not_empty_s = macro_f_string_static_t_initialize_1(KT_REMOVE_not_empty_s, 0, KT_REMOVE_not_empty_s_length);
   const f_string_static_t kt_remove_not_fail_s = macro_f_string_static_t_initialize_1(KT_REMOVE_not_fail_s, 0, KT_REMOVE_not_fail_s_length);
   const f_string_static_t kt_remove_now_s = macro_f_string_static_t_initialize_1(KT_REMOVE_now_s, 0, KT_REMOVE_now_s_length);
@@ -134,6 +135,7 @@ extern "C" {
   const f_string_static_t kt_remove_short_user_s = macro_f_string_static_t_initialize_1(KT_REMOVE_short_user_s, 0, KT_REMOVE_short_user_s_length);
 
   const f_string_static_t kt_remove_long_accessed_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_accessed_s, 0, KT_REMOVE_long_accessed_s_length);
+  const f_string_static_t kt_remove_long_allow_root_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_allow_root_s, 0, KT_REMOVE_long_allow_root_s_length);
   const f_string_static_t kt_remove_long_block_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_block_s, 0, KT_REMOVE_long_block_s_length);
   const f_string_static_t kt_remove_long_changed_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_changed_s, 0, KT_REMOVE_long_changed_s_length);
   const f_string_static_t kt_remove_long_character_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_character_s, 0, KT_REMOVE_long_character_s_length);
index e4be189e3772a517a362eb76aff2732ad4218c65..3617c2a28b2f04fc5d528fcc73b246db385279f0 100644 (file)
@@ -69,63 +69,65 @@ extern "C" {
  * kt_remove_*_s: Arbitrary strings.
  */
 #ifndef _di_kt_remove_s_
-  #define KT_REMOVE_each_s      "each"
-  #define KT_REMOVE_empty_s     "empty"
-  #define KT_REMOVE_different_s "different"
-  #define KT_REMOVE_follow_s    "follow"
-  #define KT_REMOVE_force_s     "force"
-  #define KT_REMOVE_group_s     "group"
-  #define KT_REMOVE_ignore_s    "ignore"
-  #define KT_REMOVE_never_s     "never"
-  #define KT_REMOVE_no_s        "no"
-  #define KT_REMOVE_not_s       "not"
-  #define KT_REMOVE_not_empty_s "not empty"
-  #define KT_REMOVE_not_fail_s  "not_fail"
-  #define KT_REMOVE_now_s       "now"
-  #define KT_REMOVE_once_s      "once"
-  #define KT_REMOVE_only_s      "only"
-  #define KT_REMOVE_only_fail_s "only_fail"
-  #define KT_REMOVE_parent_s    "parent"
-  #define KT_REMOVE_prompt_s    "prompt"
-  #define KT_REMOVE_recurse_s   "recurse"
-  #define KT_REMOVE_remove_s    "remove"
-  #define KT_REMOVE_root_s      "root"
-  #define KT_REMOVE_same_s      "same"
-  #define KT_REMOVE_today_s     "today"
-  #define KT_REMOVE_tomorrow_s  "tomorrow"
-  #define KT_REMOVE_tree_s      "tree"
-  #define KT_REMOVE_yes_s       "yes"
-  #define KT_REMOVE_yesterday_s "yesterday"
-  #define KT_REMOVE_user_s      "user"
-
-  #define KT_REMOVE_each_s_length      4
-  #define KT_REMOVE_empty_s_length     5
-  #define KT_REMOVE_different_s_length 9
-  #define KT_REMOVE_follow_s_length    6
-  #define KT_REMOVE_force_s_length     5
-  #define KT_REMOVE_group_s_length     5
-  #define KT_REMOVE_ignore_s_length    6
-  #define KT_REMOVE_never_s_length     5
-  #define KT_REMOVE_no_s_length        2
-  #define KT_REMOVE_not_s_length       3
-  #define KT_REMOVE_not_empty_s_length 9
-  #define KT_REMOVE_not_fail_s_length  8
-  #define KT_REMOVE_now_s_length       3
-  #define KT_REMOVE_once_s_length      4
-  #define KT_REMOVE_only_s_length      4
-  #define KT_REMOVE_only_fail_s_length 9
-  #define KT_REMOVE_parent_s_length    6
-  #define KT_REMOVE_prompt_s_length    6
-  #define KT_REMOVE_recurse_s_length   7
-  #define KT_REMOVE_remove_s_length    6
-  #define KT_REMOVE_root_s_length      4
-  #define KT_REMOVE_same_s_length      4
-  #define KT_REMOVE_today_s_length     5
-  #define KT_REMOVE_tomorrow_s_length  8
-  #define KT_REMOVE_tree_s_length      4
-  #define KT_REMOVE_yes_s_length       3
-  #define KT_REMOVE_yesterday_s_length 9
-  #define KT_REMOVE_user_s_length      4
+  #define KT_REMOVE_each_s        "each"
+  #define KT_REMOVE_empty_s       "empty"
+  #define KT_REMOVE_different_s   "different"
+  #define KT_REMOVE_follow_s      "follow"
+  #define KT_REMOVE_force_s       "force"
+  #define KT_REMOVE_group_s       "group"
+  #define KT_REMOVE_ignore_s      "ignore"
+  #define KT_REMOVE_never_s       "never"
+  #define KT_REMOVE_no_s          "no"
+  #define KT_REMOVE_not_s         "not"
+  #define KT_REMOVE_not_allowed_s "not allowed"
+  #define KT_REMOVE_not_empty_s   "not empty"
+  #define KT_REMOVE_not_fail_s    "not_fail"
+  #define KT_REMOVE_now_s         "now"
+  #define KT_REMOVE_once_s        "once"
+  #define KT_REMOVE_only_s        "only"
+  #define KT_REMOVE_only_fail_s   "only_fail"
+  #define KT_REMOVE_parent_s      "parent"
+  #define KT_REMOVE_prompt_s      "prompt"
+  #define KT_REMOVE_recurse_s     "recurse"
+  #define KT_REMOVE_remove_s      "remove"
+  #define KT_REMOVE_root_s        "root"
+  #define KT_REMOVE_same_s        "same"
+  #define KT_REMOVE_today_s       "today"
+  #define KT_REMOVE_tomorrow_s    "tomorrow"
+  #define KT_REMOVE_tree_s        "tree"
+  #define KT_REMOVE_yes_s         "yes"
+  #define KT_REMOVE_yesterday_s   "yesterday"
+  #define KT_REMOVE_user_s        "user"
+
+  #define KT_REMOVE_each_s_length        4
+  #define KT_REMOVE_empty_s_length       5
+  #define KT_REMOVE_different_s_length   9
+  #define KT_REMOVE_follow_s_length      6
+  #define KT_REMOVE_force_s_length       5
+  #define KT_REMOVE_group_s_length       5
+  #define KT_REMOVE_ignore_s_length      6
+  #define KT_REMOVE_never_s_length       5
+  #define KT_REMOVE_no_s_length          2
+  #define KT_REMOVE_not_s_length         3
+  #define KT_REMOVE_not_allowed_s_length 11
+  #define KT_REMOVE_not_empty_s_length   9
+  #define KT_REMOVE_not_fail_s_length    8
+  #define KT_REMOVE_now_s_length         3
+  #define KT_REMOVE_once_s_length        4
+  #define KT_REMOVE_only_s_length        4
+  #define KT_REMOVE_only_fail_s_length   9
+  #define KT_REMOVE_parent_s_length      6
+  #define KT_REMOVE_prompt_s_length      6
+  #define KT_REMOVE_recurse_s_length     7
+  #define KT_REMOVE_remove_s_length      6
+  #define KT_REMOVE_root_s_length        4
+  #define KT_REMOVE_same_s_length        4
+  #define KT_REMOVE_today_s_length       5
+  #define KT_REMOVE_tomorrow_s_length    8
+  #define KT_REMOVE_tree_s_length        4
+  #define KT_REMOVE_yes_s_length         3
+  #define KT_REMOVE_yesterday_s_length   9
+  #define KT_REMOVE_user_s_length        4
 
   extern const f_string_static_t kt_remove_each_s;
   extern const f_string_static_t kt_remove_empty_s;
@@ -137,6 +139,7 @@ extern "C" {
   extern const f_string_static_t kt_remove_never_s;
   extern const f_string_static_t kt_remove_no_s;
   extern const f_string_static_t kt_remove_not_s;
+  extern const f_string_static_t kt_remove_not_allowed_s;
   extern const f_string_static_t kt_remove_not_empty_s;
   extern const f_string_static_t kt_remove_not_fail_s;
   extern const f_string_static_t kt_remove_now_s;
@@ -429,33 +432,34 @@ extern "C" {
   #define KT_REMOVE_short_updated_s   "U"
   #define KT_REMOVE_short_user_s      "u"
 
-  #define KT_REMOVE_long_accessed_s  "accessed"
-  #define KT_REMOVE_long_block_s     "block"
-  #define KT_REMOVE_long_character_s "character"
-  #define KT_REMOVE_long_changed_s   "changed"
-  #define KT_REMOVE_long_different_s "different"
-  #define KT_REMOVE_long_directory_s "directory"
-  #define KT_REMOVE_long_empty_s     "empty"
-  #define KT_REMOVE_long_fifo_s      "fifo"
-  #define KT_REMOVE_long_follow_s    "follow"
-  #define KT_REMOVE_long_force_s     "force"
-  #define KT_REMOVE_long_group_s     "group"
-  #define KT_REMOVE_long_link_s      "link"
-  #define KT_REMOVE_long_local_s     "local"
-  #define KT_REMOVE_long_mode_s      "mode"
-  #define KT_REMOVE_long_prompt_s    "prompt"
-  #define KT_REMOVE_long_recurse_s   "recurse"
-  #define KT_REMOVE_long_regular_s   "regular"
-  #define KT_REMOVE_long_remember_s  "remember"
-  #define KT_REMOVE_long_same_s      "same"
-  #define KT_REMOVE_long_simulate_s  "simulate"
-  #define KT_REMOVE_long_socket_s    "socket"
-  #define KT_REMOVE_long_stay_s      "stay"
-  #define KT_REMOVE_long_tree_s      "tree"
-  #define KT_REMOVE_long_updated_s   "updated"
-  #define KT_REMOVE_long_user_s      "user"
-  #define KT_REMOVE_long_unknown_s   "unknown"
-  #define KT_REMOVE_long_utc_s       "utc"
+  #define KT_REMOVE_long_accessed_s   "accessed"
+  #define KT_REMOVE_long_allow_root_s "allow_root"
+  #define KT_REMOVE_long_block_s      "block"
+  #define KT_REMOVE_long_character_s  "character"
+  #define KT_REMOVE_long_changed_s    "changed"
+  #define KT_REMOVE_long_different_s  "different"
+  #define KT_REMOVE_long_directory_s  "directory"
+  #define KT_REMOVE_long_empty_s      "empty"
+  #define KT_REMOVE_long_fifo_s       "fifo"
+  #define KT_REMOVE_long_follow_s     "follow"
+  #define KT_REMOVE_long_force_s      "force"
+  #define KT_REMOVE_long_group_s      "group"
+  #define KT_REMOVE_long_link_s       "link"
+  #define KT_REMOVE_long_local_s      "local"
+  #define KT_REMOVE_long_mode_s       "mode"
+  #define KT_REMOVE_long_prompt_s     "prompt"
+  #define KT_REMOVE_long_recurse_s    "recurse"
+  #define KT_REMOVE_long_regular_s    "regular"
+  #define KT_REMOVE_long_remember_s   "remember"
+  #define KT_REMOVE_long_same_s       "same"
+  #define KT_REMOVE_long_simulate_s   "simulate"
+  #define KT_REMOVE_long_socket_s     "socket"
+  #define KT_REMOVE_long_stay_s       "stay"
+  #define KT_REMOVE_long_tree_s       "tree"
+  #define KT_REMOVE_long_updated_s    "updated"
+  #define KT_REMOVE_long_user_s       "user"
+  #define KT_REMOVE_long_unknown_s    "unknown"
+  #define KT_REMOVE_long_utc_s        "utc"
 
   #define KT_REMOVE_short_accessed_s_length  1
   #define KT_REMOVE_short_block_s_length     1
@@ -482,33 +486,34 @@ extern "C" {
   #define KT_REMOVE_short_updated_s_length   1
   #define KT_REMOVE_short_user_s_length      1
 
-  #define KT_REMOVE_long_accessed_s_length  8
-  #define KT_REMOVE_long_block_s_length     6
-  #define KT_REMOVE_long_character_s_length 9
-  #define KT_REMOVE_long_changed_s_length   7
-  #define KT_REMOVE_long_different_s_length 9
-  #define KT_REMOVE_long_directory_s_length 9
-  #define KT_REMOVE_long_empty_s_length     5
-  #define KT_REMOVE_long_fifo_s_length      4
-  #define KT_REMOVE_long_follow_s_length    6
-  #define KT_REMOVE_long_force_s_length     5
-  #define KT_REMOVE_long_group_s_length     5
-  #define KT_REMOVE_long_link_s_length      4
-  #define KT_REMOVE_long_local_s_length     5
-  #define KT_REMOVE_long_mode_s_length      4
-  #define KT_REMOVE_long_prompt_s_length    6
-  #define KT_REMOVE_long_recurse_s_length   7
-  #define KT_REMOVE_long_regular_s_length   7
-  #define KT_REMOVE_long_remember_s_length  8
-  #define KT_REMOVE_long_same_s_length      4
-  #define KT_REMOVE_long_simulate_s_length  8
-  #define KT_REMOVE_long_socket_s_length    6
-  #define KT_REMOVE_long_stay_s_length      4
-  #define KT_REMOVE_long_tree_s_length      4
-  #define KT_REMOVE_long_updated_s_length   7
-  #define KT_REMOVE_long_user_s_length      4
-  #define KT_REMOVE_long_unknown_s_length   7
-  #define KT_REMOVE_long_utc_s_length       3
+  #define KT_REMOVE_long_accessed_s_length   8
+  #define KT_REMOVE_long_allow_root_s_length 10
+  #define KT_REMOVE_long_block_s_length      6
+  #define KT_REMOVE_long_character_s_length  9
+  #define KT_REMOVE_long_changed_s_length    7
+  #define KT_REMOVE_long_different_s_length  9
+  #define KT_REMOVE_long_directory_s_length  9
+  #define KT_REMOVE_long_empty_s_length      5
+  #define KT_REMOVE_long_fifo_s_length       4
+  #define KT_REMOVE_long_follow_s_length     6
+  #define KT_REMOVE_long_force_s_length      5
+  #define KT_REMOVE_long_group_s_length      5
+  #define KT_REMOVE_long_link_s_length       4
+  #define KT_REMOVE_long_local_s_length      5
+  #define KT_REMOVE_long_mode_s_length       4
+  #define KT_REMOVE_long_prompt_s_length     6
+  #define KT_REMOVE_long_recurse_s_length    7
+  #define KT_REMOVE_long_regular_s_length    7
+  #define KT_REMOVE_long_remember_s_length   8
+  #define KT_REMOVE_long_same_s_length       4
+  #define KT_REMOVE_long_simulate_s_length   8
+  #define KT_REMOVE_long_socket_s_length     6
+  #define KT_REMOVE_long_stay_s_length       4
+  #define KT_REMOVE_long_tree_s_length       4
+  #define KT_REMOVE_long_updated_s_length    7
+  #define KT_REMOVE_long_user_s_length       4
+  #define KT_REMOVE_long_unknown_s_length    7
+  #define KT_REMOVE_long_utc_s_length        3
 
   extern const f_string_static_t kt_remove_short_accessed_s;
   extern const f_string_static_t kt_remove_short_block_s;
@@ -535,6 +540,7 @@ extern "C" {
   extern const f_string_static_t kt_remove_short_user_s;
 
   extern const f_string_static_t kt_remove_long_accessed_s;
+  extern const f_string_static_t kt_remove_long_allow_root_s;
   extern const f_string_static_t kt_remove_long_block_s;
   extern const f_string_static_t kt_remove_long_changed_s;
   extern const f_string_static_t kt_remove_long_character_s;
index 5a060d40bda3e6fe0f9fbdf477e667e5e87da225..6fcac430846e53a1edc7162e632c5f67ef3daa30 100644 (file)
@@ -7,7 +7,7 @@ extern "C" {
 #ifndef _di_kt_remove_operate_directory_
   f_status_t kt_remove_operate_directory(kt_remove_main_t * const main, const f_string_static_t path, const uint32_t flag_operate) {
 
-    if (!kt_remove_operate_shall_remove(flag_operate)) return (flag_operate & kt_remove_flag_file_operate_remove_fail_d) ? F_status_set_error(F_no) : F_no;
+    if (!kt_remove_operate_shall_remove(flag_operate)) return (flag_operate & kt_remove_flag_file_operate_remove_fail_d) && !(main->setting.flag & kt_remove_main_flag_simulate_d) ? F_status_set_error(F_no) : F_no;
 
     // The recurse.state.code flags represent the top-level directory being recursed on.
     main->cache.recurse.state.code = (uint64_t) flag_operate;
@@ -382,31 +382,26 @@ extern "C" {
 
     kt_remove_main_t * const main = (kt_remove_main_t *) recurse->state.custom;
 
-    // Arguments to fl_recurse_do() are invalid (parameter checking).
-    if (!recurse->depth) {
-      kt_remove_print_error_status(&main->program.error, macro_kt_remove_f(fl_recurse_do), recurse->state.status);
-
-      return;
-    }
+    // Ignore empty paths.
+    if (recurse->state.status == F_data_not) return;
 
     if (flag & f_directory_recurse_do_flag_list_d && recurse->state.status == F_status_set_error(F_recurse)) {
       recurse->state.status = F_status_set_error(F_directory_empty_not);
 
-      kt_remove_print_error_file_status(&main->program.error, macro_kt_remove_f(fl_recurse_do), (!recurse->depth && (flag & f_directory_recurse_do_flag_after_d)) ? *recurse->path_top : recurse->path, f_file_operation_delete_s, fll_error_file_type_directory_e, recurse->state.status);
+      kt_remove_print_error_file_status(&main->program.error, macro_kt_remove_f(fl_directory_do), (!recurse->depth && (flag & f_directory_recurse_do_flag_after_d)) ? *recurse->path_top : recurse->path, f_file_operation_delete_s, fll_error_file_type_directory_e, recurse->state.status);
 
       return;
     }
 
     // The top-level path is an empty string or an error occurred while processing the top-level path.
     if (!recurse->depth && (flag == f_directory_recurse_do_flag_path_d || flag == f_directory_recurse_do_flag_path_before_d)) {
-      kt_remove_print_error_file_status(&main->program.error, macro_kt_remove_f(fl_recurse_do), *recurse->path_top, f_file_operation_stat_s, fll_error_file_type_path_e, recurse->state.status);
+      kt_remove_print_error_file_status(&main->program.error, macro_kt_remove_f(fl_directory_do), *recurse->path_top, f_file_operation_stat_s, fll_error_file_type_path_e, recurse->state.status);
 
       return;
     }
 
-    // An error happened during directory list loading.
-    if (flag == f_directory_recurse_do_flag_path_list_d) {
-      kt_remove_print_error_file_status(&main->program.error, macro_kt_remove_f(fl_recurse_do), recurse->depth ? recurse->path : *recurse->path_top, f_file_operation_list_s, fll_error_file_type_directory_e, recurse->state.status);
+    if (recurse->state.status == F_status_set_error(F_parameter) || flag == f_directory_recurse_do_flag_path_list_d) {
+      kt_remove_print_error_file_status(&main->program.error, macro_kt_remove_f(fl_directory_do), (!recurse->depth && (flag & f_directory_recurse_do_flag_after_d)) ? *recurse->path_top : recurse->path, f_file_operation_list_s, fll_error_file_type_directory_e, recurse->state.status);
 
       return;
     }
@@ -486,7 +481,7 @@ extern "C" {
 #ifndef _di_kt_remove_operate_shall_remove_
   f_status_t kt_remove_operate_shall_remove(const uint32_t flag) {
 
-    return (flag & kt_remove_flag_file_operate_remove_d) && !(flag & kt_remove_flag_file_operate_remove_fail_d) && !(flag & kt_remove_flag_file_operate_remove_not_d);
+    return (flag & kt_remove_flag_file_operate_remove_d) && !(flag & kt_remove_flag_file_operate_remove_not_fail_d);
   }
 #endif // _di_kt_remove_operate_shall_remove_
 
index 154357d40195d24228a8457308db0cd0f6b39f7f..8c987b3e2f41e8cbc9877fb2edeb8eb919b2c459 100644 (file)
@@ -19,10 +19,6 @@ extern "C" {
 
     uint32_t flag_out = (main->setting.flag & kt_remove_main_flag_option_type_used_d) ? 0 : kt_remove_flag_file_operate_remove_d;
 
-    uint8_t simulate = (main->setting.flag & kt_remove_main_flag_simulate_d)
-        ? kt_remove_flag_simulate_directory_not_d
-        : kt_remove_flag_simulate_none_d;
-
     kt_remove_operate_memory_check(main, path, &flag_out);
     if (F_status_is_error(main->setting.state.status) || (flag_out & kt_remove_flag_file_operate_processed_d)) return flag_out;
 
@@ -39,7 +35,7 @@ extern "C" {
         main->setting.state.status = f_file_is(path, F_file_type_link_d, F_false);
 
         if (F_status_is_error(main->setting.state.status)) {
-          kt_remove_print_simulate_operate_file(&main->program.output, simulate, path, flag_operate);
+          kt_remove_print_simulate_operate_file(&main->program.output, path, flag_operate);
 
           remove_print_warning_file_reason(&main->program.warning, path, kt_remove_print_reason_stat_fail_s);
 
@@ -51,12 +47,12 @@ extern "C" {
         }
       }
       else if (exists == F_false || F_status_is_error(exists)) {
-        kt_remove_print_simulate_operate_file(&main->program.output, simulate, path, flag_operate);
+        kt_remove_print_simulate_operate_file(&main->program.output, path, flag_operate);
 
-        kt_remove_print_simulate_operate_file_exists(&main->program.output, simulate, path, flag_out, exists);
+        kt_remove_print_simulate_operate_file_exists(&main->program.output, path, flag_out, exists);
 
         if (exists == F_false) {
-          kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, kt_remove_ignore_s, main->setting.flag & kt_remove_main_flag_force_d);
+          kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_ignore_s, main->setting.flag & kt_remove_main_flag_force_d);
 
           return kt_remove_flag_file_operate_missing_d;
         }
@@ -79,9 +75,9 @@ extern "C" {
         main->setting.state.status = f_file_stat(path, main->setting.flag & kt_remove_main_flag_follow_d, &statistics);
 
         if (F_status_is_error(main->setting.state.status)) {
-          kt_remove_print_simulate_operate_file(&main->program.output, simulate, path, flag_operate);
+          kt_remove_print_simulate_operate_file(&main->program.output, path, flag_operate);
 
-          kt_remove_print_simulate_operate_file_exists(&main->program.output, simulate, path, flag_out, F_false);
+          kt_remove_print_simulate_operate_file_exists(&main->program.output, path, flag_out, F_false);
 
           remove_print_warning_file_reason(&main->program.warning, path, kt_remove_print_reason_stat_fail_s);
 
@@ -97,37 +93,36 @@ extern "C" {
         }
       }
 
-      // Directories get pre-processed before recursion to prevent unnecessary recursion but the pre-process again happens after recursion to perform actual operations because the child paths must be all be removed before the directory.
-      simulate = (main->setting.flag & kt_remove_main_flag_simulate_d)
-        ? (flag_out & kt_remove_flag_file_operate_directory_d)
-          ? recurse
-            ? kt_remove_flag_simulate_directory_recurse_d
-            : kt_remove_flag_simulate_directory_d
-          : kt_remove_flag_simulate_directory_not_d
-        : kt_remove_flag_simulate_none_d;
+      kt_remove_print_simulate_operate_file(&main->program.output, path, flag_operate);
+
+      kt_remove_print_simulate_operate_file_exists(&main->program.output, path, flag_out, exists);
+    }
 
-      kt_remove_print_simulate_operate_file(&main->program.output, simulate, path, flag_operate);
+    if (!(main->setting.flag & kt_remove_main_flag_root_d)) {
+      if (f_compare_dynamic(f_string_ascii_slash_forward_s, path) == F_equal_to) {
+        kt_remove_print_error_file_is_a(&main->program.error, path, kt_remove_not_allowed_s, 0);
 
-      kt_remove_print_simulate_operate_file_exists(&main->program.output, simulate, path, flag_out, exists);
+        flag_out |= kt_remove_flag_file_operate_remove_not_d;
+      }
     }
 
-    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_d | simulate, path, macro_f_file_type_is_block(statistics.st_mode), f_file_type_name_block_s, kt_remove_main_flag_block_d, kt_remove_main_flag_block_ignore_d, &flag_out);
+    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_d, path, macro_f_file_type_is_block(statistics.st_mode), f_file_type_name_block_s, kt_remove_main_flag_block_d, kt_remove_main_flag_block_ignore_d, &flag_out);
 
-    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_d | simulate, path, macro_f_file_type_is_character(statistics.st_mode), f_file_type_name_character_s, kt_remove_main_flag_character_d, kt_remove_main_flag_character_ignore_d, &flag_out);
+    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_d, path, macro_f_file_type_is_character(statistics.st_mode), f_file_type_name_character_s, kt_remove_main_flag_character_d, kt_remove_main_flag_character_ignore_d, &flag_out);
 
-    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_d | simulate, path, macro_f_file_type_is_directory(statistics.st_mode), f_file_type_name_directory_s, kt_remove_main_flag_directory_d, kt_remove_main_flag_directory_ignore_d, &flag_out);
+    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_d, path, macro_f_file_type_is_directory(statistics.st_mode), f_file_type_name_directory_s, kt_remove_main_flag_directory_d, kt_remove_main_flag_directory_ignore_d, &flag_out);
 
-    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_d | simulate, path, macro_f_file_type_is_fifo(statistics.st_mode), f_file_type_name_fifo_s, kt_remove_main_flag_fifo_d, kt_remove_main_flag_fifo_ignore_d, &flag_out);
+    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_d, path, macro_f_file_type_is_fifo(statistics.st_mode), f_file_type_name_fifo_s, kt_remove_main_flag_fifo_d, kt_remove_main_flag_fifo_ignore_d, &flag_out);
 
-    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_d | simulate, path, macro_f_file_type_is_link(statistics.st_mode), f_file_type_name_link_s, kt_remove_main_flag_link_d, kt_remove_main_flag_link_ignore_d, &flag_out);
+    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_d, path, macro_f_file_type_is_link(statistics.st_mode), f_file_type_name_link_s, kt_remove_main_flag_link_d, kt_remove_main_flag_link_ignore_d, &flag_out);
 
-    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_file_d | simulate, path, macro_f_file_type_is_regular(statistics.st_mode), f_file_type_name_regular_s, kt_remove_main_flag_regular_d, kt_remove_main_flag_regular_ignore_d, &flag_out);
+    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_file_d, path, macro_f_file_type_is_regular(statistics.st_mode), f_file_type_name_regular_s, kt_remove_main_flag_regular_d, kt_remove_main_flag_regular_ignore_d, &flag_out);
 
-    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_d | simulate, path, macro_f_file_type_is_socket(statistics.st_mode), f_file_type_name_socket_s, kt_remove_main_flag_socket_d, kt_remove_main_flag_socket_ignore_d, &flag_out);
+    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_is_a_d, path, macro_f_file_type_is_socket(statistics.st_mode), f_file_type_name_socket_s, kt_remove_main_flag_socket_d, kt_remove_main_flag_socket_ignore_d, &flag_out);
 
-    kt_remove_preprocess_file_type(main, simulate, path, macro_f_file_type_is_unknown(statistics.st_mode), f_file_type_name_unknown_s, kt_remove_main_flag_unknown_d, kt_remove_main_flag_unknown_ignore_d, &flag_out);
+    kt_remove_preprocess_file_type(main, kt_remove_flag_simulate_none_d, path, macro_f_file_type_is_unknown(statistics.st_mode), f_file_type_name_unknown_s, kt_remove_main_flag_unknown_d, kt_remove_main_flag_unknown_ignore_d, &flag_out);
 
-    if (!simulate && (flag_out & kt_remove_flag_file_operate_remove_fail_d)) return flag_out;
+    if (!(main->setting.flag & kt_remove_main_flag_simulate_d) && (flag_out & kt_remove_flag_file_operate_remove_fail_d)) return flag_out;
 
     if (main->setting.flag & kt_remove_main_flag_user_d) {
       for (i = 0; i < main->setting.users.used; ++i) {
@@ -136,9 +131,7 @@ extern "C" {
         if (statistics.st_uid == (uid_t) main->setting.users.array[i]) break;
       } // for
 
-      if (simulate & ~0x10) {
-        kt_remove_print_simulate_operate_id(&main->program.output, simulate, (f_number_unsigned_t) statistics.st_uid, F_true);
-      }
+      kt_remove_print_simulate_operate_id(&main->program.output, (f_number_unsigned_t) statistics.st_uid, F_true);
 
       if (i < main->setting.users.used) {
         flag_out |= kt_remove_flag_file_operate_remove_d;
@@ -146,7 +139,7 @@ extern "C" {
     }
 
     if (main->setting.flag & kt_remove_main_flag_same_d) {
-      kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, kt_remove_same_s, statistics.st_uid == geteuid());
+      kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_same_s, statistics.st_uid == geteuid());
 
       if (statistics.st_uid == geteuid()) {
         flag_out |= kt_remove_flag_file_operate_remove_d;
@@ -154,7 +147,7 @@ extern "C" {
     }
 
     if (main->setting.flag & kt_remove_main_flag_different_d) {
-      kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, kt_remove_different_s, statistics.st_uid != geteuid());
+      kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_different_s, statistics.st_uid != geteuid());
 
       if (statistics.st_uid != geteuid()) {
         flag_out |= kt_remove_flag_file_operate_remove_d;
@@ -168,7 +161,7 @@ extern "C" {
         if (statistics.st_gid == (gid_t) main->setting.groups.array[i]) break;
       } // for
 
-      kt_remove_print_simulate_operate_id(&main->program.output, simulate, (f_number_unsigned_t) statistics.st_gid, F_false);
+      kt_remove_print_simulate_operate_id(&main->program.output, (f_number_unsigned_t) statistics.st_gid, F_false);
 
       if (i < main->setting.groups.used) {
         flag_out |= kt_remove_flag_file_operate_remove_d;
@@ -192,7 +185,7 @@ extern "C" {
         kt_remove_flag_mode_not_d,
       };
 
-      kt_remove_print_simulate_operate_mode(&main->program.output, simulate, (f_number_unsigned_t) mode, f_string_empty_s);
+      kt_remove_print_simulate_operate_mode(&main->program.output, (f_number_unsigned_t) mode, f_string_empty_s);
 
       for (i = 0; i < main->setting.modes.used; ++i) {
 
@@ -216,7 +209,7 @@ extern "C" {
         for (uint8_t j = 0; j < 4; ++j) {
 
           if (main->setting.modes.array[i].type == types[j]) {
-            kt_remove_print_simulate_operate_mode(&main->program.output, simulate, (f_number_unsigned_t) main->setting.modes.array[i].mode, modes[j]);
+            kt_remove_print_simulate_operate_mode(&main->program.output, (f_number_unsigned_t) main->setting.modes.array[i].mode, modes[j]);
 
             break;
           }
@@ -227,7 +220,7 @@ extern "C" {
     }
 
     if (main->setting.flag & kt_remove_main_flag_accessed_changed_updated_d) {
-      kt_remove_preprocess_file_dates(main, simulate, path, flag_operate, statistics);
+      kt_remove_preprocess_file_dates(main, path, flag_operate, statistics);
       if (F_status_is_error(main->setting.state.status)) return flag_out;
 
       if (main->setting.state.status == F_yes) {
@@ -240,65 +233,67 @@ extern "C" {
       if (F_status_is_error(main->setting.state.status)) return flag_out;
 
       if (main->setting.state.status == F_true || main->setting.state.status == F_false) {
-        kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, kt_remove_empty_s, main->setting.state.status);
+        kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_empty_s, main->setting.state.status);
 
         if (main->setting.state.status == F_true) {
           flag_out |= kt_remove_flag_file_operate_empty_d;
         }
 
-        if (main->setting.flag & kt_remove_main_flag_empty_all_d) {
-          if (main->setting.state.status == F_true) {
-            if (main->setting.flag & kt_remove_main_flag_empty_not_fail_d) {
-              kt_remove_print_error_file_is_a(&main->program.error, path, kt_remove_empty_s, 0);
+        if (!(flag_out & kt_remove_flag_file_operate_remove_not_d)) {
+          if (main->setting.flag & kt_remove_main_flag_empty_all_d) {
+            if (main->setting.state.status == F_true) {
+              if (main->setting.flag & kt_remove_main_flag_empty_not_fail_d) {
+                kt_remove_print_error_file_is_a(&main->program.error, path, kt_remove_empty_s, 0);
 
-              flag_out |= kt_remove_flag_file_operate_remove_fail_d;
+                flag_out |= kt_remove_flag_file_operate_remove_fail_d;
+              }
+              else if (main->setting.flag & kt_remove_main_flag_empty_not_d) {
+                flag_out |= kt_remove_flag_file_operate_remove_not_d;
+              }
             }
-            else if (main->setting.flag & kt_remove_main_flag_empty_not_d) {
-              flag_out |= kt_remove_flag_file_operate_remove_not_d;
+            else if (main->setting.state.status == F_false) {
+              if (main->setting.flag & kt_remove_main_flag_empty_only_fail_d) {
+                kt_remove_print_error_file_is_a(&main->program.error, path, kt_remove_not_empty_s, 0);
+
+                flag_out |= kt_remove_flag_file_operate_remove_fail_d;
+              }
+              else if (main->setting.flag & kt_remove_main_flag_empty_only_d || !(main->setting.flag & (kt_remove_main_flag_empty_not_d | kt_remove_main_flag_recurse_d))) {
+                flag_out |= kt_remove_flag_file_operate_remove_not_d;
+              }
             }
           }
           else if (main->setting.state.status == F_false) {
-            if (main->setting.flag & kt_remove_main_flag_empty_only_fail_d) {
+            if (!(main->setting.flag & kt_remove_main_flag_recurse_d)) {
               kt_remove_print_error_file_is_a(&main->program.error, path, kt_remove_not_empty_s, 0);
 
               flag_out |= kt_remove_flag_file_operate_remove_fail_d;
             }
-            else if (main->setting.flag & kt_remove_main_flag_empty_only_d || !(main->setting.flag & (kt_remove_main_flag_empty_not_d | kt_remove_main_flag_recurse_d))) {
-              flag_out |= kt_remove_flag_file_operate_remove_not_d;
-            }
-          }
-        }
-        else if (main->setting.state.status == F_false) {
-          if (!(main->setting.flag & kt_remove_main_flag_recurse_d)) {
-            kt_remove_print_error_file_is_a(&main->program.error, path, kt_remove_not_empty_s, 0);
-
-            flag_out |= kt_remove_flag_file_operate_remove_fail_d;
           }
         }
       }
     }
 
     if (flag_out & kt_remove_flag_file_operate_directory_d) {
-      kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, kt_remove_recurse_s, (main->setting.flag & kt_remove_main_flag_recurse_d) && !(flag_operate & kt_remove_flag_file_operate_parent_d));
+      kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_recurse_s, (main->setting.flag & kt_remove_main_flag_recurse_d) && !(flag_operate & kt_remove_flag_file_operate_parent_d));
     }
 
     if (main->setting.flag & kt_remove_main_flag_tree_d) {
-      kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, kt_remove_parent_s, flag_operate & kt_remove_flag_file_operate_parent_d);
+      kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_parent_s, flag_operate & kt_remove_flag_file_operate_parent_d);
     }
 
     if (main->setting.flag & kt_remove_main_flag_prompt_all_d) {
       if (main->setting.flag & (kt_remove_main_flag_prompt_each_d | kt_remove_main_flag_prompt_never_d)) {
-        kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, kt_remove_prompt_s, main->setting.flag & kt_remove_main_flag_prompt_each_d);
+        kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_prompt_s, main->setting.flag & kt_remove_main_flag_prompt_each_d);
       }
       else if (main->setting.flag & kt_remove_main_flag_prompt_follow_d) {
-        kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, kt_remove_prompt_s, (main->setting.flag & kt_remove_main_flag_follow_d) && (flag_out & kt_remove_flag_file_operate_link_d));
+        kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_prompt_s, (main->setting.flag & kt_remove_main_flag_follow_d) && (flag_out & kt_remove_flag_file_operate_link_d));
       }
       else if (main->setting.flag & kt_remove_main_flag_prompt_once_d) {
-        kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, kt_remove_prompt_s, !(main->setting.prompt));
+        kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_prompt_s, !(main->setting.prompt));
       }
     }
 
-    kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, kt_remove_remove_s, kt_remove_operate_shall_remove(flag_out));
+    kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_remove_s, kt_remove_operate_shall_remove(flag_out));
 
     // Only apply tree operations on non-child paths when the tree flag is set.
     if ((main->setting.flag & kt_remove_main_flag_tree_d) && !(flag_operate & kt_remove_flag_file_operate_child_d) && !recurse) {
@@ -353,7 +348,7 @@ extern "C" {
 #endif // _di_kt_remove_preprocess_file_
 
 #ifndef _di_kt_remove_preprocess_file_dates_
-  void kt_remove_preprocess_file_dates(kt_remove_main_t * const main, const uint8_t simulate, const f_string_static_t path, const uint32_t flag_operate, const struct stat statistics) {
+  void kt_remove_preprocess_file_dates(kt_remove_main_t * const main, const f_string_static_t path, const uint32_t flag_operate, const struct stat statistics) {
 
     if (!main) return;
 
@@ -599,7 +594,7 @@ extern "C" {
         }
 
         if (name_type.used) {
-          kt_remove_print_simulate_operate_date(&main->program.output, simulate, names[i], result, times[i], dates[i]->array[j], name_type);
+          kt_remove_print_simulate_operate_date(&main->program.output, names[i], result, times[i], dates[i]->array[j], name_type);
 
           break;
         }
@@ -611,9 +606,9 @@ extern "C" {
 #endif // _di_kt_remove_preprocess_file_dates_
 
 #ifndef _di_kt_remove_preprocess_file_type_
-  void kt_remove_preprocess_file_type(kt_remove_main_t * const main, const uint8_t simulate, const f_string_static_t path, const bool is, f_string_static_t name, const uint64_t type, const uint64_t ignore, uint32_t * const flag_out) {
+  void kt_remove_preprocess_file_type(kt_remove_main_t * const main, const uint8_t simulate, const f_string_static_t path, const uint8_t is, f_string_static_t name, const uint64_t type, const uint64_t ignore, uint32_t * const flag_out) {
 
-    if (!main || !flag_out) return;
+    if (!main) return;
 
     if (is) {
       if (main->setting.flag & type) {
@@ -627,7 +622,7 @@ extern "C" {
     }
 
     if (is || (main->setting.flag & type) && !(main->setting.flag & ignore)) {
-      kt_remove_print_simulate_operate_boolean(&main->program.output, simulate & ~kt_remove_flag_simulate_is_a_file_d, name, is);
+      kt_remove_print_simulate_operate_boolean(&main->program.output, name, is);
     }
   }
 #endif // _di_kt_remove_preprocess_file_type_
index d9947d61f476cfe59b7569f767daac1e8106540d..2cd6666330c39c93d17a707542a37cd5431d769d 100644 (file)
@@ -64,9 +64,6 @@ extern "C" {
  *     F_yes on date matched.
  *     F_no on no matches.
  *     F_parameter (with error bit) if a parameter is invalid.
- * @param simulate
- *   When non-zero, then this designates that the simulate printing should happen.
- *   When kt_remove_flag_simulate_directory_d, the printing is not performed.
  * @param path
  *   The path to the file to operate on.
  * @param flag_operate
@@ -75,7 +72,7 @@ extern "C" {
  *   The already loaded file statistics.
  */
 #ifndef _di_kt_remove_preprocess_file_dates_
-  extern void kt_remove_preprocess_file_dates(kt_remove_main_t * const main, const uint8_t simulate, const f_string_static_t path, const uint32_t flag_operate, const struct stat statistics);
+  extern void kt_remove_preprocess_file_dates(kt_remove_main_t * const main, const f_string_static_t path, const uint32_t flag_operate, const struct stat statistics);
 #endif // _di_kt_remove_preprocess_file_dates_
 
 /**
@@ -114,7 +111,7 @@ extern "C" {
  *   Must not be NULL.
  */
 #ifndef _di_kt_remove_preprocess_file_type_
-  extern void kt_remove_preprocess_file_type(kt_remove_main_t * const main, const uint8_t simulate, const f_string_static_t path, const bool is, f_string_static_t name, const uint64_t type, const uint64_t ignore, uint32_t * const flag_out);
+  extern void kt_remove_preprocess_file_type(kt_remove_main_t * const main, const uint8_t simulate, const f_string_static_t path, const uint8_t is, f_string_static_t name, const uint64_t type, const uint64_t ignore, uint32_t * const flag_out);
 #endif // _di_kt_remove_preprocess_file_type_
 
 #ifdef __cplusplus
index 94c57ed6f33dc553a86d7dfb2d5282e1236eb876..cdfe691595a4605fbe3d25d44af7bc59c509363d 100644 (file)
@@ -18,6 +18,20 @@ extern "C" {
   }
 #endif // _di_kt_remove_print_error_
 
+#ifndef _di_kt_remove_print_error_file_
+  f_status_t kt_remove_print_error_file(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) {
+
+    if (!print || !print->custom) return F_status_set_error(F_output_not);
+    if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+    if (F_status_set_fine(((kt_remove_main_t *) print->custom)->setting.state.status) != F_interrupt) {
+      fll_error_file_print(print, F_status_set_fine(((kt_remove_main_t *) print->custom)->setting.state.status), function, F_true, name, operation, type);
+    }
+
+    return F_okay;
+  }
+#endif // _di_kt_remove_print_error_file_
+
 #ifndef _di_kt_remove_print_error_file_is_a_
   f_status_t kt_remove_print_error_file_is_a(fl_print_t * const print, const f_string_static_t path, const f_string_static_t is, const uint8_t code) {
 
@@ -52,20 +66,6 @@ extern "C" {
   }
 #endif // _di_kt_remove_print_error_file_is_a_
 
-#ifndef _di_kt_remove_print_error_file_
-  f_status_t kt_remove_print_error_file(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type) {
-
-    if (!print || !print->custom) return F_status_set_error(F_output_not);
-    if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
-
-    if (F_status_set_fine(((kt_remove_main_t *) print->custom)->setting.state.status) != F_interrupt) {
-      fll_error_file_print(print, F_status_set_fine(((kt_remove_main_t *) print->custom)->setting.state.status), function, F_true, name, operation, type);
-    }
-
-    return F_okay;
-  }
-#endif // _di_kt_remove_print_error_file_
-
 #ifndef _di_kt_remove_print_error_file_status_
   f_status_t kt_remove_print_error_file_status(fl_print_t * const print, const f_string_t function, const f_string_static_t name, const f_string_static_t operation, const uint8_t type, const f_status_t status) {
 
@@ -81,7 +81,7 @@ extern "C" {
 #endif // _di_kt_remove_print_error_file_status_
 
 #ifndef _di_kt_remove_print_error_id_
-  f_status_t kt_remove_print_error_id(fl_print_t * const print, const f_string_t function, const f_string_static_t name_id, const bool is_user) {
+  f_status_t kt_remove_print_error_id(fl_print_t * const print, const f_string_t function, const f_string_static_t name_id, const uint8_t is_user) {
 
     if (!print || !print->custom) return F_status_set_error(F_output_not);
     if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
index c20e5ba06787cef2370a5557940b888b658e2f3d..7b8c84119d180049e6532d854d01e5e0cfcd19f6 100644 (file)
@@ -160,7 +160,7 @@ extern "C" {
  *   F_output_not (with error bit) if setting is NULL.
  */
 #ifndef _di_kt_remove_print_error_id_
-  extern f_status_t kt_remove_print_error_id(fl_print_t * const print, const f_string_t function, const f_string_static_t name_id, const bool is_user);
+  extern f_status_t kt_remove_print_error_id(fl_print_t * const print, const f_string_t function, const f_string_static_t name_id, const uint8_t is_user);
 #endif // _di_kt_remove_print_error_id_
 
 /**
index 7e9b89db24a8dbf10d3b9497421a42d28eba5a27..b53a6d97d47f675fa6905b4a8f6ddc689f4956c0 100644 (file)
@@ -51,10 +51,11 @@ extern "C" {
 
     f_print_dynamic_raw(f_string_eol_s, print->to);
 
-    fll_program_print_help_option_long(print, kt_remove_long_local_s, f_console_symbol_long_normal_s, "   Designate dates are in local time, unless time zone is specified.");
-    fll_program_print_help_option_long(print, kt_remove_long_remember_s, f_console_symbol_long_normal_s, "Remember paths of files already deleted so as to not potentially error out on already removed path.");
-    fll_program_print_help_option_long(print, kt_remove_long_unknown_s, f_console_symbol_long_normal_s, " Remove by file type of unknown.");
-    fll_program_print_help_option_long(print, kt_remove_long_utc_s, f_console_symbol_long_normal_s, "     Designate dates are in UTC, unless time zone is specified.");
+    fll_program_print_help_option_long(print, kt_remove_long_allow_root_s, f_console_symbol_long_normal_s, "Allow removal of the root directory '/'.");
+    fll_program_print_help_option_long(print, kt_remove_long_local_s, f_console_symbol_long_normal_s, "     Designate dates are in local time, unless time zone is specified.");
+    fll_program_print_help_option_long(print, kt_remove_long_remember_s, f_console_symbol_long_normal_s, "  Remember paths of files already deleted so as to not potentially error out on already removed path.");
+    fll_program_print_help_option_long(print, kt_remove_long_unknown_s, f_console_symbol_long_normal_s, "   Remove by file type of unknown.");
+    fll_program_print_help_option_long(print, kt_remove_long_utc_s, f_console_symbol_long_normal_s, "       Designate dates are in UTC, unless time zone is specified.");
 
     f_print_dynamic_raw(f_string_eol_s, print->to);
 
index 88889b90c1dea0cac4ff666ffaadd37610b1cb41..16b40ccaf2a19631afc724a6febc4302ea33b6f6 100644 (file)
@@ -21,6 +21,8 @@ extern "C" {
       fl_print_format("  %Q%r", print->to, main->setting.files.array[i], f_string_eol_s);
     } // for
 
+    f_print_dynamic(f_string_eol_s, print->to);
+
     f_file_stream_unlock(print->to);
 
     return F_okay;
@@ -28,10 +30,13 @@ extern "C" {
 #endif // _di_kt_remove_print_simulate_operate_
 
 #ifndef _di_kt_remove_print_simulate_operate_boolean_
-  f_status_t kt_remove_print_simulate_operate_boolean(fl_print_t * const print, const uint8_t simulate, const f_string_static_t name, const bool yes) {
+  f_status_t kt_remove_print_simulate_operate_boolean(fl_print_t * const print, const f_string_static_t name, const uint8_t yes) {
 
-    if (!print) return F_status_set_error(F_output_not);
-    if (!simulate || (simulate & kt_remove_flag_simulate_directory_d)) return F_output_not;
+    if (!print || !print->custom) return F_status_set_error(F_output_not);
+
+    kt_remove_main_t * const main = (kt_remove_main_t *) print->custom;
+
+    if (!(main->setting.flag & kt_remove_main_flag_simulate_d)) return F_output_not;
 
     fll_print_format("  %r %r%r", print->to, name, yes ? kt_remove_yes_s : kt_remove_no_s, f_string_eol_s);
 
@@ -40,10 +45,13 @@ extern "C" {
 #endif // _di_kt_remove_print_simulate_operate_boolean_
 
 #ifndef _di_kt_remove_print_simulate_operate_date_
-  f_status_t kt_remove_print_simulate_operate_date(fl_print_t * const print, const uint8_t simulate, const f_string_static_t name, const bool yes, const f_time_spec_t time, const kt_remove_date_t date, const f_string_static_t type) {
+  f_status_t kt_remove_print_simulate_operate_date(fl_print_t * const print, const f_string_static_t name, const uint8_t yes, const f_time_spec_t time, const kt_remove_date_t date, const f_string_static_t type) {
 
-    if (!print) return F_status_set_error(F_output_not);
-    if (!simulate || (simulate & kt_remove_flag_simulate_directory_d)) return F_output_not;
+    if (!print || !print->custom) return F_status_set_error(F_output_not);
+
+    kt_remove_main_t * const main = (kt_remove_main_t *) print->custom;
+
+    if (!(main->setting.flag & kt_remove_main_flag_simulate_d)) return F_output_not;
 
     const f_number_unsigned_t match_year = kt_remove_time_year_unix_epoch_d + (time.tv_sec / kt_remove_time_seconds_in_year_d);
     const f_number_unsigned_t match_second = time.tv_sec % kt_remove_time_seconds_in_year_d;
@@ -64,10 +72,9 @@ extern "C" {
 #endif // _di_kt_remove_print_simulate_operate_date_
 
 #ifndef _di_kt_remove_print_simulate_operate_file_
-  f_status_t kt_remove_print_simulate_operate_file(fl_print_t * const print, const uint8_t simulate, const f_string_static_t path, const uint32_t flag) {
+  f_status_t kt_remove_print_simulate_operate_file(fl_print_t * const print, const f_string_static_t path, const uint32_t flag) {
 
     if (!print || !print->custom) return F_status_set_error(F_output_not);
-    if (!simulate || (simulate & kt_remove_flag_simulate_directory_d)) return F_output_not;
 
     kt_remove_main_t * const main = (kt_remove_main_t *) print->custom;
 
@@ -90,10 +97,9 @@ extern "C" {
 #endif // _di_kt_remove_print_simulate_operate_file_
 
 #ifndef _di_kt_remove_print_simulate_operate_file_exists_
-  f_status_t kt_remove_print_simulate_operate_file_exists(fl_print_t * const print, const uint8_t simulate, const f_string_static_t path, const uint32_t flag, const f_status_t exists) {
+  f_status_t kt_remove_print_simulate_operate_file_exists(fl_print_t * const print, const f_string_static_t path, const uint32_t flag, const f_status_t exists) {
 
     if (!print || !print->custom) return F_status_set_error(F_output_not);
-    if (!simulate || (simulate & kt_remove_flag_simulate_directory_d)) return F_output_not;
 
     kt_remove_main_t * const main = (kt_remove_main_t *) print->custom;
 
@@ -131,10 +137,9 @@ extern "C" {
 #endif // _di_kt_remove_print_simulate_operate_file_exists_
 
 #ifndef _di_kt_remove_print_simulate_operate_id_
-  f_status_t kt_remove_print_simulate_operate_id(fl_print_t * const print, const uint8_t simulate, const f_number_unsigned_t id, const bool is_user) {
+  f_status_t kt_remove_print_simulate_operate_id(fl_print_t * const print, const f_number_unsigned_t id, const uint8_t is_user) {
 
     if (!print) return F_status_set_error(F_output_not);
-    if (!simulate || (simulate & kt_remove_flag_simulate_directory_d)) return F_output_not;
 
     fll_print_format("  %r %un%r", print->to, is_user ? kt_remove_user_s : kt_remove_group_s, id, f_string_eol_s);
 
@@ -143,10 +148,9 @@ extern "C" {
 #endif // _di_kt_remove_print_simulate_operate_id_
 
 #ifndef _di_kt_remove_print_simulate_operate_mode_
-  f_status_t kt_remove_print_simulate_operate_mode(fl_print_t * const print, const uint8_t simulate, const f_number_unsigned_t mode, const f_string_static_t match) {
+  f_status_t kt_remove_print_simulate_operate_mode(fl_print_t * const print, const f_number_unsigned_t mode, const f_string_static_t match) {
 
     if (!print) return F_status_set_error(F_output_not);
-    if (!simulate || (simulate & kt_remove_flag_simulate_directory_d)) return F_output_not;
 
     if (match.used) {
       fll_print_format("  mode_matched %Q %@03un%r", print->to, match, mode, f_string_eol_s);
index 9ec1fcf92b1f6380136c482e779b271aef9d4d61..f31235e12e223b4bd86a52889d635bf40a84427b 100644 (file)
@@ -53,9 +53,6 @@ extern "C" {
  *   Must not be NULL.
  *
  *   This does not alter print.custom.setting.state.status.
- * @param simulate
- *   When non-zero, then this designates that the simulate printing should happen.
- *   When kt_remove_flag_simulate_directory_d, the printing is not performed.
  * @param name
  *   The name to be associated with the boolean value.
  * @param yes
@@ -69,7 +66,7 @@ extern "C" {
  *   F_output_not (with error bit) if setting is NULL.
  */
 #ifndef _di_kt_remove_print_simulate_operate_boolean_
-  extern f_status_t kt_remove_print_simulate_operate_boolean(fl_print_t * const print, const uint8_t simulate, const f_string_static_t name, const bool yes);
+  extern f_status_t kt_remove_print_simulate_operate_boolean(fl_print_t * const print, const f_string_static_t name, const uint8_t yes);
 #endif // _di_kt_remove_print_simulate_operate_boolean_
 
 /**
@@ -85,9 +82,6 @@ extern "C" {
  *   Must not be NULL.
  *
  *   This does not alter print.custom.setting.state.status.
- * @param simulate
- *   When non-zero, then this designates that the simulate printing should happen.
- *   When kt_remove_flag_simulate_directory_d, the printing is not performed.
  * @param name
  *   The name to be associated with the boolean value.
  * @param yes
@@ -107,7 +101,7 @@ extern "C" {
  *   F_output_not (with error bit) if setting is NULL.
  */
 #ifndef _di_kt_remove_print_simulate_operate_date_
-  extern f_status_t kt_remove_print_simulate_operate_date(fl_print_t * const print, const uint8_t simulate, const f_string_static_t name, const bool yes, const f_time_spec_t time, const kt_remove_date_t date, const f_string_static_t type);
+  extern f_status_t kt_remove_print_simulate_operate_date(fl_print_t * const print, const f_string_static_t name, const uint8_t yes, const f_time_spec_t time, const kt_remove_date_t date, const f_string_static_t type);
 #endif // _di_kt_remove_print_simulate_operate_date_
 
 /**
@@ -123,9 +117,6 @@ extern "C" {
  *   Must not be NULL.
  *
  *   This does not alter print.custom.setting.state.status.
- * @param simulate
- *   When non-zero, then this designates that the simulate printing should happen.
- *   When kt_remove_flag_simulate_directory_d, the printing is not performed.
  * @param path
  *   The path to the file to operate on.
  * @param flag
@@ -139,7 +130,7 @@ extern "C" {
  *   F_output_not (with error bit) if setting is NULL.
  */
 #ifndef _di_kt_remove_print_simulate_operate_file_
-  extern f_status_t kt_remove_print_simulate_operate_file(fl_print_t * const print, const uint8_t simulate, const f_string_static_t path, const uint32_t flag);
+  extern f_status_t kt_remove_print_simulate_operate_file(fl_print_t * const print, const f_string_static_t path, const uint32_t flag);
 #endif // _di_kt_remove_print_simulate_operate_file_
 
 /**
@@ -155,9 +146,6 @@ extern "C" {
  *   Must not be NULL.
  *
  *   This does not alter print.custom.setting.state.status.
- * @param simulate
- *   When non-zero, then this designates that the simulate printing should happen.
- *   When kt_remove_flag_simulate_directory_d, the printing is not performed.
  * @param path
  *   The path to the file to operate on.
  * @param flag
@@ -174,7 +162,7 @@ extern "C" {
  *   F_output_not (with error bit) if setting is NULL.
  */
 #ifndef _di_kt_remove_print_simulate_operate_file_exists_
-  extern f_status_t kt_remove_print_simulate_operate_file_exists(fl_print_t * const print, const uint8_t simulate, const f_string_static_t path, const uint32_t flag, const f_status_t exists);
+  extern f_status_t kt_remove_print_simulate_operate_file_exists(fl_print_t * const print, const f_string_static_t path, const uint32_t flag, const f_status_t exists);
 #endif // _di_kt_remove_print_simulate_operate_file_exists_
 
 /**
@@ -190,9 +178,6 @@ extern "C" {
  *   Must not be NULL.
  *
  *   This does not alter print.custom.setting.state.status.
- * @param simulate
- *   When non-zero, then this designates that the simulate printing should happen.
- *   When kt_remove_flag_simulate_directory_d, the printing is not performed.
  * @param id
  *   The user or group ID.
  * @param is_user
@@ -206,7 +191,7 @@ extern "C" {
  *   F_output_not (with error bit) if setting is NULL.
  */
 #ifndef _di_kt_remove_print_simulate_operate_id_
-  extern f_status_t kt_remove_print_simulate_operate_id(fl_print_t * const print, const uint8_t simulate, const f_number_unsigned_t id, const bool is_user);
+  extern f_status_t kt_remove_print_simulate_operate_id(fl_print_t * const print, const f_number_unsigned_t id, const uint8_t is_user);
 #endif // _di_kt_remove_print_simulate_operate_id_
 
 /**
@@ -222,9 +207,6 @@ extern "C" {
  *   Must not be NULL.
  *
  *   This does not alter print.custom.setting.state.status.
- * @param simulate
- *   When non-zero, then this designates that the simulate printing should happen.
- *   When kt_remove_flag_simulate_directory_d, the printing is not performed.
  * @param mode
  *   The mode of the file.
  * @param match
@@ -238,7 +220,7 @@ extern "C" {
  *   F_output_not (with error bit) if setting is NULL.
  */
 #ifndef _di_kt_remove_print_simulate_operate_mode_
-  extern f_status_t kt_remove_print_simulate_operate_mode(fl_print_t * const print, const uint8_t simulate, const f_number_unsigned_t mode, const f_string_static_t match);
+  extern f_status_t kt_remove_print_simulate_operate_mode(fl_print_t * const print, const f_number_unsigned_t mode, const f_string_static_t match);
 #endif // _di_kt_remove_print_simulate_operate_mode_
 
 #ifdef __cplusplus
index eb8a6699f08fcacdf18fc37a783f007db7795e7c..4afbef63c840555e40aaa1ebbc5a8db1340c90a4 100644 (file)
@@ -33,27 +33,29 @@ extern "C" {
     kt_remove_rm_parameter_preserve_root_not_e,
     kt_remove_rm_parameter_verbose_alt_e,
     kt_remove_rm_parameter_version_alt_e,
+    kt_remove_rm_parameter_stop_e,
   }; // enum
 
   #define kt_remove_rm_console_parameter_t_initialize \
     { \
       macro_fll_program_console_parameter_standard_initialize, \
       \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_directory_s,        kt_remove_rm_long_directory_s,         0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(                                    kt_remove_rm_short_each_s,             0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_force_s,            kt_remove_long_force_s,                0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(                                    kt_remove_rm_short_once_s,             0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_5(                                    kt_remove_rm_long_one_filesystem_s,    0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_recurse_s,          kt_remove_long_recurse_s,              0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_4(                                    kt_remove_rm_short_recursive_s,        0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_simulate_s,         kt_remove_long_simulate_s,             0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_5(                                    kt_remove_rm_long_preserve_root_s,     0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_5(                                    kt_remove_rm_long_preserve_root_not_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_rm_short_verbose_s,       kt_remove_rm_long_verbose_s,           0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_5(                                    f_console_standard_long_version_s,     0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_directory_s,  kt_remove_rm_long_directory_s,         0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_4(                              kt_remove_rm_short_each_s,             0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_force_s,      kt_remove_long_force_s,                0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_4(                              kt_remove_rm_short_once_s,             0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_5(                              kt_remove_rm_long_one_filesystem_s,    0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_recurse_s,    kt_remove_long_recurse_s,              0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_4(                              kt_remove_rm_short_recursive_s,        0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_simulate_s,   kt_remove_long_simulate_s,             0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_5(                              kt_remove_rm_long_preserve_root_s,     0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_5(                              kt_remove_rm_long_preserve_root_not_s, 0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_rm_short_verbose_s, kt_remove_rm_long_verbose_s,           0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_5(                              f_console_standard_long_version_s,     0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_7(                                                                     0, f_console_flag_normal_d | f_console_flag_empty_long_d | f_console_flag_stop_d), \
     }
 
-  #define kt_remove_rm_total_parameters_d (f_console_parameter_state_type_total_d + 12)
+  #define kt_remove_rm_total_parameters_d (f_console_parameter_state_type_total_d + 13)
 #endif // _di_kt_remove_rm_parameter_e_
 
 #ifdef __cplusplus
index f1f890957106160450cc2e742f5a4571f5849c84..1e58e2ea9e7cfe5105e78694e8532a2bad6a6de8 100644 (file)
@@ -11,6 +11,7 @@ extern "C" {
 
     f_number_unsigned_t argc = 0;
 
+    /*
     // Pre-process the parameters to find any "--" such that everything after the "--" represents a literal file name.
     if (arguments.argv) {
       for (argc = 1; argc < arguments.argc; ++argc) {
@@ -25,27 +26,29 @@ extern "C" {
     }
     else {
       kt_remove_setting_load_standard(arguments, main);
-    }
+    }*/
+
+    kt_remove_setting_load_standard(arguments, main);
 
     if (F_status_is_error(main->setting.state.status)) return;
 
-    if (main->program.parameters.array[kt_remove_rm_parameter_directory_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rm_parameter_directory_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_directory_d | kt_remove_main_flag_empty_only_fail_d;
     }
 
-    if (main->program.parameters.array[kt_remove_rm_parameter_each_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rm_parameter_each_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_prompt_each_d;
     }
 
-    if (main->program.parameters.array[kt_remove_rm_parameter_force_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rm_parameter_force_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_force_d;
     }
 
-    if (main->program.parameters.array[kt_remove_rm_parameter_once_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rm_parameter_once_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_prompt_once_d;
     }
 
-    if (main->program.parameters.array[kt_remove_rm_parameter_one_filesystem_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rm_parameter_one_filesystem_e].result & f_console_result_found_d) {
       main->setting.state.status = F_status_set_error(F_support_not);
 
       fll_program_print_error_parameter_support_not(&main->program.error, f_console_symbol_long_normal_s, kt_remove_rm_long_one_filesystem_s);
@@ -53,27 +56,26 @@ extern "C" {
       return;
     }
 
-    if ((main->program.parameters.array[kt_remove_rm_parameter_recursive_e].result & f_console_result_found_e) || (main->program.parameters.array[kt_remove_rm_parameter_recursive_alt_e].result & f_console_result_found_e)) {
+    if ((main->program.parameters.array[kt_remove_rm_parameter_recursive_e].result & f_console_result_found_d) || (main->program.parameters.array[kt_remove_rm_parameter_recursive_alt_e].result & f_console_result_found_d)) {
       main->setting.flag |= kt_remove_main_flag_recurse_d | kt_remove_main_flag_directory_d;
 
       // Must not have the empty flags set while recursive.
       main->setting.flag &= ~kt_remove_main_flag_empty_all_d;
     }
 
-    // @todo the kt_remove_main_flag_root_d needs to be implemented in the base remove project.
-    if (main->program.parameters.array[kt_remove_rm_parameter_preserve_root_e].result & f_console_result_found_e) {
-      main->setting.flag &= ~kt_remove_main_flag_root_d; // @todo check if this or preserve_root_not is farther to the right.
+    if (main->program.parameters.array[kt_remove_rm_parameter_preserve_root_e].result & f_console_result_found_d) {
+      main->setting.flag &= ~kt_remove_main_flag_root_d;
     }
 
-    if (main->program.parameters.array[kt_remove_rm_parameter_preserve_root_not_e].result & f_console_result_found_e) {
-      main->setting.flag |= kt_remove_main_flag_root_d; // @todo check if this or preserve_root is farther to the right.
+    if (main->program.parameters.array[kt_remove_rm_parameter_preserve_root_not_e].result & f_console_result_found_d) {
+      main->setting.flag |= kt_remove_main_flag_root_d;
     }
 
-    if (main->program.parameters.array[kt_remove_rm_parameter_simulate_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rm_parameter_simulate_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_simulate_d;
     }
 
-    if (main->program.parameters.array[kt_remove_rm_parameter_verbose_alt_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rm_parameter_verbose_alt_e].result & f_console_result_found_d) {
       main->program.warning.verbosity
         = main->program.error.verbosity
         = main->program.output.verbosity
@@ -81,7 +83,7 @@ extern "C" {
           = f_console_verbosity_verbose_e;
     }
 
-    if (main->program.parameters.array[kt_remove_rm_parameter_version_alt_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rm_parameter_version_alt_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_version_d;
     }
 
@@ -129,6 +131,7 @@ extern "C" {
             continue;
           }
 
+          // This is the default and "=all" is not supported, so ignore this parameter.
           if (f_compare_dynamic(kt_remove_rm_static_preserve_root_all_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
             main->setting.state.status = F_status_set_error(F_support_not);
 
@@ -137,7 +140,6 @@ extern "C" {
             return;
           }
 
-          // This is the default and "=all" is not supported, so ignore this parameter.
           if (f_compare_dynamic(kt_remove_rm_static_preserve_root_slash_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
             continue;
           }
@@ -155,24 +157,6 @@ extern "C" {
           ++main->setting.files.used;
         } // for
       }
-
-      if (argc < arguments.argc) {
-        f_string_static_t args = f_string_static_t_initialize;
-
-        for (++argc; argc < arguments.argc; ++argc, ++main->setting.files.used) {
-
-          args.string = arguments.argv[argc];
-          args.used = strnlen(arguments.argv[argc], F_console_parameter_size_d);
-
-          fl_path_clean(args, &main->setting.files.array[main->setting.files.used]);
-
-          if (F_status_is_error(main->setting.state.status)) {
-            kt_remove_print_error_file(&main->program.error, macro_kt_remove_f(fl_path_clean), args, f_file_operation_process_s, fll_error_file_type_path_e);
-
-            return;
-          }
-        } // for
-      }
     }
 
     // Make sure all non-directory files are deleted.
index 393f939d54809e01895fbcd54ba82bc929cd4b54..a4aedb55eff9b6b443068d953d58e51e5b89b6c2 100644 (file)
@@ -32,11 +32,11 @@ extern "C" {
     { \
       macro_fll_program_console_parameter_standard_initialize, \
       \
-      macro_f_console_parameter_t_initialize_5(                                    kt_remove_rmdir_long_ignore_empty_not_s, 0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_rmdir_short_parents_s,    kt_remove_rmdir_long_parents_s,          0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_simulate_s,         kt_remove_long_simulate_s,               0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s,       0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_5(                                    f_console_standard_long_version_s,       0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_5(                                    kt_remove_rmdir_long_ignore_empty_not_s, 0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_rmdir_short_parents_s,    kt_remove_rmdir_long_parents_s,          0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_simulate_s,         kt_remove_long_simulate_s,               0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s,       0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_5(                                    f_console_standard_long_version_s,       0, f_console_flag_normal_d), \
     }
 
   #define kt_remove_rmdir_total_parameters_d (f_console_parameter_state_type_total_d + 5)
index e4fc58ace999ebb0d56e9a0a176b135816625f4b..4e2930b1916762553ca7d449ea7d6c5b90580054 100644 (file)
@@ -12,19 +12,19 @@ extern "C" {
     kt_remove_setting_load_standard(arguments, main);
     if (F_status_is_error(main->setting.state.status)) return;
 
-    if (main->program.parameters.array[kt_remove_rmdir_parameter_ignore_empty_not_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rmdir_parameter_ignore_empty_not_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_empty_only_d;
     }
 
-    if (main->program.parameters.array[kt_remove_rmdir_parameter_parents_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rmdir_parameter_parents_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_tree_d;
     }
 
-    if (main->program.parameters.array[kt_remove_rmdir_parameter_simulate_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rmdir_parameter_simulate_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_simulate_d;
     }
 
-    if (main->program.parameters.array[kt_remove_rmdir_parameter_verbose_alt_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rmdir_parameter_verbose_alt_e].result & f_console_result_found_d) {
       main->program.warning.verbosity
         = main->program.error.verbosity
         = main->program.output.verbosity
@@ -32,37 +32,11 @@ extern "C" {
           = f_console_verbosity_verbose_e;
     }
 
-    if (main->program.parameters.array[kt_remove_rmdir_parameter_version_alt_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_rmdir_parameter_version_alt_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_version_d;
     }
 
-    // Load all remaining files as static strings (setting size to 0).
-    if (main->program.parameters.remaining.used) {
-      main->setting.state.status = f_memory_array_increase_by(main->program.parameters.remaining.used, sizeof(f_string_dynamic_t), (void **) &main->setting.files.array, &main->setting.files.used, &main->setting.files.size);
-
-      if (F_status_is_error(main->setting.state.status)) {
-        kt_remove_print_error(&main->program.error, macro_kt_remove_f(f_memory_array_increase_by));
-
-        return;
-      }
-
-      f_number_unsigned_t index = 0;
-
-      for (f_number_unsigned_t i = 0; i < main->program.parameters.remaining.used; ++i, ++main->setting.files.used) {
-
-        index = main->program.parameters.remaining.array[i];
-
-        main->setting.files.array[main->setting.files.used].used = 0;
-
-        fl_path_clean(main->program.parameters.arguments.array[index], &main->setting.files.array[main->setting.files.used]);
-
-        if (F_status_is_error(main->setting.state.status)) {
-          kt_remove_print_error_file(&main->program.error, macro_kt_remove_f(fl_path_clean), main->program.parameters.arguments.array[index], f_file_operation_process_s, fll_error_file_type_path_e);
-
-          return;
-        }
-      } // for
-    }
+    kt_remove_setting_load_remaining(arguments, main);
 
     // Make sure only directoreis are deleted.
     main->setting.flag |= kt_remove_main_flag_directory_d | kt_remove_main_flag_option_type_d | kt_remove_main_flag_option_used_d;
index 2fafd1f310c237d86d73a2603666d7e1d704b049..f6a79b714dc8ddcf0ca8600f69bdfb5dc6126f3f 100644 (file)
@@ -29,8 +29,8 @@ extern "C" {
     { \
       macro_fll_program_console_parameter_standard_initialize, \
       \
-      macro_f_console_parameter_t_initialize_3(kt_remove_short_simulate_s, kt_remove_long_simulate_s,         0, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_5(                            f_console_standard_long_version_s, 0, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(kt_remove_short_simulate_s, kt_remove_long_simulate_s,         0, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_5(                            f_console_standard_long_version_s, 0, f_console_flag_normal_d), \
     }
 
   #define kt_remove_unlink_total_parameters_d (f_console_parameter_state_type_total_d + 1)
index 05765c63c72661e3ec09217e974fde94854b26b0..d848b69adeae78450245fb799ffd4939b818e866 100644 (file)
@@ -12,37 +12,11 @@ extern "C" {
     kt_remove_setting_load_standard(arguments, main);
     if (F_status_is_error(main->setting.state.status)) return;
 
-    if (main->program.parameters.array[kt_remove_unlink_parameter_simulate_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_remove_unlink_parameter_simulate_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_remove_main_flag_simulate_d;
     }
 
-    // Load all remaining files as static strings (setting size to 0).
-    if (main->program.parameters.remaining.used) {
-      main->setting.state.status = f_memory_array_increase_by(main->program.parameters.remaining.used, sizeof(f_string_dynamic_t), (void **) &main->setting.files.array, &main->setting.files.used, &main->setting.files.size);
-
-      if (F_status_is_error(main->setting.state.status)) {
-        kt_remove_print_error(&main->program.error, macro_kt_remove_f(f_memory_array_increase_by));
-
-        return;
-      }
-
-      f_number_unsigned_t index = 0;
-
-      for (f_number_unsigned_t i = 0; i < main->program.parameters.remaining.used; ++i, ++main->setting.files.used) {
-
-        index = main->program.parameters.remaining.array[i];
-
-        main->setting.files.array[main->setting.files.used].used = 0;
-
-        fl_path_clean(main->program.parameters.arguments.array[index], &main->setting.files.array[main->setting.files.used]);
-
-        if (F_status_is_error(main->setting.state.status)) {
-          kt_remove_print_error_file(&main->program.error, macro_kt_remove_f(fl_path_clean), main->program.parameters.arguments.array[index], f_file_operation_process_s, fll_error_file_type_path_e);
-
-          return;
-        }
-      } // for
-    }
+    kt_remove_setting_load_remaining(arguments, main);
 
     // Make sure only links are deleted.
     main->setting.flag |= kt_remove_main_flag_link_d | kt_remove_main_flag_option_type_d | kt_remove_main_flag_option_used_d;
index 0eb975a60e8208372d8deed179087731634737da..af50bb51a01ff31c91f467074e1381b0e505617b 100644 (file)
@@ -61,33 +61,33 @@ extern "C" {
 
     f_number_unsigned_t index = 0;
 
-    if (main->program.parameters.array[kt_tacocat_parameter_help_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_tacocat_parameter_help_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_tacocat_main_flag_help_d;
     }
     else {
       main->setting.flag &= ~kt_tacocat_main_flag_help_d;
     }
 
-    if (main->program.parameters.array[kt_tacocat_parameter_version_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_tacocat_parameter_version_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_tacocat_main_flag_version_d;
     }
     else {
       main->setting.flag &= ~kt_tacocat_main_flag_version_d;
     }
 
-    if (main->program.parameters.array[kt_tacocat_parameter_copyright_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_tacocat_parameter_copyright_e].result & f_console_result_found_d) {
       main->setting.flag |= kt_tacocat_main_flag_copyright_d;
     }
     else {
       main->setting.flag &= ~kt_tacocat_main_flag_copyright_d;
     }
 
-    if (main->program.parameters.array[kt_tacocat_parameter_resolve_e].result & f_console_result_found_e) {
+    if (main->program.parameters.array[kt_tacocat_parameter_resolve_e].result & f_console_result_found_d) {
       main->setting.state.status = F_status_set_error(F_parameter);
 
       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) {
+    else if (main->program.parameters.array[kt_tacocat_parameter_resolve_e].result & f_console_result_value_d) {
       index = main->program.parameters.array[kt_tacocat_parameter_resolve_e].values.array[main->program.parameters.array[kt_tacocat_parameter_resolve_e].values.used - 1];
 
       if (f_compare_dynamic(main->program.parameters.arguments.array[index], kt_tacocat_classic_s) == F_equal_to) {
@@ -114,7 +114,7 @@ extern "C" {
       #endif // _kt_resolve_default_kevux_
     }
 
-    if (main->program.parameters.array[kt_tacocat_parameter_interval_e].result & f_console_result_value_e) {
+    if (main->program.parameters.array[kt_tacocat_parameter_interval_e].result & f_console_result_value_d) {
       index = main->program.parameters.array[kt_tacocat_parameter_interval_e].values.array[main->program.parameters.array[kt_tacocat_parameter_interval_e].values.used - 1];
 
       f_number_unsigned_t number = 0;
@@ -141,7 +141,7 @@ extern "C" {
         main->setting.interval_fast = number;
       }
     }
-    else if (main->program.parameters.array[kt_tacocat_parameter_interval_e].result & f_console_result_found_e) {
+    else if (main->program.parameters.array[kt_tacocat_parameter_interval_e].result & f_console_result_found_d) {
       main->setting.state.status = F_status_set_error(F_parameter);
 
       fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, kt_tacocat_long_interval_s);
@@ -149,7 +149,7 @@ extern "C" {
       return;
     }
 
-    if (main->program.parameters.array[kt_tacocat_parameter_max_buffer_e].result & f_console_result_value_e) {
+    if (main->program.parameters.array[kt_tacocat_parameter_max_buffer_e].result & f_console_result_value_d) {
       index = main->program.parameters.array[kt_tacocat_parameter_max_buffer_e].values.array[main->program.parameters.array[kt_tacocat_parameter_max_buffer_e].values.used - 1];
 
       f_number_unsigned_t number = 0;
@@ -186,7 +186,7 @@ extern "C" {
         main->setting.flag |= kt_tacocat_main_flag_max_buffer_d;
       }
     }
-    else if (main->program.parameters.array[kt_tacocat_parameter_max_buffer_e].result & f_console_result_found_e) {
+    else if (main->program.parameters.array[kt_tacocat_parameter_max_buffer_e].result & f_console_result_found_d) {
       main->setting.state.status = F_status_set_error(F_parameter);
 
       fll_program_print_error_parameter_missing_value(&main->program.error, f_console_symbol_long_normal_s, kt_tacocat_long_max_buffer_s);
@@ -235,7 +235,7 @@ extern "C" {
       &main->setting.send_polls,
     };
 
-    const bool is_receive[] = {
+    const uint8_t is_receive[] = {
       F_true,
       F_false,
     };
@@ -264,7 +264,7 @@ extern "C" {
 
     for (uint8_t i = 0; i < 2; ++i) {
 
-      if (main->program.parameters.array[parameters[i]].result & f_console_result_value_e) {
+      if (main->program.parameters.array[parameters[i]].result & f_console_result_value_d) {
         main->setting.flag |= flags[i];
 
         if (main->program.parameters.array[parameters[i]].values.used % 2) {
@@ -572,7 +572,7 @@ extern "C" {
           }
         } // for
       }
-      else if (main->program.parameters.array[parameters[i]].result & f_console_result_found_e) {
+      else if (main->program.parameters.array[parameters[i]].result & f_console_result_found_d) {
         main->setting.flag &= ~flags[i];
         main->setting.state.status = F_status_set_error(F_parameter);
 
index eecef5523fd76b85f5f661ae84d5dc664fc027bb..8723db34e333ea74606fb844644e73498916ba99 100644 (file)
@@ -44,11 +44,11 @@ extern "C" {
     { \
       macro_fll_program_console_parameter_standard_initialize, \
       \
-      macro_f_console_parameter_t_initialize_3(kt_tacocat_short_interval_s, kt_tacocat_long_interval_s, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_tacocat_short_max_buffer_s, kt_tacocat_long_max_buffer_s, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_tacocat_short_receive_s, kt_tacocat_long_receive_s, 2, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_tacocat_short_resolve_s, kt_tacocat_long_resolve_s, 1, f_console_flag_normal_e), \
-      macro_f_console_parameter_t_initialize_3(kt_tacocat_short_send_s, kt_tacocat_long_send_s, 2, f_console_flag_normal_e), \
+      macro_f_console_parameter_t_initialize_3(kt_tacocat_short_interval_s, kt_tacocat_long_interval_s, 1, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_tacocat_short_max_buffer_s, kt_tacocat_long_max_buffer_s, 1, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_tacocat_short_receive_s, kt_tacocat_long_receive_s, 2, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_tacocat_short_resolve_s, kt_tacocat_long_resolve_s, 1, f_console_flag_normal_d), \
+      macro_f_console_parameter_t_initialize_3(kt_tacocat_short_send_s, kt_tacocat_long_send_s, 2, f_console_flag_normal_d), \
     }
 
   #define kt_tacocat_parameter_total_d (f_console_parameter_state_type_total_d + 5)
index b41711dcd8303a4d3674d2c0df3debb683ed6d21..ce6f2bd05db97a28857af1ec2a8bee95b886eb56 100644 (file)
@@ -14,7 +14,7 @@ extern "C" {
     kt_tacocat_main_t * const main = (kt_tacocat_main_t *) void_main;
     f_number_unsigned_t i = 0;
     f_status_t ready = F_okay;
-    bool poll = F_false;
+    uint8_t poll = F_false;
 
     kt_tacocat_process_socket_set_send(main);
 
index b3cb053112d28fd8b72f04c4de0b85fee3899ee9..bc9b73b8fe844802641379abf7fe4d04343b6d0f 100644 (file)
@@ -35,15 +35,15 @@ f_status_t __wrap_f_directory_empty(const f_string_static_t path) {
   return mock_type(f_status_t);
 }
 
-f_status_t __wrap_f_directory_remove(const f_string_static_t path, const int depth_max, const bool preserve) {
+f_status_t __wrap_f_directory_remove(const f_string_static_t path, const int depth_max, const uint8_t preserve) {
   return mock_type(f_status_t);
 }
 
-f_status_t __wrap_f_file_exists(const f_string_static_t path, const bool dereference) {
+f_status_t __wrap_f_file_exists(const f_string_static_t path, const uint8_t dereference) {
   return mock_type(f_status_t);
 }
 
-f_status_t __wrap_f_file_is(const f_string_static_t path, const int type, const bool dereference) {
+f_status_t __wrap_f_file_is(const f_string_static_t path, const int type, const uint8_t dereference) {
   return mock_type(f_status_t);
 }
 
@@ -51,7 +51,7 @@ f_status_t __wrap_f_file_remove(const f_string_static_t path) {
   return mock_type(f_status_t);
 }
 
-f_status_t __wrap_f_file_stat(const f_string_static_t path, const bool dereference, struct stat * const stat_file) {
+f_status_t __wrap_f_file_stat(const f_string_static_t path, const uint8_t dereference, struct stat * const stat_file) {
 
   struct stat * const mocked_stat = mock_ptr_type(struct stat *);
 
index 2ee899a146866c46f6baae72bd8bc32d0f3ef7eb..5f555d43864a0d42ae6bd14fcd86b3bd8bce50ff 100644 (file)
@@ -42,12 +42,12 @@ extern f_status_t __wrap_f_account_group_id_by_name(const f_string_static_t name
 extern f_status_t __wrap_f_account_id_by_name(const f_string_static_t name, f_uid_t * const id);
 
 extern f_status_t __wrap_f_directory_empty(const f_string_static_t path);
-extern f_status_t __wrap_f_directory_remove(const f_string_static_t path, const int depth_max, const bool preserve);
+extern f_status_t __wrap_f_directory_remove(const f_string_static_t path, const int depth_max, const uint8_t preserve);
 
-extern f_status_t __wrap_f_file_exists(const f_string_static_t path, const bool dereference);
-extern f_status_t __wrap_f_file_is(const f_string_static_t path, const int type, const bool dereference);
+extern f_status_t __wrap_f_file_exists(const f_string_static_t path, const uint8_t dereference);
+extern f_status_t __wrap_f_file_is(const f_string_static_t path, const int type, const uint8_t dereference);
 extern f_status_t __wrap_f_file_remove(const f_string_static_t path);
-extern f_status_t __wrap_f_file_stat(const f_string_static_t path, const bool dereference, struct stat * const stat_file);
+extern f_status_t __wrap_f_file_stat(const f_string_static_t path, const uint8_t dereference, struct stat * const stat_file);
 
 extern f_status_t __wrap_f_time_clock_get(const clockid_t code, f_time_spec_t * const time);
 
index 9321cb47c09b6ebc76e9a4ec1cea605a41008bf0..0abadb1f2c64320b9181c251c91dfdd26471d50b 100644 (file)
@@ -91,7 +91,7 @@ void test__kt_remove__date_accessed__date_works(void **state) {
     macro_f_time_spec_t_initialize_1(1672429502, 0),
   };
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_false, // Equal
     F_false,
     F_false,
@@ -139,8 +139,17 @@ void test__kt_remove__date_accessed__date_works(void **state) {
 
           if (time_spec_removes[date]) {
             if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+              will_return(__wrap_f_file_stat, &stats[type]);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
@@ -239,7 +248,7 @@ void test__kt_remove__date_accessed__now_works(void **state) {
 
   const f_time_spec_t time_spec_clocks = macro_f_time_spec_t_initialize_1(2 * 86400, 123);
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_false,
     F_false,
@@ -293,8 +302,17 @@ void test__kt_remove__date_accessed__now_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
@@ -392,7 +410,7 @@ void test__kt_remove__date_accessed__today_works(void **state) {
 
   const f_time_spec_t time_spec_clocks = macro_f_time_spec_t_initialize_1(2 * 86400, 123);
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_true,
     F_false,
@@ -446,8 +464,17 @@ void test__kt_remove__date_accessed__today_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
@@ -545,7 +572,7 @@ void test__kt_remove__date_accessed__tomorrow_works(void **state) {
 
   const f_time_spec_t time_spec_clocks = macro_f_time_spec_t_initialize_1(2 * 86400, 123);
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_false, // Equal
     F_false,
     F_true,
@@ -599,8 +626,17 @@ void test__kt_remove__date_accessed__tomorrow_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
@@ -698,7 +734,7 @@ void test__kt_remove__date_accessed__yesterday_works(void **state) {
 
   const f_time_spec_t time_spec_clocks = macro_f_time_spec_t_initialize_1(2 * 86400, 345);
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_false, // Equal
     F_false,
     F_false,
@@ -752,8 +788,17 @@ void test__kt_remove__date_accessed__yesterday_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
index c3ebf0e6d1a56169e36df3de291297a526f917c3..59efe80810dfe9c0b96af28870bd1e2154ece033 100644 (file)
@@ -91,7 +91,7 @@ void test__kt_remove__date_changed__date_works(void **state) {
     macro_f_time_spec_t_initialize_1(1672429502, 0),
   };
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_false, // Equal
     F_false,
     F_false,
@@ -139,8 +139,17 @@ void test__kt_remove__date_changed__date_works(void **state) {
 
           if (time_spec_removes[date]) {
             if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+              will_return(__wrap_f_file_stat, &stats[type]);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
@@ -239,7 +248,7 @@ void test__kt_remove__date_changed__now_works(void **state) {
 
   const f_time_spec_t time_spec_clocks = macro_f_time_spec_t_initialize_1(2 * 86400, 123);
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_false,
     F_false,
@@ -293,8 +302,17 @@ void test__kt_remove__date_changed__now_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
@@ -392,7 +410,7 @@ void test__kt_remove__date_changed__today_works(void **state) {
 
   const f_time_spec_t time_spec_clocks = macro_f_time_spec_t_initialize_1(2 * 86400, 123);
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_true,
     F_false,
@@ -446,8 +464,17 @@ void test__kt_remove__date_changed__today_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
@@ -545,7 +572,7 @@ void test__kt_remove__date_changed__tomorrow_works(void **state) {
 
   const f_time_spec_t time_spec_clocks = macro_f_time_spec_t_initialize_1(2 * 86400, 123);
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_false, // Equal
     F_false,
     F_true,
@@ -599,8 +626,17 @@ void test__kt_remove__date_changed__tomorrow_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
@@ -698,7 +734,7 @@ void test__kt_remove__date_changed__yesterday_works(void **state) {
 
   const f_time_spec_t time_spec_clocks = macro_f_time_spec_t_initialize_1(2 * 86400, 345);
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_false, // Equal
     F_false,
     F_false,
@@ -752,8 +788,17 @@ void test__kt_remove__date_changed__yesterday_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
index e30749e0d8c2e66ab1235047ef9a4e741f35ddd6..faa76c8ff53beddc88cdcf3882937e225e344d13 100644 (file)
@@ -91,7 +91,7 @@ void test__kt_remove__date_updated__date_works(void **state) {
     macro_f_time_spec_t_initialize_1(1672429502, 0),
   };
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_false, // Equal
     F_false,
     F_false,
@@ -139,8 +139,17 @@ void test__kt_remove__date_updated__date_works(void **state) {
 
           if (time_spec_removes[date]) {
             if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+              will_return(__wrap_f_file_stat, &stats[type]);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
@@ -239,7 +248,7 @@ void test__kt_remove__date_updated__now_works(void **state) {
 
   const f_time_spec_t time_spec_clocks = macro_f_time_spec_t_initialize_1(2 * 86400, 123);
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_false,
     F_false,
@@ -293,8 +302,17 @@ void test__kt_remove__date_updated__now_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
@@ -392,7 +410,7 @@ void test__kt_remove__date_updated__today_works(void **state) {
 
   const f_time_spec_t time_spec_clocks = macro_f_time_spec_t_initialize_1(2 * 86400, 123);
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_true,
     F_false,
@@ -446,8 +464,17 @@ void test__kt_remove__date_updated__today_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
@@ -545,7 +572,7 @@ void test__kt_remove__date_updated__tomorrow_works(void **state) {
 
   const f_time_spec_t time_spec_clocks = macro_f_time_spec_t_initialize_1(2 * 86400, 123);
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_false, // Equal
     F_false,
     F_true,
@@ -599,8 +626,17 @@ void test__kt_remove__date_updated__tomorrow_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
@@ -698,7 +734,7 @@ void test__kt_remove__date_updated__yesterday_works(void **state) {
 
   const f_time_spec_t time_spec_clocks = macro_f_time_spec_t_initialize_1(2 * 86400, 345);
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_false, // Equal
     F_false,
     F_false,
@@ -752,8 +788,17 @@ void test__kt_remove__date_updated__yesterday_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
index 8ff25c4e2eec9834e57b2d996ec4be512111abc6..fe417c25dc6579b177eb1621b9722957a6fb2b11 100644 (file)
@@ -12,17 +12,17 @@ void test__kt_remove__directory_no_args__one_empty_exists_link(void **state) {
   mock_unwrap = 0;
   mock_unwrap_f_time_clock_get = 1;
 
-  const f_string_static_t file = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
+  const f_string_static_t target = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
 
   struct stat statistics;
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file.
+    // Pre-process target.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -30,8 +30,17 @@ void test__kt_remove__directory_no_args__one_empty_exists_link(void **state) {
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, macro_f_file_type_is_link(statistics.st_mode));
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -42,12 +51,12 @@ void test__kt_remove__directory_no_args__one_empty_exists_link(void **state) {
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, "+" F_console_standard_short_verbose_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, "+" F_console_standard_short_verbose_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file.
+    // Pre-process target.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -55,8 +64,17 @@ void test__kt_remove__directory_no_args__one_empty_exists_link(void **state) {
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, macro_f_file_type_is_link(statistics.st_mode));
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -67,12 +85,12 @@ void test__kt_remove__directory_no_args__one_empty_exists_link(void **state) {
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, "+" F_console_standard_short_debug_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, "+" F_console_standard_short_debug_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file.
+    // Pre-process target.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -80,8 +98,17 @@ void test__kt_remove__directory_no_args__one_empty_exists_link(void **state) {
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, macro_f_file_type_is_link(statistics.st_mode));
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -97,17 +124,17 @@ void test__kt_remove__directory_no_args__one_empty_exists_link_not(void **state)
   mock_unwrap = 0;
   mock_unwrap_f_time_clock_get = 1;
 
-  const f_string_static_t file = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
+  const f_string_static_t target = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
 
   struct stat statistics;
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file.
+    // Pre-process target.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -115,8 +142,17 @@ void test__kt_remove__directory_no_args__one_empty_exists_link_not(void **state)
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, macro_f_file_type_is_link(statistics.st_mode));
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -127,12 +163,12 @@ void test__kt_remove__directory_no_args__one_empty_exists_link_not(void **state)
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, "+" F_console_standard_short_verbose_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, "+" F_console_standard_short_verbose_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file.
+    // Pre-process target.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -140,8 +176,17 @@ void test__kt_remove__directory_no_args__one_empty_exists_link_not(void **state)
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, macro_f_file_type_is_link(statistics.st_mode));
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -152,12 +197,12 @@ void test__kt_remove__directory_no_args__one_empty_exists_link_not(void **state)
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, "+" F_console_standard_short_debug_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, "+" F_console_standard_short_debug_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file.
+    // Pre-process target.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -165,8 +210,17 @@ void test__kt_remove__directory_no_args__one_empty_exists_link_not(void **state)
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, macro_f_file_type_is_link(statistics.st_mode));
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -182,10 +236,10 @@ void test__kt_remove__directory_no_args__one_empty_exists_not(void **state) {
   mock_unwrap = 0;
   mock_unwrap_f_time_clock_get = 1;
 
-  const f_string_static_t file = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
+  const f_string_static_t target = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, 0 };
 
     will_return(__wrap_f_file_exists, F_false);
 
@@ -195,7 +249,7 @@ void test__kt_remove__directory_no_args__one_empty_exists_not(void **state) {
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, "+" F_console_standard_short_verbose_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, "+" F_console_standard_short_verbose_s, 0 };
 
     will_return(__wrap_f_file_exists, F_false);
 
@@ -205,7 +259,7 @@ void test__kt_remove__directory_no_args__one_empty_exists_not(void **state) {
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, "+" F_console_standard_short_debug_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, "+" F_console_standard_short_debug_s, 0 };
 
     will_return(__wrap_f_file_exists, F_false);
 
@@ -220,13 +274,13 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link(void **state)
   mock_unwrap = 0;
   mock_unwrap_f_time_clock_get = 1;
 
-  const f_string_static_t file = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
+  const f_string_static_t target = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
 
   struct stat statistics;
   struct stat statistics_regular;
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, "-" KT_REMOVE_short_empty_s, KT_REMOVE_not_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, "-" KT_REMOVE_short_empty_s, KT_REMOVE_not_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
@@ -234,7 +288,7 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link(void **state)
     memset(&statistics_regular, 0, sizeof(struct stat));
     statistics_regular.st_mode = F_file_mode_all_d | F_file_type_regular_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file.
+    // Pre-process target.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -243,8 +297,8 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link(void **state)
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_false); // kt_remove_flag_file_operate_empty_d is set.
     will_return(__wrap_fl_directory_do, 1);
-    will_return(__wrap_fl_directory_do, &file);
-    will_return(__wrap_fl_directory_do, &file);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
     will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
 
     // The pre-process gets called again before the final removal for directories.
@@ -252,8 +306,9 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link(void **state)
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
     will_return(__wrap_f_file_stat, F_okay);
-    will_return(__wrap_f_directory_empty, F_true);
+    will_return(__wrap_f_directory_empty, F_false);
 
+    // @fixme when removal is attempted on non-empty directory due to empty not flag being set this likely should fail to remove on error that directory is not empty (recursive would need to be passed to succeed).
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
 
@@ -263,7 +318,7 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link(void **state)
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, "+" F_console_standard_short_verbose_s, "-" KT_REMOVE_short_empty_s, KT_REMOVE_not_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, "+" F_console_standard_short_verbose_s, "-" KT_REMOVE_short_empty_s, KT_REMOVE_not_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
@@ -271,7 +326,7 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link(void **state)
     memset(&statistics_regular, 0, sizeof(struct stat));
     statistics_regular.st_mode = F_file_mode_all_d | F_file_type_regular_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file.
+    // Pre-process target.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -280,8 +335,8 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link(void **state)
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_false); // kt_remove_flag_file_operate_empty_d is set.
     will_return(__wrap_fl_directory_do, 1);
-    will_return(__wrap_fl_directory_do, &file);
-    will_return(__wrap_fl_directory_do, &file);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
     will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
 
     // The pre-process gets called again before the final removal for directories.
@@ -289,7 +344,7 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link(void **state)
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
     will_return(__wrap_f_file_stat, F_okay);
-    will_return(__wrap_f_directory_empty, F_true);
+    will_return(__wrap_f_directory_empty, F_false);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -300,7 +355,7 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link(void **state)
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, "+" F_console_standard_short_debug_s, "-" KT_REMOVE_short_empty_s, KT_REMOVE_not_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, "+" F_console_standard_short_debug_s, "-" KT_REMOVE_short_empty_s, KT_REMOVE_not_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
@@ -308,7 +363,7 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link(void **state)
     memset(&statistics_regular, 0, sizeof(struct stat));
     statistics_regular.st_mode = F_file_mode_all_d | F_file_type_regular_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file.
+    // Pre-process target.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -317,8 +372,8 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link(void **state)
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_false); // kt_remove_flag_file_operate_empty_d is set.
     will_return(__wrap_fl_directory_do, 1);
-    will_return(__wrap_fl_directory_do, &file);
-    will_return(__wrap_fl_directory_do, &file);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
     will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
 
     // The pre-process gets called again before the final removal for directories.
@@ -326,7 +381,7 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link(void **state)
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
     will_return(__wrap_f_file_stat, F_okay);
-    will_return(__wrap_f_directory_empty, F_true);
+    will_return(__wrap_f_directory_empty, F_false);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -342,14 +397,14 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link_not(void **st
   mock_unwrap = 0;
   mock_unwrap_f_time_clock_get = 1;
 
-  const f_string_static_t file = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
+  const f_string_static_t target = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
   const f_string_static_t child = macro_f_string_static_t_initialize_1("child", 0, 5);
 
   struct stat statistics;
   struct stat statistics_regular;
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, "-" KT_REMOVE_short_empty_s, KT_REMOVE_not_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, "-" KT_REMOVE_short_empty_s, KT_REMOVE_not_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
@@ -357,7 +412,7 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link_not(void **st
     memset(&statistics_regular, 0, sizeof(struct stat));
     statistics_regular.st_mode = F_file_mode_all_d | F_file_type_regular_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file.
+    // Pre-process target.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -365,18 +420,29 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link_not(void **st
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_false); // kt_remove_flag_file_operate_empty_d is set.
-    will_return(__wrap_fl_directory_do, 1);
-
-    // Child
+    will_return(__wrap_fl_directory_do, 2);
     will_return(__wrap_fl_directory_do, &child);
     will_return(__wrap_fl_directory_do, &child);
     will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_regular_d);
+
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
     will_return(__wrap_f_file_stat, &statistics_regular);
     will_return(__wrap_f_file_stat, F_okay);
     will_return(__wrap_f_file_remove, F_okay);
 
+    // Parent directory.
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_false);
+
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
 
@@ -386,7 +452,7 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link_not(void **st
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, "+" F_console_standard_short_verbose_s, "-" KT_REMOVE_short_empty_s, KT_REMOVE_not_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, "+" F_console_standard_short_verbose_s, "-" KT_REMOVE_short_empty_s, KT_REMOVE_not_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
@@ -394,7 +460,7 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link_not(void **st
     memset(&statistics_regular, 0, sizeof(struct stat));
     statistics_regular.st_mode = F_file_mode_all_d | F_file_type_regular_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file.
+    // Pre-process target.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -402,17 +468,28 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link_not(void **st
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_false); // kt_remove_flag_file_operate_empty_d is set.
-    will_return(__wrap_fl_directory_do, 1);
-    will_return(__wrap_fl_directory_do, &file);
-    will_return(__wrap_fl_directory_do, &file);
+    will_return(__wrap_fl_directory_do, 2);
+    will_return(__wrap_fl_directory_do, &child);
+    will_return(__wrap_fl_directory_do, &child);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_regular_d);
+
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
+    will_return(__wrap_f_file_stat, &statistics_regular);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_file_remove, F_okay);
+
+    // Parent directory.
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
     will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
 
     // The pre-process gets called again before the final removal for directories.
     will_return(__wrap_f_file_exists, F_true);
-    will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
+    will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
     will_return(__wrap_f_file_stat, F_okay);
-    will_return(__wrap_f_directory_empty, F_true);
+    will_return(__wrap_f_directory_empty, F_false);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -423,7 +500,7 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link_not(void **st
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, "+" F_console_standard_short_debug_s, "-" KT_REMOVE_short_empty_s, KT_REMOVE_not_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, "+" F_console_standard_short_debug_s, "-" KT_REMOVE_short_empty_s, KT_REMOVE_not_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
@@ -431,7 +508,7 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link_not(void **st
     memset(&statistics_regular, 0, sizeof(struct stat));
     statistics_regular.st_mode = F_file_mode_all_d | F_file_type_regular_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file.
+    // Pre-process target.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -439,17 +516,28 @@ void test__kt_remove__directory_no_args__one_empty_not_exists_link_not(void **st
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_false); // kt_remove_flag_file_operate_empty_d is set.
-    will_return(__wrap_fl_directory_do, 1);
-    will_return(__wrap_fl_directory_do, &file);
-    will_return(__wrap_fl_directory_do, &file);
+    will_return(__wrap_fl_directory_do, 2);
+    will_return(__wrap_fl_directory_do, &child);
+    will_return(__wrap_fl_directory_do, &child);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_regular_d);
+
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
+    will_return(__wrap_f_file_stat, &statistics_regular);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_file_remove, F_okay);
+
+    // Parent directory.
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
     will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
 
     // The pre-process gets called again before the final removal for directories.
     will_return(__wrap_f_file_exists, F_true);
-    will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
+    will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
     will_return(__wrap_f_file_stat, F_okay);
-    will_return(__wrap_f_directory_empty, F_true);
+    will_return(__wrap_f_directory_empty, F_false);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -465,18 +553,18 @@ void test__kt_remove__directory_no_args__two_empty_exists_and_not(void **state)
   mock_unwrap = 0;
   mock_unwrap_f_time_clock_get = 1;
 
-  const f_string_static_t file = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
-  const f_string_static_t file_also = macro_f_string_static_t_initialize_1("also/remove", 0, 11);
+  const f_string_static_t target = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
+  const f_string_static_t target_also = macro_f_string_static_t_initialize_1("also/remove", 0, 11);
 
   struct stat statistics;
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, file_also.string, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, target_also.string, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file 1.
+    // Pre-process target 1.
     will_return(__wrap_f_file_exists, F_false);
 
     const int result = kt_main_test__remove(3, argv, 0);
@@ -485,12 +573,12 @@ void test__kt_remove__directory_no_args__two_empty_exists_and_not(void **state)
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, file_also.string, "+" F_console_standard_short_verbose_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, target_also.string, "+" F_console_standard_short_verbose_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file 1.
+    // Pre-process target 1.
     will_return(__wrap_f_file_exists, F_false);
 
     const int result = kt_main_test__remove(4, argv, 0);
@@ -499,12 +587,12 @@ void test__kt_remove__directory_no_args__two_empty_exists_and_not(void **state)
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, file_also.string, "+" F_console_standard_short_debug_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, target_also.string, "+" F_console_standard_short_debug_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file 1.
+    // Pre-process target 1.
     will_return(__wrap_f_file_exists, F_false);
 
     const int result = kt_main_test__remove(4, argv, 0);
@@ -518,18 +606,18 @@ void test__kt_remove__directory_no_args__two_empty_exists_link(void **state) {
   mock_unwrap = 0;
   mock_unwrap_f_time_clock_get = 1;
 
-  const f_string_static_t file = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
-  const f_string_static_t file_also = macro_f_string_static_t_initialize_1("also/remove", 0, 11);
+  const f_string_static_t target = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
+  const f_string_static_t target_also = macro_f_string_static_t_initialize_1("also/remove", 0, 11);
 
   struct stat statistics;
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, file_also.string, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, target_also.string, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file 1.
+    // Pre-process target 1.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -537,13 +625,22 @@ void test__kt_remove__directory_no_args__two_empty_exists_link(void **state) {
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_true);
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
 
-    // Pre-process file 2.
+    // Pre-process target 2.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -551,8 +648,17 @@ void test__kt_remove__directory_no_args__two_empty_exists_link(void **state) {
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_true);
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -563,12 +669,12 @@ void test__kt_remove__directory_no_args__two_empty_exists_link(void **state) {
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, file_also.string, "+" F_console_standard_short_verbose_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, target_also.string, "+" F_console_standard_short_verbose_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file 1.
+    // Pre-process target 1.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -576,13 +682,22 @@ void test__kt_remove__directory_no_args__two_empty_exists_link(void **state) {
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_true);
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
 
-    // Pre-process file 2.
+    // Pre-process target 2.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -590,8 +705,17 @@ void test__kt_remove__directory_no_args__two_empty_exists_link(void **state) {
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_true);
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -602,12 +726,12 @@ void test__kt_remove__directory_no_args__two_empty_exists_link(void **state) {
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, file_also.string, "+" F_console_standard_short_debug_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, target_also.string, "+" F_console_standard_short_debug_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file 1.
+    // Pre-process target 1.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -615,13 +739,22 @@ void test__kt_remove__directory_no_args__two_empty_exists_link(void **state) {
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_true);
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
 
-    // Pre-process file 2.
+    // Pre-process target 2.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -629,8 +762,17 @@ void test__kt_remove__directory_no_args__two_empty_exists_link(void **state) {
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_true);
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -646,18 +788,18 @@ void test__kt_remove__directory_no_args__two_empty_exists_link_not(void **state)
   mock_unwrap = 0;
   mock_unwrap_f_time_clock_get = 1;
 
-  const f_string_static_t file = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
-  const f_string_static_t file_also = macro_f_string_static_t_initialize_1("also/remove", 0, 11);
+  const f_string_static_t target = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
+  const f_string_static_t target_also = macro_f_string_static_t_initialize_1("also/remove", 0, 11);
 
   struct stat statistics;
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, file_also.string, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, target_also.string, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file 1.
+    // Pre-process target 1.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -665,13 +807,22 @@ void test__kt_remove__directory_no_args__two_empty_exists_link_not(void **state)
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_false);
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
 
-    // Pre-process file 2.
+    // Pre-process target 2.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -679,8 +830,17 @@ void test__kt_remove__directory_no_args__two_empty_exists_link_not(void **state)
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_false);
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -691,12 +851,12 @@ void test__kt_remove__directory_no_args__two_empty_exists_link_not(void **state)
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, file_also.string, "+" F_console_standard_short_verbose_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, target_also.string, "+" F_console_standard_short_verbose_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file 1.
+    // Pre-process target 1.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -704,13 +864,22 @@ void test__kt_remove__directory_no_args__two_empty_exists_link_not(void **state)
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_false);
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
 
-    // Pre-process file 2.
+    // Pre-process target 2.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -718,8 +887,17 @@ void test__kt_remove__directory_no_args__two_empty_exists_link_not(void **state)
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_false);
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -730,12 +908,12 @@ void test__kt_remove__directory_no_args__two_empty_exists_link_not(void **state)
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, file_also.string, "+" F_console_standard_short_debug_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, target_also.string, "+" F_console_standard_short_debug_s, 0 };
 
     memset(&statistics, 0, sizeof(struct stat));
     statistics.st_mode = F_file_mode_all_d | F_file_type_directory_d; // Should result in kt_remove_flag_file_operate_remove_d.
 
-    // Pre-process file 1.
+    // Pre-process target 1.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_false); // Not a link, kt_remove_flag_file_operate_link_d is not set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -743,13 +921,22 @@ void test__kt_remove__directory_no_args__two_empty_exists_link_not(void **state)
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_false);
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
 
-    // Pre-process file 2.
+    // Pre-process target 2.
     will_return(__wrap_f_file_exists, F_true);
     will_return(__wrap_f_file_is, F_true); // A link, kt_remove_flag_file_operate_link_d is set.
     will_return(__wrap_f_file_stat, &statistics);
@@ -757,8 +944,17 @@ void test__kt_remove__directory_no_args__two_empty_exists_link_not(void **state)
 
     // Directory processing.
     will_return(__wrap_f_directory_empty, F_true);
-    will_return(__wrap_fl_directory_do, 0);
-    will_return(__wrap_fl_directory_do, F_okay);
+    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_false);
+    will_return(__wrap_f_file_stat, &statistics);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
 
     // This will fail if f_directory_remove() is not called, therefore success here means f_directory_remove has been called.
     will_return(__wrap_f_directory_remove, F_okay);
@@ -774,11 +970,11 @@ void test__kt_remove__directory_no_args__two_empty_exists_not(void **state) {
   mock_unwrap = 0;
   mock_unwrap_f_time_clock_get = 1;
 
-  const f_string_static_t file = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
-  const f_string_static_t file_also = macro_f_string_static_t_initialize_1("also/remove", 0, 11);
+  const f_string_static_t target = macro_f_string_static_t_initialize_1("to_remove", 0, 9);
+  const f_string_static_t target_also = macro_f_string_static_t_initialize_1("also/remove", 0, 11);
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, file_also.string, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, target_also.string, 0 };
 
     will_return(__wrap_f_file_exists, F_false);
 
@@ -788,7 +984,7 @@ void test__kt_remove__directory_no_args__two_empty_exists_not(void **state) {
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, file_also.string, "+" F_console_standard_short_verbose_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, target_also.string, "+" F_console_standard_short_verbose_s, 0 };
 
     will_return(__wrap_f_file_exists, F_false);
 
@@ -798,7 +994,7 @@ void test__kt_remove__directory_no_args__two_empty_exists_not(void **state) {
   }
 
   {
-    const f_string_t argv[] = { "mocked_main", file.string, file_also.string, "+" F_console_standard_short_debug_s, 0 };
+    const f_string_t argv[] = { "mocked_main", target.string, target_also.string, "+" F_console_standard_short_debug_s, 0 };
 
     will_return(__wrap_f_file_exists, F_false);
 
index f1b4c93e40c53895e60e3631e8ed036333f0392c..0c04b1a3369115382e35c6fa4b353511f598de4f 100644 (file)
@@ -35,7 +35,7 @@ void test__kt_remove__directory_recurse_simple__one_child_one_exists_link(void *
 
     // Target Directory pre-processing, begin, perform directory listing action.
     will_return(__wrap_f_directory_empty, F_false);
-    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, 2);
 
     // The first child pre-processing.
     will_return(__wrap_fl_directory_do, &child_1);
@@ -47,6 +47,18 @@ void test__kt_remove__directory_recurse_simple__one_child_one_exists_link(void *
     will_return(__wrap_f_file_stat, F_okay);
     will_return(__wrap_f_file_remove, F_okay);
 
+    // The parent.
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_true);
+    will_return(__wrap_f_file_stat, &stat_directory);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
+
     will_return(__wrap_f_directory_remove, F_okay);
 
     const int result = kt_main_test__remove(3, argv, 0);
@@ -83,7 +95,7 @@ void test__kt_remove__directory_recurse_simple__one_child_one_exists_link_not(vo
 
     // Target Directory pre-processing, begin, perform directory listing action.
     will_return(__wrap_f_directory_empty, F_false);
-    will_return(__wrap_fl_directory_do, 1);
+    will_return(__wrap_fl_directory_do, 2);
 
     // The first child pre-processing.
     will_return(__wrap_fl_directory_do, &child_1);
@@ -95,6 +107,18 @@ void test__kt_remove__directory_recurse_simple__one_child_one_exists_link_not(vo
     will_return(__wrap_f_file_stat, F_okay);
     will_return(__wrap_f_file_remove, F_okay);
 
+    // The parent.
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_false);
+    will_return(__wrap_f_file_stat, &stat_directory);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
+
     will_return(__wrap_f_directory_remove, F_okay);
 
     const int result = kt_main_test__remove(3, argv, 0);
@@ -132,7 +156,7 @@ void test__kt_remove__directory_recurse_simple__one_child_two_exists_link(void *
 
     // Target Directory pre-processing, begin, perform directory listing action.
     will_return(__wrap_f_directory_empty, F_false);
-    will_return(__wrap_fl_directory_do, 2);
+    will_return(__wrap_fl_directory_do, 3);
 
     // The first child processing.
     will_return(__wrap_fl_directory_do, &child_1);
@@ -154,6 +178,18 @@ void test__kt_remove__directory_recurse_simple__one_child_two_exists_link(void *
     will_return(__wrap_f_file_stat, F_okay);
     will_return(__wrap_f_file_remove, F_okay);
 
+    // The parent.
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_true);
+    will_return(__wrap_f_file_stat, &stat_directory);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
+
     will_return(__wrap_f_directory_remove, F_okay);
 
     const int result = kt_main_test__remove(3, argv, 0);
@@ -191,7 +227,7 @@ void test__kt_remove__directory_recurse_simple__one_child_two_exists_link_not(vo
 
     // Target Directory pre-processing, begin, perform directory listing action.
     will_return(__wrap_f_directory_empty, F_false);
-    will_return(__wrap_fl_directory_do, 2);
+    will_return(__wrap_fl_directory_do, 3);
 
     // The first child processing.
     will_return(__wrap_fl_directory_do, &child_1);
@@ -213,6 +249,18 @@ void test__kt_remove__directory_recurse_simple__one_child_two_exists_link_not(vo
     will_return(__wrap_f_file_stat, F_okay);
     will_return(__wrap_f_file_remove, F_okay);
 
+    // The parent.
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, &target);
+    will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+    // The pre-process gets called again before the final removal for directories.
+    will_return(__wrap_f_file_exists, F_true);
+    will_return(__wrap_f_file_is, F_true);
+    will_return(__wrap_f_file_stat, &stat_directory);
+    will_return(__wrap_f_file_stat, F_okay);
+    will_return(__wrap_f_directory_empty, F_true);
+
     will_return(__wrap_f_directory_remove, F_okay);
 
     const int result = kt_main_test__remove(3, argv, 0);
index bfacdf67b1c08ce592ab2adb635d71dee5a91247..6721fa4bafa2335fb7ebd1e7b6faf6229286f749 100644 (file)
@@ -90,7 +90,7 @@ void test__kt_remove__epochtime__accessed_works(void **state) {
     macro_f_time_spec_t_initialize_1(1 * 86400, 4000),
   };
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_true,
     F_false,
@@ -144,8 +144,17 @@ void test__kt_remove__epochtime__accessed_works(void **state) {
 
           if (time_spec_removes[date]) {
             if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+              will_return(__wrap_f_file_stat, &stats[type]);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
@@ -246,7 +255,7 @@ void test__kt_remove__epochtime__changed_works(void **state) {
     macro_f_time_spec_t_initialize_1(1 * 86400, 4000),
   };
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_true,
     F_false,
@@ -300,8 +309,17 @@ void test__kt_remove__epochtime__changed_works(void **state) {
 
           if (time_spec_removes[date]) {
             if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+              will_return(__wrap_f_file_stat, &stats[type]);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
@@ -402,7 +420,7 @@ void test__kt_remove__epochtime__updated_works(void **state) {
     macro_f_time_spec_t_initialize_1(1 * 86400, 4000),
   };
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_true,
     F_false,
@@ -456,8 +474,17 @@ void test__kt_remove__epochtime__updated_works(void **state) {
 
           if (time_spec_removes[date]) {
             if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+              will_return(__wrap_f_file_stat, &stats[type]);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
index c54dac21f3985a7fc243a1e58bfaa56d997c3ed7..13a64512b4f827ea6bbcedde90b4c016b9c82148 100644 (file)
@@ -88,8 +88,17 @@ void test__kt_remove__file_mode__different_works(void **state) {
           if (param != mode) {
             if (macro_f_file_type_is_directory(statistics.st_mode)) {
               will_return(__wrap_f_directory_empty, F_true);
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(statistics.st_mode));
+              will_return(__wrap_f_file_stat, &statistics);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
@@ -193,8 +202,17 @@ void test__kt_remove__file_mode__same_works(void **state) {
           if (param == mode) {
             if (macro_f_file_type_is_directory(statistics.st_mode)) {
               will_return(__wrap_f_directory_empty, F_true);
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(statistics.st_mode));
+              will_return(__wrap_f_file_stat, &statistics);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
@@ -298,8 +316,17 @@ void test__kt_remove__file_mode__similar_works(void **state) {
           if (modes[param] & modes[mode]) {
             if (macro_f_file_type_is_directory(statistics.st_mode)) {
               will_return(__wrap_f_directory_empty, F_true);
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(statistics.st_mode));
+              will_return(__wrap_f_file_stat, &statistics);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
@@ -403,8 +430,17 @@ void test__kt_remove__file_mode__not_works(void **state) {
           if (modes[param] != modes[mode]) {
             if (macro_f_file_type_is_directory(statistics.st_mode)) {
               will_return(__wrap_f_directory_empty, F_true);
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(statistics.st_mode));
+              will_return(__wrap_f_file_stat, &statistics);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
index 622da78507234e9d9431044c9971f5eaaa525407..9539b9f93a537bdd8c5088634762da4555bae28a 100644 (file)
@@ -60,8 +60,17 @@ void test__kt_remove__file_type__works(void **state) {
         if (i == type) {
           if (macro_f_file_type_is_directory(stats[i].st_mode)) {
             will_return(__wrap_f_directory_empty, F_true);
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
index 6ee6e6e2a8a7e39440706263d6724c9147fe4749..90c6c8d60c5df44d6138e9453b1c83a0a1e43681 100644 (file)
@@ -47,8 +47,17 @@ void test__kt_remove__group__name_works(void **state) {
     if (stats[type].st_gid == group_id) {
       if (macro_f_file_type_is_directory(stats[type].st_mode)) {
         will_return(__wrap_f_directory_empty, F_true);
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+        will_return(__wrap_fl_directory_do, 1);
+        will_return(__wrap_fl_directory_do, &target);
+        will_return(__wrap_fl_directory_do, &target);
+        will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+        // The pre-process gets called again before the final removal for directories.
+        will_return(__wrap_f_file_exists, F_true);
+        will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+        will_return(__wrap_f_file_stat, &stats[type]);
+        will_return(__wrap_f_file_stat, F_okay);
+        will_return(__wrap_f_directory_empty, F_true);
 
         will_return(__wrap_f_directory_remove, F_okay);
       }
index b4d645fd8b1ad5182d2956bcfc022b1cd27bba7a..bc51ed62792cb4aad1d471148e6c7739955fea75 100644 (file)
@@ -90,7 +90,7 @@ void test__kt_remove__time__accessed_works(void **state) {
     macro_f_time_spec_t_initialize_1(1 * 86400, 4000),
   };
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_true,
     F_false,
@@ -151,8 +151,17 @@ void test__kt_remove__time__accessed_works(void **state) {
 
           if (time_spec_removes[date]) {
             if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+              will_return(__wrap_f_file_stat, &stats[type]);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
@@ -253,7 +262,7 @@ void test__kt_remove__time__changed_works(void **state) {
     macro_f_time_spec_t_initialize_1(1 * 86400, 4000),
   };
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_true,
     F_false,
@@ -314,8 +323,17 @@ void test__kt_remove__time__changed_works(void **state) {
 
           if (time_spec_removes[date]) {
             if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+              will_return(__wrap_f_file_stat, &stats[type]);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
@@ -416,7 +434,7 @@ void test__kt_remove__time__updated_works(void **state) {
     macro_f_time_spec_t_initialize_1(1 * 86400, 4000),
   };
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_true,
     F_false,
@@ -477,8 +495,17 @@ void test__kt_remove__time__updated_works(void **state) {
 
           if (time_spec_removes[date]) {
             if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-              will_return(__wrap_fl_directory_do, 0);
-              will_return(__wrap_fl_directory_do, F_okay);
+              will_return(__wrap_fl_directory_do, 1);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, &target);
+              will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+              // The pre-process gets called again before the final removal for directories.
+              will_return(__wrap_f_file_exists, F_true);
+              will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+              will_return(__wrap_f_file_stat, &stats[type]);
+              will_return(__wrap_f_file_stat, F_okay);
+              will_return(__wrap_f_directory_empty, F_true);
 
               will_return(__wrap_f_directory_remove, F_okay);
             }
index 2a8a4c79005a61dd29edce2241c8d918d03d1a0d..0845b72f2158ad6f42108e5be47e1e00b9e87dc1 100644 (file)
@@ -87,7 +87,7 @@ void test__kt_remove__unix__accessed_works(void **state) {
     macro_f_time_spec_t_initialize_1(1 * 86400, 4000),
   };
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_true,
     F_false,
@@ -138,8 +138,17 @@ void test__kt_remove__unix__accessed_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
@@ -235,7 +244,7 @@ void test__kt_remove__unix__changed_works(void **state) {
     macro_f_time_spec_t_initialize_1(1 * 86400, 4000),
   };
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_true,
     F_false,
@@ -286,8 +295,17 @@ void test__kt_remove__unix__changed_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
@@ -383,7 +401,7 @@ void test__kt_remove__unix__updated_works(void **state) {
     macro_f_time_spec_t_initialize_1(1 * 86400, 4000),
   };
 
-  bool time_spec_removes[] = {
+  uint8_t time_spec_removes[] = {
     F_true,  // Equal
     F_true,
     F_false,
@@ -434,8 +452,17 @@ void test__kt_remove__unix__updated_works(void **state) {
 
         if (time_spec_removes[date]) {
           if (macro_f_file_type_is_directory(stats[type].st_mode)) {
-            will_return(__wrap_fl_directory_do, 0);
-            will_return(__wrap_fl_directory_do, F_okay);
+            will_return(__wrap_fl_directory_do, 1);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, &target);
+            will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+            // The pre-process gets called again before the final removal for directories.
+            will_return(__wrap_f_file_exists, F_true);
+            will_return(__wrap_f_file_is, macro_f_file_type_is_link(stats[type].st_mode));
+            will_return(__wrap_f_file_stat, &stats[type]);
+            will_return(__wrap_f_file_stat, F_okay);
+            will_return(__wrap_f_directory_empty, F_true);
 
             will_return(__wrap_f_directory_remove, F_okay);
           }
index decf56888bf8c52a1bd82211c6badc834b6878ba..a3a45032ee28cee90061b8e15887f54ace4a2c89 100644 (file)
@@ -52,8 +52,19 @@ void test__kt_remove__user__different_works(void **state) {
     else {
       if (macro_f_file_type_is_directory(stats[type].st_mode)) {
         will_return(__wrap_f_directory_empty, F_true);
-        will_return(__wrap_fl_directory_do, 0);
-        will_return(__wrap_fl_directory_do, F_okay);
+        will_return(__wrap_fl_directory_do, 1);
+        will_return(__wrap_fl_directory_do, &target);
+        will_return(__wrap_fl_directory_do, &target);
+        will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+        // The pre-process gets called again before the final removal for directories.
+        will_return(__wrap_geteuid, user_id);
+        will_return(__wrap_geteuid, user_id);
+        will_return(__wrap_f_file_exists, F_true);
+        will_return(__wrap_f_file_is, F_false);
+        will_return(__wrap_f_file_stat, &stats[type]);
+        will_return(__wrap_f_file_stat, F_okay);
+        will_return(__wrap_f_directory_empty, F_true);
 
         will_return(__wrap_f_directory_remove, F_okay);
       }
@@ -108,8 +119,17 @@ void test__kt_remove__user__name_works(void **state) {
     if (stats[type].st_uid == user_id) {
       if (macro_f_file_type_is_directory(stats[type].st_mode)) {
         will_return(__wrap_f_directory_empty, F_true);
-        will_return(__wrap_fl_directory_do, 0);
-        will_return(__wrap_fl_directory_do, F_okay);
+        will_return(__wrap_fl_directory_do, 1);
+        will_return(__wrap_fl_directory_do, &target);
+        will_return(__wrap_fl_directory_do, &target);
+        will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+        // The pre-process gets called again before the final removal for directories.
+        will_return(__wrap_f_file_exists, F_true);
+        will_return(__wrap_f_file_is, F_false);
+        will_return(__wrap_f_file_stat, &stats[type]);
+        will_return(__wrap_f_file_stat, F_okay);
+        will_return(__wrap_f_directory_empty, F_true);
 
         will_return(__wrap_f_directory_remove, F_okay);
       }
@@ -169,8 +189,19 @@ void test__kt_remove__user__same_works(void **state) {
     if (stats[type].st_uid == user_id) {
       if (macro_f_file_type_is_directory(stats[type].st_mode)) {
         will_return(__wrap_f_directory_empty, F_true);
-        will_return(__wrap_fl_directory_do, 0);
-        will_return(__wrap_fl_directory_do, F_okay);
+        will_return(__wrap_fl_directory_do, 1);
+        will_return(__wrap_fl_directory_do, &target);
+        will_return(__wrap_fl_directory_do, &target);
+        will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_d | f_directory_recurse_do_flag_directory_d);
+
+        // The pre-process gets called again before the final removal for directories.
+        will_return(__wrap_geteuid, user_id);
+        will_return(__wrap_geteuid, user_id);
+        will_return(__wrap_f_file_exists, F_true);
+        will_return(__wrap_f_file_is, F_false);
+        will_return(__wrap_f_file_stat, &stats[type]);
+        will_return(__wrap_f_file_stat, F_okay);
+        will_return(__wrap_f_directory_empty, F_true);
 
         will_return(__wrap_f_directory_remove, F_okay);
       }