Commit Graph

5 Commits

Author SHA1 Message Date
Arthur Williams 8dfcbf23b0 cp: don't abort when src and dest file are the same
The POSIX spec gives many options on how to handle this case, but it
also states that cp (and mv) should continue with remaining operands
regardless. We used to exit immediately, which violates the spec.

This change makes cp/mv not exit immediately in this case and
also won't cause the return value to be non-zero.

From `man 1p cp`:
   If source_file references the same file as dest_file, cp may write
   a diagnostic message to standard error; it shall do nothing more
   with source_file and shall go on to any remaining files.
2023-04-12 21:09:12 -07:00
FRIGN 8dc92fbd6c Refactor enmasse() and recurse() to reflect depth
The HLP-changes to sbase have been a great addition of functionality,
but they kind of "polluted" the enmasse() and recurse() prototypes.
As this will come in handy in the future, knowing at which "depth"
you are inside a recursing function is an important functionality.

Instead of having a special HLP-flag passed to enmasse, each sub-
function needs to provide it on its own and can calculate results
based on the current depth (for instance, 'H' implies 'P' at
depth > 0).
A special case is recurse(), because it actually depends on the
follow-type. A new flag "recurse_follow" brings consistency into
what used to be spread across different naming conventions (fflag,
HLP_flag, ...).

This also fixes numerous bugs with the behaviour of HLP in the
tools using it.
2015-03-02 22:50:38 +01:00
Tai Chi Minh Ralph Eastwood af8be7f92c cp: add symlink deref flags -H and -L for cp and mv 2015-02-09 22:54:52 +00:00
FRIGN 1436518f9d Use < 0 instead of == -1 2014-11-19 20:09:29 +00:00
sin 027052f5e5 Rename util/ to libutil/ 2014-11-17 16:48:34 +00:00