aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/cp.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-03-21 15:49:38 -0500
committerRob Landley <rob@landley.net>2015-03-21 15:49:38 -0500
commit0d39f2f52bad3df1b156bc51dcd8e6f1debc09f7 (patch)
treef4efd1f8a122e72b8a8c3ac6cf5fc6fe55bd33be /toys/posix/cp.c
parentcff8e136c02fb3c03289acd98e274f85dca42023 (diff)
downloadtoybox-0d39f2f52bad3df1b156bc51dcd8e6f1debc09f7.tar.gz
install -D bugfix from David Halls.
(I tweaked some comment text while I was there.)
Diffstat (limited to 'toys/posix/cp.c')
-rw-r--r--toys/posix/cp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/toys/posix/cp.c b/toys/posix/cp.c
index 31706630..2959f67c 100644
--- a/toys/posix/cp.c
+++ b/toys/posix/cp.c
@@ -4,13 +4,12 @@
*
* Posix says "cp -Rf dir file" shouldn't delete file, but our -f does.
-// This is subtle: MV options shared with CP must be in same order (right to
-// left) as CP for FLAG_X macros to work out right.
+// options shared between mv/cp must be in same order (right to left)
+// for FLAG macros to work out right in shared infrastructure.
USE_CP(NEWTOY(cp, "<2RHLPp"USE_CP_MORE("rdaslvnF(remove-destination)")"fi[-HLP"USE_CP_MORE("d")"]"USE_CP_MORE("[-ni]"), TOYFLAG_BIN))
USE_MV(NEWTOY(mv, "<2"USE_CP_MORE("vnF")"fi"USE_CP_MORE("[-ni]"), TOYFLAG_BIN))
USE_INSTALL(NEWTOY(install, "<1cdDpsvm:o:g:", TOYFLAG_USR|TOYFLAG_BIN))
-*
config CP
bool "cp"
@@ -391,6 +390,7 @@ void install_main(void)
}
if (toys.optflags & FLAG_D) {
+ TT.destname = toys.optargs[toys.optc-1];
if (mkpathat(AT_FDCWD, TT.destname, 0, 2))
perror_exit("-D '%s'", TT.destname);
if (toys.optc == 1) return;