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.
#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_
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;
}
}
}
- 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;
}
}
}
- 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],
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;
} // 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) {
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;
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) {
}
}
- 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) {
}
}
- 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];
}
}
}
- 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_
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) {
}
#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) {
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;
}
}
#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.
* 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_
/**
#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,
{ \
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
"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",
"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",
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,
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,
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);
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);
* 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;
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;
#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
#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;
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;
#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;
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;
}
#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_
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;
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);
}
}
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;
}
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);
}
}
- // 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) {
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;
}
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;
}
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;
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;
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) {
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;
}
}
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) {
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) {
#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;
}
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;
}
#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) {
}
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_
* 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
* 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_
/**
* 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
}
#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) {
}
#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) {
#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;
* 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_
/**
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);
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;
#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);
#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;
#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;
#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;
#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);
#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);
* 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
* 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_
/**
* 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
* 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_
/**
* 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
* 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_
/**
* 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
* 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_
/**
* 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
* 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_
/**
* 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
* 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
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
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) {
}
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);
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
= 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;
}
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);
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;
}
++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.
{ \
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)
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
= 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;
{ \
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)
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;
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) {
#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;
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);
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;
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);
&main->setting.send_polls,
};
- const bool is_receive[] = {
+ const uint8_t is_receive[] = {
F_true,
F_false,
};
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) {
}
} // 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);
{ \
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)
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);
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);
}
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 *);
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);
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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);
// 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);
}
{
- 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);
// 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);
}
{
- 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);
// 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);
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);
// 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);
}
{
- 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);
// 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);
}
{
- 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);
// 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);
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);
}
{
- 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);
}
{
- 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);
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.
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);
// 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.
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);
}
{
- 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.
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);
// 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.
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);
}
{
- 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.
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);
// 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.
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);
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.
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);
// 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);
}
{
- 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.
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);
// 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);
}
{
- 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.
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);
// 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);
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);
}
{
- 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);
}
{
- 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);
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);
// 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);
// 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);
}
{
- 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);
// 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);
// 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);
}
{
- 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);
// 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);
// 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);
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);
// 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);
// 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);
}
{
- 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);
// 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);
// 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);
}
{
- 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);
// 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);
// 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);
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);
}
{
- 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);
}
{
- 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);
// 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);
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);
// 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);
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);
// 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);
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);
// 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);
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);
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,
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);
}
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,
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);
}
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,
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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,
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);
}
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);
}
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);
}
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);
}