.
[coreutils.git] / src / copy.h
blob78482d3c7875b6435a8e901b0f98158263750c87
1 #ifndef COPY_H
2 # define COPY_H
4 /* Control creation of sparse files (files with holes). */
5 enum Sparse_type
7 SPARSE_UNUSED,
9 /* Never create holes in DEST. */
10 SPARSE_NEVER,
12 /* This is the default. Use a crude (and sometimes inaccurate)
13 heuristic to determine if SOURCE has holes. If so, try to create
14 holes in DEST. */
15 SPARSE_AUTO,
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. */
22 SPARSE_ALWAYS
25 struct cp_options
27 /* If nonzero, copy all files except (directories and, if not dereferencing
28 them, symbolic links,) as if they were regular files. */
29 int copy_as_regular;
31 /* If nonzero, dereference symbolic links (copy the files they point to). */
32 int dereference;
34 /* If nonzero, remove existing destination nondirectories. */
35 int force;
37 /* If nonzero, create hard links instead of copying files.
38 Create destination directories as usual. */
39 int hard_link;
41 /* If nonzero, query before overwriting existing destinations
42 with regular files. */
43 int interactive;
45 /* This process's effective user ID. */
46 uid_t myeuid;
48 /* If nonzero, when copying recursively, skip any subdirectories that are
49 on different filesystems from the one we started on. */
50 int one_file_system;
52 /* If nonzero, attempt to give the copies the original files' permissions,
53 owner, group, and timestamps. */
54 int preserve;
56 /* If nonzero and any of the above (for preserve) file attributes cannot
57 be applied to a destination file, treat it as a failure and return
58 nonzero immediately. E.g. cp -p requires this be nonzero, mv requires
59 it be zero. */
60 int require_preserve;
62 /* If nonzero, copy directories recursively and copy special files
63 as themselves rather than copying their contents. */
64 int recursive;
66 /* Control creation of sparse files. */
67 enum Sparse_type sparse_mode;
69 /* If nonzero, create symbolic links instead of copying files.
70 Create destination directories as usual. */
71 int symbolic_link;
73 /* The bits to preserve in created files' modes. */
74 unsigned int umask_kill;
76 /* If nonzero, do not copy a nondirectory that has an existing destination
77 with the same or newer modification time. */
78 int update;
80 /* If nonzero, display the names of the files before copying them. */
81 int verbose;
83 /* A pointer to either lstat or stat, depending on
84 whether the copy should dereference symlinks. */
85 int (*xstat) ();
88 int
89 copy PARAMS ((const char *src_path, const char *dst_path,
90 int nonexistent_dst, const struct cp_options *options));
92 #endif