summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Eremin <a.eremin@nexenta.com>2013-04-19 03:26:55 -0500
committerRichard Lowe <richlowe@richlowe.net>2013-04-19 16:47:07 -0400
commit9e647765f079a9527bc9430bd6805745b590091b (patch)
tree75080e113b6c229dc8cc06dd63da3e30992f8b61
parentb89a2c3e86acf555d0e45c283052876d244d9e6b (diff)
downloadillumos-joyent-9e647765f079a9527bc9430bd6805745b590091b.tar.gz
667 cp support for -a flag
Reviewed by: David Höppner <0xffea@gmail.com> Reviewed by: Gordon Ross <gordon.ross@nexenta.com> Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r--usr/src/cmd/mv/mv.c21
-rw-r--r--usr/src/man/man1/cp.128
2 files changed, 33 insertions, 16 deletions
diff --git a/usr/src/cmd/mv/mv.c b/usr/src/cmd/mv/mv.c
index 21623afd09..be83ed7a8a 100644
--- a/usr/src/cmd/mv/mv.c
+++ b/usr/src/cmd/mv/mv.c
@@ -182,8 +182,8 @@ main(int argc, char *argv[])
/*
* Check for options:
- * cp -r|-R [-H|-L|-P] [-fip@/] file1 [file2 ...] target
- * cp [-fiprR@/] file1 [file2 ...] target
+ * cp [ -r|-R [-H|-L|-P]] [-afip@/] file1 [file2 ...] target
+ * cp [-afiprR@/] file1 [file2 ...] target
* ln [-f] [-n] [-s] file1 [file2 ...] target
* ln [-f] [-n] [-s] file1 [file2 ...]
* mv [-f|i] file1 [file2 ...] target
@@ -191,7 +191,7 @@ main(int argc, char *argv[])
*/
if (cpy) {
- while ((c = getopt(argc, argv, "fHiLpPrR@/")) != EOF)
+ while ((c = getopt(argc, argv, "afHiLpPrR@/")) != EOF)
switch (c) {
case 'f':
fflg++;
@@ -238,6 +238,13 @@ main(int argc, char *argv[])
case 'r':
rflg++;
break;
+ case 'a':
+ Lflg = Hflg = 0;
+ pflg++;
+ Pflg++;
+ Rflg++;
+ rflg++;
+ break;
case '@':
atflg++;
attrsilent = 0;
@@ -1323,10 +1330,10 @@ usage(void)
#endif
} else if (cpy) {
(void) fprintf(stderr, gettext(
- "Usage: cp [-f] [-i] [-p] [-@] [-/] f1 f2\n"
- " cp [-f] [-i] [-p] [-@] [-/] f1 ... fn d1\n"
- " cp -r|-R [-H|-L|-P] [-f] [-i] [-p] [-@] [-/] "
- "d1 ... dn-1 dn\n"));
+ "Usage: cp [-a] [-f] [-i] [-p] [-@] [-/] f1 f2\n"
+ " cp [-a] [-f] [-i] [-p] [-@] [-/] f1 ... fn d1\n"
+ " cp [-r|-R [-H|-L|-P]] [-a] [-f] [-i] [-p] [-@] "
+ "[-/] d1 ... dn-1 dn\n"));
}
exit(2);
}
diff --git a/usr/src/man/man1/cp.1 b/usr/src/man/man1/cp.1
index 727b443ac8..e1ef2a6df8 100644
--- a/usr/src/man/man1/cp.1
+++ b/usr/src/man/man1/cp.1
@@ -1,4 +1,5 @@
'\" te
+.\" Copyright 2013 Nexenta Systems, Inc. All rights reserved.
.\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
@@ -9,48 +10,48 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH CP 1 "Oct 30, 2007"
+.TH CP 1 "Apr 15, 2013"
.SH NAME
cp \- copy files
.SH SYNOPSIS
.LP
.nf
-\fB/usr/bin/cp\fR [\fB-fip@/\fR] \fIsource_file\fR \fItarget_file\fR
+\fB/usr/bin/cp\fR [\fB-afip@/\fR] \fIsource_file\fR \fItarget_file\fR
.fi
.LP
.nf
-\fB/usr/bin/cp\fR [\fB-fip@/\fR] \fIsource_file\fR... \fItarget\fR
+\fB/usr/bin/cp\fR [\fB-afip@/\fR] \fIsource_file\fR... \fItarget\fR
.fi
.LP
.nf
-\fB/usr/bin/cp\fR \fB-r\fR | \fB-R\fR [\fB-H\fR | \fB-L\fR | \fB-P\fR] [\fB-fip@/\fR] \fIsource_dir\fR... \fItarget\fR
+\fB/usr/bin/cp\fR [\fB-r\fR | \fB-R\fR [\fB-H\fR | \fB-L\fR | \fB-P\fR]] [\fB-afip@/\fR] \fIsource_dir\fR... \fItarget\fR
.fi
.LP
.nf
-\fB/usr/bin/cp\fR \fB-R\fR | \fB-R\fR [\fB-H\fR | \fB-L\fR | \fB-P\fR] [\fB-fip@/\fR] \fIsource_dir\fR... \fItarget\fR
+\fB/usr/bin/cp\fR [\fB-R\fR | \fB-R\fR [\fB-H\fR | \fB-L\fR | \fB-P\fR]] [\fB-afip@/\fR] \fIsource_dir\fR... \fItarget\fR
.fi
.LP
.nf
-\fB/usr/xpg4/bin/cp\fR [\fB-fip@/\fR] \fIsource_file\fR \fItarget_file\fR
+\fB/usr/xpg4/bin/cp\fR [\fB-afip@/\fR] \fIsource_file\fR \fItarget_file\fR
.fi
.LP
.nf
-\fB/usr/xpg4/bin/cp\fR [\fB-fip@/\fR] \fIsource_file\fR... \fItarget\fR
+\fB/usr/xpg4/bin/cp\fR [\fB-afip@/\fR] \fIsource_file\fR... \fItarget\fR
.fi
.LP
.nf
-\fB/usr/xpg4/bin/cp\fR \fB-r\fR | \fB-R\fR [\fB-H\fR | \fB-L\fR | \fB-P\fR] [\fB-fip@/\fR] \fIsource_dir\fR... \fItarget\fR
+\fB/usr/xpg4/bin/cp\fR [\fB-r\fR | \fB-R\fR [\fB-H\fR | \fB-L\fR | \fB-P\fR]] [\fB-afip@/\fR] \fIsource_dir\fR... \fItarget\fR
.fi
.LP
.nf
-\fB/usr/xpg4/bin/cp\fR \fB-R\fR | \fB-R\fR [\fB-H\fR | \fB-L\fR | \fB-P\fR] [\fB-fip@/\fR] \fIsource_dir\fR... \fItarget\fR
+\fB/usr/xpg4/bin/cp\fR [\fB-R\fR | \fB-R\fR [\fB-H\fR | \fB-L\fR | \fB-P\fR]] [\fB-afip@/\fR] \fIsource_dir\fR... \fItarget\fR
.fi
.SH DESCRIPTION
@@ -92,6 +93,15 @@ The following options are supported for both \fB/usr/bin/cp\fR and
.sp
.ne 2
.na
+\fB\fB-a\fR\fR
+.ad
+.RS 6n
+Archive mode. Same as -RpP.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fB-f\fR\fR
.ad
.RS 6n