(do_copy): Give a better diagnostic when failing due

to nonexistent destination directory.  Reported by Dmitry Rutsky.
See http://bugs.debian.org/199730 for details.
This commit is contained in:
Jim Meyering committed 2003-07-04 10:01:35 +00:00
1 parent 4c8f617f70
commit 89d9530643
1 file changed
+10 -10
+10 -10
View File
@@ -541,18 +541,18 @@ do_copy (int n_files, char **file, const char *target_directory,
if (!dest_is_dir)
{
if (target_directory)
if (target_directory || 1 < n_files)
{
error (0, 0, _("%s: specified target is not a directory"),
quote (dest));
usage (EXIT_FAILURE);
}
char const *msg;
if (new_dst)
msg = N_("%s: specified destination directory does not exist");
else if (target_directory)
msg = N_("%s: specified target is not a directory");
else /* n_files > 1 */
msg =
N_("copying multiple files, but last argument %s is not a directory");
if (n_files > 1)
{
error (0, 0,
_("copying multiple files, but last argument %s is not a directory"),
quote (dest));
error (0, 0, _(msg), quote (dest));
usage (EXIT_FAILURE);
}
}