bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cp -f behavior


From: Andrew D Jewell
Subject: Re: cp -f behavior
Date: Wed, 5 Jun 2002 14:35:24 -0400

At 8:38 AM -0400 6/5/02, Ryan McGuigan wrote:
--force (-f) not cancelling the effect of -i is insanely annoying.  i do
not understand what the point of following that behavior(per POSIX) when
most systems do not use that behavior, at least none i've used
recently.  and why should the cp command behave differently from the
other commands?

either it should be changed back, an option while building, or there
should be another way of cancelling -i

-f actually means something distinctly different from cancelling -i. In fact, specifying both can make sense.

I would strongly recommend another way of cancelling -i, for example

  -I, --non-interactive            don't prompt before overwrite

here's the patch against fileutils-4.1.8

--- old_cp.c    Wed Jun  5 11:30:53 2002
+++ cp.c        Wed Jun  5 11:32:50 2002
@@ -130,6 +130,7 @@
   {"dereference", no_argument, NULL, 'L'},
   {"force", no_argument, NULL, 'f'},
   {"interactive", no_argument, NULL, 'i'},
+  {"non-interactive", no_argument, NULL, 'I'},
   {"link", no_argument, NULL, 'l'},
   {"no-dereference", no_argument, NULL, 'P'},
   {"no-preserve", required_argument, NULL, NO_PRESERVE_ATTRIBUTES_OPTION},
@@ -186,6 +187,7 @@
   -f, --force                  if an existing destination file cannot be\n\
                                  opened, remove it and try again\n\
   -i, --interactive            prompt before overwrite\n\
+  -I, --non-interactive        don't prompt before overwrite\n\
   -H                           follow command-line symbolic links\n\
 "), stdout);
       fputs (_("\
@@ -849,7 +851,7 @@
      we'll actually use backup_suffix_string.  */
   backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");

- while ((c = getopt_long (argc, argv, "abdfHilLprsuvxPRS:V:", long_opts, NULL)) + while ((c = getopt_long (argc, argv, "abdfHiIlLprsuvxPRS:V:", long_opts, NULL))
         != -1)
     {
       switch (c)
@@ -904,6 +906,10 @@

        case 'i':
          x.interactive = I_ASK_USER;
+         break;
+
+       case 'I':
+         x.interactive = I_UNSPECIFIED;
          break;

        case 'l':



reply via email to

[Prev in Thread] Current Thread [Next in Thread]