Commit Graph

41 Commits

Author SHA1 Message Date
erh
a329a6a0ae Fix Coverity issue 1754. Call fts_close() after we're done copying. 2006-03-17 06:22:30 +00:00
christos
95355c05c7 - Better detect pathname overflow (from FreeBSD)
- Change destination normal file detection to match with FreeBSD
- Trim trailing slashes from source filenames so that cp foo/ == cp foo
2005-11-16 22:42:12 +00:00
kleink
fd4c891ff8 Remove the "" -> "." target conversion kludge. 2005-10-24 12:59:07 +00:00
christos
509c72ef94 - Don't output 'src -> dst' when -v and there was an error.
- Mark usage as noreturn, and remove extraneous exit.
- Pass lint.
Reported by Liam Foy.
2005-10-15 18:22:18 +00:00
elad
76ed05e8b1 Add and document -N: When used with -p, it will not copy the file flags.
PR 13645.
2005-08-15 17:13:35 +00:00
christos
6310b59691 sprinkle a little const, and now everything compiles with WARNS=3 2005-06-26 19:10:48 +00:00
jschauma
6a75fbb636 Following private discussion with kleink@ and hubertf@ and public discussion
on tech-userlevel@, back out printescaped() functionality.
kleink: ``We sell rope.''
2003-09-14 19:20:16 +00:00
agc
b5b2954259 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
2003-08-07 09:05:01 +00:00
jschauma
458ed23412 As discusses a little while back on tech-userlevel:
If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.

While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.
2003-08-04 22:31:21 +00:00
jrf
4e81454aa9 Added a -v verbose option to the cp(1) command. Updated man page and utils as well. This applies to PR bin/16834. This change was approved by Christos. 2002-12-16 14:44:14 +00:00
wiz
633b06fe1e ANSIfication and some KNF fixes by Petri Koistinen from bin/13681. 2001-09-13 09:53:59 +00:00
itojun
a1e2f21a4c errx?/warnx? audit. do not pass variable alone, use %s. idea from openbsd 2000-07-07 12:50:15 +00:00
matt
e2056eada9 include <stdlib.h>, <string.h>, or whatever as appropriate to shut up
gcc 2.96
2000-07-03 03:26:17 +00:00
kleink
89e0b77a2f Initialize locale on startup. 1999-09-05 16:14:43 +00:00
mjl
382ab5ae40 Correct behaviour in case of dangling symlinks: they would be (contrary
to what the manpage and POSIX say) copied as symlinks, even without -R.
Return ENOENT instead. Closes PR 6975 by Johan Danielsson <joda@pdc.kth.se>.

From FreeBSD: return correct error message if source directory is
unreadable; remove unnecessarily included headers.
1999-03-01 18:57:29 +00:00
dean
033ff5b1e1 Got rid of redundant error message (X is a directory (not copied). was
printed twice)
1999-02-25 05:43:04 +00:00
wsanchez
8a99d7cf5d Fix bug where "cp -f" didn't work.
It's suppsed to remove the file and then copy, which it wasn't doing.
But no wait, it turns out that the described behaviour in the manual doesn't
  agree with POSIX. So we change the above fix and the manual to "try copy, and
  if fail, try remove, then copy".
Fix bug where "cp -R" didn't work on read-only directories:
  It would make the directory, set the mode, and not be able to write files into it.
Don't bother mmap()ing files of zero length. Was a workaround for a bug in Rhapsody
  mmap(), which didn't get along with such files, but makes sense anyway.
Fix race condition where "cp -p" would set the mod time of a file before close()ing
  the file, which would update the mod time and therefore screw up the "-p" idea,
  except, of course, while running in gdb, which sucked.
Add -f option to usage message in binary and man page. Already documented in man page.
1998-10-08 17:43:24 +00:00
thorpej
8d68a9dce5 Add some braces to keep egcs happy. 1998-08-19 01:29:11 +00:00
mycroft
ee9e50eacb Be more retentive about use of NOTREACHED and noreturn. 1998-07-28 11:41:40 +00:00
mycroft
9dc385beb1 Delint. 1998-07-28 05:31:22 +00:00
mycroft
29bf463dcb Delint. 1998-07-28 04:01:03 +00:00
mycroft
ce7d757530 Delint. 1998-07-28 03:47:14 +00:00
lukem
df49b6cc7f * getopt returns -1 not EOF
* cleanup use of .Nm in manpage
1997-09-14 07:15:25 +00:00
thorpej
efc20a3095 - Use __COPYRIGHT() and __RCSID()
- Fix compiler warnings.
1997-07-20 05:13:36 +00:00
kleink
8385a5edde Fix one remaining botch when copying directory trees using -R. 1997-05-21 09:48:33 +00:00
kleink
bdad0c3627 Fix thinko in last commit, causing "cp file /" to succeed but
"cp file1 file2 /" to fail badly; fixes PR/3646 from Paul Kranenburg.
1997-05-19 01:07:33 +00:00
kleink
3a978953a9 Fix lossage with new namei() when the destination given is "/";
reported by Bernd Ernesti.
1997-04-09 12:06:13 +00:00
jtc
5fc5415e25 Sync with 4.4lite2 1995-09-07 06:12:53 +00:00
mycroft
50130476f4 Fix typo in S_FIFO case when copying recursively. 1995-04-02 01:45:25 +00:00
cgd
49f0ad8601 convert to new RCS id conventions. 1995-03-21 09:01:59 +00:00
mycroft
89fb48a178 Fix core dump reported by Wolfram Schneider. 1995-01-26 06:01:36 +00:00
mycroft
051219a643 Merge 4.4-Lite version. 1994-09-22 09:24:35 +00:00
cgd
95d6a185be no more MAP_FILE 1994-03-28 02:07:04 +00:00
jtc
869cbd8c23 POSIX.2 (and common sense) says that you can't overwrite a directory with
a non-directory.
1994-02-25 00:43:25 +00:00
jtc
509eb263b9 Check user's response against both 'Y' and 'y' --- this is really supposed
to be a locale specific regular expression.  This change hard codes POSIX
locale behavior, and will be replaced by a locale independant equivalent
as soon as locales are fully implemented.
1993-11-09 18:57:54 +00:00
mycroft
d3fbe8985a From Lennart Augustsson:
If we mmap() the file, make sure we munmap() when we're done.
1993-10-30 13:06:46 +00:00
mycroft
204663a326 New version from uunet. Uses mmap(). 1993-08-07 03:14:51 +00:00
mycroft
a579b792ce Add RCS identifiers. 1993-08-01 18:59:54 +00:00
cgd
06be60083d changed "Id" to "Header" for rcsids 1993-03-23 00:22:59 +00:00
cgd
346aa5dd48 added rcs ids to all files 1993-03-22 08:04:00 +00:00
cgd
61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00