MCPcopy Create free account
hub / github.com/coreutils/coreutils / copy

Function copy

src/copy.c:2799–2823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2797 Return true if successful. */
2798
2799extern bool
2800copy (char const *src_name, char const *dst_name,
2801 int dst_dirfd, char const *dst_relname,
2802 int nonexistent_dst, const struct cp_options *options,
2803 bool *copy_into_self, bool *rename_succeeded)
2804{
2805 valid_options (options);
2806
2807 /* Record the file names: they're used in case of error, when copying
2808 a directory into itself. I don't like to make these tools do *any*
2809 extra work in the common case when that work is solely to handle
2810 exceptional cases, but in this case, I don't see a way to derive the
2811 top level source and destination directory names where they're used.
2812 An alternative is to use COPY_INTO_SELF and print the diagnostic
2813 from every caller -- but I don't want to do that. */
2814 top_level_src_name = src_name;
2815 top_level_dst_name = dst_name;
2816
2817 bool first_dir_created_per_command_line_arg = false;
2818 return copy_internal (src_name, dst_name, dst_dirfd, dst_relname,
2819 nonexistent_dst, NULL, NULL,
2820 options, true,
2821 &first_dir_created_per_command_line_arg,
2822 copy_into_self, rename_succeeded);
2823}
2824
2825/* Set *X to the default options for a value of type struct cp_options. */
2826

Callers 3

do_moveFunction · 0.85
copy_fileFunction · 0.85
do_copyFunction · 0.85

Calls 2

valid_optionsFunction · 0.85
copy_internalFunction · 0.85

Tested by

no test coverage detected