Age | Commit message (Collapse) | Author |
|
|
|
|
|
as well as the definition of lstat from cp.c to this file.
|
|
as well as the definition of lstat from here to copy.h.
|
|
|
|
|
|
|
|
checkpoint
|
|
|
|
(cp_option_init): Initialize new members.
(usage): Reflect the fact that --force (-f) relates only to whether
mv prompts.
(main): Remove uses of old `force' option member.
|
|
[long_options]: Add an entry for --remove-destination.
(usage): Describe --remove-destination.
(do_copy): Use unlink_dest_after_failed_open member, not `force.'
(cp_option_init): Initialize new members.
(main): Handle UNLINK_DEST_BEFORE_OPENING (aka --remove-destination).
|
|
|
|
|
|
|
|
[unlink_dest_before_opening]: Add member.
[unlink_dest_after_failed_open]: Add member.
|
|
and partially rewritten.
(copy_internal): Unlink destination file when unlink_dest_before_opening
option is set, and when the source is neither a regular file nor a directory.
|
|
Remove the SPARSE_MODE parameter. Update caller.
Perform POSIX-mandated (for cp) open-with-O_WRONLY|O_TRUNC when
the regular destination file exists; upon failure, unlink
that existing file, then open again, but with O_WRONLY|O_CREAT.
(copy_internal): `force' in not related to interactive; remove
the conjunct.
Remove the entire `else if (x->force)' block; justifying
removal of the non-directory part is easy: POSIX requires we try
to open an existing regular file, so we can't unlink it beforehand.
The part that changes the mode on a directory to allow overwriting
isn't necessary.
|
|
since we then unlink the destination file.
|
|
|
|
|
|
(buggy_lseek_support): New function.
(skip): Use it.
Frank Adler reported that although _llseek returns 0, lseek
erroneously returns an offset suggesting the operation succeeded
even though it fails.
|
|
impossible and some buggy drivers return zero.
Use SEEK_CUR rather than SEEK_SET; this fixes a bug when the
file descriptor is not currently rewound.
|
|
with all the other programs in this directory.
|
|
|
|
(buggy_lseek_support): New function.
(skip): Use it.
Reported by Martin Gallant via Michael Stone.
|
|
|
|
|
|
(usage): Describe -L and -H.
(cp_option_init): Initialize to DEREF_UNDEFINED, not `1'.
(main): Add `H' and `-L' to getopt spec string.
[case 'a']: Initialize `dereference' to DEREF_NEVER, not 0.
[case 'd']: Likewise.
[case 'H']: New case.
[case 'L']: New case.
[case 'R']: Don't set dereference to `0' here.
If it's not yet defined, set x.dereference to DEREF_NEVER
if -R was specified, else set it to DEREF_ALWAYS.
Set x.xstat accordingly for -H.
|
|
(copy_dir): Set `xstat' member to lstat so that with `-H' we don't
follow symlinks found via recursive traversal.
Update uses of `dereference' to compare against new enum member names.
|
|
(struct cp_options) [dereference]: Change type to Dereference_symlink.
|
|
|
|
|
|
From Bruno Haible.
|
|
POSIX.2 requires that cp -p and mv attempt to set the uid of the
destination file, even if you're not root. This affects behavior
only on hosts that let you give files away via chmod.
|
|
and `..'. Reported by Stephen Smoogen, based on a patch from H.J. Lu.
|
|
|
|
the scope where it's used.
(copy_internal): In calling copy_reg, pass not the raw `src_mode',
but the possibly-umask-relative mode, `get_dest_mode (x, src_mode)'.
|
|
|
|
Honor the umask for `cp', but not for `mv' or `cp -p'.
(copy_reg): New 4th parameter, dst_mode. Pass it as 3rd arg. to open.
(copy_internal): Change type of locals `src_mode' and `src_type' from
int to mode_t.
Remove unnecessary local `fix_mode'.
Combine two if-stmts into one.
Pass `src_mode' as 4th arg to copy_reg.
If we've just created a new regular file, return early, skipping the
chmod step. copy_reg now sets permissions of such files upon creation.
Use get_dest_mode, so there's just one chmod call here.
|
|
(iswprint, mbrtowc, wcwidth): Provide default definitions.
(total_bytes): New variable.
(print_bytes): New variable.
(longopts): Change abbreviation for --chars from 'c' to 'm'.
(usage): Update.
(write_counts): Add `bytes' argument.
(wc): New variables `bytes', `count_bytes', `count_chars',
`count_complicated'. The old code determines `bytes', not `chars'.
New case for MB_CUR_MAX > 1. A non-printable non-space character does
not increment the line position or start a word. Update `total_bytes'.
(main): Initialize `print_bytes' and `total_bytes' to 0. Accept 'm'
option. Pass `total_bytes' to write_counts.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(cut_fields): Check for I/O error as well as end-of-file.
|
|
message.
|