summaryrefslogtreecommitdiffstats
path: root/bin/cp
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-03-10 19:58:41 +0000
committerjhb <jhb@FreeBSD.org>2008-03-10 19:58:41 +0000
commit12d32f9576d78a8581086788226f595e802f5ca8 (patch)
tree4058abd1e35270e812e35223e9bb7274421179fe /bin/cp
parent9d148b4c1d10ad1656f8dc4bba4ae0fcddfba9d6 (diff)
downloadFreeBSD-src-12d32f9576d78a8581086788226f595e802f5ca8.zip
FreeBSD-src-12d32f9576d78a8581086788226f595e802f5ca8.tar.gz
Add an '-a' option which is identical to specifying '-RpP' for
compatibility with other implementations. MFC after: 1 month
Diffstat (limited to 'bin/cp')
-rw-r--r--bin/cp/cp.18
-rw-r--r--bin/cp/cp.c8
-rw-r--r--bin/cp/utils.c4
3 files changed, 15 insertions, 5 deletions
diff --git a/bin/cp/cp.1 b/bin/cp/cp.1
index 96d8f61..7329b64 100644
--- a/bin/cp/cp.1
+++ b/bin/cp/cp.1
@@ -45,7 +45,7 @@
.Op Fl H | Fl L | Fl P
.Oc
.Op Fl f | i | n
-.Op Fl lpv
+.Op Fl alpv
.Ar source_file target_file
.Nm
.Oo
@@ -53,7 +53,7 @@
.Op Fl H | Fl L | Fl P
.Oc
.Op Fl f | i | n
-.Op Fl lpv
+.Op Fl alpv
.Ar source_file ... target_directory
.Sh DESCRIPTION
In the first synopsis form, the
@@ -116,6 +116,10 @@ If you need to preserve hard links, consider using
or
.Xr pax 1
instead.
+.It Fl a
+Archive mode.
+Same as
+.Fl RpP .
.It Fl f
For each existing destination pathname, remove it and
create a new file, without prompting for confirmation
diff --git a/bin/cp/cp.c b/bin/cp/cp.c
index 823d93e..feba50f 100644
--- a/bin/cp/cp.c
+++ b/bin/cp/cp.c
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
char *target;
Hflag = Lflag = Pflag = 0;
- while ((ch = getopt(argc, argv, "HLPRfilnprv")) != -1)
+ while ((ch = getopt(argc, argv, "HLPRafilnprv")) != -1)
switch (ch) {
case 'H':
Hflag = 1;
@@ -119,6 +119,12 @@ main(int argc, char *argv[])
case 'R':
Rflag = 1;
break;
+ case 'a':
+ Pflag = 1;
+ pflag = 1;
+ Rflag = 1;
+ Hflag = Lflag = 0;
+ break;
case 'f':
fflag = 1;
iflag = nflag = 0;
diff --git a/bin/cp/utils.c b/bin/cp/utils.c
index 7eea8fa..a128188 100644
--- a/bin/cp/utils.c
+++ b/bin/cp/utils.c
@@ -429,8 +429,8 @@ usage(void)
{
(void)fprintf(stderr, "%s\n%s\n",
-"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-lpv] source_file target_file",
-" cp [-R [-H | -L | -P]] [-f | -i | -n] [-lpv] source_file ... "
+"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file target_file",
+" cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file ... "
"target_directory");
exit(EX_USAGE);
}
OpenPOWER on IntegriCloud