Commit Graph

78 Commits

Author SHA1 Message Date
jschauma 471c8a8e68 return functionality backed out yesterday after fixing the bug I had
introduced before.  A regression test will be added to src/regress
shortly.
2006-07-16 16:22:24 +00:00
jschauma d8c803bc48 The last commit introduced a bug. Revert until that's found and fixed. 2006-07-15 20:42:55 +00:00
jschauma 2b5fd7fd97 As suggested on tech-userlevel:
"-R" claims:
 -R	[...] Created directories have the same mode as the corre-
	sponding source directory, unmodified
	by the process' umask.

Make this actually true.

In addition, make '-P' (no symbolic links are followed) apply even if
'-R' is not specified.  This allows users to overwrite symbolic links
with files and/or to copy symbolic links over a file without indirecting
through the link (ie a copy of a link turns the target into a link, not
a copy of the file pointed to by the source).
2006-07-15 02:09:47 +00:00
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
wiz d8b6049e03 Sort options. Simplify macro usage. Use standard EXIT STATUS section. 2005-09-10 21:51:57 +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 ad8530d1eb remove unused code left from printescaped() backput as pointed out by Jeff
Ito in PR bin/23969 and PR bin/23970.
2004-01-04 16:04:18 +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
simonb 276fd1665c The Double-Semi-Colon Police. 2003-01-20 05:29:53 +00:00
wiz 99bdb6a773 For each, not Foreach; from Adrian Mrva. Begin new sentence on new line. 2002-12-21 13:09:57 +00:00
wiz 5911fe5347 Drop trailing whitespace. 2002-12-18 20:28:51 +00:00
kleink c8ae14b05c Add -v to SYNOPSIS, clean up STANDARDS a little. Also, bump date for -v. 2002-12-18 12:15:41 +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
provos 32b88027c7 use readlink with bufsize - 1; approved thorpej. 2002-10-19 20:33:17 +00:00
ross dc5571b22e Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:21:55 +00:00
wiz bd4e745f5b Drop unnecessary .Pps. 2001-12-20 20:01:55 +00:00
wiz 3ebcdc5e43 Whitespace nits. 2001-12-20 19:31:48 +00:00
wiz 633b06fe1e ANSIfication and some KNF fixes by Petri Koistinen from bin/13681. 2001-09-13 09:53:59 +00:00
chs ec039eb93d enable use of mmap(), falling back to read()/write() if mmap() fails. 2001-08-30 04:45:56 +00:00
tron 8ae0a016a0 Use madvise(2) after mmap(2) in case "VM_AND_BUFFER_CACHE_SYNCHRONIZED"
is defined which it is not right now.
2001-07-18 11:01:54 +00:00
kleink 2caf6aacdd For commands and utilities, use EXIT STATUS rather than RETURN VALUES as
appropriate (and documented in mdoc(7)).
2000-09-04 07:30:07 +00:00
hubertf 1cb54f68ac Add 'RETURN VALUE' section header. 2000-08-28 02:11:04 +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
garbled f124765044 More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages.  Many more to
come.
1999-03-22 18:25: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
mycroft f49407ea34 Nit: Use MAP_SHARED for read-only mappings where appropriate. 1998-02-20 09:26:00 +00:00
augustss 81b7d9b217 Use MAP_PRIVATE|MAP_FILE instead of 0 in mmap(). 1998-02-17 22:02:35 +00:00
mycroft 688ecf2a69 Use futimes(2) if possible. Also correct an error message. 1997-10-19 12:50:47 +00:00
enami fa580a821a Preserve owner/group/mode/atime/mtime of symlink if -p flag is given. 1997-10-19 12:28:01 +00:00
enami d0fa1bac38 Use .Nm "" instead of .Nm cp in SYNOPSIS. 1997-10-11 02:14:42 +00:00
lukem 76e13a0128 all but the first .Nm in SYNOPSIS need to be spelt out. [bin/4256] 1997-10-10 16:12:45 +00:00
lukem df49b6cc7f * getopt returns -1 not EOF
* cleanup use of .Nm in manpage
1997-09-14 07:15:25 +00:00
christos 23edbe3557 Remove WARNS=1 from all the subdirectory Makefiles, and add it to Makefile.inc
now that all /bin has been cleaned.
1997-07-20 22:36:20 +00:00
thorpej 1a9f01767d Build with WARNS. 1997-07-20 05:13:57 +00:00
thorpej efc20a3095 - Use __COPYRIGHT() and __RCSID()
- Fix compiler warnings.
1997-07-20 05:13:36 +00:00