summaryrefslogtreecommitdiff
path: root/src/mv.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-06-12 06:09:32 +0000
committerJim Meyering <jim@meyering.net>2000-06-12 06:09:32 +0000
commit3e9e02727bfa16f7de1cf10bcf9e6ef0a9390aa3 (patch)
tree8e303bb53ccb605ececad0a6381d66fa42d989bb /src/mv.c
parent9af1ed39b58c7117e05cc213018860fbf08a534b (diff)
downloadcoreutils-3e9e02727bfa16f7de1cf10bcf9e6ef0a9390aa3.tar.xz
(main): Give the correct diagnostic when using the
--target-dir=DIR option, but no arguments. Patch from Michael Stone. Reported by herbert@gondor.apana.org.au.
Diffstat (limited to 'src/mv.c')
-rw-r--r--src/mv.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/mv.c b/src/mv.c
index 796a9ebce..390393e4a 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -472,6 +472,12 @@ main (int argc, char **argv)
dest_is_dir = (n_files > 0 && isdir (target_directory));
+ if (n_files == 0 || (n_files == 1 && !target_directory_specified))
+ {
+ error (0, 0, "%s", _("missing file argument"));
+ usage (1);
+ }
+
if (target_directory_specified)
{
if (!dest_is_dir)
@@ -480,29 +486,12 @@ main (int argc, char **argv)
target_directory);
usage (1);
}
-
- if (n_files == 0)
- {
- error (0, 0, "%s", _("missing file argument"));
- usage (1);
- }
}
- else
+ else if (n_files > 2 && !dest_is_dir)
{
- if (n_files < 2)
- {
- error (0, 0, "%s", (n_files == 0
- ? _("missing file arguments")
- : _("missing file argument")));
- usage (1);
- }
-
- if (n_files > 2 && !dest_is_dir)
- {
- error (0, 0,
- _("when moving multiple files, last argument must be a directory"));
- usage (1);
- }
+ error (0, 0,
+ _("when moving multiple files, last argument must be a directory"));
+ usage (1);
}
if (backup_suffix_string)