Commit Graph

104 Commits

Author SHA1 Message Date
Edwin Groothuis
a76b9b6973 As suggested, replace earlier changed warnx() / exit() with an errx()
Submitted by:	Peter Jeremy <peterjeremy@optushome.com.au>
2007-12-26 08:32:20 +00:00
Edwin Groothuis
0d5ee457ad When copying multiple files to a directory, make sure that a proper
warning is given when the directory doesn't exist.

PR:		bin/50656
Submitted by:	Edwin Groothuis <edwin@mavetju.org>
Approved by:	grog@
Not reviewed by: grog@
2007-12-25 00:40:32 +00:00
Ceri Davies
b873ae5ca9 Fix typo. 2006-11-02 19:10:05 +00:00
Tom Rhodes
f3955abb6f Wording nits. 2006-10-27 08:26:24 +00:00
Tom Rhodes
6138defa43 Flesh out the compatibility section a little bit. Bump doc date. 2006-10-24 18:42:42 +00:00
Tom Rhodes
43d8847e0b Fix style(9) bugs in previous commit.
Lesson from:	bde
2006-10-11 10:26:34 +00:00
Tom Rhodes
ba3fe6d1ab Make -r a synonym for -R, similar to behavior on Linux while being backwards
compatible with old -r behavior with regards to -L.  You can now copy fifos
and other special files with -r.

Reviewed by:	-standards (long ago), das, bde
Approved by:	bde (recently)
2006-10-07 22:14:43 +00:00
Maxim Konovalov
9bdb7f2e54 o Style(9).
Submitted by:	bde
2006-10-07 12:14:50 +00:00
Maxim Konovalov
eb82e1a1f8 o Avoid division by zero.
o Place error checking code near to the syscall.

Submitted by:	bde
2006-10-07 12:11:21 +00:00
Maxim Konovalov
6a861e9bfb o Hold copied bytes counter in off_t. This prevents statistics
displayed by SIGINFO handler from overflow.

PR:		bin/104039
Submitted by:	Geoffrey Giesemann
MFC after:	2 weeks
2006-10-06 08:30:33 +00:00
Ruslan Ermilov
64941e9d80 Move the -l option processing to where it belongs.
Overall still not kosher but better matches style(9).
2006-09-29 06:06:39 +00:00
Ruslan Ermilov
cbae88b901 - Fix options order.
- Touch manpage's document date.
2006-08-25 09:58:13 +00:00
Ruslan Ermilov
d9c7237d04 Remove a stray -a option that probably sneaked in from julian's
attempt to enter append mode twice in vi(1).  :-)
2006-08-25 09:42:16 +00:00
Julian Elischer
6fa363774d Add an option to allow copying of a hierarchy while linking he regular files.
Bikeshedded to death on: hackers
Submitted by:andersonatcenttech.com
MFC in: 1 month
2006-08-24 20:45:38 +00:00
Maxim Konovalov
867e6caf17 o Call fts_close() before exit.
Obtained from:	NetBSD, Coverity ID 1754
2006-07-04 20:52:36 +00:00
Christian S.J. Peron
9b4261c9b4 Attempt to complete the userspace integration of POSIX.1e extended ACLs.
This includes adding support for ACLs into cp(1) and mv(1) userspace
utilities.

For mv(1), if _PC_ACL_EXTENDED is in effect for the source AND destination
operands, the destination file's ACLs shall reflect the source.

For cp(1), if _PC_ACL_EXTENDED is in effect for both source and destination
operands, and -p has been specified, the ACLs from the source shall be
preserved on the destination.

MFC after:	1 month
2005-09-05 04:36:08 +00:00
Tom Rhodes
61001d7506 Fix a few markup nits in previous commit.
Noticed by:	ru, who else? :)
2005-02-25 00:40:46 +00:00
Tom Rhodes
a5e1813654 Note how cp(1) handles directories ending in "/."
PR:		75774
Submitted by:	Mike Meyer <mwm@mired.org> (original version)
2005-02-24 00:06:22 +00:00
Ruslan Ermilov
a89237ae95 Sync program's usage() with manpage's SYNOPSIS. 2005-02-09 17:37:39 +00:00
Ruslan Ermilov
6fca4c7c3f Add the new standard EXIT STATUS section where appropriate.
Sort standard sections in the (documented) preferred order.
2005-01-16 16:41:59 +00:00
Warner Losh
9ddb49cbe4 /*- or .\"- or #- to begin license clauses. 2005-01-10 08:39:26 +00:00
Ruslan Ermilov
eccea571a7 Mechanically kill hard sentence breaks. 2004-07-02 21:04:19 +00:00
Tim J. Robbins
7807cb2439 Plug file descriptor leak in implementation of -n option. 2004-06-05 02:32:21 +00:00
Mark Murray
6195fb4102 Remove clause 3 from the UCB licenses.
OK'ed by:	imp, core
2004-04-06 20:06:54 +00:00
Alan Cox
b9e25f436b Don't mmap(2) and munmap(2) zero-length files.
Submitted by:	Wiktor Niesiobedzki <bsd@w.evip.pl>
2003-11-13 05:26:55 +00:00
John-Mark Gurney
529a7167bd pass -1 to setfile in cp.c
Submitted by:	Jun Kuriyama
2003-06-30 06:16:06 +00:00
John-Mark Gurney
a6b05ab6ea support saving both user/group and permissions on symlinks (from PR)
also fix a slight bogon that assumed an fd of 0 was not valid.  Changed
it to be -1.

PR:		bin/25017
Submitted by:	Martin Kammerhofer
2003-06-22 07:02:17 +00:00
Ruslan Ermilov
7d2191c827 Clarify what -p option does.
Prodded by:	marcel

While here, spell the "set-{user,group}-ID bit" correctly.
2003-06-07 06:35:36 +00:00
David E. O'Brien
09a80d4867 Quiet warnings about copyright[]. 2003-05-01 16:58:57 +00:00
Bruce Evans
82fdc5e61b Include <signal.h> instead of depending on namespace pollution in
<sys/param.h>.  Include <sys/types.h> instead of of <sys/param.h>
so that further such dependencies don't develop.
2003-04-13 08:47:30 +00:00
Bruce Evans
4901f51b4e Fixed some style bugs in rev.1.44. 2003-04-13 08:27:35 +00:00
Matthew N. Dodd
947193d93f Use the correct data type and qualifier for signal flag. 2003-04-07 12:09:17 +00:00
Matthew N. Dodd
00d321a2b3 Add a SIGINFO handler. 2003-04-07 11:00:56 +00:00
Mark Murray
ba8acd9de2 Constify and staticify for lint. 2002-10-18 14:45:00 +00:00
Stephen McKay
eedc99e7b5 cp -p could report success even if a file copy failed. This was due to
the cumulative exit status being overwritten when directory permissions
were being set.  This was particularly bad when called from mv(1) to
perform a cross-device move as the original files were deleted even if
the copy failed.

Reported by:    Slaven Rezic <slaven.rezic@berlin.de>
Patch by:       bde
PR:             42789
2002-09-22 11:15:56 +00:00
Garrett Wollman
0d3bcc2e80 Make the threatened fts(3) ABI fix. FTSENT now avoids the use of the struct
hack, thereby allowing future extensions to the structure (e.g., for extended
attributes) without rebreaking the ABI.  FTSENT now contains a pointer to the
parent stream, which fts_compar() can then take advantage of, avoiding the
undefined behavior previously warned about.  As a consequence of this change,
the prototype of the comparison function passed to fts_open() has changed
to reflect the required amount of constness for its use.  All callers in the
tree are updated to use the correct prototype.

Comparison functions can now make use of the new parent pointer to access
the new stream-specific private data pointer, which is intended to assist
creation of reentrant library routines which use fts(3) internally.

Not objected to in spirit by: -arch
2002-09-21 01:28:41 +00:00
Johan Karlsson
e849cfacaa Bump document date for the -n option.
Approved by: sheldonh (mentor)
2002-08-16 03:13:59 +00:00
Ruslan Ermilov
c3ff3e424c mdoc(7) police: grammar. 2002-08-09 10:38:34 +00:00
Mark Murray
13fcef50d0 Fix some easy WARNS. 2002-07-31 16:52:16 +00:00
Johan Karlsson
786c276fe4 Add the -n option, which automatically answers "no" to the overwrite question.
PR:		7828
Suggested by:	Daniel O'Connor <doconnor@gsoft.com.au>
Approved by:	sheldonh (mentor)
MFC after:	2 weeks
2002-07-23 00:42:56 +00:00
Sheldon Hearn
ced4deb156 Revert previous delta, which is not required with rev 1.5 of
src/contrib/gcc/c-format.c .
2002-07-15 12:08:21 +00:00
Sheldon Hearn
a3ee32f3f7 Set WFORMAT=0, because our compiler currently complains about NULL
arg 2 to err() and friends, and warnings are promoted to errors.

This allows the following revisions to be reverted:

	rev 1.39	src/bin/cp/cp.c
	rev 1.26	src/bin/chmod/chmod.c
	rev 1.40	src/bin/rm/rm.c

The following revisions can already be reverted, because they were
already covered by WFORMAT=0:

	rev 1.8		src/bin/ls/lomac.c
	rev 1.63	src/bin/ls/ls.c
	rev 1.8		src/bin/ps/lomac.c
	rev 1.34	src/bin/rcp/rcp.c
2002-07-11 08:45:38 +00:00
Matthew Dillon
5ad9e45f96 err() is documented as allowing NULL for the format string but GCC isn't
happy about it any more so change the usage to make buildworld work again.
2002-07-10 20:44:55 +00:00
Mark Murray
7ede89e44b Fix some low-hanging lint-fruit: endianness and staticness warnings. 2002-07-03 16:35:20 +00:00
David E. O'Brien
5eb43ac2f7 Consistently use __FBSDID 2002-06-30 05:13:54 +00:00
Tim J. Robbins
f9dc2a8b93 When -R is not specified, fail to copy the contents of dangling symlinks
instead of making a copy of the link itself (SUSv3)

Obtained from:	NetBSD
2002-06-13 15:48:36 +00:00
Andrey A. Chernov
486d038778 Optimize prev. commit code a bit 2002-05-17 12:24:19 +00:00
Andrey A. Chernov
27d3ae3587 Trailing slash fixes.
Fix the case:
        cp file nonexistent/
which create nonextstent as file while trailing slash clearly indicates
that nonexistent must be a directory.
Also fix the case:
	cp file1 file2/
which should produce error.
2002-05-17 11:52:48 +00:00
Alfred Perlstein
64baebf95b Add semicolon to empty default case to silence warning. 2002-05-11 00:21:00 +00:00
Bruce Evans
b909fa9cd0 Fixed some style bugs in revs 1.1 and 1.4. 2002-02-23 17:05:32 +00:00