From baea296b94a72ccc0e286ab997146bde128b696c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 2 Mar 2002 16:44:02 +0000 Subject: (main): Fail if -r is specified after --archive (-a) on the command line. --- src/cp.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/cp.c') diff --git a/src/cp.c b/src/cp.c index d8e33f523..fa5dcc805 100644 --- a/src/cp.c +++ b/src/cp.c @@ -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")); -- cgit v1.2.3-54-g00ecf