diff options
author | Jason McIntyre <jmc@cvs.openbsd.org> | 2004-12-10 10:23:31 +0000 |
---|---|---|
committer | Jason McIntyre <jmc@cvs.openbsd.org> | 2004-12-10 10:23:31 +0000 |
commit | dd8ffbba73c563ccc16c292a5aeee0ecf2b9e6d9 (patch) | |
tree | 39d98189fba5e824b84e5672fe52e2a6c2bf747e /bin | |
parent | 2b28e87e381321e74abe367828d13ffb1e61b5da (diff) |
sort options + sync usage();
standard EXAMPLES;
various other tweaks;
ok millert@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/cp/cp.1 | 93 | ||||
-rw-r--r-- | bin/cp/utils.c | 8 |
2 files changed, 50 insertions, 51 deletions
diff --git a/bin/cp/cp.1 b/bin/cp/cp.1 index 800827dd29b..3c7a7ac6bc3 100644 --- a/bin/cp/cp.1 +++ b/bin/cp/cp.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cp.1,v 1.24 2004/12/07 19:17:44 otto Exp $ +.\" $OpenBSD: cp.1,v 1.25 2004/12/10 10:23:30 jmc Exp $ .\" $NetBSD: cp.1,v 1.9 1995/07/25 19:36:45 jtc Exp $ .\" .\" Copyright (c) 1989, 1990, 1993, 1994 @@ -41,18 +41,18 @@ .Nd copy files .Sh SYNOPSIS .Nm cp +.Op Fl fip .Oo .Fl R -.Op Fl H | Fl L | Fl P +.Op Fl H | L | P .Oc -.Op Fl fip .Ar source_file target_file .Nm cp +.Op Fl fip .Oo .Fl R -.Op Fl H | Fl L | Fl P +.Op Fl H | L | P .Oc -.Op Fl fip .Ar source_file ... target_directory .Sh DESCRIPTION In the first synopsis form, the @@ -73,32 +73,23 @@ detects an attempt to copy a file to itself, the copy will fail. .Pp The options are as follows: .Bl -tag -width Ds -.It Fl R -If -.Ar source_file -designates a directory, -.Nm -copies the directory and the entire subtree connected at that point. -Created directories have the same mode as the corresponding source -directory, unmodified by the process's umask. -.Pp -This option also causes symbolic links to be copied, rather than -followed, and -special files to be created, rather than being copied as normal files. -However, -.Nm -copies hard linked files as separate files. -To preserve hard links, -use a utility such as -.Xr pax 1 -or -.Xr tar 1 -instead. +.It Fl f +For each existing destination pathname, remove it and +create a new file, without prompting for confirmation, +regardless of its permissions. +This option overrides any use of +.Fl i . .It Fl H If the .Fl R option is also specified, symbolic links on the command-line are followed. (Symbolic links encountered in the tree traversal are not followed.) +.It Fl i +Write a prompt to the standard error output before copying a file +that would overwrite an existing file. +If the response from the standard input begins with the character +.Sq Li y , +the file copy is attempted. .It Fl L If the .Fl R @@ -107,18 +98,6 @@ option is also specified, all symbolic links are followed. If the .Fl R option is also specified, no symbolic links are followed. -.It Fl f -For each existing destination pathname, remove it and -create a new file, without prompting for confirmation, -regardless of its permissions. -This option overrides any use of -.Fl i . -.It Fl i -Write a prompt to the standard error output before copying a file -that would overwrite an existing file. -If the response from the standard input begins with the character -.Sq Li y , -the file copy is attempted. .It Fl p Preserve in the copy as many of the modification time, access time, file flags, file mode, user ID, and group ID as allowed by permissions. @@ -136,6 +115,27 @@ If the source file has both its set-user-ID and set-group-ID bits on, and either the user ID or group ID cannot be preserved, neither the set-user-ID nor set-group-ID bits are preserved in the copy's permissions. +.It Fl R +If +.Ar source_file +designates a directory, +.Nm +copies the directory and the entire subtree connected at that point. +Created directories have the same mode as the corresponding source +directory, unmodified by the process's umask. +.Pp +This option also causes symbolic links to be copied, rather than +followed, and +special files to be created, rather than being copied as normal files. +However, +.Nm +copies hard linked files as separate files. +To preserve hard links, +use a utility such as +.Xr pax 1 +or +.Xr tar 1 +instead. .El .Pp For each destination file that already exists, its contents are @@ -191,26 +191,26 @@ The .Nm utility exits 0 on success or >0 if an error occurred. .Sh EXAMPLES -.Li $ cp foo bar -.Pp Make a copy of file .Pa foo named -.Pa bar . +.Pa bar : .Pp -.Li $ cp *.txt /tmp +.Dl $ cp foo bar .Pp Copy a group of files to the .Pa /tmp -directory. +directory: .Pp -.Li $ cp -R junk /tmp +.Dl $ cp *.txt /tmp .Pp Copy the directory .Pa junk and all of its contents (including any subdirectories) to the .Pa /tmp -directory. +directory: +.Pp +.Dl $ cp -R junk /tmp .Sh SEE ALSO .Xr mv 1 , .Xr rcp 1 , @@ -225,8 +225,7 @@ utility had a option. This implementation supports that option; however, its use is strongly discouraged, as it does not correctly copy special files, symbolic links -or -.Tn FIFO Ns s. +or FIFOs. .Pp The .Nm diff --git a/bin/cp/utils.c b/bin/cp/utils.c index ca6f3a6da94..7e1185fd48b 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utils.c,v 1.25 2003/11/24 04:22:44 mickey Exp $ */ +/* $OpenBSD: utils.c,v 1.26 2004/12/10 10:23:30 jmc Exp $ */ /* $NetBSD: utils.c,v 1.6 1997/02/26 14:40:51 cgd Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)utils.c 8.3 (Berkeley) 4/1/94"; #else -static char rcsid[] = "$OpenBSD: utils.c,v 1.25 2003/11/24 04:22:44 mickey Exp $"; +static char rcsid[] = "$OpenBSD: utils.c,v 1.26 2004/12/10 10:23:30 jmc Exp $"; #endif #endif /* not lint */ @@ -302,9 +302,9 @@ void usage(void) { (void)fprintf(stderr, - "usage: %s [-R [-H | -L | -P]] [-fip] src target\n", __progname); + "usage: %s [-fip] [-R [-H | -L | -P]] source_file target_file\n", __progname); (void)fprintf(stderr, - " %s [-R [-H | -L | -P]] [-fip] src1 ... srcN directory\n", + " %s [-fip] [-R [-H | -L | -P]] source_file ... target_directory\n", __progname); exit(1); } |