aboutsummaryrefslogtreecommitdiff
path: root/toys/cp.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-05-31 21:17:11 -0500
committerRob Landley <rob@landley.net>2012-05-31 21:17:11 -0500
commite495a7afc2677c7908704d2ae2aa713a989d9daa (patch)
tree189511cd051c00571bbf24c81f6d151ff404840a /toys/cp.c
parent6cd8ae641e136ce090afad900954b586c474df01 (diff)
downloadtoybox-e495a7afc2677c7908704d2ae2aa713a989d9daa.tar.gz
cp doesn't really need the optstring + logic. Still needs to be updated for new dirtree, though.
Diffstat (limited to 'toys/cp.c')
-rw-r--r--toys/cp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/toys/cp.c b/toys/cp.c
index a53d5fe0..bc922b3d 100644
--- a/toys/cp.c
+++ b/toys/cp.c
@@ -7,7 +7,7 @@
* See http://www.opengroup.org/onlinepubs/009695399/utilities/cp.html
*
* "R+ra+d+p+r"
-USE_CP(NEWTOY(cp, "<2vslrR+rdpa+d+p+rHLPif", TOYFLAG_BIN))
+USE_CP(NEWTOY(cp, "<2vslrRdpaHLPif", TOYFLAG_BIN))
config CP
bool "cp (broken by dirtree changes)"
@@ -113,7 +113,7 @@ void cp_file(char *src, char *dst, struct stat *srcst)
// Inability to set these isn't fatal, some require root access.
// Can't do fchmod() etc here because -p works on mkdir, too.
- if (toys.optflags & FLAG_p) {
+ if (toys.optflags & (FLAG_p|FLAG_a)) {
int mask = umask(0);
struct utimbuf ut;
@@ -188,7 +188,7 @@ void cp_main(void)
// Skip nonexistent sources.
- TT.keep_symlinks = toys.optflags & FLAG_d;
+ TT.keep_symlinks = toys.optflags & (FLAG_d|FLAG_a);
if (TT.keep_symlinks ? lstat(src, &st) : stat(src, &st))
{
perror_msg("'%s'", src);
@@ -205,7 +205,7 @@ void cp_main(void)
dst = xmsprintf("%s/%s", TT.destname, dst);
} else dst = TT.destname;
if (S_ISDIR(st.st_mode)) {
- if (toys.optflags & FLAG_r) {
+ if (toys.optflags & (FLAG_r|FLAG_R|FLAG_a)) {
cp_file(src, dst, &st);
TT.keep_symlinks++;