6 /* Control creation of sparse files (files with holes). */
11 /* Never create holes in DEST. */
14 /* This is the default. Use a crude (and sometimes inaccurate)
15 heuristic to determine if SOURCE has holes. If so, try to create
19 /* For every sufficiently long sequence of bytes in SOURCE, try to
20 create a corresponding hole in DEST. There is a performance penalty
21 here because CP has to search for holes in SRC. But if the holes are
22 big enough, that penalty can be offset by the decrease in the amount
23 of data written to disk. */
27 /* This type is used to help mv (via copy.c) distinguish these cases. */
36 /* How to handle symbolic links. */
37 enum Dereference_symlink
41 /* Copy the symbolic link itself. -P */
44 /* If the symbolic is a command line argument, then copy
45 its referent. Otherwise, copy the symbolic link itself. -H */
46 DEREF_COMMAND_LINE_ARGUMENTS
,
48 /* Copy the referent of the symbolic link. -L */
52 # define VALID_SPARSE_MODE(Mode) \
53 ((Mode) == SPARSE_NEVER \
54 || (Mode) == SPARSE_AUTO \
55 || (Mode) == SPARSE_ALWAYS)
59 enum backup_type backup_type
;
61 /* If nonzero, copy all files except (directories and, if not dereferencing
62 them, symbolic links,) as if they were regular files. */
65 /* How to handle symlinks. */
66 enum Dereference_symlink dereference
;
68 /* If nonzero, remove each existing destination nondirectory before
70 int unlink_dest_before_opening
;
72 /* If nonzero, first try to open each existing destination nondirectory,
73 then, if the open fails, unlink and try again.
74 This option must be set for `cp -f', in case the destination file
75 exists when the open is attempted. It is irrelevant to `mv' since
76 any destination is sure to be removed before the open. */
77 int unlink_dest_after_failed_open
;
79 /* If nonzero, create hard links instead of copying files.
80 Create destination directories as usual. */
83 /* This value is used to determine whether to prompt before removing
84 each existing destination file. It works differently depending on
85 whether move_mode is set. See code/comments in copy.c. */
86 enum Interactive interactive
;
88 /* If nonzero, rather than copying, first attempt to use rename.
89 If that fails, then resort to copying. */
92 /* This process's effective user ID. */
95 /* If nonzero, when copying recursively, skip any subdirectories that are
96 on different filesystems from the one we started on. */
99 /* If nonzero, attempt to give the copies the original files' permissions,
100 owner, group, and timestamps. */
101 int preserve_ownership
;
103 int preserve_timestamps
;
105 /* Enabled for mv, and for cp by the --preserve=links option.
106 If nonzero, attempt to preserve in the destination files any
107 logical hard links between the source files. If used with cp's
108 --no-dereference option, and copying two hard-linked files,
109 the two corresponding destination files will also be hard linked.
111 If used with cp's --dereference (-L) option, then, as that option implies,
112 hard links are *not* preserved. However, when copying a file F and
113 a symlink S to F, the resulting S and F in the destination directory
114 will be hard links to the same file (a copy of F). */
117 /* If nonzero and any of the above (for preserve) file attributes cannot
118 be applied to a destination file, treat it as a failure and return
119 nonzero immediately. E.g. cp -p requires this be nonzero, mv requires
121 int require_preserve
;
123 /* If nonzero, copy directories recursively and copy special files
124 as themselves rather than copying their contents. */
127 /* If nonzero, set file mode to value of MODE. Otherwise,
128 set it based on current umask modified by UMASK_KILL. */
131 /* Set the mode of the destination file to exactly this value
132 if USE_MODE is nonzero. */
135 /* Control creation of sparse files. */
136 enum Sparse_type sparse_mode
;
138 /* If nonzero, create symbolic links instead of copying files.
139 Create destination directories as usual. */
142 /* The bits to preserve in created files' modes. */
145 /* If nonzero, do not copy a nondirectory that has an existing destination
146 with the same or newer modification time. */
149 /* If nonzero, display the names of the files before copying them. */
152 /* A pointer to either lstat or stat, depending on
153 whether the copy should dereference symlinks. */
156 /* If nonzero, stdin is a tty. */
159 /* This is a set of destination name/inode/dev triples. Each such triple
160 represents a file we have created corresponding to a source file name
161 that was specified on the command line. Use it to avoid clobbering
162 source files in commands like this:
163 rm -rf a b c; mkdir a b c; touch a/f b/f; mv a/f b/f c
164 For now, it protects only regular files when copying (i.e. not renaming).
165 When renaming, it protects all non-directories.
166 Use dest_info_init to initialize it, or set it to NULL to disable
168 Hash_table
*dest_info
;
171 Hash_table
*src_info
;
177 /* Arrange to make lstat calls go through the wrapper function
178 on systems with an lstat function that does not dereference symlinks
179 that are specified with a trailing slash. */
180 # if ! LSTAT_FOLLOWS_SLASHED_SYMLINK
181 int rpl_lstat
PARAMS((const char *, struct stat
*));
183 # define lstat rpl_lstat
188 /* Arrange to make rename calls go through the wrapper function
189 on systems with a rename function that fails for a source path
190 specified with a trailing slash. */
191 # if RENAME_TRAILING_SLASH_BUG
192 int rpl_rename
PARAMS((const char *, const char *));
194 # define rename rpl_rename
198 copy
PARAMS ((const char *src_path
, const char *dst_path
,
199 int nonexistent_dst
, const struct cp_options
*options
,
200 int *copy_into_self
, int *rename_succeeded
));
203 dest_info_init
PARAMS ((struct cp_options
*));
205 src_info_init
PARAMS ((struct cp_options
*));