---
cp.1 | 5 ++++-
cp.c | 3 +++
libutil/cp.c | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/cp.1 b/cp.1
index f74127d..a37caa3 100644
--- a/cp.1
+++ b/cp.1
_AT_@ -48,9 +48,12 @@ Dereference
if it is a symbolic link.
.It Fl L
Dereference all symbolic links.
-This is the default.
+This is the default without
+.Fl R .
.It Fl P
Preserve symbolic links.
+This is the default with
+.Fl R .
.It Fl R
Traverse directories recursively. If this flag is not specified, directories
are not copied.
diff --git a/cp.c b/cp.c
index d87e77e..6abe02c 100644
--- a/cp.c
+++ b/cp.c
_AT_@ -45,6 +45,9 @@ main(int argc, char *argv[])
if (argc < 2)
usage();
+ if (!cp_follow)
+ cp_follow = cp_rflag ? 'P' : 'L';
+
if (argc > 2) {
if (stat(argv[argc - 1], &st) < 0)
eprintf("stat %s:", argv[argc - 1]);
diff --git a/libutil/cp.c b/libutil/cp.c
index b6f8b23..bb85c14 100644
--- a/libutil/cp.c
+++ b/libutil/cp.c
_AT_@ -20,7 +20,7 @@ int cp_pflag = 0;
int cp_rflag = 0;
int cp_vflag = 0;
int cp_status = 0;
-int cp_follow = 'L';
+int cp_follow;
int
cp(const char *s1, const char *s2, int depth)
--
2.24.1
Received on Sun Dec 22 2019 - 06:26:38 CET
This archive was generated by hypermail 2.3.0 : Sun Dec 22 2019 - 10:48:22 CET