Add normal allocation length define and shrink the path to this size if the size is larger than the large length.
Restructure the simulate to be called during the directory recursion so that there is only a single `fl_directory_do()` recursion.
The simulate must not be aware of when it is being called during recursion and when it is not being called during recursion.
The directory has to be processed to determine if and when it is being recursed.
However, the directory should be deleted after recursion into its child paths.
Update the unit rests accordingly.
The directory recursion is now moved into a top level cache.
This reduces the amount of allocations necessary and makes clean up on exit easier.
The parent path logic needs to be updated.
I added sample snippet of code with a todo, commented out.
Remove some stale documentation comments.
I did some basic tests using (with and without `-S` added):
```
clear ; md a/b/c/d && touch a/b/file.txt && valgrind --leak-check=full remove +V a/b -r ; t a
```
And (with and without `-S` added):
```
clear ; md a/b/{c/d,e/f} && touch a/b/file.txt && valgrind --leak-check=full remove +V a/b -r ; t a
```
The file statistics for the top-level directory being recursed needs to be preserved and passed through to the simulate.
The first directory processing pass before recursion should retain this.
During recursion, the parent directory should utilize this information when needed.
* control_allocation_*_d:
* - console: An allocation step used for small buffers specifically for console parameter.
* - large: An allocation step used for buffers that are anticipated to have large buffers.
+ * - normal: An allocation size to set to when shrinking an over sized array.
* - pipe: A buffer size used for processing piped data.
* - small: An allocation step used for buffers that are anticipated to have small buffers.
*/
#ifndef _di_kt_remove_allocation_d_
#define kt_remove_allocation_console_d 4
#define kt_remove_allocation_large_d 2048
+ #define kt_remove_allocation_normal_d 256
#define kt_remove_allocation_pipe_d 16384
#define kt_remove_allocation_small_d 8
#endif // _di_kt_remove_allocation_d_
/**
+ * 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".
+ */
+#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
+#endif // _di_kt_remove_flag_file_code_d_
+
+/**
* A set of flags used internally in the convert process.
*
* These are generally used during parsing of Time and EpochTime strings.
f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &cache->files.array, &cache->files.used, &cache->files.size, &f_string_dynamics_delete_callback);
f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &cache->memory.array, &cache->memory.used, &cache->memory.size, &f_string_dynamics_delete_callback);
f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &cache->tree.array, &cache->tree.used, &cache->tree.size, &f_string_dynamics_delete_callback);
+
+ f_directory_recurse_do_delete(&cache->recurse);
}
#endif // _di_kt_remove_cache_delete_
/**
* The program cache.
*
- * polls: An array of poll structures.
+ * statistics: The statistics of the parent directory before recursion takes place.
+ *
+ * polls: An array of poll structures.
+ *
* buffer: The generic buffer.
* input: The buffer used specifically for handling input.
+ *
* files: A collection of files, often used during path recursion like those associated with the tree parameter.
* memory: A list of paths or partial paths representing files already processed.
* tree: A collection of files to process as a result of the --tree command.
+ *
+ * recurse: Directory recurse data.
*/
#ifndef _di_kt_remove_cache_t_
typedef struct {
+ struct stat statistics;
f_polls_t polls;
f_string_dynamic_t buffer;
f_string_dynamic_t input;
+
f_string_dynamics_t files;
f_string_dynamics_t memory;
f_string_dynamics_t tree;
+
+ f_directory_recurse_do_t recurse;
} kt_remove_cache_t;
#define kt_remove_cache_t_initialize \
{ \
+ { 0 }, \
f_polls_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamics_t_initialize, \
f_string_dynamics_t_initialize, \
f_string_dynamics_t_initialize, \
+ f_directory_recurse_do_t_initialize, \
}
#endif // _di_kt_remove_cache_t_
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;
- f_directory_recurse_do_t recurse = f_directory_recurse_do_t_initialize;
-
// The recurse.state.code flags represent the top-level directory being recursed on.
- recurse.state.code = (uint64_t) flag_operate;
- recurse.state.custom = (void *) main;
- recurse.state.interrupt = &kt_remove_signal_check_recurse;
+ main->cache.recurse.state.code = (uint64_t) flag_operate;
+ main->cache.recurse.state.custom = (void *) main;
+ main->cache.recurse.state.interrupt = &kt_remove_signal_check_recurse;
- recurse.depth_max = main->setting.flag & kt_remove_main_flag_recurse_d ? kt_remove_depth_max_d : 0;
- recurse.flag = 0;
- recurse.path_top = &path;
+ main->cache.recurse.depth_max = main->setting.flag & kt_remove_main_flag_recurse_d ? kt_remove_depth_max_d : 0;
+ main->cache.recurse.flag = 0;
+ main->cache.recurse.path.used = 0;
+ main->cache.recurse.path_top = &path;
- recurse.action = &kt_remove_operate_recurse_action;
- recurse.handle = &kt_remove_operate_recurse_handle;
+ main->cache.recurse.action = &kt_remove_operate_recurse_action;
+ main->cache.recurse.handle = &kt_remove_operate_recurse_handle;
- fl_directory_do(path, &recurse);
- if (F_status_is_error(recurse.state.status)) return recurse.state.status;
+ fl_directory_do(path, &main->cache.recurse);
+ if (F_status_is_error(main->cache.recurse.state.status)) return main->cache.recurse.state.status;
- f_status_t status_remove = F_no;
+ // Shrink path if oversized.
+ if (main->cache.recurse.path.used > kt_remove_allocation_large_d) {
+ const f_status_t status = f_memory_array_resize(kt_remove_allocation_normal_d, sizeof(f_char_t), (void **) &main->cache.recurse.path.string, &main->cache.recurse.path.used, &main->cache.recurse.path.size);
- // Remove the directory, if not simulating.
- if (!(main->setting.flag & kt_remove_main_flag_simulate_d)) {
- status_remove = kt_remove_operate_remove(main, path, flag_operate);
+ if (F_status_is_error(status)) {
+ kt_remove_print_error(&main->program.error, macro_kt_remove_f(f_memory_array_resize));
+
+ return status;
+ }
}
- {
- const f_status_t status = f_directory_recurse_do_delete(&recurse);
- if (F_status_is_error(status)) return status;
+ // Remove the directory, if not simulating.
+ if (main->setting.flag & kt_remove_main_flag_simulate_d) {
+ fll_print_dynamic(f_string_eol_s, main->program.output.to);
+
+ kt_remove_preprocess_file(main, path, 0, 0x2);
+ }
+ else {
+ return kt_remove_operate_remove(main, path, flag_operate);
}
- return status_remove;
+ return F_no;
}
#endif // _di_kt_remove_operate_directory_
#ifndef _di_kt_remove_operate_file_
- f_status_t kt_remove_operate_file(kt_remove_main_t * const main, const f_string_static_t path) {
+ f_status_t kt_remove_operate_file(kt_remove_main_t * const main, const f_string_static_t path, const uint8_t recurse) {
if (!main) return F_status_set_error(F_parameter);
if (!path.used) return F_data_not;
if (macro_kt_remove_signal_check(&main->program, &main->setting.state)) return F_status_set_error(F_interrupt);
- const uint32_t flag_operate = kt_remove_preprocess_file(main, path, 0);
+ const uint32_t flag_operate = kt_remove_preprocess_file(main, path, 0, recurse);
if (F_status_is_error(main->setting.state.status)) return main->setting.state.status;
if (flag_operate & kt_remove_flag_file_operate_processed_d) return F_no;
main->setting.state.status = kt_remove_operate_file_prompt(main, path, flag_operate);
if (F_status_is_error(main->setting.state.status)) return main->setting.state.status;
- return (flag_operate & kt_remove_flag_file_operate_directory_d)
+ return (flag_operate & kt_remove_flag_file_operate_directory_d) && !recurse
? kt_remove_operate_directory(main, path, flag_operate)
: !(main->setting.flag & kt_remove_main_flag_simulate_d)
? kt_remove_operate_remove(main, path, flag_operate)
if (macro_kt_remove_signal_check(&main->program, &main->setting.state)) return;
- const uint32_t flag_operate = kt_remove_preprocess_file(main, path, kt_remove_flag_file_operate_parent_d);
+ // @todo update this function, the related kt_remove_operate_file() has newer practices that need to be reflected here.
+ /*
+ const uint32_t flag_operate = kt_remove_preprocess_file(main, path, 0, recurse);
+
+ if (F_status_is_error(main->setting.state.status)) return main->setting.state.status;
+ if (flag_operate & kt_remove_flag_file_operate_processed_d) return F_no;
+
+ if (flag_operate & kt_remove_flag_file_operate_missing_d) {
+ if (!(main->setting.flag & kt_remove_main_flag_force_simulate_d)) {
+ main->setting.state.status = F_status_set_error(F_file_found_not);
+
+ kt_remove_print_error_file(&main->program.error, macro_kt_remove_f(kt_remove_preprocess_file), path, f_file_operation_delete_s, fll_error_file_type_file_e);
+
+ return main->setting.state.status;
+ }
+ }
+ else if (main->setting.state.status != F_skip) {
+ main->setting.state.status = kt_remove_operate_file_prompt(main, path, flag_operate);
+ if (F_status_is_error(main->setting.state.status)) return main->setting.state.status;
+
+ return !(main->setting.flag & kt_remove_main_flag_simulate_d)
+ ? kt_remove_operate_remove(main, path, flag_operate)
+ : F_no;
+ }*/
+
+ const uint32_t flag_operate = kt_remove_preprocess_file(main, path, kt_remove_flag_file_operate_parent_d, F_false);
if (!kt_remove_operate_shall_remove(flag_operate) || (main->setting.flag & kt_remove_main_flag_simulate_d)) return;
f_print_dynamic(f_string_eol_s, main->program.output.to);
}
- recurse->state.status = kt_remove_operate_file(main, recurse->path);
+ recurse->state.status = kt_remove_operate_file(main, recurse->path, F_true);
if (F_status_is_error_not(recurse->state.status)) {
recurse->state.status = F_okay;
* F_no (with error bit) on failure and file is not to be removed or cannot be removed.
* F_recurse (with error bit) on max recursion depth reached.
*
- * Errors (with error bit) from: f_directory_recurse_do_delete()
+ * Errors (with error bit) from: f_memory_array_resize()
* Errors (with error bit) from: fl_directory_do()
+ * Errors (with error bit) from: kt_remove_operate_remove()
*
- * @see f_directory_recurse_do_delete()
- * @see f_file_remove()
+ * @see f_memory_array_resize()
* @see fl_directory_do()
+ * @see kt_remove_operate_remove()
*/
#ifndef _di_kt_remove_operate_directory_
extern f_status_t kt_remove_operate_directory(kt_remove_main_t * const main, const f_string_static_t path, const uint32_t flag_operate);
* This should always be TRUE when calling from the top level.
* This should always be FALSE if calling from within a fl_directory_do() callback.
* This is because fl_directory_do() handles directory traversal and processing.
- * @param state
- * The state information for processing.
- * A new state should be created rather than using the main.setting.state to prevent conflicts during recursion.
- * The first state outside of recursion can use main.setting.state.
- *
- * Must not be NULL.
+ * @param recurse
+ * If F_true, then this function is being called during directory recursion.
+ * If F_false, then this function is being called outside of directory recursion.
*
* @return
* F_yes on success and removed.
* @see kt_remove_preprocess_file()
*/
#ifndef _di_kt_remove_operate_file_
- extern f_status_t kt_remove_operate_file(kt_remove_main_t * const main, const f_string_static_t path);
+ extern f_status_t kt_remove_operate_file(kt_remove_main_t * const main, const f_string_static_t path, const uint8_t recurse);
#endif // _di_kt_remove_operate_file_
/**
* Must not be NULL.
*
* This does not alter main.setting.state.status.
- *
* @param path
* The path to the file to operate on.
+ * @param flag_operate
+ * The operate file specific flags from kt_remove_flag_file_operate_*_e.
*
* @return
* F_okay on success or if prompting is not requested.
#endif
#ifndef _di_kt_remove_preprocess_file_
- uint16_t kt_remove_preprocess_file(kt_remove_main_t * const main, const f_string_static_t path, const uint32_t flag_operate) {
+ uint16_t kt_remove_preprocess_file(kt_remove_main_t * const main, const f_string_static_t path, const uint32_t flag_operate, const uint8_t recurse) {
if (!main) return 0;
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;
- kt_remove_print_simulate_operate_file(&main->program.output, path, flag_operate);
-
main->setting.state.status = f_file_exists(path, main->setting.flag & kt_remove_main_flag_follow_d);
if (main->setting.state.status == F_true) {
const f_status_t status = f_file_is(path, F_file_type_link_d, F_false);
if (F_status_is_error(status)) {
+ kt_remove_print_simulate_operate_file(&main->program.output, simulate, path, flag_operate);
+
main->setting.state.status = status;
remove_print_warning_file_reason(&main->program.warning, path, kt_remove_print_reason_stat_fail_s);
flag_out |= kt_remove_flag_file_operate_link_d;
}
}
+ else if (main->setting.state.status == F_false || 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_exists(&main->program.output, path, flag_out);
+ kt_remove_print_simulate_operate_file_exists(&main->program.output, simulate, path, flag_out);
- if (main->setting.state.status == F_false) {
- if (main->setting.flag & kt_remove_main_flag_simulate_d) {
- kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_ignore_s, main->setting.flag & kt_remove_main_flag_force_d);
- }
+ if (main->setting.state.status == 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);
- return kt_remove_flag_file_operate_missing_d;
- }
+ return kt_remove_flag_file_operate_missing_d;
+ }
- if (F_status_is_error(main->setting.state.status)) {
remove_print_warning_file_reason(&main->program.warning, path, kt_remove_print_reason_no_access_s);
return 0;
}
- if (main->setting.state.status == F_false) {
- kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_remove_s, F_false);
-
- return 0;
- }
-
if (macro_kt_remove_signal_check(&main->program, &main->setting.state)) return 0;
if (main->setting.flag & kt_remove_main_flag_follow_d) {
memset(&statistics, 0, sizeof(struct stat));
- 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)) {
- remove_print_warning_file_reason(&main->program.warning, path, kt_remove_print_reason_stat_fail_s);
-
- return flag_out;
+ if (recurse == 0x2) {
+ memcpy(&statistics, &main->cache.statistics, sizeof(struct stat));
}
+ else {
+ main->setting.state.status = f_file_stat(path, main->setting.flag & kt_remove_main_flag_follow_d, &statistics);
- kt_remove_preprocess_file_type(main, 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, 0x1, &flag_out);
+ if (F_status_is_error(main->setting.state.status)) {
+ kt_remove_print_simulate_operate_file(&main->program.output, simulate, path, flag_operate);
- kt_remove_preprocess_file_type(main, 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, 0x1, &flag_out);
+ kt_remove_print_simulate_operate_file_exists(&main->program.output, simulate, path, flag_out);
- kt_remove_preprocess_file_type(main, 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, 0x1, &flag_out);
+ remove_print_warning_file_reason(&main->program.warning, path, kt_remove_print_reason_stat_fail_s);
+
+ return flag_out;
+ }
+ }
if (macro_f_file_type_is_directory(statistics.st_mode)) {
flag_out |= kt_remove_flag_file_operate_directory_d;
+
+ if (!recurse) {
+ memcpy(&main->cache.statistics, &statistics, sizeof(struct stat));
+ }
}
- kt_remove_preprocess_file_type(main, 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, 0x1, &flag_out);
+ // 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, simulate, path, flag_operate);
- kt_remove_preprocess_file_type(main, 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, 0x1, &flag_out);
+ kt_remove_print_simulate_operate_file_exists(&main->program.output, simulate, path, flag_out);
- kt_remove_preprocess_file_type(main, 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, 0x3, &flag_out);
+ 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, 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, 0x1, &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, 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, 0x0, &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);
- if (!(main->setting.flag & kt_remove_main_flag_simulate_d) && (flag_out & kt_remove_flag_file_operate_remove_fail_d)) return 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 | 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_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_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, 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);
+
+ if (!simulate && (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
- kt_remove_print_simulate_operate_id(&main->program.output, (f_number_unsigned_t) statistics.st_uid, F_true);
+ if (simulate & ~0x10) {
+ kt_remove_print_simulate_operate_id(&main->program.output, simulate, (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, kt_remove_same_s, statistics.st_uid == geteuid());
+ kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, 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, kt_remove_different_s, statistics.st_uid != geteuid());
+ kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, 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, (f_number_unsigned_t) statistics.st_gid, F_false);
+ kt_remove_print_simulate_operate_id(&main->program.output, simulate, (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, (f_number_unsigned_t) mode, f_string_empty_s);
+ kt_remove_print_simulate_operate_mode(&main->program.output, simulate, (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, (f_number_unsigned_t) main->setting.modes.array[i].mode, modes[j]);
+ kt_remove_print_simulate_operate_mode(&main->program.output, simulate, (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, path, flag_operate, statistics);
+ kt_remove_preprocess_file_dates(main, simulate, 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, kt_remove_empty_s, main->setting.state.status);
+ kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, 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 (flag_out & kt_remove_flag_file_operate_directory_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));
+ 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));
}
if (main->setting.flag & kt_remove_main_flag_tree_d) {
- kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_parent_s, flag_operate & kt_remove_flag_file_operate_parent_d);
+ kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, 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, kt_remove_prompt_s, main->setting.flag & kt_remove_main_flag_prompt_each_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);
}
else if (main->setting.flag & kt_remove_main_flag_prompt_follow_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));
+ 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));
}
else if (main->setting.flag & kt_remove_main_flag_prompt_once_d) {
- 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_prompt_s, !(main->setting.prompt));
}
}
- kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_remove_s, kt_remove_operate_shall_remove(flag_out));
+ kt_remove_print_simulate_operate_boolean(&main->program.output, simulate, 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)) {
+ if ((main->setting.flag & kt_remove_main_flag_tree_d) && !(flag_operate & kt_remove_flag_file_operate_child_d) && !recurse) {
f_range_t range = macro_f_range_t_initialize_2(path.used);
if (range.stop > range.start) {
#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 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 uint8_t simulate, 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, names[i], result, times[i], dates[i]->array[j], name_type);
+ kt_remove_print_simulate_operate_date(&main->program.output, simulate, 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 f_string_static_t path, const bool is, f_string_static_t name, const uint64_t type, const uint64_t ignore, const uint8_t code, 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 bool is, f_string_static_t name, const uint64_t type, const uint64_t ignore, uint32_t * const flag_out) {
if (!main || !flag_out) return;
*flag_out |= kt_remove_flag_file_operate_remove_d;
}
else if (main->setting.flag & kt_remove_main_flag_option_type_d) {
- kt_remove_print_error_file_is_a(&main->program.error, path, name, code);
+ kt_remove_print_error_file_is_a(&main->program.error, path, name, simulate & kt_remove_flag_simulate_is_a_file_d);
*flag_out |= kt_remove_flag_file_operate_remove_fail_d;
}
}
if (is || (main->setting.flag & type) && !(main->setting.flag & ignore)) {
- kt_remove_print_simulate_operate_boolean(&main->program.output, name, is);
+ kt_remove_print_simulate_operate_boolean(&main->program.output, simulate & ~kt_remove_flag_simulate_is_a_file_d, name, is);
}
}
#endif // _di_kt_remove_preprocess_file_type_
* The path to the file to operate on.
* @param flag_operate
* The operate file specific flags from kt_remove_flag_file_operate_*_e.
+ * @param recurse
+ * If F_true as 0x1, then this function is being called during directory recursion.
+ * If F_true as 0x2, then this funtion is being called during directory recursion and it represents the parent directory being recursed.
+ * If F_false, then this function is being called outside of directory recursion.
*
* @return
* The resulting flags determined by the pre-process.
* @see kt_remove_preprocess_file_dates()
*/
#ifndef _di_kt_remove_preprocess_file_
- extern uint16_t kt_remove_preprocess_file(kt_remove_main_t * const main, const f_string_static_t path, const uint32_t flag_operate);
+ extern uint16_t kt_remove_preprocess_file(kt_remove_main_t * const main, const f_string_static_t path, const uint32_t flag_operate, const uint8_t recurse);
#endif // _di_kt_remove_preprocess_file_
/**
* 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 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 uint8_t simulate, const f_string_static_t path, const uint32_t flag_operate, const struct stat statistics);
#endif // _di_kt_remove_preprocess_file_dates_
/**
* F_yes on date matched.
* F_no on no matches.
* F_parameter (with error bit) if a parameter is invalid.
+ * @param simulate
+ * Values 0x1 and 0x2 are intended to be passed to kt_remove_print_error_file_is_a() as needed.
+ * Other values:
+ * - 0x4: Simulate, non-directory.
+ * - 0x8: Simulate directory, recurse.
+ * - 0x10: Simulate directory, not recurse.
+ * - 0x1c: Any of these bits set (0x4, 0x8, and 0x10), then simulate is enabled.
* @param path
* The path to the file to operate on.
* @param is
* A flag from the kt_remove_main_flag_*_d representing the file type.
* @param ignore
* A flag from the kt_remove_main_flag_*_ignore_d representing the file type ignore flag.
- * @param code
- * A code intended to be passed to kt_remove_print_error_file_is_a() as needed.
* @param flag_out
* The return flag to modify if needed.
*
* 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 f_string_static_t path, const bool is, f_string_static_t name, const uint64_t type, const uint64_t ignore, const uint8_t code, 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 bool 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
fl_print_format("%[%Q%]", print->to, print->set->notable, path, print->set->notable);
fl_print_format("%[', is ", print->to, print->set->error);
- if (code & 0x1) {
+ if (code & kt_remove_flag_simulate_is_a_d) {
fl_print_format("a ", print->to);
}
fl_print_format("%Q", print->to, is);
- if (code & 0x2) {
+ if (code & kt_remove_flag_simulate_is_file_d) {
fl_print_format(" file", print->to);
}
* @param is
* Designate what the file is.
* @param code
- * Set to 0x1 to print an ' a' before the 'is' parameter.
- * Set to 0x2 to print ' file' after the 'is' parameter.
+ * The code from the "is" parts of kt_remove_flag_simulate_is_*_d:
+ * - a: Print an ' a' before the 'is' parameter.
+ * - file: Print ' file' after the 'is' parameter.
*
* @return
* F_okay on success.
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 f_string_static_t name, const bool yes) {
-
- if (!print || !print->custom) return F_status_set_error(F_output_not);
+ 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) {
- 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;
+ 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 %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 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 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) {
- 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;
+ if (!print) return F_status_set_error(F_output_not);
+ if (!simulate || (simulate & kt_remove_flag_simulate_directory_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 f_string_static_t path, const uint32_t flag) {
+ 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) {
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 f_string_static_t path, const uint32_t flag) {
+ 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) {
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 f_number_unsigned_t id, const bool is_user) {
+ 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) {
- 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;
+ 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 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 uint8_t simulate, const f_number_unsigned_t mode, const f_string_static_t match) {
- 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;
+ 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 f_string_static_t name, const bool yes);
+ 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);
#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 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 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);
#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 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 uint8_t simulate, 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 f_string_static_t path, const uint32_t flag);
+ 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);
#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 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 uint8_t simulate, const f_number_unsigned_t id, const bool 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 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 uint8_t simulate, const f_number_unsigned_t mode, const f_string_static_t match);
#endif // _di_kt_remove_print_simulate_operate_mode_
#ifdef __cplusplus
for (; i < main->setting.files.used; ++i) {
- main->setting.state.status = kt_remove_operate_file(main, main->setting.files.array[i]);
+ main->setting.state.status = kt_remove_operate_file(main, main->setting.files.array[i], F_false);
if ((main->setting.flag & kt_remove_main_flag_simulate_d) && i + 1 < main->setting.files.used && (F_status_is_error_not(main->setting.state.status) || F_status_set_fine(main->setting.state.status) == F_interrupt)) {
f_print_dynamic(f_string_eol_s, main->program.output.to);
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e);
+
+ // 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_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);
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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e);
+
+ // 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_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);
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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e);
+
+ // 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_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_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 child = macro_f_string_static_t_initialize_1("child", 0, 5);
struct stat statistics;
struct stat statistics_regular;
// 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+
+ // Child
+ 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_e | f_directory_recurse_do_flag_regular_e);
+ 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);
// 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);
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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e);
+
+ // 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_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);
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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e);
+
+ // 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_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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
// Directory processing.
will_return(__wrap_f_directory_empty, F_true);
- 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, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
// 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);
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, &stat_regular);
will_return(__wrap_f_file_stat, F_okay);
-
- // Target Directory processing, begin.
- will_return(__wrap_fl_directory_do, 2);
-
- // The first child processing.
- will_return(__wrap_fl_directory_do, &child_1);
- will_return(__wrap_fl_directory_do, &child_1);
- will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_regular_e);
will_return(__wrap_f_file_remove, F_okay);
- // Target Directory processing, continue.
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
will_return(__wrap_f_directory_remove, F_okay);
const int result = kt_main_test__remove(3, argv, 0);
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, &stat_regular);
will_return(__wrap_f_file_stat, F_okay);
-
- // Target Directory processing, begin.
- will_return(__wrap_fl_directory_do, 2);
-
- // The first child processing.
- will_return(__wrap_fl_directory_do, &child_1);
- will_return(__wrap_fl_directory_do, &child_1);
- will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_regular_e);
will_return(__wrap_f_file_remove, F_okay);
- // Target Directory processing, continue.
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
will_return(__wrap_f_directory_remove, F_okay);
const int result = kt_main_test__remove(3, argv, 0);
will_return(__wrap_f_directory_empty, F_false);
will_return(__wrap_fl_directory_do, 2);
- // The first child pre-processing.
+ // The first child processing.
will_return(__wrap_fl_directory_do, &child_1);
will_return(__wrap_fl_directory_do, &child_1);
will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_regular_e);
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, &stat_regular);
will_return(__wrap_f_file_stat, F_okay);
+ will_return(__wrap_f_file_remove, F_okay);
- // The second child pre-processing.
+ // The second child processing.
will_return(__wrap_fl_directory_do, &child_2);
will_return(__wrap_fl_directory_do, &child_2);
will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_regular_e);
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, &stat_regular);
will_return(__wrap_f_file_stat, F_okay);
-
- // Target Directory processing, begin.
- will_return(__wrap_fl_directory_do, 3);
-
- // The first child processing.
- will_return(__wrap_fl_directory_do, &child_1);
- will_return(__wrap_fl_directory_do, &child_1);
- will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_regular_e);
- will_return(__wrap_f_file_remove, F_okay);
-
- // The second child processing.
- will_return(__wrap_fl_directory_do, &child_2);
- will_return(__wrap_fl_directory_do, &child_2);
- will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_regular_e);
will_return(__wrap_f_file_remove, F_okay);
- // Target Directory processing, continue.
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
will_return(__wrap_f_directory_remove, F_okay);
const int result = kt_main_test__remove(3, argv, 0);
will_return(__wrap_f_directory_empty, F_false);
will_return(__wrap_fl_directory_do, 2);
- // The first child pre-processing.
+ // The first child processing.
will_return(__wrap_fl_directory_do, &child_1);
will_return(__wrap_fl_directory_do, &child_1);
will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_regular_e);
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, &stat_regular);
will_return(__wrap_f_file_stat, F_okay);
+ will_return(__wrap_f_file_remove, F_okay);
- // The second child pre-processing.
+ // The second child processing.
will_return(__wrap_fl_directory_do, &child_2);
will_return(__wrap_fl_directory_do, &child_2);
will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_regular_e);
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, &stat_regular);
will_return(__wrap_f_file_stat, F_okay);
-
- // Target Directory processing, begin.
- will_return(__wrap_fl_directory_do, 3);
-
- // The first child processing.
- will_return(__wrap_fl_directory_do, &child_1);
- will_return(__wrap_fl_directory_do, &child_1);
- will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_regular_e);
- will_return(__wrap_f_file_remove, F_okay);
-
- // The second child processing.
- will_return(__wrap_fl_directory_do, &child_2);
- will_return(__wrap_fl_directory_do, &child_2);
- will_return(__wrap_fl_directory_do, f_directory_recurse_do_flag_action_e | f_directory_recurse_do_flag_regular_e);
will_return(__wrap_f_file_remove, F_okay);
- // Target Directory processing, continue.
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
will_return(__wrap_f_directory_remove, F_okay);
const int result = kt_main_test__remove(3, argv, 0);
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
const f_string_t argv[] = { "mocked_main", target.string, "-" KT_REMOVE_short_mode_s, kt_remove_mode_word_different_s.string, params[param], 0 };
- struct stat stat_file;
+ struct stat statistics;
- memset(&stat_file, 0, sizeof(struct stat));
+ memset(&statistics, 0, sizeof(struct stat));
// The unknown type at the last index requires '&' logic rather than '|' logic.
- stat_file.st_mode = types[type] == ~S_IFMT
+ statistics.st_mode = types[type] == ~S_IFMT
? modes[mode] & types[type]
: modes[mode] | types[type];
// Pre-process file.
will_return(__wrap_f_file_exists, F_true);
- will_return(__wrap_f_file_is, macro_f_file_type_is_link(stat_file.st_mode));
- will_return(__wrap_f_file_stat, &stat_file);
+ 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);
// Process file.
if (param != mode) {
- if (macro_f_file_type_is_directory(stat_file.st_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, 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
}
}
else {
- if (macro_f_file_type_is_directory(stat_file.st_mode)) {
+ if (macro_f_file_type_is_directory(statistics.st_mode)) {
will_return(__wrap_f_directory_empty, F_true);
}
}
const f_string_t argv[] = { "mocked_main", target.string, "-" KT_REMOVE_short_mode_s, kt_remove_mode_word_same_s.string, params[param], 0 };
- struct stat stat_file;
+ struct stat statistics;
- memset(&stat_file, 0, sizeof(struct stat));
+ memset(&statistics, 0, sizeof(struct stat));
// The unknown type at the last index requires '&' logic rather than '|' logic.
- stat_file.st_mode = types[type] == ~S_IFMT
+ statistics.st_mode = types[type] == ~S_IFMT
? modes[mode] & types[type]
: modes[mode] | types[type];
// Pre-process file.
will_return(__wrap_f_file_exists, F_true);
- will_return(__wrap_f_file_is, macro_f_file_type_is_link(stat_file.st_mode));
- will_return(__wrap_f_file_stat, &stat_file);
+ 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);
// Process file.
if (param == mode) {
- if (macro_f_file_type_is_directory(stat_file.st_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, 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
}
}
else {
- if (macro_f_file_type_is_directory(stat_file.st_mode)) {
+ if (macro_f_file_type_is_directory(statistics.st_mode)) {
will_return(__wrap_f_directory_empty, F_true);
}
}
const f_string_t argv[] = { "mocked_main", target.string, "-" KT_REMOVE_short_mode_s, kt_remove_mode_word_similar_s.string, params[param], 0 };
- struct stat stat_file;
+ struct stat statistics;
- memset(&stat_file, 0, sizeof(struct stat));
+ memset(&statistics, 0, sizeof(struct stat));
// The unknown type at the last index requires '&' logic rather than '|' logic.
- stat_file.st_mode = types[type] == ~S_IFMT
+ statistics.st_mode = types[type] == ~S_IFMT
? modes[mode] & types[type]
: modes[mode] | types[type];
// Pre-process file.
will_return(__wrap_f_file_exists, F_true);
- will_return(__wrap_f_file_is, macro_f_file_type_is_link(stat_file.st_mode));
- will_return(__wrap_f_file_stat, &stat_file);
+ 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);
// Process file.
if (modes[param] & modes[mode]) {
- if (macro_f_file_type_is_directory(stat_file.st_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, 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
}
}
else {
- if (macro_f_file_type_is_directory(stat_file.st_mode)) {
+ if (macro_f_file_type_is_directory(statistics.st_mode)) {
will_return(__wrap_f_directory_empty, F_true);
}
}
const f_string_t argv[] = { "mocked_main", target.string, "-" KT_REMOVE_short_mode_s, kt_remove_mode_word_not_s.string, params[param], 0 };
- struct stat stat_file;
+ struct stat statistics;
- memset(&stat_file, 0, sizeof(struct stat));
+ memset(&statistics, 0, sizeof(struct stat));
// The unknown type at the last index requires '&' logic rather than '|' logic.
- stat_file.st_mode = types[type] == ~S_IFMT
+ statistics.st_mode = types[type] == ~S_IFMT
? modes[mode] & types[type]
: modes[mode] | types[type];
// Pre-process file.
will_return(__wrap_f_file_exists, F_true);
- will_return(__wrap_f_file_is, macro_f_file_type_is_link(stat_file.st_mode));
- will_return(__wrap_f_file_stat, &stat_file);
+ 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);
// Process file.
if (modes[param] != modes[mode]) {
- if (macro_f_file_type_is_directory(stat_file.st_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, 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
}
}
else {
- if (macro_f_file_type_is_directory(stat_file.st_mode)) {
+ if (macro_f_file_type_is_directory(statistics.st_mode)) {
will_return(__wrap_f_directory_empty, F_true);
}
}
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, 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
stats[2].st_gid = 1;
stats[3].st_gid = 2;
- for (uint8_t i = 0; i < total; ++i) {
+ for (uint8_t type = 0; type < total; ++type) {
will_return(__wrap_f_account_group_id_by_name, group_id);
will_return(__wrap_f_account_group_id_by_name, F_okay);
// Pre-process file.
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, &stats[i]);
+ will_return(__wrap_f_file_stat, &stats[type]);
will_return(__wrap_f_file_stat, F_okay);
// Process file.
- if (stats[i].st_gid == group_id) {
- if (macro_f_file_type_is_directory(stats[i].st_mode)) {
+ 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, 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
}
}
else {
- if (macro_f_file_type_is_directory(stats[i].st_mode)) {
+ if (macro_f_file_type_is_directory(stats[type].st_mode)) {
will_return(__wrap_f_directory_empty, F_true);
}
}
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
if (time_spec_removes[date]) {
if (macro_f_file_type_is_directory(stats[type].st_mode)) {
- 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
stats[2].st_uid = 1;
stats[3].st_uid = 2;
- for (uint8_t i = 0; i < total; ++i) {
+ for (uint8_t type = 0; type < total; ++type) {
will_return(__wrap_geteuid, user_id);
will_return(__wrap_geteuid, user_id);
// Pre-process file.
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, &stats[i]);
+ will_return(__wrap_f_file_stat, &stats[type]);
will_return(__wrap_f_file_stat, F_okay);
// Process file.
- if (stats[i].st_uid == user_id) {
- if (macro_f_file_type_is_directory(stats[i].st_mode)) {
+ 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);
}
}
else {
- if (macro_f_file_type_is_directory(stats[i].st_mode)) {
+ 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, 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
stats[2].st_uid = 1;
stats[3].st_uid = 2;
- for (uint8_t i = 0; i < total; ++i) {
+ for (uint8_t type = 0; type < total; ++type) {
will_return(__wrap_f_account_id_by_name, user_id);
will_return(__wrap_f_account_id_by_name, F_okay);
// Pre-process file.
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, &stats[i]);
+ will_return(__wrap_f_file_stat, &stats[type]);
will_return(__wrap_f_file_stat, F_okay);
// Process file.
- if (stats[i].st_uid == user_id) {
- if (macro_f_file_type_is_directory(stats[i].st_mode)) {
+ 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, 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
}
}
else {
- if (macro_f_file_type_is_directory(stats[i].st_mode)) {
+ if (macro_f_file_type_is_directory(stats[type].st_mode)) {
will_return(__wrap_f_directory_empty, F_true);
}
}
stats[2].st_uid = 1;
stats[3].st_uid = 2;
- for (uint8_t i = 0; i < total; ++i) {
+ for (uint8_t type = 0; type < total; ++type) {
will_return(__wrap_geteuid, user_id);
will_return(__wrap_geteuid, user_id);
// Pre-process file.
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, &stats[i]);
+ will_return(__wrap_f_file_stat, &stats[type]);
will_return(__wrap_f_file_stat, F_okay);
// Process file.
- if (stats[i].st_uid == user_id) {
- if (macro_f_file_type_is_directory(stats[i].st_mode)) {
+ 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, 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_e | f_directory_recurse_do_flag_directory_e | f_directory_recurse_do_flag_top_after_e);
+ will_return(__wrap_fl_directory_do, 0);
+ will_return(__wrap_fl_directory_do, F_okay);
+
will_return(__wrap_f_directory_remove, F_okay);
}
else {
}
}
else {
- if (macro_f_file_type_is_directory(stats[i].st_mode)) {
+ if (macro_f_file_type_is_directory(stats[type].st_mode)) {
will_return(__wrap_f_directory_empty, F_true);
}
}