1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
Grabbed from upstream SVN
--- coreutils/cp.c
+++ coreutils/cp.c
@@ -42,7 +42,7 @@
#include "libcoreutils/coreutils.h"
/* WARNING!! ORDER IS IMPORTANT!! */
-static const char cp_opts[] = "pdRfiar";
+static const char cp_opts[] = "pdRfiarPHL";
extern int cp_main(int argc, char **argv)
{
@@ -79,6 +79,20 @@
*/
flags |= FILEUTILS_DEREFERENCE;
}
+ if (flags & 128) {
+ /* Make -P a synonym for -d,
+ * -d is the GNU option while -P is the POSIX 2003 option
+ */
+ flags |= FILEUTILS_DEREFERENCE;
+ }
+ /* Default behavior of cp is to dereference, so we don't have to do
+ * anything special when we are given -L.
+ * The behavior of -H is *almost* like -L, but not quite, so let's
+ * just ignore it too for fun.
+ if (flags & 256 || flags & 512) {
+ ;
+ }
+ */
flags ^= FILEUTILS_DEREFERENCE; /* The sense of this flag was reversed. */
--- include/usage.h
+++ include/usage.h
@@ -205,6 +205,7 @@
"\n" \
"\t-a\tSame as -dpR\n" \
- "\t-d\tPreserves links\n" \
+ "\t-d,-P\tPreserves links\n" \
+ "\t-H,-L\tDereference all symlinks (implied by default)\n" \
"\t-p\tPreserves file attributes if possible\n" \
"\t-f\tforce (implied; ignored) - always set\n" \
"\t-i\tinteractive, prompt before overwrite\n" \
|