cp add -a document -r

Andreas Hauser andy at splashground.de
Fri May 26 08:35:33 PDT 2006


Hoi,

this patch adds the -a flag to cp(1) and documents the -r flag.
Also it cleans up the Synopsis (-pv -> -p -v).

The -a flag is the same as -rp and is quite convenient and in
the semantic tradition of other tools, like rsync -a, it also
exists on other systems.

-- 
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 14:57:46 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
+Same as
+.Fl RF .
 .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 14:57:46 2006 +0200
@@ -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