Add an '-a' option which is identical to specifying '-RpP' for

compatibility with other implementations.

MFC after:	1 month
This commit is contained in:
John Baldwin 2008-03-10 19:58:41 +00:00
parent 39d63c55af
commit d140946cf3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177036
3 changed files with 15 additions and 5 deletions

View File

@ -45,7 +45,7 @@
.Op Fl H | Fl L | Fl P .Op Fl H | Fl L | Fl P
.Oc .Oc
.Op Fl f | i | n .Op Fl f | i | n
.Op Fl lpv .Op Fl alpv
.Ar source_file target_file .Ar source_file target_file
.Nm .Nm
.Oo .Oo
@ -53,7 +53,7 @@
.Op Fl H | Fl L | Fl P .Op Fl H | Fl L | Fl P
.Oc .Oc
.Op Fl f | i | n .Op Fl f | i | n
.Op Fl lpv .Op Fl alpv
.Ar source_file ... target_directory .Ar source_file ... target_directory
.Sh DESCRIPTION .Sh DESCRIPTION
In the first synopsis form, the In the first synopsis form, the
@ -116,6 +116,10 @@ If you need to preserve hard links, consider using
or or
.Xr pax 1 .Xr pax 1
instead. instead.
.It Fl a
Archive mode.
Same as
.Fl RpP .
.It Fl f .It Fl f
For each existing destination pathname, remove it and For each existing destination pathname, remove it and
create a new file, without prompting for confirmation create a new file, without prompting for confirmation

View File

@ -102,7 +102,7 @@ main(int argc, char *argv[])
char *target; char *target;
Hflag = Lflag = Pflag = 0; Hflag = Lflag = Pflag = 0;
while ((ch = getopt(argc, argv, "HLPRfilnprv")) != -1) while ((ch = getopt(argc, argv, "HLPRafilnprv")) != -1)
switch (ch) { switch (ch) {
case 'H': case 'H':
Hflag = 1; Hflag = 1;
@ -119,6 +119,12 @@ main(int argc, char *argv[])
case 'R': case 'R':
Rflag = 1; Rflag = 1;
break; break;
case 'a':
Pflag = 1;
pflag = 1;
Rflag = 1;
Hflag = Lflag = 0;
break;
case 'f': case 'f':
fflag = 1; fflag = 1;
iflag = nflag = 0; iflag = nflag = 0;

View File

@ -429,8 +429,8 @@ usage(void)
{ {
(void)fprintf(stderr, "%s\n%s\n", (void)fprintf(stderr, "%s\n%s\n",
"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-lpv] source_file target_file", "usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file target_file",
" cp [-R [-H | -L | -P]] [-f | -i | -n] [-lpv] source_file ... " " cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file ... "
"target_directory"); "target_directory");
exit(EX_USAGE); exit(EX_USAGE);
} }