summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-07-04 10:01:35 +0000
committerJim Meyering <jim@meyering.net>2003-07-04 10:01:35 +0000
commit89d953064360a5aa6ac25943f065698183a6e5bf (patch)
tree148262e4bd92ae71c5abbba4f5b084a307b268fc /src
parent4c8f617f700e18ab3acd1c7b4dbc26325a0ac347 (diff)
downloadcoreutils-89d953064360a5aa6ac25943f065698183a6e5bf.tar.xz
(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.
Diffstat (limited to 'src')
-rw-r--r--src/cp.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/cp.c b/src/cp.c
index 8a947be66..a2cc551f6 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -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);
- }
-
- if (n_files > 1)
- {
- error (0, 0,
- _("copying multiple files, but last argument %s is not a directory"),
- quote (dest));
+ 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");
+
+ error (0, 0, _(msg), quote (dest));
usage (EXIT_FAILURE);
}
}