From 9e647765f079a9527bc9430bd6805745b590091b Mon Sep 17 00:00:00 2001 From: Alexander Eremin Date: Fri, 19 Apr 2013 03:26:55 -0500 Subject: [PATCH] =?utf8?q?667=20cp=20support=20for=20-a=20flag=20Reviewed?= =?utf8?q?=20by:=20David=20H=C3=B6ppner=20<0xffea@gmail.com>=20Reviewed=20?= =?utf8?q?by:=20Gordon=20Ross=20=20Approved=20by:?= =?utf8?q?=20Richard=20Lowe=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- usr/src/cmd/mv/mv.c | 21 ++++++++++++++------- usr/src/man/man1/cp.1 | 28 +++++++++++++++++++--------- 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 -- 2.11.4.GIT