summaryrefslogtreecommitdiff
path: root/src/cp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cp.c')
-rw-r--r--src/cp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cp.c b/src/cp.c
index d2cedcfac..0a81d97ac 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -836,7 +836,9 @@ main (int argc, char **argv)
struct cp_options x;
char *target_directory = NULL;
bool seen_option_a = false;
+ bool seen_option_r = false;
bool seen_option_a_then_r = false;
+ bool seen_option_r_then_a = false;
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -874,6 +876,8 @@ main (int argc, char **argv)
x.recursive = 1;
x.copy_as_regular = 0;
seen_option_a = true;
+ if (seen_option_r)
+ seen_option_r_then_a = true;
break;
case 'V': /* FIXME: this is deprecated. Remove it in 2001. */
@@ -948,6 +952,7 @@ main (int argc, char **argv)
case 'r':
x.recursive = 1;
x.copy_as_regular = 1;
+ seen_option_r = true;
if (seen_option_a)
seen_option_a_then_r = true;
break;
@@ -1017,6 +1022,10 @@ main (int argc, char **argv)
usage (1);
}
+ if (seen_option_r_then_a)
+ error (0, 0,
+ _("WARNING: -r has no effect when specified before --archive (-a)"));
+
if (x.hard_link && x.symbolic_link)
{
error (0, 0, _("cannot make both hard and symbolic links"));