diff options
author | Matt Kraai <kraai@debian.org> | 2001-10-05 01:35:10 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-10-05 01:35:10 +0000 |
commit | 4c557bf576e772bfd78429d5f9b2a436ccadf268 (patch) | |
tree | aa5f6352063fadb09d09d303436cdf3f0f6b79a4 | |
parent | 54a992d81e4a875e1710e188a3593fa9762e06a4 (diff) | |
download | busybox-w32-4c557bf576e772bfd78429d5f9b2a436ccadf268.tar.gz busybox-w32-4c557bf576e772bfd78429d5f9b2a436ccadf268.tar.bz2 busybox-w32-4c557bf576e772bfd78429d5f9b2a436ccadf268.zip |
Invert FILEUTILS_PRESERVE_SYMLINKS into FILEUTILS_DEREFERENCE.
-rw-r--r-- | coreutils/cp.c | 8 | ||||
-rw-r--r-- | coreutils/mv.c | 4 | ||||
-rw-r--r-- | cp.c | 8 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | libbb/copy_file.c | 4 | ||||
-rw-r--r-- | libbb/libbb.h | 2 | ||||
-rw-r--r-- | mv.c | 4 |
7 files changed, 16 insertions, 16 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c index 82d43adff..8f8fe5ed3 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c | |||
@@ -36,7 +36,7 @@ extern int cp_main(int argc, char **argv) | |||
36 | { | 36 | { |
37 | int status = 0; | 37 | int status = 0; |
38 | int opt; | 38 | int opt; |
39 | int flags = 0; | 39 | int flags = FILEUTILS_DEREFERENCE; |
40 | int i; | 40 | int i; |
41 | 41 | ||
42 | while ((opt = getopt(argc, argv, "adfipR")) != -1) | 42 | while ((opt = getopt(argc, argv, "adfipR")) != -1) |
@@ -45,7 +45,7 @@ extern int cp_main(int argc, char **argv) | |||
45 | flags |= FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR; | 45 | flags |= FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR; |
46 | /* fallthrough */ | 46 | /* fallthrough */ |
47 | case 'd': | 47 | case 'd': |
48 | flags |= FILEUTILS_PRESERVE_SYMLINKS; | 48 | flags &= ~FILEUTILS_DEREFERENCE; |
49 | break; | 49 | break; |
50 | case 'f': | 50 | case 'f': |
51 | flags |= FILEUTILS_FORCE; | 51 | flags |= FILEUTILS_FORCE; |
@@ -73,9 +73,9 @@ extern int cp_main(int argc, char **argv) | |||
73 | int source_exists = 1; | 73 | int source_exists = 1; |
74 | int dest_exists = 1; | 74 | int dest_exists = 1; |
75 | 75 | ||
76 | if (((flags & FILEUTILS_PRESERVE_SYMLINKS) && | 76 | if ((!(flags & FILEUTILS_DEREFERENCE) && |
77 | lstat(argv[optind], &source_stat) < 0) || | 77 | lstat(argv[optind], &source_stat) < 0) || |
78 | (!(flags & FILEUTILS_PRESERVE_SYMLINKS) && | 78 | ((flags & FILEUTILS_DEREFERENCE) && |
79 | stat(argv[optind], &source_stat))) { | 79 | stat(argv[optind], &source_stat))) { |
80 | if (errno != ENOENT) | 80 | if (errno != ENOENT) |
81 | perror_msg_and_die("unable to stat `%s'", argv[optind]); | 81 | perror_msg_and_die("unable to stat `%s'", argv[optind]); |
diff --git a/coreutils/mv.c b/coreutils/mv.c index b890abf6e..1c4a34788 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c | |||
@@ -74,8 +74,8 @@ static int manual_rename(const char *source, const char *dest) | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | if (copy_file(source, dest, FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS | | 77 | if (copy_file(source, dest, |
78 | FILEUTILS_PRESERVE_SYMLINKS) < 0) | 78 | FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS) < 0) |
79 | return -1; | 79 | return -1; |
80 | 80 | ||
81 | if (remove_file(source, FILEUTILS_RECUR | FILEUTILS_FORCE) < 0) | 81 | if (remove_file(source, FILEUTILS_RECUR | FILEUTILS_FORCE) < 0) |
@@ -36,7 +36,7 @@ extern int cp_main(int argc, char **argv) | |||
36 | { | 36 | { |
37 | int status = 0; | 37 | int status = 0; |
38 | int opt; | 38 | int opt; |
39 | int flags = 0; | 39 | int flags = FILEUTILS_DEREFERENCE; |
40 | int i; | 40 | int i; |
41 | 41 | ||
42 | while ((opt = getopt(argc, argv, "adfipR")) != -1) | 42 | while ((opt = getopt(argc, argv, "adfipR")) != -1) |
@@ -45,7 +45,7 @@ extern int cp_main(int argc, char **argv) | |||
45 | flags |= FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR; | 45 | flags |= FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR; |
46 | /* fallthrough */ | 46 | /* fallthrough */ |
47 | case 'd': | 47 | case 'd': |
48 | flags |= FILEUTILS_PRESERVE_SYMLINKS; | 48 | flags &= ~FILEUTILS_DEREFERENCE; |
49 | break; | 49 | break; |
50 | case 'f': | 50 | case 'f': |
51 | flags |= FILEUTILS_FORCE; | 51 | flags |= FILEUTILS_FORCE; |
@@ -73,9 +73,9 @@ extern int cp_main(int argc, char **argv) | |||
73 | int source_exists = 1; | 73 | int source_exists = 1; |
74 | int dest_exists = 1; | 74 | int dest_exists = 1; |
75 | 75 | ||
76 | if (((flags & FILEUTILS_PRESERVE_SYMLINKS) && | 76 | if ((!(flags & FILEUTILS_DEREFERENCE) && |
77 | lstat(argv[optind], &source_stat) < 0) || | 77 | lstat(argv[optind], &source_stat) < 0) || |
78 | (!(flags & FILEUTILS_PRESERVE_SYMLINKS) && | 78 | ((flags & FILEUTILS_DEREFERENCE) && |
79 | stat(argv[optind], &source_stat))) { | 79 | stat(argv[optind], &source_stat))) { |
80 | if (errno != ENOENT) | 80 | if (errno != ENOENT) |
81 | perror_msg_and_die("unable to stat `%s'", argv[optind]); | 81 | perror_msg_and_die("unable to stat `%s'", argv[optind]); |
diff --git a/include/libbb.h b/include/libbb.h index 30f0bb9a7..bbdbc6c86 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -273,7 +273,7 @@ char *simplify_path(const char *path); | |||
273 | 273 | ||
274 | enum { | 274 | enum { |
275 | FILEUTILS_PRESERVE_STATUS = 1, | 275 | FILEUTILS_PRESERVE_STATUS = 1, |
276 | FILEUTILS_PRESERVE_SYMLINKS = 2, | 276 | FILEUTILS_DEREFERENCE = 2, |
277 | FILEUTILS_RECUR = 4, | 277 | FILEUTILS_RECUR = 4, |
278 | FILEUTILS_FORCE = 8, | 278 | FILEUTILS_FORCE = 8, |
279 | FILEUTILS_INTERACTIVE = 16 | 279 | FILEUTILS_INTERACTIVE = 16 |
diff --git a/libbb/copy_file.c b/libbb/copy_file.c index 9c1bba689..d3902ffbe 100644 --- a/libbb/copy_file.c +++ b/libbb/copy_file.c | |||
@@ -40,9 +40,9 @@ int copy_file(const char *source, const char *dest, int flags) | |||
40 | int dest_exists = 1; | 40 | int dest_exists = 1; |
41 | int status = 0; | 41 | int status = 0; |
42 | 42 | ||
43 | if (((flags & FILEUTILS_PRESERVE_SYMLINKS) && | 43 | if ((!(flags & FILEUTILS_DEREFERENCE) && |
44 | lstat(source, &source_stat) < 0) || | 44 | lstat(source, &source_stat) < 0) || |
45 | (!(flags & FILEUTILS_PRESERVE_SYMLINKS) && | 45 | ((flags & FILEUTILS_DEREFERENCE) && |
46 | stat(source, &source_stat) < 0)) { | 46 | stat(source, &source_stat) < 0)) { |
47 | perror_msg("%s", source); | 47 | perror_msg("%s", source); |
48 | return -1; | 48 | return -1; |
diff --git a/libbb/libbb.h b/libbb/libbb.h index 30f0bb9a7..bbdbc6c86 100644 --- a/libbb/libbb.h +++ b/libbb/libbb.h | |||
@@ -273,7 +273,7 @@ char *simplify_path(const char *path); | |||
273 | 273 | ||
274 | enum { | 274 | enum { |
275 | FILEUTILS_PRESERVE_STATUS = 1, | 275 | FILEUTILS_PRESERVE_STATUS = 1, |
276 | FILEUTILS_PRESERVE_SYMLINKS = 2, | 276 | FILEUTILS_DEREFERENCE = 2, |
277 | FILEUTILS_RECUR = 4, | 277 | FILEUTILS_RECUR = 4, |
278 | FILEUTILS_FORCE = 8, | 278 | FILEUTILS_FORCE = 8, |
279 | FILEUTILS_INTERACTIVE = 16 | 279 | FILEUTILS_INTERACTIVE = 16 |
@@ -74,8 +74,8 @@ static int manual_rename(const char *source, const char *dest) | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | if (copy_file(source, dest, FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS | | 77 | if (copy_file(source, dest, |
78 | FILEUTILS_PRESERVE_SYMLINKS) < 0) | 78 | FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS) < 0) |
79 | return -1; | 79 | return -1; |
80 | 80 | ||
81 | if (remove_file(source, FILEUTILS_RECUR | FILEUTILS_FORCE) < 0) | 81 | if (remove_file(source, FILEUTILS_RECUR | FILEUTILS_FORCE) < 0) |