diff options
author | Denys Vlasenko | 2010-01-15 22:05:07 +0100 |
---|---|---|
committer | Denys Vlasenko | 2010-01-15 22:05:07 +0100 |
commit | a40f0624db4c9490d46f116c4c4635dfa68e070c (patch) | |
tree | 6495c54fab2be22802c6befc9d5c8ea01807a60c /coreutils/cp.c | |
parent | 662078f9fd41efe422d7abc0aea1395c27c61ddd (diff) | |
download | busybox-a40f0624db4c9490d46f116c4c4635dfa68e070c.zip busybox-a40f0624db4c9490d46f116c4c4635dfa68e070c.tar.gz |
cp: fix -H handling
function old new delta
copy_file 1495 1518 +23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/cp.c')
-rw-r--r-- | coreutils/cp.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c index 9f6c123..d7c8d91 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c @@ -35,10 +35,9 @@ int cp_main(int argc, char **argv) OPT_a = 1 << (sizeof(FILEUTILS_CP_OPTSTR)-1), OPT_r = 1 << (sizeof(FILEUTILS_CP_OPTSTR)), OPT_P = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+1), - OPT_H = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+2), - OPT_v = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+3), + OPT_v = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+2), #if ENABLE_FEATURE_CP_LONG_OPTIONS - OPT_parents = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+4), + OPT_parents = 1 << (sizeof(FILEUTILS_CP_OPTSTR)+3), #endif }; @@ -48,7 +47,7 @@ int cp_main(int argc, char **argv) // -r and -R are the same // -R (and therefore -r) turns on -d (coreutils does this) // -a = -pdR - opt_complementary = "-2:l--s:s--l:Pd:rRd:Rd:apdR:HL"; + opt_complementary = "-2:l--s:s--l:Pd:rRd:Rd:apdR"; #if ENABLE_FEATURE_CP_LONG_OPTIONS applet_long_options = "archive\0" No_argument "a" @@ -64,7 +63,7 @@ int cp_main(int argc, char **argv) ; #endif // -v (--verbose) is ignored - flags = getopt32(argv, FILEUTILS_CP_OPTSTR "arPHv"); + flags = getopt32(argv, FILEUTILS_CP_OPTSTR "arPv"); /* Options of cp from GNU coreutils 6.10: * -a, --archive * -f, --force @@ -113,17 +112,14 @@ int cp_main(int argc, char **argv) */ argc -= optind; argv += optind; - flags ^= FILEUTILS_DEREFERENCE; /* the sense of this flag was reversed */ + /* Reverse this bit. If there is -d, bit is not set: */ + flags ^= FILEUTILS_DEREFERENCE; /* coreutils 6.9 compat: * by default, "cp" derefs symlinks (creates regular dest files), * but "cp -R" does not. We switch off deref if -r or -R (see above). * However, "cp -RL" must still deref symlinks: */ if (flags & FILEUTILS_DEREF_SOFTLINK) /* -L */ flags |= FILEUTILS_DEREFERENCE; - /* The behavior of -H is *almost* like -L, but not quite, so let's - * just ignore it too for fun. TODO. - if (flags & OPT_H) ... // deref command-line params only - */ #if ENABLE_SELINUX if (flags & FILEUTILS_PRESERVE_SECURITY_CONTEXT) { |