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 /coreutils | |
| 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 'coreutils')
| -rw-r--r-- | coreutils/cp.c | 18 | ||||
| -rw-r--r-- | coreutils/mv.c | 18 |
2 files changed, 18 insertions, 18 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c index 254445f02..82d43adff 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c | |||
| @@ -42,22 +42,22 @@ extern int cp_main(int argc, char **argv) | |||
| 42 | while ((opt = getopt(argc, argv, "adfipR")) != -1) | 42 | while ((opt = getopt(argc, argv, "adfipR")) != -1) |
| 43 | switch (opt) { | 43 | switch (opt) { |
| 44 | case 'a': | 44 | case 'a': |
| 45 | flags |= CP_PRESERVE_STATUS | CP_RECUR; | 45 | flags |= FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR; |
| 46 | /* fallthrough */ | 46 | /* fallthrough */ |
| 47 | case 'd': | 47 | case 'd': |
| 48 | flags |= CP_PRESERVE_SYMLINKS; | 48 | flags |= FILEUTILS_PRESERVE_SYMLINKS; |
| 49 | break; | 49 | break; |
| 50 | case 'f': | 50 | case 'f': |
| 51 | flags |= CP_FORCE; | 51 | flags |= FILEUTILS_FORCE; |
| 52 | break; | 52 | break; |
| 53 | case 'i': | 53 | case 'i': |
| 54 | flags |= CP_INTERACTIVE; | 54 | flags |= FILEUTILS_INTERACTIVE; |
| 55 | break; | 55 | break; |
| 56 | case 'p': | 56 | case 'p': |
| 57 | flags |= CP_PRESERVE_STATUS; | 57 | flags |= FILEUTILS_PRESERVE_STATUS; |
| 58 | break; | 58 | break; |
| 59 | case 'R': | 59 | case 'R': |
| 60 | flags |= CP_RECUR; | 60 | flags |= FILEUTILS_RECUR; |
| 61 | break; | 61 | break; |
| 62 | default: | 62 | default: |
| 63 | show_usage(); | 63 | show_usage(); |
| @@ -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 & CP_PRESERVE_SYMLINKS) && | 76 | if (((flags & FILEUTILS_PRESERVE_SYMLINKS) && |
| 77 | lstat(argv[optind], &source_stat) < 0) || | 77 | lstat(argv[optind], &source_stat) < 0) || |
| 78 | (!(flags & CP_PRESERVE_SYMLINKS) && | 78 | (!(flags & FILEUTILS_PRESERVE_SYMLINKS) && |
| 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]); |
| @@ -93,7 +93,7 @@ extern int cp_main(int argc, char **argv) | |||
| 93 | (!dest_exists || !S_ISDIR(dest_stat.st_mode))) || | 93 | (!dest_exists || !S_ISDIR(dest_stat.st_mode))) || |
| 94 | /* ...recursing, the first is a directory, and the | 94 | /* ...recursing, the first is a directory, and the |
| 95 | * second doesn't exist, then... */ | 95 | * second doesn't exist, then... */ |
| 96 | ((flags & CP_RECUR) && S_ISDIR(source_stat.st_mode) && | 96 | ((flags & FILEUTILS_RECUR) && S_ISDIR(source_stat.st_mode) && |
| 97 | !dest_exists)) { | 97 | !dest_exists)) { |
| 98 | /* ...do a simple copy. */ | 98 | /* ...do a simple copy. */ |
| 99 | if (copy_file(argv[optind], argv[optind + 1], flags) < 0) | 99 | if (copy_file(argv[optind], argv[optind + 1], flags) < 0) |
diff --git a/coreutils/mv.c b/coreutils/mv.c index 13d1aae5b..efc4ae6d8 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | 30 | ||
| 31 | #include "busybox.h" | 31 | #include "busybox.h" |
| 32 | 32 | ||
| 33 | static int flags = CP_RECUR | CP_PRESERVE_STATUS | CP_PRESERVE_SYMLINKS; | 33 | static int flags; |
| 34 | 34 | ||
| 35 | static int remove_file(const char *path, struct stat *statbuf, void *junk) | 35 | static int remove_file(const char *path, struct stat *statbuf, void *junk) |
| 36 | { | 36 | { |
| @@ -88,8 +88,8 @@ static int manual_rename(const char *source, const char *dest) | |||
| 88 | } | 88 | } |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | if (copy_file(source, dest, | 91 | if (copy_file(source, dest, FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS | |
| 92 | CP_RECUR | CP_PRESERVE_STATUS | CP_PRESERVE_SYMLINKS) < 0) | 92 | FILEUTILS_PRESERVE_SYMLINKS) < 0) |
| 93 | return -1; | 93 | return -1; |
| 94 | 94 | ||
| 95 | if (!recursive_action(source, TRUE, FALSE, TRUE, remove_file, | 95 | if (!recursive_action(source, TRUE, FALSE, TRUE, remove_file, |
| @@ -112,9 +112,9 @@ static int move_file(const char *source, const char *dest) | |||
| 112 | dest_exists = 0; | 112 | dest_exists = 0; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | if (dest_exists && !(flags & CP_FORCE) && | 115 | if (dest_exists && !(flags & FILEUTILS_FORCE) && |
| 116 | ((access(dest, W_OK) < 0 && isatty(0)) || | 116 | ((access(dest, W_OK) < 0 && isatty(0)) || |
| 117 | (flags & CP_INTERACTIVE))) { | 117 | (flags & FILEUTILS_INTERACTIVE))) { |
| 118 | fprintf(stderr, "mv: overwrite `%s'? ", dest); | 118 | fprintf(stderr, "mv: overwrite `%s'? ", dest); |
| 119 | if (!ask_confirmation()) | 119 | if (!ask_confirmation()) |
| 120 | return 0; | 120 | return 0; |
| @@ -140,12 +140,12 @@ extern int mv_main(int argc, char **argv) | |||
| 140 | while ((opt = getopt(argc, argv, "fi")) != -1) | 140 | while ((opt = getopt(argc, argv, "fi")) != -1) |
| 141 | switch (opt) { | 141 | switch (opt) { |
| 142 | case 'f': | 142 | case 'f': |
| 143 | flags &= ~CP_INTERACTIVE; | 143 | flags &= ~FILEUTILS_INTERACTIVE; |
| 144 | flags |= CP_FORCE; | 144 | flags |= FILEUTILS_FORCE; |
| 145 | break; | 145 | break; |
| 146 | case 'i': | 146 | case 'i': |
| 147 | flags &= ~CP_FORCE; | 147 | flags &= ~FILEUTILS_FORCE; |
| 148 | flags |= CP_INTERACTIVE; | 148 | flags |= FILEUTILS_INTERACTIVE; |
| 149 | break; | 149 | break; |
| 150 | default: | 150 | default: |
| 151 | show_usage(); | 151 | show_usage(); |
