changeset 583:9802b2afbce8

cp doesn't really need the optstring + logic. Still needs to be updated for new dirtree, though.
author Rob Landley <rob@landley.net>
date Thu, 31 May 2012 21:17:11 -0500
parents b88bc7dcdb48
children ca6875170b9a
files toys/cp.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/toys/cp.c	Sun May 27 00:56:17 2012 -0500
+++ b/toys/cp.c	Thu May 31 21:17:11 2012 -0500
@@ -7,7 +7,7 @@
  * See http://www.opengroup.org/onlinepubs/009695399/utilities/cp.html
  *
  * "R+ra+d+p+r"
-USE_CP(NEWTOY(cp, "<2vslrR+rdpa+d+p+rHLPif", TOYFLAG_BIN))
+USE_CP(NEWTOY(cp, "<2vslrRdpaHLPif", TOYFLAG_BIN))
 
 config CP
 	bool "cp (broken by dirtree changes)"
@@ -113,7 +113,7 @@
 	// Inability to set these isn't fatal, some require root access.
 	// Can't do fchmod() etc here because -p works on mkdir, too.
 
-	if (toys.optflags & FLAG_p) {
+	if (toys.optflags & (FLAG_p|FLAG_a)) {
 		int mask = umask(0);
 		struct utimbuf ut;
 
@@ -188,7 +188,7 @@
 
 		// Skip nonexistent sources.
 
-		TT.keep_symlinks = toys.optflags & FLAG_d;
+		TT.keep_symlinks = toys.optflags & (FLAG_d|FLAG_a);
 		if (TT.keep_symlinks ? lstat(src, &st) : stat(src, &st))
 		{
 			perror_msg("'%s'", src);
@@ -205,7 +205,7 @@
 			dst = xmsprintf("%s/%s", TT.destname, dst);
 		} else dst = TT.destname;
 		if (S_ISDIR(st.st_mode)) {
-			if (toys.optflags & FLAG_r) {
+			if (toys.optflags & (FLAG_r|FLAG_R|FLAG_a)) {
 				cp_file(src, dst, &st);
 
 				TT.keep_symlinks++;