diff options
author | Jim Meyering <jim@meyering.net> | 2002-03-02 17:23:34 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2002-03-02 17:23:34 +0000 |
commit | b9d1d9e98e343443115139c9c9b46d6923ae8966 (patch) | |
tree | 9590c6ca94b0b0749a0206c3a35412be1f6b324a | |
parent | 3c3e5c4a312f757a2f4e2ffaeb2212ce180b72fe (diff) | |
download | coreutils-b9d1d9e98e343443115139c9c9b46d6923ae8966.tar.xz |
(main): Warn when -r is specified before --archive (-a).
-rw-r--r-- | src/cp.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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")); |