]> Kevux Git Server - fll/commitdiff
Progress: Additional file copy, clone, and move changes.
authorKevin Day <kevin@kevux.org>
Sun, 16 Apr 2023 03:19:04 +0000 (22:19 -0500)
committerKevin Day <kevin@kevux.org>
Sun, 16 Apr 2023 03:19:04 +0000 (22:19 -0500)
Remove code relating to the recursive copy functions.
Remove the fll_file_move() function.

The fll_file_move() has some additional logic for handling a case where the return status is F_mount.
If this is still a problem then I will have to address this.
The fll_file_move() doesn't make as much sense now that thee is an fl_directory_do().
Most of the logic needed is now outside of the FLL project and inside of the projects utilizing the library.

The fl_directory_copy() function is now fully replaced by the fl_directory_do() function.
This has an upside of being more flexible but a downside of putting more of the design burden onto the caller.
This overall appears to be resulting in a cleaner and simpler design.

Move the fl_directory_do() related callbacks into a new source and header file in Featureless Make.

I have noticed a regression, of which I would wildly guess be related to the recent cache design changes, where testing Featureless Make against bzip is not working anymore.
There is a path separator at the start of the files when there should not be.
This regression is not fixed here.
I only wanted to record it.

25 files changed:
build/stand_alone/fake.config.h
build/stand_alone/fake.settings
level_0/f_directory/c/directory/type.c
level_0/f_directory/c/directory/type.h
level_1/fl_directory/c/directory.c
level_1/fl_directory/c/directory.h
level_1/fl_directory/c/private-directory.c
level_1/fl_directory/c/private-directory.h
level_2/fll_file/c/file.c
level_2/fll_file/c/file.h
level_3/fake/c/main/build.c
level_3/fake/c/main/build.h
level_3/fake/c/main/build/print/verbose.c
level_3/fake/c/main/build/print/verbose.h
level_3/fake/c/main/common/enumeration.h
level_3/fake/c/main/common/print.c
level_3/fake/c/main/common/print.h
level_3/fake/c/main/fake.h
level_3/fake/c/main/fake/do.c [new file with mode: 0644]
level_3/fake/c/main/fake/do.h [new file with mode: 0644]
level_3/fake/c/main/make/operate_process_type.c
level_3/fake/c/main/make/operate_process_type.h
level_3/fake/c/main/print/verbose.c
level_3/fake/c/main/print/verbose.h
level_3/fake/data/build/settings

index c83ec0d0e64d430c428a43a6d13e58fc71fabc95..08cb93e12488e4a835a45ffc8f9a56fbfe8c8c39 100644 (file)
 #define _di_f_directory_mode_
 //#define _di_f_directory_open_
 #define _di_f_directory_open_at_
-//#define _di_f_directory_recurse_copy_delete_
-#define _di_f_directory_recurse_copy_destroy_
-//#define _di_f_directory_recurse_copy_flag_e_
-//#define _di_f_directory_recurse_copy_t_
-#define _di_f_directory_recurse_do_delete_
+//#define _di_f_directory_recurse_do_delete_
 #define _di_f_directory_recurse_do_destroy_
-#define _di_f_directory_recurse_do_flag_e_
-#define _di_f_directory_recurse_do_t_
+//#define _di_f_directory_recurse_do_flag_e_
+//#define _di_f_directory_recurse_do_t_
 //#define _di_f_directory_remove_
 //#define _di_f_directory_remove_custom_
 #define _di_f_directory_s_
 #define _di_fl_conversion_dynamic_to_unsigned_
 //#define _di_fl_conversion_dynamic_to_unsigned_detect_
 
-//#define _di_fl_directory_copy_
 //#define _di_fl_directory_create_
-#define _di_fl_directory_do_
+//#define _di_fl_directory_do_
 //#define _di_fl_directory_list_
 #define _di_fl_directory_path_pop_
 #define _di_fl_directory_path_push_
 #define _di_f_string_append_assure_
 #define _di_f_string_append_assure_nulless_
 #define _di_f_string_append_mash_
-#define _di_f_string_append_nulless_
+//#define _di_f_string_append_nulless_
 //#define _di_f_string_ascii_s_
 #define _di_f_string_constant_t_
 #define _di_f_string_dynamic_adjust_
index c08936d5b1011e63db483a4a9789aaec840f94e1..1d8852315659c4f043080d04d58e83c82e94a9af 100644 (file)
@@ -81,7 +81,7 @@ build_sources_program fll/level_2/program.c fll/level_2/program/common.c fll/lev
 build_sources_program program/fake/main/build.c program/fake/main/clean.c program/fake/main/common.c program/fake/main/fake.c program/fake/main/make.c program/fake/main/print/common.c program/fake/main/print/context.c program/fake/main/print/error.c program/fake/main/print/message.c program/fake/main/print/operation.c program/fake/main/print/warning.c program/fake/main/print/verbose.c program/fake/main/signal.c program/fake/main/skeleton.c program/fake/main/thread.c
 build_sources_program program/fake/main/build/enumeration.c program/fake/main/build/library.c program/fake/main/build/load.c program/fake/main/build/object.c program/fake/main/build/objects.c program/fake/main/build/print/compile.c program/fake/main/build/print/error.c program/fake/main/build/print/message.c program/fake/main/build/print/verbose.c program/fake/main/build/print/warning.c program/fake/main/build/program.c program/fake/main/build/skeleton.c program/fake/main/build/string.c
 build_sources_program program/fake/main/common/define.c program/fake/main/common/enumeration.c program/fake/main/common/print.c program/fake/main/common/string.c program/fake/main/common/type.c
-build_sources_program program/fake/main/fake/path_generate.c
+build_sources_program program/fake/main/fake/path_generate.c program/fake/main/fake/do.c
 build_sources_program program/fake/main/make/load_fakefile.c program/fake/main/make/load_parameters.c program/fake/main/make/operate_block.c program/fake/main/make/operate.c program/fake/main/make/operate_process.c program/fake/main/make/operate_process_type.c program/fake/main/make/operate_validate.c program/fake/main/make/operate_validate_type.c program/fake/main/make/print/error.c program/fake/main/make/print/message.c program/fake/main/make/print/verbose.c program/fake/main/make/print/warning.c
 
 build_sources_program program/fake/main/main.c
index ad1fc922a57d850d1491c8f6333ff37d22f8f749..ab54806a37b59477fc638262979f0f32ed07eb50 100644 (file)
@@ -43,30 +43,6 @@ extern "C" {
   }
 #endif // _di_f_directory_listing_destroy_
 
-#ifndef _di_f_directory_recurse_copy_delete_
-  f_status_t f_directory_recurse_copy_delete(f_directory_recurse_copy_t * const recurse) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!recurse) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    f_directory_listing_delete(&recurse->listing);
-
-    return F_none;
-  }
-#endif // _di_f_directory_recurse_copy_delete_
-
-#ifndef _di_f_directory_recurse_copy_destroy_
-  f_status_t f_directory_recurse_copy_destroy(f_directory_recurse_copy_t * const recurse) {
-    #ifndef _di_level_0_parameter_checking_
-      if (!recurse) return F_status_set_error(F_parameter);
-    #endif // _di_level_0_parameter_checking_
-
-    f_directory_listing_destroy(&recurse->listing);
-
-    return F_none;
-  }
-#endif // _di_f_directory_recurse_copy_destroy_
-
 #ifndef _di_f_directory_recurse_do_delete_
   f_status_t f_directory_recurse_do_delete(f_directory_recurse_do_t * const recurse) {
     #ifndef _di_level_0_parameter_checking_
index 29f46b52e853d89e0c834d1b41cdbfc08d59e040..d6677d999a726afa90ff38a7f5632585acf6306d 100644 (file)
@@ -112,111 +112,6 @@ extern "C" {
 #endif // _di_f_directory_statuss_t_
 
 /**
- * A structure containing directory recursion information for copy or clone operations.
- *
- * The flag is processed as follows (using f_file_stat_flags_*_e):
- *   - f_file_stat_flag_exclusive_e:
- *     - If set, fail when file already exists.
- *     - If not set, do not fail if file already exists (existing file will be replaced).
- *   - f_file_stat_flag_reference_e:
- *     - If set, operate directly on a link rather than what it references.
- *     - If not set, dereference any links.
- *
- * For clone operations:
- *   - f_file_stat_flag_group_e:
- *     - If set, copy the group ids.
- *     - If not set, do not copy the group ids.
- *   - f_file_stat_flag_owner_e:
- *     - If set, copy the owner ids.
- *     - If not set, do not copy the owner ids.
- *
- *   (For a clone operation, the file mode is always copied.)
- *
- * The verbose() callbacks provide full access to this f_directory_recurse_copy_t structure.
- * These callbacks must take care to properly modify the structure or they could cause security, integrity, or functionality problems.
- *
- * flag:            A set of flags used exclusively by the directory recurse process (not to be confused with state.flag).
- * max_depth:       The maximum recursion depth to use.
- * size_block:      The default number of chunks to read at a time with each chunk being 1-byte (Must be greater than 0).
- * depth:           A number representing the depth recursed thus far (generally assigned internally).
- * mode:            A pointer to the mode, used for error handling and printing (generally assigned internally).
- * state:           A pointer to the state information.
- * listing:         A directory listing structure used internally to help reduce repeated memory allocation overhead.
- * source:          A pointer to the source string, used for error handling and printing (generally assigned internally).
- * source_top:      A pointer to the top source string, used for error handling and printing (generally assigned internally).
- * destination:     A pointer to the destination string, used for error handling and printing (generally assigned internally).
- * destination_top: A pointer to the top destination string, used for error handling and printing (generally assigned internally).
- * verbose:         A callback used for printing verbose messages (Set to NULL to not use).
- *
- * The macro_f_directory_recurse_copy_t_initialize_1() all arguments.
- * The macro_f_directory_recurse_copy_t_initialize_2() all arguments except for internally managed source, destination, mode, and depth.
- */
-#ifndef _di_f_directory_recurse_copy_t_
-  typedef struct {
-    f_number_unsigned_t max_depth;
-    f_number_unsigned_t size_block;
-    uint8_t flag;
-    f_array_length_t depth;
-
-    f_mode_t mode;
-    f_state_t state;
-    f_directory_listing_t listing;
-
-    const f_string_static_t *source;
-    const f_string_static_t *source_top;
-    const f_string_static_t *destination;
-    const f_string_static_t *destination_top;
-
-    void (*verbose)(const f_string_static_t source, const f_string_static_t destination, void * const recurse);
-  } f_directory_recurse_copy_t;
-
-  #define f_directory_recurse_copy_t_initialize { \
-    F_directory_max_recurse_depth_d, \
-    F_file_default_read_size_d, \
-    F_file_flag_write_only_d, \
-    0, \
-    f_mode_t_initialize, \
-    f_state_t_initialize, \
-    f_directory_listing_t_initialize, \
-    0, \
-    0, \
-    0, \
-    0, \
-    0, \
-  }
-
-  #define macro_f_directory_recurse_copy_t_initialize_1(max_depth, size_block, flag, depth, mode, state, listing, source, source_top, destination, destination_top, verbose) { \
-    max_depth, \
-    size_block, \
-    flag, \
-    depth, \
-    mode, \
-    state, \
-    listing, \
-    source, \
-    source_top, \
-    destination, \
-    destination_top, \
-    verbose, \
-  }
-
-  #define macro_f_directory_recurse_copy_t_initialize_2(max_depth, size_block, flag, depth, mode, state, verbose) { \
-    max_depth, \
-    size_block, \
-    flag, \
-    depth,\
-    mode, \
-    state, \
-    f_directory_listing_t_initialize, \
-    0, \
-    0, \
-    0, \
-    0, \
-    verbose, \
-  }
-#endif // _di_f_directory_recurse_copy_t_
-
-/**
  * A structure containing directory recursion information.
  *
  * The action() callback provide full access to this f_directory_recurse_do_t structure.
@@ -365,44 +260,6 @@ extern "C" {
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  *
- *   Errors (with error bit) from: f_string_dynamics_resize().
- *
- * @see f_string_dynamics_resize()
- */
-#ifndef _di_f_directory_recurse_copy_delete_
-  extern f_status_t f_directory_recurse_copy_delete(f_directory_recurse_copy_t * const recurse);
-#endif // _di_f_directory_recurse_copy_delete_
-
-/**
- * Destroy all non-pointer based dynamic arrays within the recurse.
- *
- * @param recurse
- *   The recurse to fully destroy.
- *
- * @return
- *   F_none on success.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- *   Errors (with error bit) from: f_string_dynamics_adjust().
- *
- * @see f_string_dynamics_adjust()
- */
-#ifndef _di_f_directory_recurse_copy_destroy_
-  extern f_status_t f_directory_recurse_copy_destroy(f_directory_recurse_copy_t * const recurse);
-#endif // _di_f_directory_recurse_copy_destroy_
-
-/**
- * Delete all non-pointer based dynamic arrays within the recurse.
- *
- * @param recurse
- *   The recurse to fully delete.
- *
- * @return
- *   F_none on success.
- *
- *   F_parameter (with error bit) if a parameter is invalid.
- *
  *   Errors (with error bit) from: f_directory_listing_delete().
  *   Errors (with error bit) from: f_string_dynamic_resize().
  *
index 5462e35514344a1e1825b0841cc05bb73a6c93e2..ff059c23c1ca2051b87216e01276c5084133ce60 100644 (file)
@@ -47,153 +47,6 @@ extern "C" {
   }
 #endif // _di_fl_directory_create_
 
-#ifndef _di_fl_directory_copy_
-  void fl_directory_copy(const f_string_static_t source, const f_string_static_t destination, f_directory_recurse_copy_t * const recurse) {
-    #ifndef _di_level_1_parameter_checking_
-      if (!recurse) return;
-    #endif // _di_level_1_parameter_checking_
-
-    recurse->source = recurse->source_top;
-    recurse->source_top = &source;
-    recurse->destination = recurse->destination_top;
-    recurse->destination_top = &destination;
-    recurse->depth = 0;
-    recurse->state.status = F_none;
-    recurse->state.data = (void *) recurse;
-
-    if (!recurse->source_top->used || !recurse->destination_top->used) {
-      recurse->state.status = F_data_not;
-
-      if (recurse->state.handle) {
-        recurse->state.handle(&recurse->state, (void *) recurse);
-      }
-
-      return;
-    }
-
-    recurse->state.status = f_directory_exists(*recurse->source_top);
-
-    if (recurse->state.status == F_false) {
-      recurse->state.status = F_status_set_error(F_directory_not);
-    }
-
-    if (F_status_is_error(recurse->state.status)) {
-      if (recurse->state.handle) {
-        recurse->state.handle(&recurse->state, (void *) recurse);
-      }
-
-      return;
-    }
-
-    if (recurse->flag & f_directory_recurse_copy_flag_top_e) {
-      if (recurse->flag & f_directory_recurse_copy_flag_clone_e) {
-        struct stat source_stat;
-
-        memset(&source_stat, 0, sizeof(struct stat));
-
-        recurse->state.status = f_file_stat(*recurse->source_top, recurse->flag & f_directory_recurse_copy_flag_dereference_e, &source_stat);
-
-        if (F_status_is_error_not(recurse->state.status)) {
-          recurse->state.status = f_directory_exists(*recurse->destination_top);
-        }
-
-        if (F_status_is_error_not(recurse->state.status)) {
-          if (recurse->state.status == F_true) {
-            if (recurse->flag & f_directory_recurse_copy_flag_exclusive_e) {
-              recurse->state.status = F_status_set_error(F_directory_found);
-            }
-            else {
-              recurse->state.status = f_file_mode_set(*recurse->destination_top, source_stat.st_mode);
-            }
-          }
-          else {
-            recurse->state.status = f_directory_create(*recurse->destination_top, source_stat.st_mode);
-          }
-        }
-
-        if (F_status_is_error_not(recurse->state.status) && (recurse->flag & (f_directory_recurse_copy_flag_group_e | f_directory_recurse_copy_flag_owner_e))) {
-          recurse->state.status = f_file_role_change(*recurse->destination_top, (recurse->flag & f_directory_recurse_copy_flag_owner_e) ? source_stat.st_uid : -1, (recurse->flag & f_directory_recurse_copy_flag_group_e) ? source_stat.st_gid : -1, recurse->flag & f_directory_recurse_copy_flag_dereference_e);
-        }
-      }
-      else {
-        if (recurse->state.status == F_true) {
-          if (recurse->flag & f_directory_recurse_copy_flag_exclusive_e) {
-            recurse->state.status = F_status_set_error(F_directory_found);
-          }
-          else {
-            recurse->state.status = f_file_mode_set(*recurse->destination_top, recurse->mode.directory);
-          }
-        }
-        else {
-          recurse->state.status = f_directory_create(*recurse->destination_top, recurse->mode.directory);
-        }
-      }
-    }
-    else {
-      recurse->state.status = f_directory_exists(*recurse->destination_top);
-
-      if (recurse->state.status == F_false) {
-        recurse->state.status = F_status_set_error(F_directory_not);
-      }
-    }
-
-    if (F_status_is_error(recurse->state.status)) {
-      if (recurse->state.handle) {
-        recurse->state.handle(&recurse->state, (void *) &recurse);
-      }
-
-      return;
-    }
-
-    if (recurse->max_depth) {
-      f_array_length_t i = recurse->source_top->used;
-
-      // Do not allow null termination or trailing path separators in the string's length calculation.
-      for (; i > 0; --i) {
-
-        if (!recurse->source_top->string[i - 1]) continue;
-        if (recurse->source_top->string[i - 1] == f_path_separator_s.string[0]) continue;
-
-        break;
-      } // for
-
-      const f_string_static_t static_source = macro_f_string_static_t_initialize(recurse->source_top->string, recurse->source_top->size, i);
-
-      for (i = recurse->destination_top->used; i > 0; --i) {
-
-        if (!recurse->destination_top->string[i - 1]) continue;
-        if (recurse->destination_top->string[i - 1] == f_path_separator_s.string[0]) continue;
-
-        break;
-      } // for
-
-      const f_string_static_t static_destination = macro_f_string_static_t_initialize(recurse->destination_top->string, recurse->destination_top->size, i);
-
-      recurse->source = &static_source;
-      recurse->destination = &static_destination;
-      recurse->depth = 1;
-
-      private_fl_directory_copy_recurse(recurse);
-
-      recurse->source = recurse->source_top;
-      recurse->destination = recurse->destination_top;
-      recurse->depth = 0;
-    }
-    else {
-      recurse->state.status = F_none;
-    }
-
-    if (recurse->state.status == F_none && recurse->verbose) {
-      recurse->verbose(*recurse->source, *recurse->destination, (void *) recurse);
-    }
-    else if (F_status_is_error(recurse->state.status)) {
-      if (recurse->state.handle) {
-        recurse->state.handle(&recurse->state, (void *) &recurse);
-      }
-    }
-  }
-#endif // _di_fl_directory_copy_
-
 #ifndef _di_fl_directory_do_
   void fl_directory_do(const f_string_static_t path, f_directory_recurse_do_t * const recurse) {
     #ifndef _di_level_1_parameter_checking_
index c0bcb8a32ba07c2b31ff4063e963225d4bb344ad..3704f34deb31421d16547562d2715da17b13447d 100644 (file)
@@ -86,74 +86,6 @@ extern "C" {
 #endif // _di_fl_directory_create_
 
 /**
- * Copy (or clone) a directories contents (and possibly the directory itself).
- *
- * The file mode, owner, and group may conditionally be preserved when not cloning (when copying).
- *
- * The source and destination must not contain NULL except for the terminating NULL.
- * The source and destination must be NULL terminated.
- *
- * Symbolic links are by default not followed, they are copied as the symbolic link itself.
- * Set the f_directory_recurse_copy_flag_dereference_e to follow the symbolic links rather than copying the link itself.
- *
- * This does not copy unknown file types.
- *
- * If recurse.flag has f_directory_recurse_copy_flag_top_e set, then this operates on the top directory otherwise only the content within the directory is operated on.
- *
- * If recurse.flag has f_directory_recurse_copy_flag_clone_e set, then this operates a clone operation rather than a copy operation.
- *
- * When using f_directory_recurse_copy_flag_clone_e, the recurse.mode is not used.
- * When not using f_directory_recurse_copy_flag_clone_e, the recurse.mode is used and should be set accordingly.
- * To not used recurse.mode, set the point to NULL.
- *
- * The recurse.state.handle() callback is used for processing and reporting errors.
- * This is not intended to replace the error state with a non error.
- * To do so will likely cause problems and undefined behavior.
- *
- * The recurse.state.verbose() callback is used for printing success messages (generally when in verbose mode).
- *
- * The recurse.state.interrupt() callback is used during some loops.
- *
- * The recurse.state.custom is available to be defined by the caller for all recurse.state callbacks.
- *
- * @param source
- *   The source file path.
- *   Must be NULL terminated.
- * @param destination
- *   The destination file path.
- *   Must be NULL terminated.
- * @param recurse
- *   The directory recurse data.
- *   This must not be NULL.
- *
- *   This alters recurse.state.status:
- *     F_none on success.
- *     F_data_not if source.used or destination.used is 0.
- *
- *     F_directory_not (with error bit) if the source directory does not exist.
- *     F_failure (with error bit) for any other failure, failures might be populated with individual status codes.
- *
- *     Errors (with error bit) from: f_directory_create().
- *     Errors (with error bit) from: f_directory_exists().
- *     Errors (with error bit) from: f_string_dynamic_resize().
- *     Errors (with error bit) from: f_string_dynamics_resize().
- *     Errors (with error bit) from: f_file_mode_set().
- *     Errors (with error bit) from: f_file_role_change().
- *     Errors (with error bit) from: f_file_stat().
- *
- * @see f_directory_create()
- * @see f_directory_exists()
- * @see f_string_dynamic_resize()
- * @see f_string_dynamics_resize()
- * @see f_file_mode_set()
- * @see f_file_role_change()
- * @see f_file_stat()
- */
-#ifndef _di_fl_directory_copy_
-  extern void fl_directory_copy(const f_string_static_t source, const f_string_static_t destination, f_directory_recurse_copy_t * const recurse);
-#endif // _di_fl_directory_copy_
-
-/**
  * Perform a recursive action on some directory.
  *
  * This is intended to be used as an alternative to functions like fl_directory_list(), giving more control over the recursion process.
index 8092d33cba6e240f0f91a969557649d8a99945e4..67b1a53e6ffffaedd8df6bf9d24ee67fcd529699 100644 (file)
@@ -5,300 +5,6 @@
 extern "C" {
 #endif
 
-#if !defined(_di_fl_directory_copy_)
-  void private_fl_directory_copy_recurse(f_directory_recurse_copy_t * const recurse) {
-
-    f_string_dynamics_t directories_original = f_string_dynamics_t_initialize;
-
-    directories_original.array = recurse->listing.directory.array;
-    directories_original.used = recurse->listing.directory.used;
-    directories_original.size = recurse->listing.directory.size;
-
-    recurse->listing.directory.array = 0;
-    recurse->listing.directory.used = 0;
-    recurse->listing.directory.size = 0;
-
-    // Use a clean set for each recursion.
-    recurse->listing.block.used = 0;
-    recurse->listing.character.used = 0;
-    recurse->listing.directory.used = 0;
-    recurse->listing.regular.used = 0;
-    recurse->listing.link.used = 0;
-    recurse->listing.fifo.used = 0;
-    recurse->listing.socket.used = 0;
-    recurse->listing.unknown.used = 0;
-
-    recurse->state.status = private_fl_directory_list(*recurse->source, 0, 0, recurse->flag & f_directory_recurse_copy_flag_dereference_e, &recurse->listing);
-
-    if (F_status_is_error(recurse->state.status)) {
-
-      // Only the directory is to be freed because all others are preserved between recursions.
-      f_string_dynamics_resize(0, &recurse->listing.directory);
-
-      recurse->listing.directory.array = directories_original.array;
-      recurse->listing.directory.used = directories_original.used;
-      recurse->listing.directory.size = directories_original.size;
-
-      return;
-    }
-
-    recurse->state.status = F_none;
-
-    {
-      f_string_dynamics_t * const list[] = {
-        &recurse->listing.block,
-        &recurse->listing.character,
-        &recurse->listing.regular,
-        &recurse->listing.link,
-        &recurse->listing.fifo,
-        &recurse->listing.socket,
-        &recurse->listing.unknown,
-      };
-
-      f_array_length_t j = 0;
-
-      for (uint8_t i = 0; i < 7; ++i) {
-
-        for (j = 0; F_status_is_fine(recurse->state.status) && j < list[i]->used; ++j) {
-
-          if (recurse->state.interrupt) {
-            recurse->state.interrupt((void *) &recurse->state, (void *) recurse);
-            if (F_status_set_fine(recurse->state.status) == F_interrupt) break;
-          }
-
-          private_fl_directory_copy_recurse_file(list[j]->array[i], recurse);
-        } // for
-
-        list[i]->used = 0;
-
-        // Use an upper limit when retaining memory between recursion calls.
-        if (list[i]->size > F_directory_max_list_d) {
-          recurse->state.status = f_string_dynamics_resize(F_directory_max_list_d, list[i]);
-          if (F_status_is_error(recurse->state.status)) break;
-        }
-
-        for (j = 0; j < list[i]->used; ++j) {
-
-          list[j]->array[i].used = 0;
-
-          if (list[j]->array[i].size > F_directory_max_string_d) {
-            recurse->state.status = f_string_dynamic_resize(F_directory_max_string_d, &list[j]->array[i]);
-            if (F_status_is_error(recurse->state.status)) break;
-          }
-        } // for
-      } // for
-    }
-
-    if (F_status_is_error_not(recurse->state.status)) {
-      for (f_array_length_t i = 0; i < recurse->listing.directory.used; ++i) {
-
-        if (recurse->state.interrupt) {
-          recurse->state.interrupt((void *) &recurse->state, (void *) recurse);
-          if (F_status_set_fine(recurse->state.status) == F_interrupt) break;
-        }
-
-        f_string_static_t source_sub = f_string_static_t_initialize;
-        f_string_static_t destination_sub = f_string_static_t_initialize;
-
-        source_sub.used = recurse->source->used + recurse->listing.directory.array[i].used + 1;
-        source_sub.size = source_sub.used;
-
-        destination_sub.used = recurse->destination->used + recurse->listing.directory.array[i].used + 1;
-        destination_sub.size = destination_sub.used;
-
-        f_char_t path_source_sub[source_sub.used + 1];
-        f_char_t path_destination_sub[destination_sub.used + 1];
-
-        memcpy(path_source_sub, recurse->source->string, sizeof(f_char_t) * recurse->source->used);
-        memcpy(path_source_sub + recurse->source->used + 1, recurse->listing.directory.array[i].string, sizeof(f_char_t) * recurse->listing.directory.array[i].used);
-
-        memcpy(path_destination_sub, recurse->destination->string, sizeof(f_char_t) * recurse->destination->used);
-        memcpy(path_destination_sub + recurse->destination->used + 1, recurse->listing.directory.array[i].string, sizeof(f_char_t) * recurse->listing.directory.array[i].used);
-
-        path_source_sub[recurse->source->used] = f_path_separator_s.string[0];
-        path_source_sub[source_sub.used] = 0;
-
-        path_destination_sub[recurse->destination->used] = f_path_separator_s.string[0];
-        path_destination_sub[destination_sub.used] = 0;
-
-        source_sub.string = path_source_sub;
-        destination_sub.string = path_destination_sub;
-
-        recurse->state.status = f_directory_exists(source_sub);
-        if (F_status_is_error(recurse->state.status)) break;
-
-        if (recurse->state.status == F_false) {
-          recurse->state.status = F_status_set_error(F_directory);
-
-          break;
-        }
-
-        if (recurse->flag & f_directory_recurse_copy_flag_clone_e) {
-          struct stat source_stat;
-
-          memset(&source_stat, 0, sizeof(struct stat));
-
-          recurse->state.status = f_file_stat(source_sub, recurse->flag & f_directory_recurse_copy_flag_dereference_e, &source_stat);
-          if (F_status_is_error(recurse->state.status)) break;
-
-          recurse->state.status = f_directory_exists(destination_sub);
-          if (F_status_is_error(recurse->state.status)) break;
-
-          if (recurse->state.status == F_true) {
-            if (recurse->flag & f_directory_recurse_copy_flag_exclusive_e) {
-              recurse->state.status = F_status_set_error(F_directory_found);
-
-              break;
-            }
-
-            recurse->state.status = f_file_mode_set(destination_sub, source_stat.st_mode);
-            if (F_status_is_error(recurse->state.status)) break;
-          }
-          else {
-            recurse->state.status = f_directory_create(destination_sub, source_stat.st_mode);
-            if (F_status_is_error(recurse->state.status)) break;
-          }
-
-          if (recurse->flag & (f_directory_recurse_copy_flag_group_e | f_directory_recurse_copy_flag_owner_e)) {
-            recurse->state.status = f_file_role_change(destination_sub, (recurse->flag & f_directory_recurse_copy_flag_owner_e) ? source_stat.st_uid : -1, (recurse->flag & f_directory_recurse_copy_flag_group_e) ? source_stat.st_gid : -1, recurse->flag & f_directory_recurse_copy_flag_dereference_e);
-            if (F_status_is_error(recurse->state.status)) break;
-          }
-        }
-        else {
-          if (recurse->state.status == F_true) {
-            if (recurse->flag & f_directory_recurse_copy_flag_exclusive_e) {
-              recurse->state.status = F_status_set_error(F_directory_found);
-
-              break;
-            }
-
-            recurse->state.status = f_file_mode_set(destination_sub, recurse->mode.directory);
-            if (F_status_is_error(recurse->state.status)) break;
-          }
-          else {
-            recurse->state.status = f_directory_create(destination_sub, recurse->mode.directory);
-            if (F_status_is_error(recurse->state.status)) break;
-          }
-        }
-
-        if (recurse->depth < recurse->max_depth) {
-          recurse->source = (f_string_static_t * const) & source_sub;
-          recurse->destination = (f_string_static_t * const) & destination_sub;
-
-          ++recurse->depth;
-
-          private_fl_directory_copy_recurse(recurse);
-
-          // Data must be restored after recursion.
-          recurse->source = (f_string_static_t * const) & source_sub;
-          recurse->destination = (f_string_static_t * const) & destination_sub;
-
-          // Success inside the recursed function is handled inside the recursed function, so handle at the current depth.
-          if (recurse->state.status == F_none) {
-            --recurse->depth;
-
-            if (recurse->verbose) {
-              recurse->verbose(source_sub, destination_sub, recurse);
-            }
-          }
-
-          // Errors in the recursed function are handled outside the recursed function here.
-          else if (F_status_is_error(recurse->state.status)) {
-            if (recurse->state.handle) {
-              recurse->state.handle(&recurse->state, (void *) &recurse);
-            }
-
-            recurse->state.status = F_failure;
-          }
-
-          // Error is now handled, so update the depth and exit.
-          if (recurse->state.status == F_failure) {
-            --recurse->depth;
-
-            break;
-          }
-        }
-
-        recurse->state.status = F_none;
-      } // for
-    }
-
-    // Only the directory is to be freed because all others are preserved between recursions.
-    f_string_dynamics_resize(0, &recurse->listing.directory);
-
-    recurse->listing.directory.array = directories_original.array;
-    recurse->listing.directory.used = directories_original.used;
-    recurse->listing.directory.size = directories_original.size;
-  }
-#endif // !defined(_di_fl_directory_copy_)
-
-#if !defined(_di_fl_directory_copy_)
-  void private_fl_directory_copy_recurse_file(const f_string_static_t file, f_directory_recurse_copy_t * const recurse) {
-
-    f_string_static_t path_source = f_string_static_t_initialize;
-    f_string_static_t path_destination = f_string_static_t_initialize;
-
-    path_source.used = recurse->source->used + file.used + 2;
-    path_destination.used = recurse->destination->used + file.used + 2;
-
-    f_char_t path_source_string[path_source.used];
-    f_char_t path_destination_string[path_destination.used];
-
-    path_source.string = path_source_string;
-    path_destination.string = path_destination_string;
-
-    memcpy(path_source_string, recurse->source->string, sizeof(f_char_t) * recurse->source->used);
-    memcpy(path_source_string + recurse->source->used + 1, file.string, sizeof(f_char_t) * file.used);
-    path_source_string[recurse->source->used] = f_path_separator_s.string[0];
-    path_source_string[recurse->source->used + file.used + 1] = 0;
-
-    memcpy(path_destination_string, recurse->destination->string, sizeof(f_char_t) * recurse->destination->used);
-    memcpy(path_destination_string + recurse->destination->used + 1, file.string, sizeof(f_char_t) * file.used);
-    path_destination_string[recurse->destination->used] = f_path_separator_s.string[0];
-    path_destination_string[recurse->destination->used + file.used + 1] = 0;
-
-    f_status_t status = F_none;
-    int flag = (recurse->flag & f_directory_recurse_copy_flag_dereference_e) ? 0 : f_file_stat_flag_reference_e;
-
-    if (recurse->flag & f_directory_recurse_copy_flag_exclusive_e) {
-      flag |= f_file_stat_flag_exclusive_e;
-    }
-
-    if (recurse->flag & f_directory_recurse_copy_flag_group_e) {
-      flag |= f_file_stat_flag_group_e;
-    }
-
-    if (recurse->flag & f_directory_recurse_copy_flag_owner_e) {
-      flag |= f_file_stat_flag_owner_e;
-    }
-
-    if (recurse->flag & f_directory_recurse_copy_flag_clone_e) {
-      recurse->state.status = f_file_clone(path_source, path_destination, recurse->size_block, flag);
-    }
-    else {
-      recurse->state.status = f_file_copy(path_source, path_destination, recurse->mode, recurse->size_block, flag);
-    }
-
-    if (F_status_is_error(status) || status == F_support_not) {
-      if (recurse->state.handle) {
-        recurse->state.handle(&recurse->state, (void *) &recurse);
-      }
-
-      if (status == F_status_set_error(F_memory_not)) return;
-
-      recurse->state.status = F_failure;
-
-      return;
-    }
-
-    if (recurse->verbose) {
-      recurse->verbose(path_source, path_destination, (void *) recurse);
-    }
-
-    recurse->state.status = F_none;
-  }
-#endif // !defined(_di_fl_directory_copy_)
-
 #if !defined(_di_fl_directory_do_)
   void private_fl_directory_do_recurse(f_directory_recurse_do_t * const recurse) {
 
@@ -528,7 +234,7 @@ extern "C" {
   }
 #endif // !defined(_di_fl_directory_do_)
 
-#if !defined(_di_fl_directory_copy_) || !defined(_di_fl_directory_do_) || !defined(_di_fl_directory_list_)
+#if !defined(_di_fl_directory_do_) || !defined(_di_fl_directory_list_)
   f_status_t private_fl_directory_list(const f_string_static_t path, int (*filter)(const struct dirent *), int (*sort)(const struct dirent **, const struct dirent **), const bool dereference, f_directory_listing_t * const listing) {
 
     struct dirent **entity = 0;
@@ -649,7 +355,7 @@ extern "C" {
 
     return F_none;
   }
-#endif // !defined(_di_fl_directory_copy_) || !defined(_di_fl_directory_do_) || !defined(_di_fl_directory_list_)
+#endif // !defined(_di_fl_directory_do_) || !defined(_di_fl_directory_list_)
 
 #if !defined(_di_fl_directory_path_push_) || !defined(_di_fl_directory_path_push_dynamic_)
   f_status_t private_fl_directory_path_push(const f_string_static_t source, f_string_dynamic_t * const destination) {
index 834a77921d9a5d602ec66965962d0959a9d1d8b6..e220cbcaa699c32f8f558cb7baa9b00381191136 100644 (file)
@@ -15,47 +15,6 @@ extern "C" {
 #endif
 
 /**
- * Private implementation of fl_directory_copy().
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param recurse
- *   The directory recurse data.
- *
- * @return
- *   F_none on success.
- *
- *   F_failure (with error bit) for any other failure, failures might be populated with individual status codes.
- *
- * @see fl_directory_copy()
- */
-#if !defined(_di_fl_directory_copy_)
-  extern void private_fl_directory_copy_recurse(f_directory_recurse_copy_t * const recurse) F_attribute_visibility_internal_d;
-#endif // !defined(_di_fl_directory_copy_)
-
-/**
- * A special function intended to be used directly by private_fl_directory_copy_recurse().
- *
- * Will only copy a single file and record any detected errors.
- *
- * @param file
- *   The name of the current file.
- * @param recurse
- *   The directory recurse data.
- *
- * @return
- *   F_none on success.
- *
- *   F_array_too_large (with error bit) if a buffer would exceed max length.
- *   F_failure (with error bit) for any other failure, failures might be populated with individual status codes.
- *
- * @see fl_directory_copy()
- */
-#if !defined(_di_fl_directory_copy_)
-  extern void private_fl_directory_copy_recurse_file(const f_string_static_t file, f_directory_recurse_copy_t * const recurse) F_attribute_visibility_internal_d;
-#endif // !defined(_di_fl_directory_copy_)
-
-/**
  * Private implementation of fl_directory_do().
  *
  * Intended to be shared to each of the different implementation variations.
@@ -162,13 +121,12 @@ extern "C" {
  * @see f_file_stat_at()
  * @see f_string_dynamics_increase_by()
  *
- * @see fl_directory_copy()
  * @see fl_directory_do()
  * @see fl_directory_list()
  */
-#if !defined(_di_fl_directory_copy_) || !defined(_di_fl_directory_do_) || !defined(_di_fl_directory_list_)
+#if !defined(_di_fl_directory_do_) || !defined(_di_fl_directory_list_)
   extern f_status_t private_fl_directory_list(const f_string_static_t path, int (*filter)(const struct dirent *), int (*sort)(const struct dirent **, const struct dirent **), const bool dereference, f_directory_listing_t * const listing) F_attribute_visibility_internal_d;
-#endif // !defined(_di_fl_directory_copy_) || !defined(_di_fl_directory_do_) || !defined(_di_fl_directory_list_)
+#endif // !defined(_di_fl_directory_do_) || !defined(_di_fl_directory_list_)
 
 /**
  * Private implementation of fl_directory_path_push().
index c3300618526445be6b27a29ed56e91b9a0538538..04664cc725449e077d7f58796f6eda2f1e9056ec 100644 (file)
@@ -14,66 +14,6 @@ extern "C" {
   }
 #endif // _di_fll_file_mode_set_all_
 
-#ifndef _di_fll_file_move_
-  void fll_file_move(const f_string_static_t source, const f_string_static_t destination, f_directory_recurse_copy_t * const recurse) {
-    #ifndef _di_level_2_parameter_checking_
-      if (!recurse) return;
-    #endif // _di_level_2_parameter_checking_
-
-    if (!source.used || !destination.used) {
-      recurse->state.status = F_data_not;
-
-      return;
-    }
-
-    recurse->state.status = f_file_rename(source, destination);
-
-    if (F_status_set_fine(recurse->state.status) != F_mount) {
-      if (recurse->state.status == F_none && recurse->verbose) {
-        recurse->verbose(source, destination, recurse);
-      }
-
-      return;
-    }
-
-    recurse->state.status = f_file_is(source, F_file_type_directory_d, !(recurse->flag & f_file_stat_flag_reference_e));
-
-    if (recurse->state.status == F_file_found_not) {
-      recurse->state.status = F_status_set_error(recurse->state.status);
-    }
-
-    if (F_status_is_error(recurse->state.status)) return;
-
-    if (recurse->state.status == F_true) {
-      const uint8_t flag_original = recurse->flag;
-
-      recurse->flag = f_directory_recurse_copy_flag_clone_e;
-
-      fl_directory_copy(source, destination, recurse);
-
-      recurse->flag = flag_original;
-
-      if (F_status_is_error(recurse->state.status)) return;
-
-      recurse->state.status = f_directory_remove(source, recurse->max_depth, F_false);
-
-      if (recurse->state.status == F_none && recurse->verbose) {
-        recurse->verbose(source, destination, recurse);
-      }
-    }
-    else {
-      recurse->state.status = f_file_clone(source, destination, recurse->size_block, recurse->flag);
-      if (F_status_is_error(recurse->state.status)) return;
-
-      recurse->state.status = f_file_remove(source);
-
-      if (recurse->state.status == F_none && recurse->verbose) {
-        recurse->verbose(source, destination, recurse);
-      }
-    }
-  }
-#endif // _di_fll_file_move_
-
 #ifndef _di_fll_file_role_change_all_
   f_status_t fll_file_role_change_all(const f_string_static_t path, const uid_t uid, const gid_t gid, const bool dereference, const f_number_unsigned_t depth_max) {
     #ifndef _di_level_2_parameter_checking_
index 67e834cc5756ee4032b0d388c45b4cd83b5ee61e..512255bcbb2b359fd5ddd8fdfc69d6773ff7da23 100644 (file)
@@ -73,64 +73,6 @@ extern "C" {
 #endif // _di_fll_file_mode_set_all_
 
 /**
- * Move a file.
- *
- * The paths must not contain NULL except for the terminating NULL.
- * The paths must be NULL terminated.
- *
- * This attempts to rename a file but if the file is on another file system then it tries to clone the file or directory.
- * If the file or directory is cloned, then the original is deleted after a successful copy.
- *
- * When this calls the additional functions, if the clone succeeds but the remove fails the source may exist.
- * Therefore, if there is an error during remove, then the file should be checked for existence and possibly be manually removed.
- *
- * @param source
- *   The path to the file to copy from.
- * @param destination
- *   The path to copy to.
- * @param recurse
- *   The directory recurse data.
- *   This must not be NULL.
- *
- *   This alters recurse.state.status:
- *     F_none on success.
- *
- *     F_access_denied (with error bit) on access denied.
- *     F_buffer (with error bit) if the buffer is invalid.
- *     F_busy (with error bit) if file system is too busy to perform write.
- *     F_directory (with error bit) if a supposed directory in path is not actually a directory.
- *     F_directory_empty_not (with error bit) if the destination is a non-empty directory.
- *     F_file_found_not (with error bit) if file at path was not found.
- *     F_file_type_directory (with error bit) if destination is a directory but source is not.
- *     F_filesystem_quota_block (with error bit) if file system's disk blocks or inodes are exhausted.
- *     F_link (with error bit) if source or destination has the maxiumum associated links.
- *     F_loop (with error bit) on loop error.
- *     F_memory_not (with error bit) if out of memory.
- *     F_name (with error bit) on path name error.
- *     F_parameter (with error bit) if a parameter is invalid.
- *     F_prohibited (with error bit) if file system does not allow for making changes.
- *     F_read_only (with error bit) if file is read-only.
- *     F_space_not (with error bit) if file system is out of space (or file system quota is reached).
- *     F_failure (with error bit) for any other error, failures might be populated with individual status codes.
- *
- *     Errors (with error bit) from: f_directory_remove_custom().
- *     Errors (with error bit) from: f_file_is().
- *     Errors (with error bit) from: f_file_remove().
- *     Errors (with error bit) from: f_file_rename().
- *     Errors (with error bit) from: fl_directory_copy().
- *
- * @see f_directory_remove()
- * @see f_directory_remove_custom()
- * @see f_file_is()
- * @see f_file_remove()
- * @see f_file_rename()
- * @see fl_directory_copy()
- */
-#ifndef _di_fll_file_move_
-  extern void fll_file_move(const f_string_static_t source, const f_string_static_t destination, f_directory_recurse_copy_t * const recurse);
-#endif // _di_fll_file_move_
-
-/**
  * Change owner and/or group of a given file at the specified path.
  *
  * At least one of uid or gid must not be -1.
index 70adcf722ca6086a2744efc2447f3f3a70852da1..ceee017663855e551ccd1c126e5437faaebbf28a 100644 (file)
@@ -172,8 +172,8 @@ extern "C" {
     fake_local_t local = macro_fake_local_t_initialize_1(main, &main->cache_map, &failed);
 
     f_directory_recurse_do_t recurse = f_directory_recurse_do_t_initialize;
-    recurse.action = &fake_build_copy_action;
-    recurse.handle = &fake_build_copy_handle;
+    recurse.action = &fake_do_copy_action;
+    recurse.handle = &fake_do_copy_handle;
     recurse.state.custom = (void *) &local;
     recurse.state.code = fake_state_code_local_e;
     recurse.flag = f_directory_recurse_do_flag_top_e | f_directory_recurse_do_flag_before_e | f_directory_recurse_do_flag_after_e;
@@ -236,7 +236,7 @@ extern "C" {
       main->setting.state.status = f_directory_is(main->cache_2);
 
       if (main->setting.state.status == F_true) {
-        main->setting.state.status = f_file_name_base(main->cache_2, &main->cache_map.value);
+        main->setting.state.status = f_file_name_base(main->cache_2, &main->cache_map.name);
 
         if (F_status_is_error(main->setting.state.status)) {
           fake_print_error(&main->program.error, macro_fake_f(f_file_name_base));
@@ -244,14 +244,6 @@ extern "C" {
           break;
         }
 
-        main->setting.state.status = f_string_dynamic_append_nulless(main->cache_map.value, &main->cache_map.name);
-
-        if (F_status_is_error(main->setting.state.status)) {
-          fake_print_error(&main->program.error, macro_fake_f(f_string_dynamic_append_nulless));
-
-          break;
-        }
-
         main->cache_map.name.string[main->cache_map.name.used] = 0;
 
         fl_directory_do(main->cache_2, &recurse);
@@ -276,12 +268,6 @@ extern "C" {
         }
       }
       else if (main->setting.state.status == F_false) {
-        fake_string_dynamic_reset(&main->cache_map.value);
-
-        if (main->cache_map.value.size) {
-          main->cache_map.value.string[0] = 0;
-        }
-
         main->setting.state.status = f_string_dynamic_append_nulless(destination, &main->cache_map.value);
 
         if (F_status_is_error(main->setting.state.status)) {
@@ -321,10 +307,6 @@ extern "C" {
         else {
           fake_string_dynamic_reset(&main->cache_map.name);
 
-          if (main->cache_map.name.size) {
-            main->cache_map.name.string[0] = 0;
-          }
-
           main->setting.state.status = f_file_name_base(main->cache_2, &main->cache_map.value);
 
           if (F_status_is_error(main->setting.state.status)) {
@@ -334,7 +316,9 @@ extern "C" {
           }
         }
 
-        fake_build_print_verbose_copying(&main->program.message, main->cache_2, main->cache_map.value);
+        main->cache_map.value.string[main->cache_map.value.used] = 0;
+
+        fake_print_verbose_copying(&main->program.message, main->cache_2, main->cache_map.value);
 
         main->setting.state.status = f_file_copy(main->cache_2, main->cache_map.value, mode, F_file_default_read_size_d, f_file_stat_flag_reference_e);
 
@@ -372,225 +356,6 @@ extern "C" {
   }
 #endif // _di_fake_build_copy_
 
-#ifndef _di_fake_build_copy_action_
-  void fake_build_copy_action(void * const void_recurse, const f_string_static_t name, const uint16_t flag) {
-
-    if (!void_recurse) return;
-
-    f_directory_recurse_do_t * const recurse = (f_directory_recurse_do_t *) void_recurse;
-
-    if (!recurse->state.custom) return;
-
-    fake_local_t * const local = (fake_local_t *) recurse->state.custom;
-
-    if (!local->custom_1) {
-      recurse->state.status = F_status_set_error(F_parameter);
-
-      return;
-    }
-
-    f_string_map_t * const map = (f_string_map_t *) local->custom_1;
-
-    if (flag & f_directory_recurse_do_flag_before_e) {
-      if (flag & f_directory_recurse_do_flag_top_e) {
-        fake_build_print_verbose_copying(&local->main->program.message, *recurse->path_top, map->name);
-
-        recurse->state.status = f_directory_exists(map->name);
-
-        if (F_status_is_error(recurse->state.status)) {
-          local->main->setting.state.status = recurse->state.status;
-
-          fake_print_error_file(&local->main->program.error, macro_fake_f(fl_directory_create), map->value, f_file_operation_verify_s, fll_error_file_type_directory_e);
-
-          // Save the error status for when the error message is printed.
-          *((f_status_t *) local->custom_2) = recurse->state.status;
-        }
-        else if (recurse->state.status != F_true) {
-          recurse->state.status = fl_directory_create(map->name, F_file_mode_all_rwx_d);
-
-          if (F_status_is_error(recurse->state.status)) {
-            local->main->setting.state.status = recurse->state.status;
-
-            fake_print_error_file(&local->main->program.error, macro_fake_f(fl_directory_create), map->value, f_file_operation_create_s, fll_error_file_type_directory_e);
-
-            // Save the error status for when the error message is printed.
-            *((f_status_t *) local->custom_2) = recurse->state.status;
-          }
-        }
-
-        if (F_status_is_error_not(recurse->state.status)) {
-          fake_string_dynamic_reset(&recurse->path_cache);
-
-          // Pre-populate the destination into the path cache.
-          recurse->state.status = f_string_dynamic_append(map->name, &recurse->path_cache);
-
-          if (F_status_is_error_not(recurse->state.status)) {
-            recurse->state.status = F_none;
-
-            // Do not allow trailing path separators in the string's length calculation, except root directory '/'.
-            for (; recurse->path_cache.used; --recurse->path_cache.used) {
-              if (recurse->path_cache.string[recurse->path_cache.used - 1] != f_path_separator_s.string[0]) break;
-            } // for
-
-            recurse->path_cache.string[recurse->path_cache.used] = 0;
-          }
-        }
-
-        return;
-      }
-
-      if (flag & f_directory_recurse_do_flag_directory_e) {
-
-        // Push the directory name on the path stack (the destination path is expected to be pre-populated).
-        recurse->state.status = f_string_dynamic_increase_by(f_path_separator_s.used + name.used + 1, &recurse->path_cache);
-
-        if (F_status_is_error_not(recurse->state.status)) {
-          recurse->state.status = f_string_dynamic_append(f_path_separator_s, &recurse->path_cache);
-        }
-
-        if (F_status_is_error_not(recurse->state.status)) {
-          recurse->state.status = f_string_dynamic_append_nulless(name, &recurse->path_cache);
-        }
-
-        // Guaranetee NULL terminated string.
-        recurse->path_cache.string[recurse->path_cache.used] = 0;
-
-        if (F_status_is_error(recurse->state.status)) return;
-
-        fake_build_print_verbose_copying(&local->main->program.message, recurse->path, recurse->path_cache);
-
-        recurse->state.status = f_directory_exists(recurse->path_cache);
-
-        if (F_status_is_error_not(recurse->state.status) && recurse->state.status != F_true) {
-          recurse->state.status = fl_directory_create(recurse->path_cache, F_file_mode_all_rwx_d);
-        }
-
-        if (F_status_is_error(recurse->state.status)) {
-          local->main->setting.state.status = recurse->state.status;
-
-          fake_print_error_file(&local->main->program.error, macro_fake_f(fl_directory_create), recurse->path_cache, f_file_operation_verify_s, fll_error_file_type_directory_e);
-
-          // Save the error status for when the error message is printed.
-          *((f_status_t *) local->custom_2) = recurse->state.status;
-        }
-        else if (recurse->state.status != F_true) {
-          recurse->state.status = fl_directory_create(recurse->path_cache, F_file_mode_all_rwx_d);
-
-          if (F_status_is_error(recurse->state.status)) {
-            local->main->setting.state.status = recurse->state.status;
-
-            fake_print_error_file(&local->main->program.error, macro_fake_f(fl_directory_create), recurse->path_cache, f_file_operation_create_s, fll_error_file_type_directory_e);
-
-            // Save the error status for when the error message is printed.
-            *((f_status_t *) local->custom_2) = recurse->state.status;
-          }
-        }
-      }
-
-      return;
-    }
-
-    if (flag & f_directory_recurse_do_flag_after_e) {
-      if (flag & f_directory_recurse_do_flag_directory_e) {
-
-        // Pop the current path off of the path stack.
-        if (F_status_is_error_not(recurse->state.status)) {
-          recurse->path_cache.used -= f_path_separator_s.used + name.used;
-        }
-
-        // Guaranetee NULL terminated string.
-        recurse->path_cache.string[recurse->path_cache.used] = 0;
-      }
-
-      return;
-    }
-
-    fake_string_dynamic_reset(&map->value);
-
-    recurse->state.status = f_string_dynamic_increase_by(recurse->path_cache.used + f_path_separator_s.used + name.used + 1, &map->value);
-
-    if (F_status_is_error_not(recurse->state.status)) {
-      recurse->state.status = f_string_dynamic_append_nulless(recurse->path_cache, &map->value);
-    }
-
-    if (F_status_is_error_not(recurse->state.status)) {
-      recurse->state.status = f_string_dynamic_append(f_path_separator_s, &map->value);
-    }
-
-    if (F_status_is_error_not(recurse->state.status)) {
-      recurse->state.status = f_string_dynamic_append_nulless(name, &map->value);
-    }
-
-    // Guaranetee NULL terminated string.
-    map->value.string[map->value.used] = 0;
-
-    if (F_status_is_error(recurse->state.status)) return;
-
-    fake_build_print_verbose_copying(&local->main->program.message, recurse->path, map->value);
-
-    if (flag & f_directory_recurse_do_flag_directory_e) {
-      if (F_status_is_error(recurse->state.status)) {
-        local->main->setting.state.status = recurse->state.status;
-
-        fake_print_error_file(&local->main->program.error, macro_fake_f(fl_directory_create), map->value, f_file_operation_verify_s, fll_error_file_type_directory_e);
-
-        // Save the error status for when the error message is printed.
-        *((f_status_t *) local->custom_2) = recurse->state.status;
-      }
-      else if (recurse->state.status != F_true) {
-        recurse->state.status = fl_directory_create(map->value, F_file_mode_all_rwx_d);
-
-        if (F_status_is_error(recurse->state.status)) {
-          local->main->setting.state.status = recurse->state.status;
-
-          fake_print_error_file(&local->main->program.error, macro_fake_f(fl_directory_create), map->value, f_file_operation_create_s, fll_error_file_type_directory_e);
-
-          // Save the error status for when the error message is printed.
-          *((f_status_t *) local->custom_2) = recurse->state.status;
-        }
-      }
-    }
-    else {
-      recurse->state.status = f_file_copy(recurse->path, map->value, recurse->mode, F_file_default_read_size_d, f_file_stat_flag_reference_e);
-
-      if (F_status_is_error(recurse->state.status)) {
-        local->main->setting.state.status = recurse->state.status;
-
-        fake_print_error_file(&local->main->program.error, macro_fake_f(f_file_copy), map->value, f_file_operation_create_s, fll_error_file_type_file_e);
-
-        // Save the error status for when the error message is printed.
-        *((f_status_t *) local->custom_2) = recurse->state.status;
-      }
-    }
-  }
-#endif // _di_fake_build_copy_action_
-
-#ifndef _di_fake_build_copy_handle_
-  void fake_build_copy_handle(void * const void_recurse, const f_string_static_t name, const uint16_t flag) {
-
-    if (!void_recurse) return;
-
-    f_directory_recurse_do_t * const recurse = (f_directory_recurse_do_t *) void_recurse;
-
-    // Do not print any errors on interrupts.
-    if (F_status_set_fine(recurse->state.status) == F_interrupt) return;
-
-    if (!recurse->state.custom) return;
-
-    fake_local_t * const local = (fake_local_t *) recurse->state.custom;
-
-    if (!local->main || !local->custom_1 || !local->custom_2) return;
-
-    if (F_status_is_error_not(*((f_status_t *) local->custom_2))) {
-      local->main->setting.state.status = recurse->state.status;
-
-      fake_print_error_build_operation_file(&local->main->program.error, macro_fake_f(fl_directory_do), f_file_operation_copy_s, *recurse->path_top, recurse->path_cache, f_file_operation_to_s, F_true);
-
-      *((f_status_t *) local->custom_2) = recurse->state.status;
-    }
-  }
-#endif // _di_fake_build_copy_handle_
-
 #ifndef _di_fake_build_execute_process_script_
   int fake_build_execute_process_script(fake_data_t * const data, fake_build_data_t * const data_build, const f_string_static_t process_script, const f_string_static_t file_stage) {
 
index 676350ebfb71d164b839d47606bca138c162b893..f8c49855c9973e361bfd2e34c11d075b79f14a87 100644 (file)
@@ -41,13 +41,13 @@ extern "C" {
 #endif // _di_fake_build_arguments_standard_add_
 
 /**
- * Copy over the main setting files.
+ * Copy over the build files.
  *
  * @param data
  *   The program data.
  *
- *   This modifies data.main->cache_2.
- *   This modifies data.main->cache_map.
+ *   This modifies data.main.cache_2.
+ *   This modifies data.main.cache_map.
  *
  *   This alters data.main->setting.state.status:
  *     F_none on success.
@@ -59,12 +59,11 @@ extern "C" {
  *     Errors (with error bit) from: f_file_exists()
  *     Errors (with error bit) from: f_file_name_base()
  *     Errors (with error bit) from: f_file_name_directory()
- *     Errors (with error bit) from: f_string_append()
+ *     Errors (with error bit) from: f_string_append_nulless()
  *     Errors (with error bit) from: f_string_dynamic_append()
  *     Errors (with error bit) from: f_string_dynamic_append_nulless()
  *     Errors (with error bit) from: f_string_dynamic_resize()
  *     Errors (with error bit) from: fl_directory_create()
- *     Errors (with error bit) from: fl_directory_copy()
  *     Errors (with error bit) from: fl_directory_do()
  * @param mode
  *   The modes for each file type.
@@ -93,11 +92,10 @@ extern "C" {
  * @see f_file_exists()
  * @see f_file_name_base()
  * @see f_file_name_directory()
- * @see f_string_append()
+ * @see f_string_append_nulless()
  * @see f_string_dynamic_append_nulless()
  * @see f_string_dynamic_resize()
  * @see fl_directory_create()
- * @see fl_directory_copy()
  * @see fl_directory_do()
  * @see fll_program_print_signal_received()
  */
@@ -106,53 +104,6 @@ extern "C" {
 #endif // _di_fake_build_copy_
 
 /**
- * Callback for performing an action regarding the copy operation for fake_build_copy().
- *
- * @param recurse
- *   The recuse structure.
- *   Must be of type f_directory_recurse_do_t.
- *
- *   This does not alter local.main.setting.state.status.
- *
- *   This alters data.main->setting.state.status:
- *     @todo document this.
- * @param name
- *   The directory name currently being process based on the flag.
- * @param flag
- *   The flags representing the action.
- *
- * @see f_string_dynamic_append()
- * @see f_string_dynamic_increase_by()
- *
- * @see fake_build_copy()
- */
-#ifndef _di_fake_build_copy_action_
-  extern void fake_build_copy_action(void * const recurse, const f_string_static_t name, const uint16_t flag);
-#endif // _di_fake_build_copy_action_
-
-/**
- * Callback for handling an error regarding the copy operation for fake_build_copy().
- *
- * @param recurse
- *   The recuse structure.
- *   Must be of type f_directory_recurse_do_t.
- *
- *   This alters local.main.setting.state.status:
- *     Assigns value from recurse.state.status.
- *
- *   This does not alter recurse.state.status.
- * @param name
- *   The directory name currently being process based on the flag.
- * @param flag
- *   The flags representing the action.
- *
- * @see fake_build_copy()
- */
-#ifndef _di_fake_build_copy_handle_
-  extern void fake_build_copy_handle(void * const recurse, const f_string_static_t name, const uint16_t flag);
-#endif // _di_fake_build_copy_handle_
-
-/**
  * Execute the Pre-Process or Post-pocess build script.
  *
  * @param data
index ae8bf1cbc3c56bdec8e7296643a118bee7941046..4e5f31b6db7d6cc506689069473b203056290aeb 100644 (file)
@@ -4,18 +4,6 @@
 extern "C" {
 #endif
 
-#ifndef _di_fake_build_print_verbose_copying_
-  f_status_t fake_build_print_verbose_copying(fl_print_t * const print, const f_string_static_t source, const f_string_static_t destination) {
-
-    if (!print) return F_status_set_error(F_output_not);
-    if (print->verbosity < f_console_verbosity_verbose_e) return F_output_not;
-
-    fake_print_common_wrapped_variables(print, "Copying file ", source, " to ", destination, f_string_empty_s.string);
-
-    return F_none;
-  }
-#endif // _di_fake_build_print_verbose_copying_
-
 #ifndef _di_fake_build_print_verbose_create_directory_
   f_status_t fake_build_print_verbose_create_directory(fl_print_t * const print, const f_string_static_t directory) {
 
index 97100d74683aebafc67e198bb0a901f5fab6fc32..85871b9f14903d74f8acbc23ecc955900224d2b8 100644 (file)
@@ -17,32 +17,6 @@ extern "C" {
 #endif
 
 /**
- * Print verbose message about copying a file.
- *
- * @param print
- *   The output structure to print to.
- *
- *   This requires print.custom to be fake_main_t.
- *
- *   This does not alter print.custom.setting.state.status.
- * @param source
- *   The source file path.
- * @param destination
- *   The destination file path.
- *
- * @return
- *   F_none on success.
- *   F_output_not on success, but no printing is performed.
- *
- *   F_output_not (with error bit) if setting is NULL.
- *
- * @see fake_print_common_wrapped_variables()
- */
-#ifndef _di_fake_build_print_verbose_copying_
-  extern f_status_t fake_build_print_verbose_copying(fl_print_t * const print, const f_string_static_t source, const f_string_static_t destination);
-#endif // _di_fake_build_print_verbose_copying_
-
-/**
  * Print verbose message about _di_fake_build_print_verbose_copied_file_ a directory.
  *
  * @param print
index d76cbc21b057c8fe495e02110bbb62a7f9958e9c..31151be23e0afc7fab47b4913fa436bc89f69b6d 100644 (file)
@@ -386,12 +386,14 @@ extern "C" {
  *
  * fake_state_code_*_e:
  *   - none:  No flags set.
- *   - local: A flag designating that the state.custom is in fake_local_t rather than fake_main_t.
+ *   - clone: Designate that the operation is a clone operation (as opposed to a copy operation).
+ *   - local: Designate that the state.custom is in fake_local_t rather than fake_main_t.
  */
 #ifndef _di_fake_state_code_e_
   enum {
     fake_state_code_none_e  = 0x0,
-    fake_state_code_local_e = 0x1,
+    fake_state_code_clone_e = 0x1,
+    fake_state_code_local_e = 0x2,
   }; // enum
 #endif // _di_fake_state_code_e_
 
index 9fe46e2b9a46d5c6626a2ac6917482bba55aa754..87ab5916d855fd5251427ed65763c87b26af6c4d 100644 (file)
@@ -38,6 +38,7 @@ extern "C" {
     "f_file_owner_read",
     "f_file_read",
     "f_file_remove",
+    "f_file_rename",
     "f_file_role_change",
     "f_file_size",
     "f_file_stat",
@@ -51,7 +52,6 @@ extern "C" {
     "f_path_change",
     "f_path_current",
     "f_path_directory_cleanup",
-    "f_string_append",
     "f_string_append_nulless",
     "f_string_dynamic_append",
     "f_string_dynamic_append_assure",
@@ -71,7 +71,6 @@ extern "C" {
     "f_uint8s_increase_by",
     "f_utf_is_word_dash_plus",
     "fl_conversion_dynamic_to_unsigned_detect",
-    "fl_directory_copy",
     "fl_directory_create",
     "fl_directory_do",
     "fl_directory_list",
@@ -82,7 +81,6 @@ extern "C" {
     "fll_execute_arguments_add_parameter_set",
     "fll_execute_program",
     "fll_file_mode_set_all",
-    "fll_file_move",
     "fll_file_role_change_all",
     "fll_fss_basic_list_read",
     "fll_fss_extended_read",
index 060a4f9f284889e4839aef995f871413e546e343..20bd1968c1ee59c4c5d07c479b82d0dff72e07ca 100644 (file)
@@ -71,6 +71,7 @@ extern "C" {
     fake_f_f_file_owner_read_e,
     fake_f_f_file_read_e,
     fake_f_f_file_remove_e,
+    fake_f_f_file_rename_e,
     fake_f_f_file_role_change_e,
     fake_f_f_file_size_e,
     fake_f_f_file_stat_e,
@@ -84,7 +85,6 @@ extern "C" {
     fake_f_f_path_change_e,
     fake_f_f_path_current_e,
     fake_f_f_path_directory_cleanup_e,
-    fake_f_f_string_append_e,
     fake_f_f_string_append_nulless_e,
     fake_f_f_string_dynamic_append_e,
     fake_f_f_string_dynamic_append_assure_e,
@@ -104,7 +104,6 @@ extern "C" {
     fake_f_f_uint8s_increase_by_e,
     fake_f_f_utf_is_word_dash_plus_e,
     fake_f_fl_conversion_dynamic_to_unsigned_detect_e,
-    fake_f_fl_directory_copy_e,
     fake_f_fl_directory_create_e,
     fake_f_fl_directory_do_e,
     fake_f_fl_directory_list_e,
@@ -115,7 +114,6 @@ extern "C" {
     fake_f_fll_execute_arguments_add_parameter_set_e,
     fake_f_fll_execute_program_e,
     fake_f_fll_file_mode_set_all_e,
-    fake_f_fll_file_move_e,
     fake_f_fll_file_role_change_all_e,
     fake_f_fll_fss_basic_list_read_e,
     fake_f_fll_fss_extended_read_e,
index 0e53db26b5bcf54029beb2877dec88eb3ccd6b5f..43a5ca36017fa05485dc21c0ae6eeabf19836500 100644 (file)
 #include <program/fake/main/build/skeleton.h>
 #include <program/fake/main/build/string.h>
 #include <program/fake/main/clean.h>
+#include <program/fake/main/fake/do.h>
 #include <program/fake/main/fake/path_generate.h>
 #include <program/fake/main/make.h>
 #include <program/fake/main/make/load_fakefile.h>
diff --git a/level_3/fake/c/main/fake/do.c b/level_3/fake/c/main/fake/do.c
new file mode 100644 (file)
index 0000000..a94c044
--- /dev/null
@@ -0,0 +1,196 @@
+#include "../fake.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_fake_do_copy_action_
+  void fake_do_copy_action(void * const void_recurse, const f_string_static_t name, const uint16_t flag) {
+
+    if (!void_recurse) return;
+
+    f_directory_recurse_do_t * const recurse = (f_directory_recurse_do_t *) void_recurse;
+
+    if (!recurse->state.custom) return;
+
+    fake_local_t * const local = (fake_local_t *) recurse->state.custom;
+
+    if (!local->custom_1) {
+      recurse->state.status = F_status_set_error(F_parameter);
+
+      return;
+    }
+
+    f_string_map_t * const map = (f_string_map_t *) local->custom_1;
+
+    if (flag & f_directory_recurse_do_flag_before_e) {
+      if (flag & f_directory_recurse_do_flag_top_e) {
+        if (recurse->state.code & fake_state_code_clone_e) {
+          fake_print_verbose_cloning(&local->main->program.message, *recurse->path_top, map->name);
+
+          recurse->state.status = f_file_clone(*recurse->path_top, map->name, F_file_default_write_size_d, F_file_flag_write_only_d);
+        }
+        else {
+          fake_print_verbose_copying(&local->main->program.message, *recurse->path_top, map->name);
+
+          recurse->state.status = f_file_copy(*recurse->path_top, map->name, recurse->mode, F_file_default_write_size_d, F_file_flag_write_only_d);
+        }
+
+        if (F_status_is_error(recurse->state.status)) {
+          local->main->setting.state.status = recurse->state.status;
+
+          fake_print_error_file(&local->main->program.error, (recurse->state.code & fake_state_code_clone_e) ? macro_fake_f(f_file_clone) : macro_fake_f(f_file_copy), *recurse->path_top, (recurse->state.code & fake_state_code_clone_e) ? f_file_operation_clone_s : f_file_operation_copy_s, fll_error_file_type_directory_e);
+
+          // Save the error status for when the error message is printed.
+          *((f_status_t *) local->custom_2) = recurse->state.status;
+        }
+        else {
+          fake_string_dynamic_reset(&recurse->path_cache);
+
+          // Pre-populate the destination into the path cache.
+          recurse->state.status = f_string_dynamic_append_nulless(map->name, &recurse->path_cache);
+
+          if (F_status_is_error_not(recurse->state.status)) {
+            recurse->state.status = F_none;
+
+            // Do not allow trailing path separators in the string's length calculation, except root directory '/'.
+            for (; recurse->path_cache.used; --recurse->path_cache.used) {
+              if (recurse->path_cache.string[recurse->path_cache.used - 1] != f_path_separator_s.string[0]) break;
+            } // for
+
+            recurse->path_cache.string[recurse->path_cache.used] = 0;
+          }
+        }
+
+        return;
+      }
+
+      if (flag & f_directory_recurse_do_flag_directory_e) {
+
+        // Push the directory name on the path stack (the destination path is expected to be pre-populated).
+        recurse->state.status = f_string_dynamic_increase_by(f_path_separator_s.used + name.used + 1, &recurse->path_cache);
+
+        if (F_status_is_error_not(recurse->state.status)) {
+          recurse->state.status = f_string_dynamic_append_assure(f_path_separator_s, &recurse->path_cache);
+        }
+
+        if (F_status_is_error_not(recurse->state.status)) {
+          recurse->state.status = f_string_dynamic_append_nulless(name, &recurse->path_cache);
+        }
+
+        // Guaranetee NULL terminated string.
+        recurse->path_cache.string[recurse->path_cache.used] = 0;
+
+        if (F_status_is_error(recurse->state.status)) return;
+
+        if (recurse->state.code & fake_state_code_clone_e) {
+          fake_print_verbose_cloning(&local->main->program.message, recurse->path, recurse->path_cache);
+
+          recurse->state.status = f_file_clone(recurse->path, recurse->path_cache, F_file_default_write_size_d, F_file_flag_write_only_d);
+        }
+        else {
+          fake_print_verbose_copying(&local->main->program.message, recurse->path, recurse->path_cache);
+
+          recurse->state.status = f_file_copy(recurse->path, recurse->path_cache, recurse->mode, F_file_default_write_size_d, F_file_flag_write_only_d);
+        }
+
+        if (F_status_is_error(recurse->state.status)) {
+          local->main->setting.state.status = recurse->state.status;
+
+          fake_print_error_file(&local->main->program.error, (recurse->state.code & fake_state_code_clone_e) ? macro_fake_f(f_file_clone) : macro_fake_f(f_file_copy), recurse->path, (recurse->state.code & fake_state_code_clone_e) ? f_file_operation_clone_s : f_file_operation_copy_s, fll_error_file_type_directory_e);
+
+          // Save the error status for when the error message is printed.
+          *((f_status_t *) local->custom_2) = recurse->state.status;
+        }
+      }
+
+      return;
+    }
+
+    if (flag & f_directory_recurse_do_flag_after_e) {
+      if (flag & f_directory_recurse_do_flag_directory_e) {
+
+        // Pop the current path off of the path stack.
+        if (F_status_is_error_not(recurse->state.status)) {
+          recurse->path_cache.used -= f_path_separator_s.used + name.used;
+        }
+
+        // Guaranetee NULL terminated string.
+        recurse->path_cache.string[recurse->path_cache.used] = 0;
+      }
+
+      return;
+    }
+
+    fake_string_dynamic_reset(&map->value);
+
+    recurse->state.status = f_string_dynamic_increase_by(recurse->path_cache.used + f_path_separator_s.used + name.used + 1, &map->value);
+
+    if (F_status_is_error_not(recurse->state.status)) {
+      recurse->state.status = f_string_dynamic_append_nulless(recurse->path_cache, &map->value);
+    }
+
+    if (F_status_is_error_not(recurse->state.status)) {
+      recurse->state.status = f_string_dynamic_append_assure(f_path_separator_s, &map->value);
+    }
+
+    if (F_status_is_error_not(recurse->state.status)) {
+      recurse->state.status = f_string_dynamic_append_nulless(name, &map->value);
+    }
+
+    // Guaranetee NULL terminated string.
+    map->value.string[map->value.used] = 0;
+
+    if (F_status_is_error(recurse->state.status)) return;
+
+    if (recurse->state.code & fake_state_code_clone_e) {
+      fake_print_verbose_cloning(&local->main->program.message, recurse->path, map->value);
+
+      recurse->state.status = f_file_clone(recurse->path, map->value, F_file_default_write_size_d, F_file_flag_write_only_d);
+    }
+    else {
+      fake_print_verbose_copying(&local->main->program.message, recurse->path, map->value);
+
+      recurse->state.status = f_file_copy(recurse->path, map->value, recurse->mode, F_file_default_write_size_d, F_file_flag_write_only_d);
+    }
+
+    if (F_status_is_error(recurse->state.status)) {
+      local->main->setting.state.status = recurse->state.status;
+
+      fake_print_error_file(&local->main->program.error, (recurse->state.code & fake_state_code_clone_e) ? macro_fake_f(f_file_clone) : macro_fake_f(f_file_copy), map->value, f_file_operation_create_s, (flag & f_directory_recurse_do_flag_directory_e) ? fll_error_file_type_directory_e : fll_error_file_type_file_e);
+
+      // Save the error status for when the error message is printed.
+      *((f_status_t *) local->custom_2) = recurse->state.status;
+    }
+  }
+#endif // _di_fake_do_copy_action_
+
+#ifndef _di_fake_do_copy_handle_
+  void fake_do_copy_handle(void * const void_recurse, const f_string_static_t name, const uint16_t flag) {
+
+    if (!void_recurse) return;
+
+    f_directory_recurse_do_t * const recurse = (f_directory_recurse_do_t *) void_recurse;
+
+    // Do not print any errors on interrupts.
+    if (F_status_set_fine(recurse->state.status) == F_interrupt) return;
+
+    if (!recurse->state.custom) return;
+
+    fake_local_t * const local = (fake_local_t *) recurse->state.custom;
+
+    if (!local->main || !local->custom_1 || !local->custom_2) return;
+
+    if (F_status_is_error_not(*((f_status_t *) local->custom_2))) {
+      local->main->setting.state.status = recurse->state.status;
+
+      fake_print_error_build_operation_file(&local->main->program.error, macro_fake_f(fl_directory_do), (recurse->state.code & fake_state_code_clone_e) ? f_file_operation_clone_s : f_file_operation_copy_s, *recurse->path_top, recurse->path_cache, f_file_operation_to_s, F_true);
+
+      *((f_status_t *) local->custom_2) = recurse->state.status;
+    }
+  }
+#endif // _di_fake_do_copy_handle_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/fake/c/main/fake/do.h b/level_3/fake/c/main/fake/do.h
new file mode 100644 (file)
index 0000000..ddfc6b3
--- /dev/null
@@ -0,0 +1,89 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: Featureless Make
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides functions, usually callbacks, for functions like fl_directory_do().
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _fake_fake_do_h
+#define _fake_fake_do_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Callback for performing an action regarding the copy operation for fake_build_copy().
+ *
+ * This can also be used for a clone or a move operation when the appropriate flags or set.
+ *
+ * @param recurse
+ *   The recuse structure.
+ *   Must be of type f_directory_recurse_do_t.
+ *
+ *   The recurse.state.code relevant flags:
+ *     - fake_state_code_clone_e: Designate that this is a clone instead of copy.
+ *     - fake_state_code_local_e: This is required and assumed to be set.
+ *
+ *   This alters recurse.state.custom.main.setting.state.status and recurse.state.status:
+ *     F_none on success.
+ *
+ *     F_parameter (with error bit) on invalid parameter to the callback.
+ *
+ *     Errors (with error bit) from: f_file_clone().
+ *     Errors (with error bit) from: f_file_copy().
+ *     Errors (with error bit) from: f_string_dynamic_append_assure().
+ *     Errors (with error bit) from: f_string_dynamic_append_nulless().
+ *     Errors (with error bit) from: f_string_dynamic_increase_by().
+ * @param name
+ *   The directory name currently being process based on the flag.
+ * @param flag
+ *   The flags representing the action.
+ *
+ * @see f_file_clone()
+ * @see f_file_copy()
+ * @see f_string_dynamic_append_assure()
+ * @see f_string_dynamic_append_nulless()
+ * @see f_string_dynamic_increase_by()
+ *
+ * @see fake_build_copy()
+ */
+#ifndef _di_fake_do_copy_action_
+  extern void fake_do_copy_action(void * const recurse, const f_string_static_t name, const uint16_t flag);
+#endif // _di_fake_do_copy_action_
+
+/**
+ * Callback for handling an error regarding the copy operation for fake_build_copy().
+ *
+ * This can also be used for a clone or a move operation when the appropriate flags or set.
+ *
+ * @param recurse
+ *   The recuse structure.
+ *   Must be of type f_directory_recurse_do_t.
+ *
+ *   The recurse.state.code relevant flags:
+ *     - fake_state_code_clone_e: Designate that this is a clone instead of copy.
+ *     - fake_state_code_local_e: This is required and assumed to be set.
+ *
+ *   This alters recurse.state.custom.main.setting.state.status:
+ *     Assigns value from recurse.state.status.
+ *
+ *   This does not alter recurse.state.status.
+ * @param name
+ *   The directory name currently being process based on the flag.
+ * @param flag
+ *   The flags representing the action.
+ */
+#ifndef _di_fake_do_copy_handle_
+  extern void fake_do_copy_handle(void * const recurse, const f_string_static_t name, const uint16_t flag);
+#endif // _di_fake_do_copy_handle_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _fake_fake_do_h
index aaeb45d205912e2053373e97717afe846f9d9123..41b0859cb48cc1e9a4488aadeec287fa3bc73423 100644 (file)
@@ -210,16 +210,19 @@ extern "C" {
     fake_main_t * const main = data_make->main;
 
     const f_array_length_t total = main->cache_arguments.used - 1;
-    f_string_static_t destination = f_string_static_t_initialize;
-    f_directory_recurse_copy_t recurse = f_directory_recurse_copy_t_initialize;
+    f_status_t failed = F_none;
+    fake_local_t local = macro_fake_local_t_initialize_1(main, &main->cache_map, &failed);
 
-    if (main->program.error.verbosity > f_console_verbosity_normal_e) {
-      recurse.state.custom = main;
-      recurse.verbose = clone ? fake_print_verbose_recursive_clone : fake_print_verbose_recursive_copy;
-    }
+    f_directory_recurse_do_t recurse = f_directory_recurse_do_t_initialize;
+    recurse.action = &fake_do_copy_action;
+    recurse.handle = &fake_do_copy_handle;
+    recurse.state.custom = (void *) &local;
+    recurse.state.code = fake_state_code_local_e;
+    recurse.flag = f_directory_recurse_do_flag_top_e | f_directory_recurse_do_flag_before_e | f_directory_recurse_do_flag_after_e;
 
     if (clone) {
-      recurse.flag = f_file_stat_flag_group_e | f_file_stat_flag_owner_e;
+      recurse.state.code |= fake_state_code_clone_e;
+      recurse.flag = f_file_stat_flag_group_e | f_file_stat_flag_owner_e | f_directory_recurse_copy_flag_clone_e;
     }
     else {
       macro_f_mode_t_set_default_umask(recurse.mode, main->program.umask);
@@ -227,127 +230,114 @@ extern "C" {
 
     bool existing = F_true;
     f_array_length_t i = 0;
+    const f_string_t *function = 0;
+    const f_string_static_t *operation = 0;
+    uint8_t type = fll_error_file_type_path_e;
 
+    // The first argument may designate not to dereference links.
     if (f_compare_dynamic(fake_make_operation_argument_no_dereference_s, main->cache_arguments.array[i]) == F_equal_to) {
       ++i;
       recurse.flag |= f_file_stat_flag_reference_e;
     }
 
-    // In this case, the destination could be a file, so confirm this.
+    // Confirm if the destination is a file when there are three or more arguments (after the potential no dereference argument).
     if (main->cache_arguments.used == 2 + i) {
       main->setting.state.status = f_directory_is(main->cache_arguments.array[1]);
 
       if (F_status_is_error(main->setting.state.status)) {
-        fake_print_error_file(&main->program.error, macro_fake_f(f_directory_is), main->cache_arguments.array[1], f_file_operation_identify_s, fll_error_file_type_path_e);
-
-        main->setting.state.status = F_status_set_error(F_failure);
-
-        f_directory_recurse_copy_delete(&recurse);
-
-        return;
+        function = &macro_fake_f(f_directory_is);
+        operation = &f_file_operation_identify_s;
       }
-
-      if (main->setting.state.status == F_false || main->setting.state.status == F_file_found_not || main->setting.state.status == F_data_not) {
+      else if (main->setting.state.status == F_false || main->setting.state.status == F_file_found_not || main->setting.state.status == F_data_not) {
         existing = F_false;
       }
     }
 
-    for (; i < total; ++i) {
+    if (F_status_is_error_not(main->setting.state.status)) {
+      for (; i < total; ++i) {
 
-      destination.used = main->cache_arguments.array[total].used + 1;
+        fake_string_dynamic_reset(&main->cache_map.name);
 
-      if (existing) {
-        fake_string_dynamic_reset(&main->cache_argument);
-
-        main->setting.state.status = f_file_name_base(main->cache_arguments.array[i], &main->cache_argument);
+        main->setting.state.status = f_string_dynamic_append_nulless(main->cache_arguments.array[total], &main->cache_map.name);
 
         if (F_status_is_error(main->setting.state.status)) {
-          fake_print_error_file(&main->program.error, macro_fake_f(f_file_name_base), main->cache_arguments.array[i], f_file_operation_process_s, fll_error_file_type_path_e);
-
-          main->setting.state.status = F_status_set_error(F_failure);
-
-          f_directory_recurse_copy_delete(&recurse);
+          function = &macro_fake_f(f_string_dynamic_append_nulless);
+          operation = &f_file_operation_process_s;
 
-          return;
+          break;
         }
 
-        destination.used += main->cache_argument.used + 1;
-      }
-
-      f_char_t destination_string[destination.used + 1];
-      destination.string = destination_string;
-      destination_string[destination.used] = 0;
-      destination_string[destination.used - 1] = 0;
+        if (existing) {
+          main->setting.state.status = f_string_dynamic_append_assure(f_path_separator_s, &main->cache_map.name);
 
-      if (existing) {
-        destination_string[destination.used - 2] = 0;
-      }
+          if (F_status_is_error(main->setting.state.status)) {
+            function = &macro_fake_f(f_string_dynamic_append_assure);
+            operation = &f_file_operation_process_s;
 
-      memcpy(destination_string, main->cache_arguments.array[total].string, sizeof(f_char_t) * main->cache_arguments.array[total].used);
+            break;
+          }
 
-      if (existing) {
-        if (destination_string[main->cache_arguments.array[total].used - 1] == f_path_separator_s.string[0]) {
-          memcpy(destination_string + main->cache_arguments.array[total].used, main->cache_argument.string, sizeof(f_char_t) * main->cache_argument.used);
+          main->setting.state.status = f_file_name_base(main->cache_arguments.array[i], &main->cache_map.name);
 
-          --destination.used;
-        }
-        else {
-          memcpy(destination_string + main->cache_arguments.array[total].used + 1, main->cache_argument.string, sizeof(f_char_t) * main->cache_arguments.array[i].used);
+          if (F_status_is_error(main->setting.state.status)) {
+            function = &macro_fake_f(f_file_name_base);
+            operation = &f_file_operation_process_s;
 
-          destination_string[main->cache_arguments.array[total].used] = f_path_separator_s.string[0];
+            break;
+          }
         }
-      }
 
-      main->setting.state.status = f_directory_is(main->cache_arguments.array[i]);
-
-      if (main->setting.state.status == F_true) {
-        if (clone) {
-          recurse.flag |= f_directory_recurse_copy_flag_clone_e;
-        }
-        else {
-          recurse.flag -= recurse.flag & f_directory_recurse_copy_flag_clone_e;
-        }
+        main->setting.state.status = f_directory_is(main->cache_arguments.array[i]);
 
-        fl_directory_copy(main->cache_arguments.array[i], destination, &recurse);
+        if (main->setting.state.status == F_true) {
+          fl_directory_do(main->cache_arguments.array[i], &recurse);
 
-        if (F_status_is_error(recurse.state.status)) {
-          main->setting.state.status = recurse.state.status;
+          if (F_status_is_error(recurse.state.status)) {
+            main->setting.state.status = recurse.state.status;
 
-          fake_print_error_file(&main->program.error, macro_fake_f(fl_directory_copy), main->cache_arguments.array[i], clone ? f_file_operation_clone_s : f_file_operation_copy_s, fll_error_file_type_directory_e);
+            function = &macro_fake_f(fl_directory_do);
+            operation = clone ? &f_file_operation_clone_s : &f_file_operation_copy_s;
+            type = fll_error_file_type_directory_e;
 
-          main->setting.state.status = F_status_set_error(F_failure);
-        }
-      }
-      else if (main->setting.state.status == F_false) {
-        if (clone) {
-          main->setting.state.status = f_file_clone(main->cache_arguments.array[i], destination, recurse.size_block, recurse.flag);
-        }
-        else {
-          main->setting.state.status = f_file_copy(main->cache_arguments.array[i], destination, recurse.mode, recurse.size_block, recurse.flag);
+            break;
+          }
         }
+        else if (main->setting.state.status == F_false) {
+          if (clone) {
+            main->setting.state.status = f_file_clone(main->cache_arguments.array[i], main->cache_map.name, F_file_default_write_size_d, F_file_flag_write_only_d);
+          }
+          else {
+            main->setting.state.status = f_file_copy(main->cache_arguments.array[i], main->cache_map.name, recurse.mode, F_file_default_write_size_d, F_file_flag_write_only_d);
+          }
 
-        if (F_status_is_error(main->setting.state.status)) {
-          fake_print_error_file(&main->program.error, clone ? macro_fake_f(f_file_clone) : macro_fake_f(f_file_copy), main->cache_arguments.array[i], clone ? f_file_operation_clone_s : f_file_operation_copy_s, fll_error_file_type_file_e);
+          if (F_status_is_error(main->setting.state.status)) {
+            function = clone ? &macro_fake_f(f_file_clone) : &macro_fake_f(f_file_copy);
+            operation = clone ? &f_file_operation_clone_s : &f_file_operation_copy_s;
+            type = fll_error_file_type_file_e;
 
-          main->setting.state.status = F_status_set_error(F_failure);
+            break;
+          }
 
-          break;
+          fake_make_print_verbose_operate_copy(&main->program.message, clone, main->cache_arguments.array[i], main->cache_map.name);
         }
+        else if (F_status_is_error(main->setting.state.status)) {
+          function = &macro_fake_f(f_directory_is);
+          operation = &f_file_operation_identify_s;
+          type = fll_error_file_type_directory_e;
 
-        fake_make_print_verbose_operate_copy(&main->program.message, clone, main->cache_arguments.array[i], destination);
-      }
-      else if (F_status_is_error(main->setting.state.status)) {
-        fake_print_error_file(&main->program.error, macro_fake_f(f_directory_is), main->cache_arguments.array[i], f_file_operation_identify_s, fll_error_file_type_directory_e);
-
-        main->setting.state.status = F_status_set_error(F_failure);
+          break;
+        }
+      } // for
+    }
 
-        break;
-      }
-    } // for
+    f_directory_recurse_do_delete(&recurse);
 
-    f_directory_recurse_copy_delete(&recurse);
+    if (F_status_is_error(main->setting.state.status)) {
+      fake_print_error_file(&main->program.error, *function, main->cache_arguments.array[1], *operation, fll_error_file_type_path_e);
 
-    if (F_status_is_error_not(main->setting.state.status)) {
+      main->setting.state.status = F_status_set_error(F_failure);
+    }
+    else {
       main->setting.state.status = F_none;
     }
   }
@@ -1495,17 +1485,10 @@ extern "C" {
 
     fake_main_t * const main = data_make->main;
 
-    const f_array_length_t total = main->cache_arguments.used -1;
+    const f_array_length_t total = main->cache_arguments.used - 1;
 
-    f_directory_recurse_copy_t recurse = f_directory_recurse_copy_t_initialize;
     f_string_static_t destination = f_string_static_t_initialize;
 
-    if (main->program.error.verbosity > f_console_verbosity_normal_e) {
-      recurse.state.custom = main;
-
-      recurse.verbose = fake_print_verbose_recursive_move;
-    }
-
     bool existing = F_true;
 
     // In this case, the destination could be a file, so confirm this.
@@ -1517,8 +1500,6 @@ extern "C" {
 
         main->setting.state.status = F_status_set_error(F_failure);
 
-        f_directory_recurse_copy_delete(&recurse);
-
         return;
       }
 
@@ -1527,69 +1508,67 @@ extern "C" {
       }
     }
 
-    for (f_array_length_t i = 0; i < total; ++i) {
-
-      destination.used = main->cache_arguments.array[total].used;
-
-      if (existing) {
-        fake_string_dynamic_reset(&main->cache_argument);
-
-        main->setting.state.status = f_file_name_base(main->cache_arguments.array[i], &main->cache_argument);
+    const f_string_t *function = 0;
+    const f_string_static_t *operation = 0;
+    f_string_static_t *file = 0;
 
-        if (F_status_is_error(main->setting.state.status)) {
-          fake_print_error_file(&main->program.error, macro_fake_f(f_file_name_base), main->cache_arguments.array[i], f_file_operation_process_s, fll_error_file_type_path_e);
+    for (f_array_length_t i = 0; i < total; ++i) {
 
-          main->setting.state.status = F_status_set_error(F_failure);
+      fake_string_dynamic_reset(&main->cache_argument);
 
-          f_directory_recurse_copy_delete(&recurse);
+      main->setting.state.status = f_string_dynamic_append_nulless(main->cache_arguments.array[total], &main->cache_argument);
 
-          return;
-        }
+      if (F_status_is_error(main->setting.state.status)) {
+        function = &macro_fake_f(f_string_dynamic_append_nulless);
+        operation = &f_file_operation_process_s;
+        file = &main->cache_arguments.array[i];
 
-        destination.used += main->cache_argument.used + 1;
+        break;
       }
 
-      f_char_t destination_string[destination.used + 1];
-      destination.string = destination_string;
-      destination_string[destination.used] = 0;
-
       if (existing) {
-        destination_string[destination.used - 1] = 0;
-      }
+        main->setting.state.status = f_string_dynamic_append_assure(f_path_separator_s, &main->cache_argument);
 
-      memcpy(destination_string, main->cache_arguments.array[total].string, sizeof(f_char_t) * main->cache_arguments.array[total].used);
-
-      if (existing) {
-        if (destination_string[main->cache_arguments.array[total].used - 1] == f_path_separator_s.string[0]) {
-          memcpy(destination_string + main->cache_arguments.array[total].used, main->cache_argument.string, sizeof(f_char_t) * main->cache_argument.used);
+        if (F_status_is_error(main->setting.state.status)) {
+          function = &macro_fake_f(f_string_dynamic_append_assure);
+          operation = &f_file_operation_process_s;
+          file = &main->cache_arguments.array[i];
 
-          --destination.used;
+          break;
         }
-        else {
-          memcpy(destination_string + main->cache_arguments.array[total].used + 1, main->cache_argument.string, sizeof(f_char_t) * main->cache_arguments.array[i].used);
 
-          destination_string[main->cache_arguments.array[total].used] = f_path_separator_s.string[0];
-        }
-      }
+        main->setting.state.status = f_file_name_base(main->cache_arguments.array[i], &main->cache_argument);
 
-      fll_file_move(main->cache_arguments.array[i], destination, &recurse);
+        if (F_status_is_error(main->setting.state.status)) {
+          function = &macro_fake_f(f_file_name_base);
+          operation = &f_file_operation_process_s;
+          file = &main->cache_arguments.array[i];
 
-      if (F_status_is_error(recurse.state.status)) {
-        main->setting.state.status = recurse.state.status;
+          return;
+        }
+      }
 
-        fake_print_error_file(&main->program.error, macro_fake_f(fll_file_move), main->cache_arguments.array[i], f_file_operation_move_s, fll_error_file_type_directory_e);
+      main->cache_argument.string[main->cache_argument.used] = 0;
 
-        main->setting.state.status = F_status_set_error(F_failure);
+      main->setting.state.status = f_file_rename(main->cache_arguments.array[i], main->cache_argument);
 
-        f_directory_recurse_copy_delete(&recurse);
+      if (F_status_is_error(main->setting.state.status)) {
+        function = &macro_fake_f(f_file_rename);
+        operation = &f_file_operation_move_s;
+        file = &main->cache_argument;
 
-        return;
+        break;
       }
     } // for
 
-    f_directory_recurse_copy_delete(&recurse);
+    if (F_status_is_error(main->setting.state.status)) {
+      fake_print_error_file(&main->program.error, *function, *file, *operation, fll_error_file_type_path_e);
 
-    main->setting.state.status = F_none;
+      main->setting.state.status = F_status_set_error(F_failure);
+    }
+    else {
+      main->setting.state.status = F_none;
+    }
   }
 #endif // _di_fake_make_operate_process_type_move_
 
index 83cda233eacf8f14afdb0a81ccb070174bf2ce1f..a3f90bf1282c898aa2f65ec6e898765d27cc480f 100644 (file)
@@ -131,18 +131,14 @@ extern "C" {
  * @param data_make
  *   All make related setting data, including data from the fakefile and the build settings file.
  *
+ *   This modifies data.main.cache_map.
+ *
  *   This alters data_make.main->setting.state.status:
  *     F_none on success.
  *
  *     F_failure (with error bit) on any error.
  *
  *     F_interrupt (with error bit) on interrupt signal received.
- *
- *     Errors (with error bit) from: f_directory_is()
- *     Errors (with error bit) from: f_file_clone()
- *     Errors (with error bit) from: f_file_copy()
- *     Errors (with error bit) from: f_file_name_base()
- *     Errors (with error bit) from: fl_directory_copy()
  * @param clone
  *   If TRUE, perform a copy that is a clone (preserved timestamps, roles, and permissions).
  *   If FALSE, perforrm a normaly copy without preserving properties.
@@ -151,7 +147,9 @@ extern "C" {
  * @see f_file_clone()
  * @see f_file_copy()
  * @see f_file_name_base()
- * @see fl_directory_copy()
+ * @see fl_directory_do()
+ *
+ * @see fake_do_copy_action()
  */
 #ifndef _di_fake_make_operate_process_type_copy_
   extern void fake_make_operate_process_type_copy(fake_make_data_t * const data_make, const bool clone);
@@ -545,6 +543,8 @@ extern "C" {
  * @param data_make
  *   All make related setting data, including data from the fakefile and the build settings file.
  *
+ *   This modifies data.main.cache_argument.
+ *
  *   This alters data_make.main->setting.state.status:
  *     F_none on success.
  *
@@ -552,11 +552,11 @@ extern "C" {
  *
  *     Errors (with error bit) from: f_directory_is()
  *     Errors (with error bit) from: f_file_name_base()
- *     Errors (with error bit) from: fll_file_move()
+ *     Errors (with error bit) from: f_file_rename()
  *
  * @see f_directory_is()
  * @see f_file_name_base()
- * @see fll_file_move()
+ * @see f_file_rename()
  */
 #ifndef _di_fake_make_operate_process_type_move_
   extern void fake_make_operate_process_type_move(fake_make_data_t * const data_make);
index 363ac20084eaa756fb2076f1b2363905a8dd4d20..9424560bb73d57679b15011402968f49153c9744 100644 (file)
@@ -4,6 +4,30 @@
 extern "C" {
 #endif
 
+#ifndef _di_fake_print_verbose_cloning_
+  f_status_t fake_print_verbose_cloning(fl_print_t * const print, const f_string_static_t source, const f_string_static_t destination) {
+
+    if (!print) return F_status_set_error(F_output_not);
+    if (print->verbosity < f_console_verbosity_verbose_e) return F_output_not;
+
+    fake_print_common_wrapped_variables(print, "Cloning file ", source, " to ", destination, f_string_empty_s.string);
+
+    return F_none;
+  }
+#endif // _di_fake_print_verbose_cloning_
+
+#ifndef _di_fake_print_verbose_copying_
+  f_status_t fake_print_verbose_copying(fl_print_t * const print, const f_string_static_t source, const f_string_static_t destination) {
+
+    if (!print) return F_status_set_error(F_output_not);
+    if (print->verbosity < f_console_verbosity_verbose_e) return F_output_not;
+
+    fake_print_common_wrapped_variables(print, "Copying file ", source, " to ", destination, f_string_empty_s.string);
+
+    return F_none;
+  }
+#endif // _di_fake_print_verbose_copying_
+
 #ifndef _di_fake_print_verbose_create_directory_
   void fake_print_verbose_create_directory(fl_print_t * const print, const f_string_static_t path) {
 
@@ -78,86 +102,17 @@ extern "C" {
   }
 #endif // _di_fake_print_verbose_file_pre_populated_
 
-#ifndef _di_fake_print_verbose_recursive_clone_
-  void fake_print_verbose_recursive_clone(const f_string_static_t source, const f_string_static_t destination, void * const void_recurse) {
-
-    if (!void_recurse) return;
-
-    f_directory_recurse_copy_t * const recurse = (f_directory_recurse_copy_t * const) void_recurse;
-
-    if (!recurse->state.custom) {
-      recurse->state.status = F_output_not;
-
-      return;
-    }
-
-    fake_main_t * const main = (recurse->state.code & fake_state_code_local_e)
-      ? ((fake_local_t *) recurse->state.custom)->main
-      : (fake_main_t *) recurse->state.custom;
-
-    if (main->program.message.verbosity < f_console_verbosity_verbose_e) {
-      recurse->state.status = F_output_not;
+#ifndef _di_fake_print_verbose_moving_
+  f_status_t fake_print_verbose_moving(fl_print_t * const print, const f_string_static_t source, const f_string_static_t destination) {
 
-      return;
-    }
-
-    fake_print_common_wrapped_variables(&main->program.message, "Cloned ", source, " to ", destination, 0);
-  }
-#endif // _di_fake_print_verbose_recursive_clone_
-
-#ifndef _di_fake_print_verbose_recursive_copy_
-  void fake_print_verbose_recursive_copy(const f_string_static_t source, const f_string_static_t destination, void * const void_recurse) {
-
-    if (!void_recurse) return;
-
-    f_directory_recurse_copy_t * const recurse = (f_directory_recurse_copy_t * const) void_recurse;
-
-    if (!recurse->state.custom) {
-      recurse->state.status = F_output_not;
-
-      return;
-    }
-
-    fake_main_t * const main = (recurse->state.code & fake_state_code_local_e)
-      ? ((fake_local_t *) recurse->state.custom)->main
-      : (fake_main_t *) recurse->state.custom;
-
-    if (main->program.message.verbosity < f_console_verbosity_verbose_e) {
-      recurse->state.status = F_output_not;
-
-      return;
-    }
-
-    fake_print_common_wrapped_variables(&main->program.message, "Copied ", source, " to ", destination, 0);
-  }
-#endif // _di_fake_print_verbose_recursive_copy_
-
-#ifndef _di_fake_print_verbose_recursive_move_
-  void fake_print_verbose_recursive_move(const f_string_static_t source, const f_string_static_t destination, void * const void_recurse) {
-
-    if (!void_recurse) return;
-
-    f_directory_recurse_copy_t * const recurse = (f_directory_recurse_copy_t * const) void_recurse;
-
-    if (!recurse->state.custom) {
-      recurse->state.status = F_output_not;
-
-      return;
-    }
-
-    fake_main_t * const main = (recurse->state.code & fake_state_code_local_e)
-      ? ((fake_local_t *) recurse->state.custom)->main
-      : (fake_main_t *) recurse->state.custom;
-
-    if (main->program.message.verbosity < f_console_verbosity_verbose_e) {
-      recurse->state.status = F_output_not;
+    if (!print) return F_status_set_error(F_output_not);
+    if (print->verbosity < f_console_verbosity_verbose_e) return F_output_not;
 
-      return;
-    }
+    fake_print_common_wrapped_variables(print, "Moving file ", source, " to ", destination, f_string_empty_s.string);
 
-    fake_print_common_wrapped_variables(&main->program.message, "Moved ", source, " to ", destination, 0);
+    return F_none;
   }
-#endif // _di_fake_print_verbose_recursive_move_
+#endif // _di_fake_print_verbose_moving_
 
 #ifdef __cplusplus
 } // extern "C"
index a116229b5712cf659bd4f16b464ec6171bf5faca..b17688cf1ef0e92b6ea8554c627286b624bd9cad 100644 (file)
@@ -17,6 +17,58 @@ extern "C" {
 #endif
 
 /**
+ * Print verbose message about cloning a file.
+ *
+ * @param print
+ *   The output structure to print to.
+ *
+ *   This requires print.custom to be fake_main_t.
+ *
+ *   This does not alter print.custom.setting.state.status.
+ * @param source
+ *   The source file path.
+ * @param destination
+ *   The destination file path.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fake_print_common_wrapped_variables()
+ */
+#ifndef _di_fake_print_verbose_cloning_
+  extern f_status_t fake_print_verbose_cloning(fl_print_t * const print, const f_string_static_t source, const f_string_static_t destination);
+#endif // _di_fake_print_verbose_cloning_
+
+/**
+ * Print verbose message about copying a file.
+ *
+ * @param print
+ *   The output structure to print to.
+ *
+ *   This requires print.custom to be fake_main_t.
+ *
+ *   This does not alter print.custom.setting.state.status.
+ * @param source
+ *   The source file path.
+ * @param destination
+ *   The destination file path.
+ *
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_output_not (with error bit) if setting is NULL.
+ *
+ * @see fake_print_common_wrapped_variables()
+ */
+#ifndef _di_fake_print_verbose_copying_
+  extern f_status_t fake_print_verbose_copying(fl_print_t * const print, const f_string_static_t source, const f_string_static_t destination);
+#endif // _di_fake_print_verbose_copying_
+
+/**
  * Print verbose message about creating a directory.
  *
  * @param print
@@ -179,73 +231,30 @@ extern "C" {
 #endif // _di_fake_print_verbose_file_pre_populated_
 
 /**
- * Helper function for performing a verbose print for a file clone operation.
- *
- * This is intended to be passed as a callback to f_directory_recurse_copy_t.verbose.
- * The f_directory_recurse_copy_t.state.custom must be the fake_data_t.
+ * Print verbose message about moving a file.
  *
- * @param source
- *   The source string.
- * @param destination
- *   The destination string.
- * @param recurse
- *   This requires recurse.state.custom to be fake_main_t.
- *
- *   This alters recurse.state.status:
- *     F_none on success.
- *     F_output_not on success, but no printing is performed.
- *
- * @see fll_print_format()
- */
-#ifndef _di_fake_print_verbose_recursive_clone_
-  extern void fake_print_verbose_recursive_clone(const f_string_static_t source, const f_string_static_t destination, void * const recurse);
-#endif // _di_fake_print_verbose_recursive_clone_
-
-/**
- * Helper function for performing a verbose print for a file copy operation.
+ * @param print
+ *   The output structure to print to.
  *
- * This is intended to be passed as a callback to f_directory_recurse_copy_t.verbose.
- * The f_directory_recurse_copy_t.state.custom must be the fake_data_t.
+ *   This requires print.custom to be fake_main_t.
  *
+ *   This does not alter print.custom.setting.state.status.
  * @param source
- *   The source string.
+ *   The source file path.
  * @param destination
- *   The destination string.
- * @param recurse
- *   This requires recurse.state.custom to be fake_main_t.
- *
- *   This alters recurse.state.status:
- *     F_none on success.
- *     F_output_not on success, but no printing is performed.
- *
- * @see fll_print_format()
- */
-#ifndef _di_fake_print_verbose_recursive_copy_
-  extern void fake_print_verbose_recursive_copy(const f_string_static_t source, const f_string_static_t destination, void * const recurse);
-#endif // _di_fake_print_verbose_recursive_copy_
-
-/**
-* Print a verbose message for when a file is moved.
+ *   The destination file path.
  *
- * This is intended to be passed as a callback to f_directory_recurse_copy_t.verbose.
- * The f_directory_recurse_copy_t.state.custom must be the fake_data_t.
- *
- * @param source
- *   The source string.
- * @param destination
- *   The destination string.
- * @param recurse
- *   This requires recurse.state.custom to be fake_main_t.
+ * @return
+ *   F_none on success.
+ *   F_output_not on success, but no printing is performed.
  *
- *   This alters recurse.state.status:
- *     F_none on success.
- *     F_output_not on success, but no printing is performed.
+ *   F_output_not (with error bit) if setting is NULL.
  *
- * @see fll_print_format()
+ * @see fake_print_common_wrapped_variables()
  */
-#ifndef _di_fake_print_verbose_recursive_move_
-  extern void fake_print_verbose_recursive_move(const f_string_static_t source, const f_string_static_t destination, void * const recurse);
-#endif // _di_fake_print_verbose_recursive_move_
+#ifndef _di_fake_print_verbose_moving_
+  extern f_status_t fake_print_verbose_moving(fl_print_t * const print, const f_string_static_t source, const f_string_static_t destination);
+#endif // _di_fake_print_verbose_moving_
 
 #ifdef __cplusplus
 } // extern "C"
index 217e6a1a180633e6e7138db7686ba41efc4bd1c4..dfd9f2d271ced6953c70afa6e3de7c0aea7e51a7 100644 (file)
@@ -43,7 +43,7 @@ build_libraries-monolithic -lfll
 build_sources_library main/build.c main/clean.c main/common.c main/fake.c main/make.c main/print/common.c main/print/context.c main/print/error.c main/print/message.c main/print/operation.c main/print/warning.c main/print/verbose.c main/signal.c main/skeleton.c main/thread.c
 build_sources_library main/build/enumeration.c main/build/library.c main/build/load.c main/build/object.c main/build/objects.c main/build/print/compile.c main/build/print/error.c main/build/print/message.c main/build/print/verbose.c main/build/print/warning.c main/build/program.c main/build/skeleton.c main/build/string.c
 build_sources_library main/common/define.c main/common/enumeration.c main/common/print.c main/common/string.c main/common/type.c
-build_sources_library main/fake/path_generate.c
+build_sources_library main/fake/path_generate.c main/fake/do.c
 build_sources_library main/make/load_fakefile.c main/make/load_parameters.c main/make/operate_block.c main/make/operate.c main/make/operate_process.c main/make/operate_process_type.c main/make/operate_validate.c main/make/operate_validate_type.c main/make/print/error.c main/make/print/message.c main/make/print/verbose.c main/make/print/warning.c
 
 build_sources_program main/main.c
@@ -51,7 +51,7 @@ build_sources_program main/main.c
 build_sources_headers main/build.h main/clean.h main/common.h main/fake.h main/make.h main/print/common.h main/print/context.h main/print/error.h main/print/message.h main/print/operation.h main/print/warning.h main/print/verbose.h main/signal.h main/skeleton.h main/thread.h
 build_sources_headers main/build/enumeration.h main/build/library.h main/build/load.h main/build/object.h main/build/objects.h main/build/print/compile.h main/build/print/error.h main/build/print/message.h main/build/print/verbose.h main/build/print/warning.h main/build/program.h main/build/skeleton.h main/build/string.h
 build_sources_headers main/common/define.h main/common/enumeration.h main/common/print.h main/common/string.h main/common/type.h
-build_sources_headers main/fake/path_generate.h
+build_sources_headers main/fake/path_generate.h main/fake/do.h
 build_sources_headers main/make/load_fakefile.h main/make/load_parameters.h main/make/operate_block.h main/make/operate.h main/make/operate_process.h main/make/operate_process_type.h main/make/operate_validate.h main/make/operate_validate_type.h main/make/print/error.h main/make/print/message.h main/make/print/verbose.h main/make/print/warning.h
 
 build_sources_documentation man