diff options
author | Jim Meyering <jim@meyering.net> | 2002-03-02 16:44:02 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2002-03-02 16:44:02 +0000 |
commit | baea296b94a72ccc0e286ab997146bde128b696c (patch) | |
tree | 4163488e3aab7acabbe190758c7b31294217395f /src | |
parent | 07b422cb2a4265738f1c7cfc121177e05a3a2b55 (diff) | |
download | coreutils-baea296b94a72ccc0e286ab997146bde128b696c.tar.xz |
(main): Fail if -r is specified after --archive (-a) on the command line.
Diffstat (limited to 'src')
-rw-r--r-- | src/cp.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -1,5 +1,5 @@ /* cp.c -- file copying (main routines) - Copyright (C) 89, 90, 91, 1995-2001 Free Software Foundation. + Copyright (C) 89, 90, 91, 1995-2002 Free Software Foundation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -834,6 +834,8 @@ main (int argc, char **argv) char *version_control_string = NULL; struct cp_options x; char *target_directory = NULL; + bool seen_option_a = false; + bool seen_option_a_then_r = false; program_name = argv[0]; setlocale (LC_ALL, ""); @@ -870,6 +872,7 @@ main (int argc, char **argv) x.require_preserve = 1; x.recursive = 1; x.copy_as_regular = 0; + seen_option_a = true; break; case 'V': /* FIXME: this is deprecated. Remove it in 2001. */ @@ -945,6 +948,8 @@ main (int argc, char **argv) x.recursive = 1; x.copy_as_regular = 1; x.dereference = DEREF_ALWAYS; + if (seen_option_a) + seen_option_a_then_r = true; break; case 'R': @@ -1003,6 +1008,15 @@ main (int argc, char **argv) } } + if (seen_option_a_then_r) + { + error (0, 0, + _("do not specify -r after --archive (-a);\ + -r is obsolescent.\nIf you're sure you want that combination,\ + use -dpr instead.")); + usage (1); + } + if (x.hard_link && x.symbolic_link) { error (0, 0, _("cannot make both hard and symbolic links")); |