4 /* Control creation of sparse files (files with holes). */
9 /* Never create holes in DEST. */
12 /* This is the default. Use a crude (and sometimes inaccurate)
13 heuristic to determine if SOURCE has holes. If so, try to create
17 /* For every sufficiently long sequence of bytes in SOURCE, try to
18 create a corresponding hole in DEST. There is a performance penalty
19 here because CP has to search for holes in SRC. But if the holes are
20 big enough, that penalty can be offset by the decrease in the amount
21 of data written to disk. */
25 enum Dereference_symlink
30 DEREF_COMMAND_LINE_ARGUMENTS
33 # define VALID_SPARSE_MODE(Mode) \
34 ((Mode) == SPARSE_NEVER \
35 || (Mode) == SPARSE_AUTO \
36 || (Mode) == SPARSE_ALWAYS)
40 enum backup_type backup_type
;
42 /* If nonzero, copy all files except (directories and, if not dereferencing
43 them, symbolic links,) as if they were regular files. */
46 /* If nonzero, dereference symbolic links (copy the files they point to). */
47 enum Dereference_symlink dereference
;
49 /* If nonzero, remove each existing destination nondirectory before
51 int unlink_dest_before_opening
;
53 /* If nonzero, first try to open each existing destination nondirectory,
54 then, if the open fails, unlink and try again.
55 This option must be set for `cp -f', in case the destination file
56 exists when the open is attempted. It is irrelevant to `mv' since
57 any destination is sure to be removed before the open. */
58 int unlink_dest_after_failed_open
;
60 /* Setting this member is meaningful only if FORCE is also set.
61 If nonzero, copy returns nonzero upon failed unlink.
62 Otherwise, the failure still elicits a diagnostic, but it doesn't
63 change copy's return value. This is nonzero for cp and mv, and zero
65 /* FIXME: this is now unused. */
66 int failed_unlink_is_fatal
;
68 /* If nonzero, create hard links instead of copying files.
69 Create destination directories as usual. */
72 /* If nonzero, query before overwriting existing destinations
73 with regular files. */
76 /* If nonzero, rather than copying, first attempt to use rename.
77 If that fails, then resort to copying. */
80 /* This process's effective user ID. */
83 /* If nonzero, when copying recursively, skip any subdirectories that are
84 on different filesystems from the one we started on. */
87 /* If nonzero, attempt to give the copies the original files' permissions,
88 owner, group, and timestamps. */
89 int preserve_owner_and_group
;
90 int preserve_chmod_bits
;
91 int preserve_timestamps
;
93 /* If nonzero and any of the above (for preserve) file attributes cannot
94 be applied to a destination file, treat it as a failure and return
95 nonzero immediately. E.g. cp -p requires this be nonzero, mv requires
99 /* If nonzero, copy directories recursively and copy special files
100 as themselves rather than copying their contents. */
103 /* If nonzero, set file mode to value of MODE. Otherwise,
104 set it based on current umask modified by UMASK_KILL. */
107 /* Set the mode of the destination file to exactly this value
108 if USE_MODE is nonzero. */
111 /* Control creation of sparse files. */
112 enum Sparse_type sparse_mode
;
114 /* If nonzero, create symbolic links instead of copying files.
115 Create destination directories as usual. */
118 /* The bits to preserve in created files' modes. */
121 /* If nonzero, do not copy a nondirectory that has an existing destination
122 with the same or newer modification time. */
125 /* If nonzero, display the names of the files before copying them. */
128 /* A pointer to either lstat or stat, depending on
129 whether the copy should dereference symlinks. */
136 /* Arrange to make lstat calls go through the wrapper function
137 on systems with an lstat function that does not dereference symlinks
138 that are specified with a trailing slash. */
139 # if ! LSTAT_FOLLOWS_SLASHED_SYMLINK
140 int rpl_lstat
PARAMS((const char *, struct stat
*));
142 # define lstat rpl_lstat
147 /* Arrange to make rename calls go through the wrapper function
148 on systems with a rename function that fails for a source path
149 specified with a trailing slash. */
150 # if RENAME_TRAILING_SLASH_BUG
151 int rpl_rename
PARAMS((const char *, const char *));
153 # define rename rpl_rename
157 copy
PARAMS ((const char *src_path
, const char *dst_path
,
158 int nonexistent_dst
, const struct cp_options
*options
,
159 int *copy_into_self
, int *rename_succeeded
));