cp: Update program usage and manpages
Do not document the non-standard -r flag as it is highly discouraged. It is still silently accepted and treated the same as -R.
This commit is contained in:
parent
6c31f1d2a8
commit
16719ea6e1
30
cp.1
30
cp.1
@ -1,4 +1,4 @@
|
|||||||
.Dd January 30, 2015
|
.Dd February 17, 2015
|
||||||
.Dt CP 1
|
.Dt CP 1
|
||||||
.Os sbase
|
.Os sbase
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -6,11 +6,11 @@
|
|||||||
.Nd copy files and directories
|
.Nd copy files and directories
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl Rr
|
.Op Fl afpv
|
||||||
.Ar file
|
.Oo
|
||||||
.Op Ar name
|
.Fl R
|
||||||
.Nm
|
.Op Fl H | L | P
|
||||||
.Op Fl aPpRrv
|
.Oc
|
||||||
.Op Ar file ...
|
.Op Ar file ...
|
||||||
.Op Ar directory
|
.Op Ar directory
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
@ -34,6 +34,14 @@ and
|
|||||||
.Fl r .
|
.Fl r .
|
||||||
.It Fl f
|
.It Fl f
|
||||||
If an existing destination file cannot be opened, remove it and try again.
|
If an existing destination file cannot be opened, remove it and try again.
|
||||||
|
.It Fl p
|
||||||
|
Preserve mode, timestamp and permissions.
|
||||||
|
.It Fl v
|
||||||
|
Print names of source and destination per file to stdout. In the format:
|
||||||
|
"source \-> destination".
|
||||||
|
.It Fl R
|
||||||
|
Copies directories recursively. If this flag is not specified, directories
|
||||||
|
are not copied.
|
||||||
.It Fl H
|
.It Fl H
|
||||||
Only dereference symbolic links that are passed as command line arguments when
|
Only dereference symbolic links that are passed as command line arguments when
|
||||||
recursively traversing directories.
|
recursively traversing directories.
|
||||||
@ -42,16 +50,6 @@ Always dereference symbolic links while recursively traversing directories
|
|||||||
(default).
|
(default).
|
||||||
.It Fl P
|
.It Fl P
|
||||||
Don't dereference symbolic links.
|
Don't dereference symbolic links.
|
||||||
.It Fl p
|
|
||||||
Preserve mode, timestamp and permissions.
|
|
||||||
.It Fl R
|
|
||||||
Equivalent to -r.
|
|
||||||
.It Fl r
|
|
||||||
Copies directories recursively. If this flag is not specified, directories
|
|
||||||
are not copied.
|
|
||||||
.It Fl v
|
|
||||||
Print names of source and destination per file to stdout. In the format:
|
|
||||||
"source \-> destination".
|
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr mv 1
|
.Xr mv 1
|
||||||
|
12
cp.c
12
cp.c
@ -7,7 +7,7 @@
|
|||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
eprintf("usage: %s [-adfpRrv] source... dest\n", argv0);
|
eprintf("usage: %s [-afpv] [-R [-H | -L | -P]] source... dest\n", argv0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -21,11 +21,14 @@ main(int argc, char *argv[])
|
|||||||
cp_HLPflag = 'P';
|
cp_HLPflag = 'P';
|
||||||
cp_aflag = cp_pflag = cp_rflag = 1;
|
cp_aflag = cp_pflag = cp_rflag = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'f':
|
||||||
|
cp_fflag = 1;
|
||||||
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
cp_pflag = 1;
|
cp_pflag = 1;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'v':
|
||||||
cp_fflag = 1;
|
cp_vflag = 1;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
case 'R':
|
case 'R':
|
||||||
@ -36,9 +39,6 @@ main(int argc, char *argv[])
|
|||||||
case 'P':
|
case 'P':
|
||||||
cp_HLPflag = ARGC();
|
cp_HLPflag = ARGC();
|
||||||
break;
|
break;
|
||||||
case 'v':
|
|
||||||
cp_vflag = 1;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
} ARGEND;
|
} ARGEND;
|
||||||
|
Loading…
Reference in New Issue
Block a user