summaryrefslogtreecommitdiffstats
path: root/bin/cp
Commit message (Collapse)AuthorAgeFilesLines
* Constify and staticify for lint.markm2002-10-183-6/+6
|
* cp -p could report success even if a file copy failed. This was due tomckay2002-09-221-3/+4
| | | | | | | | | | | 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
* Make the threatened fts(3) ABI fix. FTSENT now avoids the use of the structwollman2002-09-211-2/+2
| | | | | | | | | | | | | | | | 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
* Bump document date for the -n option.johan2002-08-161-1/+1
| | | | Approved by: sheldonh (mentor)
* mdoc(7) police: grammar.ru2002-08-091-1/+1
|
* Fix some easy WARNS.markm2002-07-311-4/+4
|
* Add the -n option, which automatically answers "no" to the overwrite question.johan2002-07-234-12/+35
| | | | | | | PR: 7828 Suggested by: Daniel O'Connor <doconnor@gsoft.com.au> Approved by: sheldonh (mentor) MFC after: 2 weeks
* Revert previous delta, which is not required with rev 1.5 ofsheldonh2002-07-151-1/+0
| | | | src/contrib/gcc/c-format.c .
* Set WFORMAT=0, because our compiler currently complains about NULLsheldonh2002-07-111-0/+1
| | | | | | | | | | | | | | | | | | 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
* err() is documented as allowing NULL for the format string but GCC isn'tdillon2002-07-101-1/+1
| | | | happy about it any more so change the usage to make buildworld work again.
* Fix some low-hanging lint-fruit: endianness and staticness warnings.markm2002-07-032-4/+6
|
* Consistently use __FBSDIDobrien2002-06-302-4/+4
|
* When -R is not specified, fail to copy the contents of dangling symlinkstjr2002-06-131-3/+11
| | | | | | instead of making a copy of the link itself (SUSv3) Obtained from: NetBSD
* Optimize prev. commit code a bitache2002-05-171-4/+4
|
* Trailing slash fixes.ache2002-05-171-2/+12
| | | | | | | | | | 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.
* Add semicolon to empty default case to silence warning.alfred2002-05-111-0/+1
|
* Fixed some style bugs in revs 1.1 and 1.4.bde2002-02-231-4/+4
|
* Fix warnings inspired by lint, a commercial lint and WARNS=4.markm2002-02-224-21/+20
|
* Modernization effort for bin/c*:imp2002-02-023-33/+17
| | | | | | | | | | | | o __P has been reoved o Old-style K&R declarations have been converted to new C89 style o register has been removed o prototype for main() has been removed (gcc3 makes it an error) o int main(int argc, char *argv[]) is the preferred main definition. o Attempt to not break style(9) conformance for declarations more than they already are. Approved by: arch@, new style(9)
* Bruce thought some of the comments I added were not clear enough. This ismckay2002-01-011-8/+8
| | | | a combination of my words and his. We will stop fiddling now. :-)
* The previous fix caused cp to emit spurious warnings under somemckay2001-12-231-22/+26
| | | | | | | circumstances. This is a reworked version of the same fix, that does not have this defect, and which fixes some style bugs at the same time. Bug reported and fix reviewed by: bde
* Preserve directory timestamps with -p. Allow non-empty read-onlymckay2001-12-111-11/+39
| | | | | | | | | | directories to be copied. Apply umask to newly created directories when -p is not specified. PR: 27970 PR: 31633 MFC after: 4 days
* Typo in warning message (chown should be chmod).mckay2001-12-111-1/+1
|
* Default to WARNS=2. Binary builds that cannot handle this must explicitlyobrien2001-12-041-1/+2
| | | | | | set WARNS=0. Reviewed by: mike
* mdoc(7) police: utilize the new .Ex macro.ru2001-08-151-3/+1
|
* Remove whitespace at EOL.dd2001-07-151-9/+9
|
* mdoc(7) police: removed HISTORY info from the .Os call.ru2001-07-101-1/+1
|
* Add more headers that are required with -fno-builtin (stdlib and strings)des2001-06-192-0/+2
|
* Removed the broken code which claimed to lose the set[ug]id bits inbde2001-06-113-27/+4
| | | | | | | | | | | | | | | | | | | | | the !(pflag && setfile()) case for regular files unless the copy is owned by the same user and group. These bits have already been lost (or never gained) in the correct way. The code didn't actually lose the bits; it depended on them being lost already (apparently in all cases) and attempted to gain them as necessary, but it often gained them (and sometimes collateral bits) when wrong: - pflag && setfile() == 0 case (i.e., for a successful cp -p): setfile() copies all the attributes as correctly as possible (as specified by POSIX), and we sometimes messed up the up the mode by setting it again. Also, if the file is immutable, then setting the mode again gave spurious errors (PR 20646). - !pflag case. If the target is created, POSIX requires it to not have the set[ug]id bits, but we sometimes copied them from the source. If the target already exists, POSIX requires its mode to be unchanged, but we sometimes copied the whole mode from the source. PR: 20646 MFC after: 4 weeks
* Make it clear that -P is the default.ru2001-05-251-0/+1
| | | | PR: docs/27629
* Migrate from using MAXPATHLEN to MAX_PATH. Use strlcpy to copy theimp2001-05-163-5/+6
| | | | strings.
* In the hope of saving others from hours of tedious recovery work,mckay2001-02-041-0/+10
| | | | | document that cp still isn't very useful for recursive copies even with the -R flag. This is because hard links are broken by cp.
* mdoc(7) police: use the new features of the Nm macro.ru2000-11-201-2/+2
|
* Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and therebywollman2000-10-101-0/+1
| | | | <time.h>).
* fix cp -vi bugmharo2000-01-231-2/+3
| | | | Submitted by: Dan Papasian (bugg_ on irc)
* brucifymharo1999-11-282-16/+20
| | | | Reviewed by: obrien
* brucify and move printf() to catch cases of special filesmharo1999-08-293-11/+7
|
* $Id$ -> $FreeBSD$peter1999-08-275-5/+5
|
* Add a verbose mode to show what files are being copied.mharo1999-08-264-9/+24
| | | | | | Idea taken from obrien. Reviewed by: obrien
* Add -W and fix the warning due to missing struct initializerkris1999-07-102-4/+4
|
* Various spelling/formatting changes.kris1999-05-083-8/+9
| | | | Submitted by: Philippe Charnier <charnier@xp11.frmug.org>
* First set of fixes to keep egcs happy. These include {} around singleimp1999-04-252-4/+6
| | | | | | | | | | statement if blocks[*] when the else could be ambiguous, not defaulting to int type and removal of some unused variables. [*] This is explicitly allowed by style(9) when the single statement spans more than one line. Reviewed by: obrien, chuckr
* Don't use mmap() for non-regular files, since st_size is only meaningfulbde1998-11-181-2/+2
| | | | | | | | for regular files. This fixes recent breakage of cp'ing from /dev/zero. /dev/zero doesn't support mmap(), but the device driver mmap routines are not called for mapping 0 bytes, so the error was not detected. mmap() can't even be used for cp'ing special files that support mmap(), since there is general way to determine the file size.
* Use mmap for file coping. 5-10% faster than the read system call.wosch1998-11-141-1/+2
|
* Correct a grammatical nit and remove ambiguity about the effect ofjkoshy1998-10-131-4/+6
| | | | | | | the -p option. PR: 8229 Submitted-by: Sheldon Hearn <axl@iafrica.com>
* Don't attempt to change owner/mode/flags that don't need to changed.peter1998-06-101-15/+29
| | | | | | This should calm down attempts to `cp -p' to a nfs mount or some other filesystem that doesn't accept flags or all combinations of flags. It will warn if it fails to change flags though.
* Print correct error message if we copy an unreadable directory.dt1998-06-091-1/+2
|
* Make sure we pass the length - 1 to readlink, since it adds its ownimp1998-06-091-2/+2
| | | | | NUL at the end of the path. Inspired by: OpenBSD's changes in this area by theo de raadt
* Restore Lite-2 sccsid.charnier1998-05-132-4/+4
|
* Correct use of .Nm and other cosmetics. Add rcsid. Remove unused #inc.charnier1998-05-063-24/+21
|
OpenPOWER on IntegriCloud