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 /* This type is used to help mv (via copy.c) distinguish these cases. */
34 enum Dereference_symlink
39 DEREF_COMMAND_LINE_ARGUMENTS
42 # define VALID_SPARSE_MODE(Mode) \
43 ((Mode) == SPARSE_NEVER \
44 || (Mode) == SPARSE_AUTO \
45 || (Mode) == SPARSE_ALWAYS)
49 enum backup_type backup_type;
51 /* If nonzero, copy all files except (directories and, if not dereferencing
52 them, symbolic links,) as if they were regular files. */
55 /* If nonzero, dereference symbolic links (copy the files they point to). */
56 enum Dereference_symlink dereference;
58 /* If nonzero, remove each existing destination nondirectory before
60 int unlink_dest_before_opening;
62 /* If nonzero, first try to open each existing destination nondirectory,
63 then, if the open fails, unlink and try again.
64 This option must be set for `cp -f', in case the destination file
65 exists when the open is attempted. It is irrelevant to `mv' since
66 any destination is sure to be removed before the open. */
67 int unlink_dest_after_failed_open;
69 /* Setting this member is meaningful only if FORCE is also set.
70 If nonzero, copy returns nonzero upon failed unlink.
71 Otherwise, the failure still elicits a diagnostic, but it doesn't
72 change copy's return value. This is nonzero for cp and mv, and zero
74 /* FIXME: this is now unused. */
75 int failed_unlink_is_fatal;
77 /* If nonzero, create hard links instead of copying files.
78 Create destination directories as usual. */
81 /* This value is used to determine whether to prompt before removing
82 each existing destination file. It works differently depending on
83 whether move_mode is set. See code/comments in copy.c. */
84 enum Interactive interactive;
86 /* If nonzero, rather than copying, first attempt to use rename.
87 If that fails, then resort to copying. */
90 /* This process's effective user ID. */
93 /* If nonzero, when copying recursively, skip any subdirectories that are
94 on different filesystems from the one we started on. */
97 /* If nonzero, attempt to give the copies the original files' permissions,
98 owner, group, and timestamps. */
99 int preserve_ownership;
101 int preserve_timestamps;
103 /* If nonzero and any of the above (for preserve) file attributes cannot
104 be applied to a destination file, treat it as a failure and return
105 nonzero immediately. E.g. cp -p requires this be nonzero, mv requires
107 int require_preserve;
109 /* If nonzero, copy directories recursively and copy special files
110 as themselves rather than copying their contents. */
113 /* If nonzero, set file mode to value of MODE. Otherwise,
114 set it based on current umask modified by UMASK_KILL. */
117 /* Set the mode of the destination file to exactly this value
118 if USE_MODE is nonzero. */
121 /* Control creation of sparse files. */
122 enum Sparse_type sparse_mode;
124 /* If nonzero, create symbolic links instead of copying files.
125 Create destination directories as usual. */
128 /* The bits to preserve in created files' modes. */
131 /* If nonzero, do not copy a nondirectory that has an existing destination
132 with the same or newer modification time. */
135 /* If nonzero, display the names of the files before copying them. */
138 /* A pointer to either lstat or stat, depending on
139 whether the copy should dereference symlinks. */
142 /* If nonzero, stdin is a tty. */
149 /* Arrange to make lstat calls go through the wrapper function
150 on systems with an lstat function that does not dereference symlinks
151 that are specified with a trailing slash. */
152 # if ! LSTAT_FOLLOWS_SLASHED_SYMLINK
153 int rpl_lstat PARAMS((const char *, struct stat *));
155 # define lstat rpl_lstat
160 /* Arrange to make rename calls go through the wrapper function
161 on systems with a rename function that fails for a source path
162 specified with a trailing slash. */
163 # if RENAME_TRAILING_SLASH_BUG
164 int rpl_rename PARAMS((const char *, const char *));
166 # define rename rpl_rename
170 copy PARAMS ((const char *src_path, const char *dst_path,
171 int nonexistent_dst, const struct cp_options *options,
172 int *copy_into_self, int *rename_succeeded));
175 dest_info_init PARAMS ((void));