cp: make -P a synonym for -d
authorMike Frysinger <vapier@gentoo.org>
Fri, 7 Jan 2005 00:56:47 +0000 (00:56 -0000)
committerMike Frysinger <vapier@gentoo.org>
Fri, 7 Jan 2005 00:56:47 +0000 (00:56 -0000)
coreutils/cp.c
include/usage.h

index 6a82f6bffcc61a4257eb2600ec351d44f469cb89..97731e83ffaeee2b368d58d40c78cab8dcb8844d 100644 (file)
@@ -42,7 +42,7 @@
 #include "libcoreutils/coreutils.h"
 
 /* WARNING!! ORDER IS IMPORTANT!! */
-static const char cp_opts[] = "pdRfiar";
+static const char cp_opts[] = "pdRfiarP";
 
 extern int cp_main(int argc, char **argv)
 {
@@ -73,6 +73,12 @@ extern int cp_main(int argc, char **argv)
                 */
                flags |= FILEUTILS_RECUR;
        }
+       if (flags & 128) {
+               /* Make -P a synonym for -d,
+                * -d is the GNU option while -P is the POSIX 2003 option
+                */
+               flags |= FILEUTILS_DEREFERENCE;
+       }
 
        flags ^= FILEUTILS_DEREFERENCE;         /* The sense of this flag was reversed. */
 
index d928a10a302cbbe7860222569455a0500dd8c577..7cf44d74ae5257da919608ed3df57a8f69f9dfd9 100644 (file)
        "Copies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" \
        "\n" \
        "\t-a\tSame as -dpR\n" \
-       "\t-d\tPreserves links\n" \
+       "\t-d,-P\tPreserves links\n" \
        "\t-p\tPreserves file attributes if possible\n" \
        "\t-f\tforce (implied; ignored) - always set\n" \
        "\t-i\tinteractive, prompt before overwrite\n" \