Commit Graph

37 Commits

Author SHA1 Message Date
mharo
2e370fe4cc fix cp -vi bug
Submitted by:	Dan Papasian (bugg_ on irc)
2000-01-23 03:04:49 +00:00
mharo
7e22d49a6b brucify
Reviewed by:	obrien
1999-11-28 09:34:21 +00:00
mharo
779ca8c356 brucify and move printf() to catch cases of special files 1999-08-29 07:58:19 +00:00
peter
3b7c52fb9a $Id$ -> $FreeBSD$ 1999-08-27 23:15:48 +00:00
mharo
9d36eee6ed Add a verbose mode to show what files are being copied.
Idea taken from obrien.

Reviewed by:	obrien
1999-08-26 02:44:56 +00:00
kris
416153043a Add -W and fix the warning due to missing struct initializer 1999-07-10 05:46:44 +00:00
kris
935bd87c22 Various spelling/formatting changes.
Submitted by: Philippe Charnier <charnier@xp11.frmug.org>
1999-05-08 10:22:15 +00:00
imp
efe79e057e First set of fixes to keep egcs happy. These include {} around single
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
1999-04-25 21:13:34 +00:00
bde
7245195d50 Don't use mmap() for non-regular files, since st_size is only meaningful
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.
1998-11-18 11:47:45 +00:00
wosch
4314ed9126 Use mmap for file coping. 5-10% faster than the read system call. 1998-11-14 23:43:11 +00:00
jkoshy
a6550ca750 Correct a grammatical nit and remove ambiguity about the effect of
the -p option.

PR:		8229
Submitted-by:	Sheldon Hearn <axl@iafrica.com>
1998-10-13 08:52:29 +00:00
peter
281c4a8ba0 Don't attempt to change owner/mode/flags that don't need to changed.
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.
1998-06-10 06:29:23 +00:00
dt
1284a6e0ab Print correct error message if we copy an unreadable directory. 1998-06-09 13:42:51 +00:00
imp
807b93df66 Make sure we pass the length - 1 to readlink, since it adds its own
NUL at the end of the path.
Inspired by: OpenBSD's changes in this area by theo de raadt
1998-06-09 03:38:43 +00:00
charnier
f85d3336ba Restore Lite-2 sccsid. 1998-05-13 07:25:17 +00:00
charnier
120edffcab Correct use of .Nm and other cosmetics. Add rcsid. Remove unused #inc. 1998-05-06 06:51:42 +00:00
bde
b9518de314 Fixed syntax error in normally-unconfigured code in previous commit. 1998-01-17 13:39:29 +00:00
bde
f180157a7a Fixed handling of short writes. Previously, we stopped copying and
printed a bogus warning with a stale errno if write() returns a short
count.  Now we continue copying.  We still print a bogus warning if
write() returns an "impossible" short count of 0.
1998-01-16 07:37:05 +00:00
wosch
e53e79b37b cp(1) is too silent if used with the option -i. It should
print which input cp(1) expect (y/n) and print a warning if the
file was not overwritten.
1997-10-03 18:11:14 +00:00
imp
cdc0e920d8 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-28 15:24:41 +00:00
peter
34fd560164 Revert $FreeBSD$ to $Id$ 1997-02-22 14:13:04 +00:00
alex
ee019a53dc Sweep through the tree fixing mmap() usage:
- Use MAP_FAILED instead of the constant -1 to indicate
    failure (required by POSIX).
  - Removed flag arguments of '0' (required by POSIX).
  - Fixed code which expected an error return of 0.
  - Fixed code which thought any address with the high bit set
    was an error.
  - Check for failure where no checks were present.

Discussed with:	bde
1997-01-16 21:58:40 +00:00
jkh
9c0cd3f9df Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
steve
9e6e305b90 Merge Lite2 mods and -Wall cleaning. 1996-12-14 05:51:58 +00:00
wosch
d4a1c1cff8 [HISTORY] command appeared in Version 1 AT&T UNIX
Obtained from: A Quarter Century of UNIX, Peter H. Salus, page 41
1996-08-29 18:06:19 +00:00
wosch
c9b4fb2252 Option -f implemented (remove + create)
option -f and -i are exclusive
respond `Y' is equal to `y'
fix usage string
remove isatty(3) check

Reviewed by:	pst
1996-03-08 06:58:08 +00:00
pst
47e06c1e28 Don't initialize udata, remove bogus case, fix usage string 1996-02-19 05:56:34 +00:00
wosch
2a9518f55e delete my last commit
Submitted by:	pst, ache
1996-02-19 00:44:19 +00:00
wosch
a027b5fde4 Option -f implemented (remove + create)
option -f and -i are exclusive
all flag variables initialized with zero
respond `Y' is equal to `y'
update usage string
1996-02-18 18:48:26 +00:00
bde
243b088ed2 Preserve sticky bit for cp -pR'. It was already preserved for cp -R'.
This also fixes loss of the sticky bit for `mv' across file systems.
1995-10-03 12:55:01 +00:00
bde
4a3a78f536 Don't unlink the target file if the copy failed. This behaviour isn't
documented and is incompatible with gnu cp.  It has very few good effects
(it recovers some disk space) and many bad ones:
- special files are unlinked after certain errors.
- the data may not be recoverable if the source is a special file or fifo.
- unlinking destroys the target attributes as well as the target data.
- unlinking doesn't actually remove the target data if the target is multiply
  linked.
1995-06-14 05:41:27 +00:00
rgrimes
e6999472c1 Remove trailing whitespace.
Reviewed by:	phk
1995-05-30 00:07:29 +00:00
bde
a9ad393e6d Add braces to fix wrong if-if-else-if nesting that broke `cp -pR' for
fifos.
1995-04-02 00:49:16 +00:00
dg
ed9ead7a73 Fix bogus format string; fixes problem reported by Wolfram Schneider. 1995-01-25 07:31:01 +00:00
bde
c665c672a6 Don't strip off the last slash in the pathname "/". cp used to
stat the pathname "" in order to decide that the pathname "/" is
a directory.  This caused `cp kernel /' to fail if the kernel has
the POSIX behaviour of not allowing the pathname "" to be an alias
for ".".  It presumably also caused `cp /etc/motd /' to fail in
the unlikely event that "." is not stat'able.

Be more careful about concatenating pathnames: don't check that
the pathname fits until prefixes have been discarded (the check
was too strict).  Print the final pathname in error messages.
Terminate the target directory name properly for error messages.
Don't add a slash between components if there is already a slash.
1994-12-30 13:12:12 +00:00
dg
00eb2a4dc0 Added $Id$ 1994-09-24 02:59:15 +00:00
rgrimes
e3cfc8ce61 BSD 4.4 Lite bin Sources 1994-05-26 06:18:55 +00:00