From b9d1d9e98e343443115139c9c9b46d6923ae8966 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 2 Mar 2002 17:23:34 +0000 Subject: (main): Warn when -r is specified before --archive (-a). --- src/cp.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') 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")); -- cgit v1.2.3-54-g00ecf