diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-16 00:05:07 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-16 00:05:07 +0300 |
commit | a40f0624db4c9490d46f116c4c4635dfa68e070c (patch) | |
tree | 6495c54fab2be22802c6befc9d5c8ea01807a60c /coreutils | |
parent | 662078f9fd41efe422d7abc0aea1395c27c61ddd (diff) |
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')
-rw-r--r-- | coreutils/cp.c | 16 | ||||
-rw-r--r-- | coreutils/install.c | 2 |
2 files changed, 7 insertions, 11 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c index 9f6c12367..d7c8d91cc 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) { diff --git a/coreutils/install.c b/coreutils/install.c index 2e604bec7..e9682990d 100644 --- a/coreutils/install.c +++ b/coreutils/install.c @@ -101,7 +101,7 @@ int install_main(int argc, char **argv) #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS applet_long_options = install_longopts; #endif - opt_complementary = "s--d:d--s" IF_SELINUX(":Z--\xff:\xff--Z"); + opt_complementary = "s--d:d--s" IF_FEATURE_INSTALL_LONG_OPTIONS(IF_SELINUX(":Z--\xff:\xff--Z")); /* -c exists for backwards compatibility, it's needed */ /* -v is ignored ("print name of each created directory") */ /* -b is ignored ("make a backup of each existing destination file") */ |