diff options
author | Matt Kraai <kraai@debian.org> | 2001-04-24 01:30:02 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-04-24 01:30:02 +0000 |
commit | 01441036e9754425e2b09b43deec879ca46206cb (patch) | |
tree | d9d4c66bb7d2142dd525adfa3a9cae07e3f80557 /libbb/copy_file.c | |
parent | 9ff9325e60eac6cc119eab5dff0dbbba78edfd32 (diff) | |
download | busybox-w32-01441036e9754425e2b09b43deec879ca46206cb.tar.gz busybox-w32-01441036e9754425e2b09b43deec879ca46206cb.tar.bz2 busybox-w32-01441036e9754425e2b09b43deec879ca46206cb.zip |
Use generic flag names.
Diffstat (limited to 'libbb/copy_file.c')
-rw-r--r-- | libbb/copy_file.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c index f24d1b119..4ee3efdbc 100644 --- a/libbb/copy_file.c +++ b/libbb/copy_file.c | |||
@@ -39,8 +39,9 @@ int copy_file(const char *source, const char *dest, int flags) | |||
39 | int dest_exists = 1; | 39 | int dest_exists = 1; |
40 | int status = 0; | 40 | int status = 0; |
41 | 41 | ||
42 | if (((flags & CP_PRESERVE_SYMLINKS) && lstat(source, &source_stat) < 0) || | 42 | if (((flags & FILEUTILS_PRESERVE_SYMLINKS) && |
43 | (!(flags & CP_PRESERVE_SYMLINKS) && | 43 | lstat(source, &source_stat) < 0) || |
44 | (!(flags & FILEUTILS_PRESERVE_SYMLINKS) && | ||
44 | stat(source, &source_stat) < 0)) { | 45 | stat(source, &source_stat) < 0)) { |
45 | perror_msg("%s", source); | 46 | perror_msg("%s", source); |
46 | return -1; | 47 | return -1; |
@@ -64,7 +65,7 @@ int copy_file(const char *source, const char *dest, int flags) | |||
64 | DIR *dp; | 65 | DIR *dp; |
65 | struct dirent *d; | 66 | struct dirent *d; |
66 | 67 | ||
67 | if (!(flags & CP_RECUR)) { | 68 | if (!(flags & FILEUTILS_RECUR)) { |
68 | error_msg("%s: omitting directory", source); | 69 | error_msg("%s: omitting directory", source); |
69 | return -1; | 70 | return -1; |
70 | } | 71 | } |
@@ -80,7 +81,7 @@ int copy_file(const char *source, const char *dest, int flags) | |||
80 | saved_umask = umask(0); | 81 | saved_umask = umask(0); |
81 | 82 | ||
82 | mode = source_stat.st_mode; | 83 | mode = source_stat.st_mode; |
83 | if (!(flags & CP_PRESERVE_STATUS)) | 84 | if (!(flags & FILEUTILS_PRESERVE_STATUS)) |
84 | mode = source_stat.st_mode & ~saved_umask; | 85 | mode = source_stat.st_mode & ~saved_umask; |
85 | mode |= S_IRWXU; | 86 | mode |= S_IRWXU; |
86 | 87 | ||
@@ -125,14 +126,14 @@ int copy_file(const char *source, const char *dest, int flags) | |||
125 | FILE *sfp, *dfp; | 126 | FILE *sfp, *dfp; |
126 | 127 | ||
127 | if (dest_exists) { | 128 | if (dest_exists) { |
128 | if (flags & CP_INTERACTIVE) { | 129 | if (flags & FILEUTILS_INTERACTIVE) { |
129 | fprintf(stderr, "%s: overwrite `%s'? ", applet_name, dest); | 130 | fprintf(stderr, "%s: overwrite `%s'? ", applet_name, dest); |
130 | if (!ask_confirmation()) | 131 | if (!ask_confirmation()) |
131 | return 0; | 132 | return 0; |
132 | } | 133 | } |
133 | 134 | ||
134 | if ((dfp = fopen(dest, "w")) == NULL) { | 135 | if ((dfp = fopen(dest, "w")) == NULL) { |
135 | if (!(flags & CP_FORCE)) { | 136 | if (!(flags & FILEUTILS_FORCE)) { |
136 | perror_msg("unable to open `%s'", dest); | 137 | perror_msg("unable to open `%s'", dest); |
137 | return -1; | 138 | return -1; |
138 | } | 139 | } |
@@ -187,7 +188,7 @@ int copy_file(const char *source, const char *dest, int flags) | |||
187 | saved_umask = umask(0); | 188 | saved_umask = umask(0); |
188 | 189 | ||
189 | mode = source_stat.st_mode; | 190 | mode = source_stat.st_mode; |
190 | if (!(flags & CP_PRESERVE_STATUS)) | 191 | if (!(flags & FILEUTILS_PRESERVE_STATUS)) |
191 | mode = source_stat.st_mode & ~saved_umask; | 192 | mode = source_stat.st_mode & ~saved_umask; |
192 | mode |= S_IRWXU; | 193 | mode |= S_IRWXU; |
193 | 194 | ||
@@ -213,7 +214,7 @@ int copy_file(const char *source, const char *dest, int flags) | |||
213 | } | 214 | } |
214 | 215 | ||
215 | #if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) | 216 | #if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) |
216 | if (flags & CP_PRESERVE_STATUS) | 217 | if (flags & FILEUTILS_PRESERVE_STATUS) |
217 | if (lchown(dest, source_stat.st_uid, source_stat.st_gid) < 0) | 218 | if (lchown(dest, source_stat.st_uid, source_stat.st_gid) < 0) |
218 | perror_msg("unable to preserve ownership of `%s'", dest); | 219 | perror_msg("unable to preserve ownership of `%s'", dest); |
219 | #endif | 220 | #endif |
@@ -225,7 +226,7 @@ int copy_file(const char *source, const char *dest, int flags) | |||
225 | 226 | ||
226 | end: | 227 | end: |
227 | 228 | ||
228 | if (flags & CP_PRESERVE_STATUS) { | 229 | if (flags & FILEUTILS_PRESERVE_STATUS) { |
229 | struct utimbuf times; | 230 | struct utimbuf times; |
230 | 231 | ||
231 | times.actime = source_stat.st_atime; | 232 | times.actime = source_stat.st_atime; |