cp add -a document -r

Andreas Hauser andy at splashground.de
Fri May 26 09:50:56 PDT 2006


joerg wrote @ Fri, 26 May 2006 18:09:35 +0200:
> On Fri, May 26, 2006 at 05:31:39PM +0200, Andreas Hauser wrote:
> > this patch adds the -a flag to cp(1) and documents the -r flag.
> > Also it cleans up the Synopsis (-pv -> -p -v).
> 
> The 'r' flag *is* documented. And exactly for the reasons given in the
> man page, I don't want to see this commited.

This patch documents -r but tells you not to use it.
It makes -a be -Rp.
It also adds a to getopt ...

-- 
Andy


diff -r 34c9cb8fd38c bin/cp/cp.1
--- a/bin/cp/cp.1	Tue Apr 18 22:11:35 2006 +0000
+++ b/bin/cp/cp.1	Fri May 26 16:33:40 2006 +0200
@@ -48,16 +48,14 @@
 .Fl R
 .Op Fl H | Fl L | Fl P
 .Oc
-.Op Fl f | i | n
-.Op Fl pv
+.Op Fl a | f | i | n | p | r | v
 .Ar source_file target_file
 .Nm
 .Oo
 .Fl R
 .Op Fl H | Fl L | Fl P
 .Oc
-.Op Fl f | i | n
-.Op Fl pv
+.Op Fl a | f | i | n | p | r | v
 .Ar source_file ... target_directory
 .Sh DESCRIPTION
 In the first synopsis form, the
@@ -120,6 +118,8 @@ or
 or
 .Xr pax 1
 instead.
+.It Fl a
+Same as -Rp.
 .It Fl f
 For each existing destination pathname, remove it and
 create a new file, without prompting for confirmation
@@ -177,6 +177,9 @@ and either the user ID or group ID canno
 and either the user ID or group ID cannot be preserved, neither
 the set-user-ID nor set-group-ID bits are preserved in the copy's
 permissions.
+.It Fl r
+Don't use! See 
+.Sx COMPATIBILITY .
 .It Fl v
 Cause
 .Nm
diff -r 34c9cb8fd38c bin/cp/cp.c
--- a/bin/cp/cp.c	Tue Apr 18 22:11:35 2006 +0000
+++ b/bin/cp/cp.c	Fri May 26 16:33:40 2006 +0200
@@ -95,7 +95,7 @@ main(int argc, char **argv)
 	char *target;
 
 	Hflag = Lflag = Pflag = 0;
-	while ((ch = getopt(argc, argv, "HLPRfinprv")) != -1)
+	while ((ch = getopt(argc, argv, "HLPRafinprv")) != -1)
 		switch (ch) {
 		case 'H':
 			Hflag = 1;
@@ -111,6 +111,10 @@ main(int argc, char **argv)
 			break;
 		case 'R':
 			Rflag = 1;
+			break;
+		case 'a':
+			Rflag = 1;
+			pflag = 1;
 			break;
 		case 'f':
 			fflag = 1;





More information about the Submit mailing list