|| euidaccess (file, W_OK) == 0);
}
-static void
-overwrite_prompt (struct cp_options const *x, char const *dst_name,
- struct stat const *dst_sb)
+static bool
+overwrite_ok (struct cp_options const *x, char const *dst_name,
+ struct stat const *dst_sb)
{
if (! writable_destination (dst_name, dst_sb->st_mode))
{
fprintf (stderr, _("%s: overwrite %s? "),
program_name, quote (dst_name));
}
+
+ return yesno ();
}
/* Initialize the hash table implementing a set of F_triple entries
|| (x->interactive == I_UNSPECIFIED
&& x->stdin_tty
&& ! writable_destination (dst_name, dst_sb->st_mode)))
- && (overwrite_prompt (x, dst_name, dst_sb), 1)
- && ! yesno ()));
+ && ! overwrite_ok (x, dst_name, dst_sb)));
}
/* Print --verbose output on standard output, e.g. 'new' -> 'old'.
if (! S_ISDIR (src_mode)
&& (x->interactive == I_ALWAYS_NO
|| (x->interactive == I_ASK_USER
- && (overwrite_prompt (x, dst_name, &dst_sb), 1)
- && ! yesno ())))
+ && ! overwrite_ok (x, dst_name, &dst_sb))))
return true;
}