changeset 1746:b11f536bac74 draft

install -D bugfix from David Halls. (I tweaked some comment text while I was there.)
author Rob Landley <rob@landley.net>
date Sat, 21 Mar 2015 15:49:38 -0500
parents 1b97da3c7b91
children 3297b4b490f8
files toys/posix/cp.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/toys/posix/cp.c	Sat Mar 21 15:29:21 2015 -0500
+++ b/toys/posix/cp.c	Sat Mar 21 15:49:38 2015 -0500
@@ -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 @@
   }
 
   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;