MCPcopy Create free account
hub / github.com/coreutils/coreutils / abandon_move

Function abandon_move

src/copy.c:1486–1501  ·  view source on GitHub ↗

When effecting a move (e.g., for mv(1)), and given the name DST_NAME aka DST_DIRFD+DST_RELNAME of the destination and a corresponding stat buffer, DST_SB, return true if the logical 'move' operation should _not_ proceed. Otherwise, return false. Depending on options specified in X, this code may issue an interactive prompt asking whether it's ok to overwrite DST_NAME. */

Source from the content-addressed store, hash-verified

1484 Depending on options specified in X, this code may issue an
1485 interactive prompt asking whether it's ok to overwrite DST_NAME. */
1486static bool
1487abandon_move (const struct cp_options *x,
1488 char const *dst_name,
1489 int dst_dirfd, char const *dst_relname,
1490 struct stat const *dst_sb)
1491{
1492 affirm (x->move_mode);
1493 return (x->update == UPDATE_NONE
1494 || x->update == UPDATE_NONE_FAIL
1495 || ((x->interactive == I_ASK_USER
1496 || (x->interactive == I_UNSPECIFIED
1497 && x->stdin_tty
1498 && ! writable_destination (dst_dirfd, dst_relname,
1499 dst_sb->st_mode)))
1500 && ! overwrite_ok (x, dst_name, dst_dirfd, dst_relname, dst_sb)));
1501}
1502
1503/* Print --verbose output on standard output, e.g. 'new' -> 'old'.
1504 If BACKUP_DST_NAME is non-null, then also indicate that it is

Callers 1

copy_internalFunction · 0.85

Calls 2

writable_destinationFunction · 0.85
overwrite_okFunction · 0.85

Tested by

no test coverage detected