changeset 14016:9d68e7a6a0c3

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>
author Alexander Eremin <a.eremin@nexenta.com>
date Fri, 19 Apr 2013 03:26:55 -0500
parents e5fc7d0d7c24
children a8db07801f46
files usr/src/cmd/mv/mv.c usr/src/man/man1/cp.1
diffstat 2 files changed, 33 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/mv/mv.c	Wed Apr 17 10:28:26 2013 -0400
+++ b/usr/src/cmd/mv/mv.c	Fri Apr 19 03:26:55 2013 -0500
@@ -182,8 +182,8 @@
 
 	/*
 	 * 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 @@
 	 */
 
 	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 @@
 			case 'r':
 				rflg++;
 				break;
+			case 'a':
+				Lflg = Hflg = 0;
+				pflg++;
+				Pflg++;
+				Rflg++;
+				rflg++;
+				break;
 			case '@':
 				atflg++;
 				attrsilent = 0;
@@ -1323,10 +1330,10 @@
 #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);
 }
--- a/usr/src/man/man1/cp.1	Wed Apr 17 10:28:26 2013 -0400
+++ b/usr/src/man/man1/cp.1	Fri Apr 19 03:26:55 2013 -0500
@@ -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 @@
 .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